修改:网站管理

This commit is contained in:
jmal 2021-02-09 16:16:46 +08:00
parent 9851a297ce
commit 65aa2f7605
6 changed files with 530 additions and 451 deletions

View File

@ -5,7 +5,7 @@
import { Icon } from 'ant-design-vue' import { Icon } from 'ant-design-vue'
const IconFont = Icon.createFromIconfontCN({ const IconFont = Icon.createFromIconfontCN({
scriptUrl: '//at.alicdn.com/t/font_2024484_poicam3vg6b.js' scriptUrl: '//at.alicdn.com/t/font_2024484_64i0l9tj8gq.js'
}) })
// 把此段代码贴到iconfont项目页面的控制台中, 以获取图标列表 // 把此段代码贴到iconfont项目页面的控制台中, 以获取图标列表
@ -16,7 +16,7 @@ const IconFont = Icon.createFromIconfontCN({
// console.log(iconNames.slice(80,160)) // console.log(iconNames.slice(80,160))
export const iconFonts = { export const iconFonts = {
list: ["disk-drive", "menu-fuzhi", "iso", "zuijinhuoyue","key", "shouquan", "sort", "grid", "list", "emoji-a", "emoji-bizui", "emoji-baiyan", "emoji-aixin", "emoji-dajing", "emoji-ziya", "emoji-daxiao", "emoji-esi", "emoji-fadai", "emoji-fankun", "emoji-ganga", "emoji-fennu", "emoji-hanyan", "emoji-jingkong", "emoji-haochi", "emoji-emo", "emoji-jingsong", "emoji-jingya", "emoji-kaixin", "emoji-lengku", "emoji-danao", "emoji-liukoushui", "emoji-liulei", "emoji-mengbi", "mianwubiaoqing", "nanguo", "shuizhuo", "taoyan", "tanchi", "siliao", "tiaopi", "xiaochulei", "wuliao", "xingxingyan", "xieyan", "xiasi", "xiaolian", "ku", "shengqi", "yousiliao", "en", "bushufu", "bianbian", "fankun1", "feiwen", "ganmao", "huaixiao", "liuhan", "outu", "keshui", "renzhe", "santiaoxian", "guaiwu", "shoushang", "tianshi", "shuai", "xianwen", "xiaodiaodaya", "xiong", "yiwen", "yun", "liubixie", "shimo", "dianzan", "biti", "fendou", "huqi", "heng", "kulou", "leng", "taoyan1", "shuixing", "aini", "aixin1", "zhadan", "xinsui", list: ["wulianwang-","zuji","disk-drive", "menu-fuzhi", "iso", "zuijinhuoyue","key", "shouquan", "sort", "grid", "list", "emoji-a", "emoji-bizui", "emoji-baiyan", "emoji-aixin", "emoji-dajing", "emoji-ziya", "emoji-daxiao", "emoji-esi", "emoji-fadai", "emoji-fankun", "emoji-ganga", "emoji-fennu", "emoji-hanyan", "emoji-jingkong", "emoji-haochi", "emoji-emo", "emoji-jingsong", "emoji-jingya", "emoji-kaixin", "emoji-lengku", "emoji-danao", "emoji-liukoushui", "emoji-liulei", "emoji-mengbi", "mianwubiaoqing", "nanguo", "shuizhuo", "taoyan", "tanchi", "siliao", "tiaopi", "xiaochulei", "wuliao", "xingxingyan", "xieyan", "xiasi", "xiaolian", "ku", "shengqi", "yousiliao", "en", "bushufu", "bianbian", "fankun1", "feiwen", "ganmao", "huaixiao", "liuhan", "outu", "keshui", "renzhe", "santiaoxian", "guaiwu", "shoushang", "tianshi", "shuai", "xianwen", "xiaodiaodaya", "xiong", "yiwen", "yun", "liubixie", "shimo", "dianzan", "biti", "fendou", "huqi", "heng", "kulou", "leng", "taoyan1", "shuixing", "aini", "aixin1", "zhadan", "xinsui",
"maren", "zhutou", "qie", "youling", "apple-fill", "attachment", "android-fill", "apple", "download", "arrow-up-circle", "arrow-right-circle", "arrow-down", "ashbin", "add", "file_music", "menu", "role", "jiaoseguanli", "yemianshezhi", "drop_down", "yuandian", "tag", "service-directory", "fabu", "wailian", "bianji-", "WEBSITE", "wangzhanguanli", "Up", "up", "fenlei", "guanlizhuanjiawenzhang", "pifu", "tuichudenglu", "shezhi", "wangzhan", "huaban", "yunshezhi", "UserSettings", "blogger", "biaoqian", "myself", "guidang", "quxiaoyulan1-copy", "yulan-copy", "quxiaoyulan1", "yulan"] "maren", "zhutou", "qie", "youling", "apple-fill", "attachment", "android-fill", "apple", "download", "arrow-up-circle", "arrow-right-circle", "arrow-down", "ashbin", "add", "file_music", "menu", "role", "jiaoseguanli", "yemianshezhi", "drop_down", "yuandian", "tag", "service-directory", "fabu", "wailian", "bianji-", "WEBSITE", "wangzhanguanli", "Up", "up", "fenlei", "guanlizhuanjiawenzhang", "pifu", "tuichudenglu", "shezhi", "wangzhan", "huaban", "yunshezhi", "UserSettings", "blogger", "biaoqian", "myself", "guidang", "quxiaoyulan1-copy", "yulan-copy", "quxiaoyulan1", "yulan"]
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="container"> <div class="container">
<article-manager :page-title="pageTitle" alone-page></article-manager> <article-manager :page-title="pageTitle" :new-article-text="newArticleText" alone-page></article-manager>
</div> </div>
</template> </template>
@ -14,6 +14,7 @@ export default {
data() { data() {
return { return {
pageTitle: '管理独立页面', pageTitle: '管理独立页面',
newArticleText: '新增页面'
} }
}, },
computed: {}, computed: {},

View File

@ -9,14 +9,14 @@
@open="openDialog" @open="openDialog"
@close="closeDialog" @close="closeDialog"
> >
<markdown-editor ref="editor" :has-change.sync="hasChange" :alone-page="alonePage" @onTitle="onTitle" @onRelease="onRelease"></markdown-editor> <markdown-editor ref="editor" :has-change.sync="hasChange" :alone-page="alonePage" :site-url="siteUrl" :is-edit="isEdit" @onTitle="onTitle" @onRelease="onRelease"></markdown-editor>
</el-dialog> </el-dialog>
<el-card class="box-card"> <el-card class="box-card">
<div slot="header"> <div slot="header">
<div class="box-card-header"> <div class="box-card-header">
<div class="clearfix card-header-back"> <div class="clearfix card-header-back">
<span>{{ alonePage ? '管理独立页面':'管理文章' }}</span> <span>{{ alonePage ? '管理独立页面':'管理文章' }}</span>
<el-button class="card-button" size="mini" type="primary" @click="newArticle">写文章</el-button> <el-button class="card-button" size="mini" type="primary" @click="newArticle">{{newArticleText}}</el-button>
</div> </div>
<div class="card-header-right" v-show="this.multipleSelection.length > 0"> <div class="card-header-right" v-show="this.multipleSelection.length > 0">
<el-button size="small" type="danger" @click="handleDelete()">删除</el-button> <el-button size="small" type="danger" @click="handleDelete()">删除</el-button>
@ -90,7 +90,7 @@
label="标题"> label="标题">
<template slot-scope="scope"> <template slot-scope="scope">
<a :title="'编辑 '+scope.row.name" @click="editArticle(scope.row.id)">{{scope.row.name}}<svg-icon icon-class="bianji-"></svg-icon></a> <a :title="'编辑 '+scope.row.name" @click="editArticle(scope.row.id)">{{scope.row.name}}<svg-icon icon-class="bianji-"></svg-icon></a>
<router-link :title="'浏览 '+scope.row.name" :to="(alonePage?'/articles/o/':'/articles/s/')+scope.row.slug" target="_blank"><svg-icon class="wailian" icon-class="wailian"></svg-icon></router-link> <a :title="'浏览 '+scope.row.name" :href="(alonePage?siteUrl+'/o/':siteUrl+'/s/')+scope.row.slug" target="_blank"><svg-icon class="wailian" icon-class="wailian"></svg-icon></a>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -158,6 +158,7 @@ import MarkdownEditor from '@/views/markdown/index'
import markdownApi from "@/api/markdown-api"; import markdownApi from "@/api/markdown-api";
import categoryApi from "@/api/category"; import categoryApi from "@/api/category";
import api from "@/api/file-api"; import api from "@/api/file-api";
import {getSetting} from '@/api/setting-api'
import MultipleTreeSelect from "@/components/select/MultipleTree"; import MultipleTreeSelect from "@/components/select/MultipleTree";
export default { export default {
name: 'articleManager', name: 'articleManager',
@ -173,6 +174,10 @@ export default {
alonePage: { alonePage: {
type: Boolean, type: Boolean,
default: false default: false
},
newArticleText: {
type: String,
default: ''
} }
}, },
data() { data() {
@ -199,6 +204,8 @@ export default {
}, },
draftNums: 0, draftNums: 0,
multipleSelection: [], multipleSelection: [],
siteUrl: `${window.location.origin}/articles`,
isEdit: false,
} }
}, },
computed: {}, computed: {},
@ -215,6 +222,7 @@ export default {
mounted() { mounted() {
this.getArticleList() this.getArticleList()
this.categoryTree() this.categoryTree()
this.getWebsiteSetting()
this.newArticleDialogVisible = !!this.$route.query.operation this.newArticleDialogVisible = !!this.$route.query.operation
// 监听返回 // 监听返回
if (window.history && window.history.pushState) { if (window.history && window.history.pushState) {
@ -312,6 +320,14 @@ export default {
const operation = this.$route.query.operation const operation = this.$route.query.operation
this.newArticleDialogVisible = !!operation; this.newArticleDialogVisible = !!operation;
}, },
// 获取网站设置
getWebsiteSetting() {
getSetting({userId: this.$store.state.user.userId}).then((res) => {
if(res.data) {
this.siteUrl = res.data.siteUrl
}
})
},
// 取消筛选 // 取消筛选
cancelFilter() { cancelFilter() {
this.query.userId = '' this.query.userId = ''
@ -394,8 +410,10 @@ export default {
newArticle() { newArticle() {
this.newArticleDialogVisible = true this.newArticleDialogVisible = true
this.$router.push({query: {operation: 'new'}}) this.$router.push({query: {operation: 'new'}})
this.isEdit = false
}, },
editArticle(id) { editArticle(id) {
this.isEdit = true
this.newArticleDialogVisible = true this.newArticleDialogVisible = true
this.$router.push({query: {operation: 'editor', id: id}}) this.$router.push({query: {operation: 'editor', id: id}})
if(this.$refs.editor){ if(this.$refs.editor){
@ -431,9 +449,11 @@ export default {
if(this.alonePage){ if(this.alonePage){
this.title = '创建新页面 ' + val this.title = '创建新页面 ' + val
} }
this.isEdit = false
} }
if(operation === 'editor'){ if(operation === 'editor'){
this.title = '编辑:' + val this.title = '编辑:' + val
this.isEdit = true
} }
}, },
openDialog() { openDialog() {

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="container"> <div class="container">
<article-manager :page-title="pageTitle"></article-manager> <article-manager :page-title="pageTitle" :new-article-text="newArticleText"></article-manager>
</div> </div>
</template> </template>
@ -15,6 +15,7 @@ export default {
data() { data() {
return { return {
pageTitle: '管理文章', pageTitle: '管理文章',
newArticleText: '写文章'
} }
}, },
computed: {}, computed: {},

View File

@ -12,8 +12,10 @@
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="网站首页背景" name="1"> <el-tab-pane label="网站首页背景" name="1">
<div class="config-itme-label">站点背景大图: <div class="config-itme-label">站点地址:</div>
</div> <el-input autosize type="textarea" width="100%" v-model="form.siteUrl"></el-input>
<span class="instruction">在这里填入站点的地址或域名。例如:<a href="https://blog.jmal.top" target="_blank">https://blog.jmal.top</a></span>
<div class="config-itme-label">站点背景大图:</div>
<upload-image-input v-model="form.backgroundSite"/> <upload-image-input v-model="form.backgroundSite"/>
<span class="instruction">在这里填入图片的URL地址, 以在网站首页显示一个背景大图。</span> <span class="instruction">在这里填入图片的URL地址, 以在网站首页显示一个背景大图。</span>
<div class="config-itme-label">首页大图内文字:</div> <div class="config-itme-label">首页大图内文字:</div>
@ -95,6 +97,7 @@ export default {
activeName: '1', activeName: '1',
example: '<i class="fab fa-github">github</i>', example: '<i class="fab fa-github">github</i>',
form: { form: {
siteUrl: '',
backgroundSite: '', backgroundSite: '',
backgroundTextSite: '', backgroundTextSite: '',
backgroundDescSite: '', backgroundDescSite: '',