diff --git a/public/styles/css/editor.css b/public/styles/css/editor.css index edb485a..1db619f 100644 --- a/public/styles/css/editor.css +++ b/public/styles/css/editor.css @@ -6,6 +6,14 @@ font-family: ProximaNova; src: url('./styles/font/ProximaNova-Regular.otf'); } +@font-face { + font-family: PingFang; + src: url('./styles/font/PingFang-Regular.otf'); +} +@font-face { + font-family: PingFang SC; + src: url('./styles/font/PingFang-Regular.otf'); +} .mce-content-body:not([dir='rtl']) blockquote { padding: 8px 15px; border-left: 0; diff --git a/public/styles/font/PingFang-Regular.otf b/public/styles/font/PingFang-Regular.otf new file mode 100644 index 0000000..11032b6 Binary files /dev/null and b/public/styles/font/PingFang-Regular.otf differ diff --git a/src/libs/util.js b/src/libs/util.js index 0e9aae4..95a0785 100644 --- a/src/libs/util.js +++ b/src/libs/util.js @@ -1,6 +1,7 @@ import { _local } from "./util.db"; import { Message } from "element-ui"; import store from "@/store"; +import Setting from '@/setting' // 文件后缀集合 const exts = { @@ -13,12 +14,17 @@ const util = { local: _local, // 筛选出有权限的站点 getSite(list) { - const result = [] - const auth = store.state.auth.btns - list.map(e => { - auth.find(n => n.includes(e.siteName)) && result.push(e) - }) - return result + // 开启了动态路由的需要根据权限筛选站点 + if (Setting.dynamicRoute) { + const result = [] + const auth = store.state.auth.btns + list.map(e => { + auth.find(n => n.includes(e.siteName)) && result.push(e) + }) + return result + } else { + return list + } }, //返回格式化时间,传参例如:"yyyy-MM-dd hh:mm:ss" formatDate(fmt, date) { diff --git a/src/pages/article/list/index.vue b/src/pages/article/list/index.vue index 5be8d5b..754972c 100644 --- a/src/pages/article/list/index.vue +++ b/src/pages/article/list/index.vue @@ -2,92 +2,190 @@

全部栏目

-
- - - {{ node.label }} +
+ + + {{ node.label }}
-
+
- - + + - +
- - + + - 列重置 + 列重置 - + {{ column.name }} - 新增 - 删除 + 新增 + 删除
- - - + + + - - - - + + + + - - - - - - + + + + + + - + - +
@@ -99,325 +197,325 @@ import util from '@/libs/util' import { mapMutations } from 'vuex' import ColumnConst from '@/const/column' export default { - data() { - return { - last: this.$route.query.last, // 是否直接跳到最后一页的文章(编辑文章的时候改了所属栏目,返回到列表后则需要跳到最后一页文章) - types: ColumnConst.types, - siteName: this.$store.state.content.site.siteName, - columns: [], - defaultProps: { - value: 'id', - label: 'columnName' + data () { + return { + last: this.$route.query.last, // 是否直接跳到最后一页的文章(编辑文章的时候改了所属栏目,返回到列表后则需要跳到最后一页文章) + types: ColumnConst.types, + siteName: this.$store.state.content.site.siteName, + columns: [], + defaultProps: { + value: 'id', + label: 'columnName' + }, + field: 'title', + keywords: [ + { + id: 'title', + name: '标题' }, - field: 'title', - keywords: [ - { - id: 'title', - name: '标题' - }, - { - id: 'founder', - name: '录入人' - }, - { - id: 'column', - name: '栏目' - }, - { - id: 'editor', - name: '修改人' - } - ], - keyword: '', - list: [], - page: 1, - pageSize: 10, - total: 0, - modifiedTimeSort: '', - publicationTimeSort: '', - topSort: '', - multipleSelection: [], - originSettings: [], - settings: [ - { - name: '选择框', - show: true - }, - { - name: '标题', - show: true - }, - { - name: '栏目', - show: true - }, - { - name: '所属分类', - show: false - }, - { - name: '栏目类型', - show: true - }, - { - name: '录入人', - show: true - }, - { - name: '修改人', - show: true - }, - { - name: '修改日期', - show: true - }, - { - name: '发布日期', - show: true - }, - { - name: '总浏览', - show: true - }, - { - name: '状态', - show: true - }, - { - name: '操作', - show: true - } - ], - originList: [] - }; - }, - watch: { - keyword: function(val) { - clearTimeout(this.searchTimer) - this.searchTimer = setTimeout(() => { - this.initData() - }, 500) - } - }, - mounted() { - this.$store.commit('user/setCrumbs', [ { - name: '站点管理', - route: '/site' + id: 'founder', + name: '录入人' }, { - name: '内容管理' + id: 'column', + name: '栏目' }, { - name: '文章管理' + id: 'editor', + name: '修改人' } - ]) - this.originSettings = JSON.parse(JSON.stringify(this.settings)) - this.getColumn() - }, - methods: { - ...mapMutations('content', [ - 'setColumn' - ]), - // 栏目树形 - getColumn() { - this.$post(this.api.listWithTree, { - siteId: this.$store.state.content.site.id, - columnName: '', - templateId: '', - typeId : '', - isSort: 1 - }).then(({ data }) => { - this.columns = data - this.$nextTick(() => { - this.$refs.column.setCurrentKey(this.$route.query.columnId || data[0].id) - this.getData() - }) - }).catch(e => {}) - }, - // 文章列表 - getData() { - const id = this.$refs.column.getCurrentKey() - this.$router.push(`/article?columnId=${id}`).catch(e => {}) - const { keyword } = this - const data = { - siteId: this.$store.state.content.site.id, - columnIds: [id], - pageNum: this.page, - pageSize: this.pageSize, - topSort: this.topSort, - title: this.field === 'title' ? keyword : '', - founder: this.field === 'founder' ? keyword : '', - column: this.field === 'column' ? keyword : '', - editor: this.field === 'editor' ? keyword : '' + ], + keyword: '', + list: [], + page: 1, + pageSize: 10, + total: 0, + modifiedTimeSort: '', + publicationTimeSort: '', + topSort: '', + multipleSelection: [], + originSettings: [], + settings: [ + { + name: '选择框', + show: true + }, + { + name: '标题', + show: true + }, + { + name: '栏目', + show: true + }, + { + name: '所属分类', + show: false + }, + { + name: '栏目类型', + show: true + }, + { + name: '录入人', + show: true + }, + { + name: '修改人', + show: true + }, + { + name: '修改日期', + show: true + }, + { + name: '发布日期', + show: true + }, + { + name: '总浏览', + show: true + }, + { + name: '状态', + show: true + }, + { + name: '操作', + show: true } - if (this.modifiedTimeSort !== '') data.modifiedTimeSort = this.modifiedTimeSort - if (this.publicationTimeSort !== '') data.publicationTimeSort = this.publicationTimeSort - this.$post(this.api.queryArticle, data).then(({ data }) => { - data.records.map(e => { - e.editing = false - e.releaseTime = e.releaseTime.split(' ')[0] - }) - this.originList = JSON.parse(JSON.stringify(data.records)) - this.list = data.records - const total = +data.total - this.total = total - if (this.last) { - let page = parseInt(total / 10) - total % 10 && page++ - this.page = page - this.last = '' - this.getData() - } - }).catch(err => {}) - }, - // 重置栏位筛选 - resetColumns() { - this.settings = JSON.parse(JSON.stringify(this.originSettings)) - }, - currentChange(val) { - this.page = val - this.getData() - }, - handleSelectionChange(val) { - this.multipleSelection = val - }, - initData() { - this.$refs.table.clearSelection() - this.page = 1 - this.getData() + ], + originList: [] + }; + }, + watch: { + keyword: function (val) { + clearTimeout(this.searchTimer) + this.searchTimer = setTimeout(() => { + this.initData() + }, 500) + } + }, + mounted () { + this.$store.commit('user/setCrumbs', [ + { + name: '站点管理', + route: '/site' }, - // 排序提交 - submitSequence(row) { - const { sequence } = row - if (!sequence) return util.errorMsg('请输入排序') - if (isNaN(sequence)) return util.errorMsg('请输入数字') - this.$post(`${this.api.modifiedSort}?articleId=${row.id}&sequenceNumber=${sequence > this.total ? this.total : sequence}`).then(res => { - this.initData() - }).catch(res => {}) + { + name: '内容管理' }, - // 编辑排序 - editSequence(row) { - this.list.forEach(e => { + { + name: '文章管理' + } + ]) + this.originSettings = JSON.parse(JSON.stringify(this.settings)) + this.getColumn() + }, + methods: { + ...mapMutations('content', [ + 'setColumn' + ]), + // 栏目树形 + getColumn () { + this.$post(this.api.listWithTree, { + siteId: this.$store.state.content.site.id, + columnName: '', + templateId: '', + typeId: '', + isSort: 1 + }).then(({ data }) => { + this.columns = data + this.$nextTick(() => { + this.$refs.column.setCurrentKey(this.$route.query.columnId || data[0].id) + this.getData() + }) + }).catch(e => { }) + }, + // 文章列表 + getData () { + const id = this.$refs.column.getCurrentKey() + this.$router.push(`/article?columnId=${id}`).catch(e => { }) + const { keyword } = this + const data = { + siteId: this.$store.state.content.site.id, + columnIds: [id], + pageNum: this.page, + pageSize: this.pageSize, + topSort: this.topSort, + title: this.field === 'title' ? keyword : '', + founder: this.field === 'founder' ? keyword : '', + column: this.field === 'column' ? keyword : '', + editor: this.field === 'editor' ? keyword : '' + } + if (this.modifiedTimeSort !== '') data.modifiedTimeSort = this.modifiedTimeSort + if (this.publicationTimeSort !== '') data.publicationTimeSort = this.publicationTimeSort + this.$post(this.api.queryArticle, data).then(({ data }) => { + data.records.map(e => { e.editing = false + e.releaseTime = e.releaseTime.split(' ')[0] }) - row.editing = true - }, - // 批量删除 - batchDel() { - const list = this.multipleSelection - if (list.length) { - this.$confirm('确定要删除吗?', '提示', { - type: 'warning' - }).then(() => { - const data = [] - list.map(e => { - data.push('ids=' + e.id) - }) - this.$post(`${this.api.deleteArticle}?${data.join('&')}`).then(res => { - this.$refs.table.clearSelection() - util.successMsg("删除成功") - this.getData() - }).catch(res => {}) - }).catch(() => {}) - } else { - util.errorMsg('请先选择数据 !') + this.originList = JSON.parse(JSON.stringify(data.records)) + this.list = data.records + const total = +data.total + this.total = total + if (this.last) { + let page = parseInt(total / 10) + total % 10 && page++ + this.page = page + this.last = '' + this.getData() } - }, - // 删除 - handleDelete(row) { + }).catch(err => { }) + }, + // 重置栏位筛选 + resetColumns () { + this.settings = JSON.parse(JSON.stringify(this.originSettings)) + }, + currentChange (val) { + this.page = val + this.getData() + }, + handleSelectionChange (val) { + this.multipleSelection = val + }, + initData () { + this.$refs.table.clearSelection() + this.page = 1 + this.getData() + }, + // 排序提交 + submitSequence (row) { + const { sequence } = row + if (!sequence) return util.errorMsg('请输入排序') + if (isNaN(sequence)) return util.errorMsg('请输入数字') + this.$post(`${this.api.modifiedSort}?articleId=${row.id}&sequenceNumber=${sequence > this.total ? this.total : sequence}`).then(res => { + this.initData() + }).catch(res => { }) + }, + // 编辑排序 + editSequence (row) { + this.list.forEach(e => { + e.editing = false + }) + row.editing = true + }, + // 批量删除 + batchDel () { + const list = this.multipleSelection + if (list.length) { this.$confirm('确定要删除吗?', '提示', { type: 'warning' }).then(() => { - this.$post(`${this.api.deleteArticle}?ids=${row.id}`).then(res => { - util.successMsg('删除成功') + const data = [] + list.map(e => { + data.push('ids=' + e.id) + }) + this.$post(`${this.api.deleteArticle}?${data.join('&')}`).then(res => { + this.$refs.table.clearSelection() + util.successMsg("删除成功") this.getData() - }).catch(res => {}) - }).catch(() => {}) - }, - // 禁用启用 - switchOff(val, row) { - this.$post(`${this.api.articleEnableOrDisable}?id=${row.id}&isDisable=${val}`).then(res => {}).catch((res) => {}) - }, - // 新增 - add() { - if (!this.columns.length) return util.errorMsg('请添加栏目') - this.setColumn(this.$refs.column.getCurrentNode()) - this.$router.push(`add?columnId=${this.$refs.column.getCurrentKey()}&columnName=${this.$refs.column.getCurrentNode().columnName}`) - }, - // 排序回调 - sortChange(column) { - const { order } = column - // 三个排序只能同时传1个,所以点了一个排序的时候要清除掉其余两个 - // 两个时间0默认倒序 1升序 - if (column.prop === 'updateTime') { - this.modifiedTimeSort = order ? order === 'ascending' ? 1 : 0 : '' - if (order) { - this.publicationTimeSort = '' - this.topSort = '' - } + }).catch(res => { }) + }).catch(() => { }) + } else { + util.errorMsg('请先选择数据 !') + } + }, + // 删除 + handleDelete (row) { + this.$confirm('确定要删除吗?', '提示', { + type: 'warning' + }).then(() => { + this.$post(`${this.api.deleteArticle}?ids=${row.id}`).then(res => { + util.successMsg('删除成功') + this.getData() + }).catch(res => { }) + }).catch(() => { }) + }, + // 禁用启用 + switchOff (val, row) { + this.$post(`${this.api.articleEnableOrDisable}?id=${row.id}&isDisable=${val}`).then(res => { }).catch((res) => { }) + }, + // 新增 + add () { + if (!this.columns.length) return util.errorMsg('请添加栏目') + this.setColumn(this.$refs.column.getCurrentNode()) + this.$router.push(`add?columnId=${this.$refs.column.getCurrentKey()}&columnName=${this.$refs.column.getCurrentNode().columnName}`) + }, + // 排序回调 + sortChange (column) { + const { order } = column + // 三个排序只能同时传1个,所以点了一个排序的时候要清除掉其余两个 + // 两个时间0默认倒序 1升序 + if (column.prop === 'updateTime') { + this.modifiedTimeSort = order ? order === 'ascending' ? 1 : 0 : '' + if (order) { + this.publicationTimeSort = '' + this.topSort = '' } - if (column.prop === 'releaseTime') { - this.publicationTimeSort = order ? order === 'ascending' ? 1 : 0 : '' - if (order) { - this.modifiedTimeSort = '' - this.topSort = '' - } + } + if (column.prop === 'releaseTime') { + this.publicationTimeSort = order ? order === 'ascending' ? 1 : 0 : '' + if (order) { + this.modifiedTimeSort = '' + this.topSort = '' } - // 序号排序 0默认升序 1倒序 - if (column.prop === 'sequence') { - this.topSort = order ? order === 'ascending' ? 0 : 1 : '' - if (order) { - this.publicationTimeSort = '' - this.modifiedTimeSort = '' - } + } + // 序号排序 0默认升序 1倒序 + if (column.prop === 'sequence') { + this.topSort = order ? order === 'ascending' ? 0 : 1 : '' + if (order) { + this.publicationTimeSort = '' + this.modifiedTimeSort = '' } - this.getData() - }, - // 置顶 - sticky(row) { - this.$post(`${this.api.articleTopOperation}?articleId=${row.id}&isTop=${row.isTop ? 0 : 1}`).then(res => { - this.initData() - }).catch(res => {}) - }, - // 预览 - preview(row) { - window.open((Setting.isDev ? `http://${location.hostname}:8095` : this.$store.state.content.site.domainName) + `#/article?articleId=${row.id}&siteId=${this.$refs.column.getCurrentNode().siteId}&id=${row.columnId}`) - }, - // 编辑 - edit(row) { - this.$router.push(`add?id=${row.id}&columnId=${this.$refs.column.getCurrentKey()}&columnName=${this.$refs.column.getCurrentNode().columnName}`) - }, - } + } + this.getData() + }, + // 置顶 + sticky (row) { + this.$post(`${this.api.articleTopOperation}?articleId=${row.id}&isTop=${row.isTop ? 0 : 1}`).then(res => { + this.initData() + }).catch(res => { }) + }, + // 预览 + preview (row) { + window.open((Setting.isDev ? `http://${location.hostname}:8095` : this.$store.state.content.site.domainName) + `#/article?articleId=${row.id}&siteId=${this.$refs.column.getCurrentNode().siteId}&id=${row.columnId}`) + }, + // 编辑 + edit (row) { + this.$router.push(`add?id=${row.id}&columnId=${this.$refs.column.getCurrentKey()}&columnName=${this.$refs.column.getCurrentNode().columnName}`) + }, + } }; \ No newline at end of file diff --git a/src/pages/column/page/deviceIntroBeam.vue b/src/pages/column/page/deviceIntroBeam.vue index 75c754b..386942a 100644 --- a/src/pages/column/page/deviceIntroBeam.vue +++ b/src/pages/column/page/deviceIntroBeam.vue @@ -69,7 +69,8 @@
-
{{ modules[4].form.title }}
+
@@ -203,7 +204,7 @@ export default { width: 986px; padding-bottom: 60px; margin: 0 auto; - h6 { + .title { padding-left: 15px; margin-bottom: 15px; font-size: 20px; diff --git a/src/pages/column/page/deviceIntroLayout.vue b/src/pages/column/page/deviceIntroLayout.vue index f0aed54..b76e529 100644 --- a/src/pages/column/page/deviceIntroLayout.vue +++ b/src/pages/column/page/deviceIntroLayout.vue @@ -71,7 +71,8 @@
-
{{ modules[4].form.title }}
+
@@ -195,7 +196,7 @@ export default { width: 986px; padding-bottom: 60px; margin: 0 auto; - h6 { + .title { padding-left: 15px; margin-bottom: 15px; font-size: 20px; diff --git a/src/pages/column/page/deviceIntroLinear.vue b/src/pages/column/page/deviceIntroLinear.vue index 66641ff..7065a4e 100644 --- a/src/pages/column/page/deviceIntroLinear.vue +++ b/src/pages/column/page/deviceIntroLinear.vue @@ -59,14 +59,16 @@
-
{{ modules[3].form.title }}
+
点击更改标题与图片
-
{{ modules[4].form.title }}
+

站点列表

- +
- - + + - - + + - +
@@ -37,80 +64,105 @@ import { mapState, mapMutations } from 'vuex' import util from '@/libs/util' import Setting from '@/setting' export default { - data() { - return { - keyword: '', - page: +this.$route.query.page || 1, - pageSize: 10, - total: 0, - list: [] - }; - }, - computed: { - ...mapState('auth', [ - 'btns' - ]) - }, - watch: { - keyword: function(val) { - clearTimeout(this.searchTimer) - this.searchTimer = setTimeout(() => { - this.initData() - }, 500) + data () { + return { + keyword: '', + page: +this.$route.query.page || 1, + pageSize: 10, + total: 0, + list: [] + }; + }, + computed: { + ...mapState('auth', [ + 'btns' + ]) + }, + watch: { + keyword: function (val) { + clearTimeout(this.searchTimer) + this.searchTimer = setTimeout(() => { + this.initData() + }, 500) + } + }, + mounted () { + this.getData() + this.$store.commit('user/setCrumbs', [ + { + name: '站点管理' } + ]) + // this.updateSite() + }, + methods: { + ...mapMutations('content', [ + 'setSite' + ]), + // 更改域名 + async updateSite () { + await this.$put(this.api.updateSite, { + id: 1, + siteName: 'IASF英文站点' + }) + await this.$put(this.api.updateSite, { + id: 2, + siteName: 'IASF中文站点' + }) + await this.$put(this.api.updateSite, { + id: 3, + siteName: 'S³FEL中文站点' + }) + await this.$put(this.api.updateSite, { + id: 4, + siteName: 'S³FEL英文站点' + }) + await this.$put(this.api.updateSite, { + id: 5, + siteName: 'SRF中文站点' + }) + await this.$put(this.api.updateSite, { + id: 6, + siteName: 'SRF英文站点' + }) }, - mounted() { + getData () { + this.$post(this.api.site, { + page: this.page, + limit: this.pageSize, + siteName: this.keyword + }).then(({ data }) => { + const list = util.getSite(data.records) + this.list = list + this.total = list.length + }).catch(e => { }) + }, + initData () { + this.page = 1 this.getData() - this.$store.commit('user/setCrumbs', [ - { - name: '站点管理' - } - ]) }, - methods: { - ...mapMutations('content', [ - 'setSite' - ]), - getData() { - this.$post(this.api.site, { - page: this.page, - limit: this.pageSize, - siteName: this.keyword - }).then(({ data }) => { - const list = util.getSite(data.records) - this.list = list - this.total = list.length - }).catch(e => {}) - }, - initData() { - this.page = 1 - this.getData() - }, - handleCurrentChange(val) { - this.page = val - }, - // 更改域名 - update(row) { - this.$put(this.api.updateSite, { - id: row.id, - domainName: row.domainName - }).then(res => { - - }).catch(e => {}) - }, - // 前往网站首页 - toIndex(row) { - window.open((Setting.isDev ? `http://${location.hostname}:8095` : row.domainName) + `#/column?siteId=${row.id}`) - }, - // 内容管理 - content(row) { - this.setSite(row) - this.$router.push(`/column`) - }, - } + handleCurrentChange (val) { + this.page = val + }, + // 更改域名 + async update (row) { + await this.$put(this.api.updateSite, { + id: row.id, + domainName: row.domainName + }) + }, + // 前往网站首页 + toIndex (row) { + window.open((Setting.isDev ? `http://${location.hostname}:8095` : row.domainName) + `#/column?siteId=${row.id}`) + }, + // 内容管理 + content (row) { + this.setSite(row) + this.$router.push(`/column`) + }, + } }; \ No newline at end of file diff --git a/src/plugins/auth/index.js b/src/plugins/auth/index.js index 48a6975..d158b79 100644 --- a/src/plugins/auth/index.js +++ b/src/plugins/auth/index.js @@ -4,9 +4,12 @@ * 用例:text 或者:text * */ import store from '@/store' +import Setting from '@/setting' export default { inserted(el, binding, vnode) { + // 开启了动态路由的需要根据权限筛选 + if (!Setting.dynamicRoute) return false const val = binding.value // 如果有传值,判断是否有/,有就说说明传的是完整的值,否则就拿路由拼接传的值;如果没传值,就取按钮名字 const text = val && val.includes('/') ? val : vnode.context.$route.path + ':' + (val || el.innerText) diff --git a/src/setting.js b/src/setting.js index 72558cf..78ea842 100644 --- a/src/setting.js +++ b/src/setting.js @@ -59,7 +59,7 @@ const Setting = { // 相同路由,不同参数间进行切换,是否强力更新 sameRouteForceUpdate: false, // 是否使用动态路由(即角色权限,开启了的话就会取后端返回的权限树来显示头部导肮和页面按钮) - dynamicRoute: true + dynamicRoute: false }; export default Setting;