diff --git a/src/api/index.js b/src/api/index.js index d7392f7..61f1ae9 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -41,6 +41,7 @@ export default { deleteColumn: `/iasf/sysColumn/batchDeletion`, sameLevelJudgment: `/iasf/sysColumn/sameLevelJudgment`, sortByColumn: `/iasf/sysColumn/sortByColumn`, + controlDisplayNavigationMenu: `/iasf/sysColumn/controlDisplayNavigationMenu`, checkIfTheTitleIsRepeat: `/iasf/sysContent/checkIfTheTitleIsRepeat`, deleteArticle: `/iasf/sysContent/batchDeletion`, findArticle: `/iasf/sysContent/findById`, diff --git a/src/layouts/navbar/index.vue b/src/layouts/navbar/index.vue index b4784c2..fa59622 100644 --- a/src/layouts/navbar/index.vue +++ b/src/layouts/navbar/index.vue @@ -154,7 +154,11 @@ export default { }, { index: '/floatingFrame', - title: '悬浮栏管理' + title: '悬浮栏设置' + }, + { + index: '/footer', + title: '页脚设置' } ] } diff --git a/src/mixins/page/index.js b/src/mixins/page/index.js index 84c1cdd..6a41bd5 100644 --- a/src/mixins/page/index.js +++ b/src/mixins/page/index.js @@ -65,24 +65,26 @@ export default { }) const { modules } = this // 查询页面详情 - this.$post(`${this.api.findPage}?columnId=${this.columnId}`).then(({ data }) => { - if (data.length) { - const json = data[0] - this.id = json.id - const str = json[json.state ? 'theEditedJson' : 'jsonBeforeEditing'] - const list = JSON.parse(str) + if (this.columnId) { + this.$post(`${this.api.findPage}?columnId=${this.columnId}`).then(({ data }) => { + if (data.length) { + const json = data[0] + this.id = json.id + const str = json[json.state ? 'theEditedJson' : 'jsonBeforeEditing'] + const list = JSON.parse(str) - this.modules.map((e, i) => { - e.form = list[i].form - if (list[i].list) e.list = list[i].list - if (this.withOriginForm.includes(e.type) && !e.originForm) { - e.originForm = modules[i].originForm - } - }) - this.originModules = JSON.stringify(this.modules) // 原始json,用以页面离开的时候判断是否需要提示保存 - console.log("🚀 ~ file: index.js:85 ~ this.$post ~ list:", this.modules) - } - }).catch(err => { }) + this.modules.map((e, i) => { + e.form = list[i].form + if (list[i].list) e.list = list[i].list + if (this.withOriginForm.includes(e.type) && !e.originForm) { + e.originForm = modules[i].originForm + } + }) + this.originModules = JSON.stringify(this.modules) // 原始json,用以页面离开的时候判断是否需要提示保存 + console.log("🚀 ~ file: index.js:85 ~ this.$post ~ list:", this.modules) + } + }).catch(err => { }) + } }, // 展开模块设置 toSet (i, listIndex) { diff --git a/src/pages/annex/list/index.vue b/src/pages/annex/list/index.vue index 34a3ba5..325eaae 100644 --- a/src/pages/annex/list/index.vue +++ b/src/pages/annex/list/index.vue @@ -1,51 +1,42 @@ @@ -86,152 +78,150 @@ import { mapState } from 'vuex' import util from '@/libs/util' export default { - data() { - return { - sites: [], - types: [ - { - name: '不限' - }, - { - name: '图片' - }, - { - name: '视频' - }, - { - name: '文档' - } - ], - field: 'fileName', - keywords: [ - { - id: 'fileName', - name: '文件名称' - }, - { - id: 'uploader', - name: '上传人' - }, - { - id: 'quote', - name: '文章名称' - } - ], - keyword: '', - form: { - site: '', - type: '不限' - }, - page: +this.$route.query.page || 1, - pageSize: 10, - total: 0, - list: [], - multipleSelection: [], - }; - }, - computed: { - ...mapState('auth', [ - 'btns' - ]) - }, - watch: { - keyword: function(val) { - clearTimeout(this.searchTimer) - this.searchTimer = setTimeout(() => { - this.initData() - }, 500) - } - }, - mounted() { - this.$store.commit('user/setCrumbs', [ + data () { + return { + sites: [], + types: [ + { + name: '不限' + }, + { + name: '图片' + }, { - name: '附件管理' + name: '视频' + }, + { + name: '文档' + } + ], + field: 'fileName', + keywords: [ + { + id: 'fileName', + name: '文件名称' + }, + { + id: 'uploader', + name: '上传人' + }, + { + id: 'quote', + name: '文章名称' } - ]) + ], + keyword: '', + form: { + site: '', + type: '不限' + }, + page: +this.$route.query.page || 1, + pageSize: 10, + total: 0, + list: [], + multipleSelection: [], + }; + }, + computed: { + ...mapState('auth', [ + 'btns' + ]) + }, + watch: { + keyword: function (val) { + clearTimeout(this.searchTimer) + this.searchTimer = setTimeout(() => { + this.initData() + }, 500) + } + }, + mounted () { + this.$store.commit('user/setCrumbs', [ + { + name: '附件管理' + } + ]) + this.getData() + this.getSite() + }, + methods: { + getData () { + const { form } = this + this.$post(this.api.listByPage, { + page: this.page, + limit: this.pageSize, + quote: this.field === 'quote' ? this.keyword : '', + fileName: this.field === 'fileName' ? this.keyword : '', + uploader: this.field === 'uploader' ? this.keyword : '', + site: form.site, + type: form.type === '不限' ? '' : form.type + }).then(({ data }) => { + this.list = data.records + this.total = +data.total + }).catch(err => { }) + }, + // 获取站点列表 + getSite () { + this.$post(this.api.site, { + page: 1, + limit: 1000, + siteName: '' + }).then(({ data }) => { + this.sites = util.getSite(data.records) + }).catch(e => { }) + }, + initData () { + this.$refs.table.clearSelection() + this.page = 1 this.getData() - this.getSite() }, - methods: { - getData() { - const { form } = this - this.$post(this.api.listByPage, { - page: this.page, - limit: this.pageSize, - quote: this.field === 'quote' ? this.keyword : '', - fileName: this.field === 'fileName' ? this.keyword : '', - uploader: this.field === 'uploader' ? this.keyword : '', - site: form.site, - type: form.type === '不限' ? '' : form.type - }).then(({ data }) => { - this.list = data.records - this.total = +data.total - }).catch(err => {}) - }, - // 获取站点列表 - getSite() { - this.$post(this.api.site, { - page: 1, - limit: 1000, - siteName: '' - }).then(({ data }) => { - this.sites = util.getSite(data.records) - }).catch(e => {}) - }, - initData() { - this.$refs.table.clearSelection() - this.page = 1 - this.getData() - }, - // 查看 - show(row) { - const format = row.format - window.open((util.isDoc(format) ? 'https://view.officeapps.live.com/op/view.aspx?src=' : '') + row.url) - }, - // 下载 - download(row) { - util.downloadFile(row.fileName, row.url) - }, - // 删除 - del(row) { + // 查看 + show (row) { + const format = row.format + window.open((util.isDoc(format) ? 'https://view.officeapps.live.com/op/view.aspx?src=' : '') + row.url) + }, + // 下载 + download (row) { + util.downloadFile(row.fileName, row.url) + }, + // 删除 + del (row) { + this.$confirm('确定要删除吗?', '提示', { + type: 'warning' + }).then(() => { + this.$del(`${this.api.delFile}`, [row.id]).then(res => { + util.successMsg('删除成功') + this.getData() + }).catch(res => { }) + }).catch(() => { }) + }, + // 批量删除 + batchDel () { + const list = this.multipleSelection + if (list.length) { this.$confirm('确定要删除吗?', '提示', { type: 'warning' }).then(() => { - this.$del(`${this.api.delFile}`, [row.id]).then(res => { + this.$del(`${this.api.delFile}`, list.map(e => e.id)).then(res => { + this.$refs.table.clearSelection() util.successMsg('删除成功') this.getData() - }).catch(res => {}) - }).catch(() => {}) - }, - // 批量删除 - batchDel() { - const list = this.multipleSelection - if (list.length) { - this.$confirm('确定要删除吗?', '提示', { - type: 'warning' - }).then(() => { - this.$del(`${this.api.delFile}`, list.map(e => e.id)).then(res => { - this.$refs.table.clearSelection() - util.successMsg('删除成功') - this.getData() - }).catch(res => {}) - }).catch(() => {}) - } else { - util.errorMsg('请先选择数据 !') - } - }, - handleSelectionChange(val) { - this.multipleSelection = val - }, - handleCurrentChange(val) { - this.page = val - this.$router.push(`list?page=${val}`) - this.getData() - }, - } + }).catch(res => { }) + }).catch(() => { }) + } else { + util.errorMsg('请先选择数据 !') + } + }, + handleSelectionChange (val) { + this.multipleSelection = val + }, + handleCurrentChange (val) { + this.page = val + this.$router.push(`list?page=${val}`) + this.getData() + }, + } }; - \ No newline at end of file + \ No newline at end of file diff --git a/src/pages/column/list/index.vue b/src/pages/column/list/index.vue index 9e12c91..2aa7995 100644 --- a/src/pages/column/list/index.vue +++ b/src/pages/column/list/index.vue @@ -276,8 +276,8 @@ export default { }).catch(() => { }) }, // 禁用启用 - switchOff (val, row) { - this.$post(this.api.updateColumn, row).then(res => { }).catch((res) => { }) + async switchOff (val, row) { + await this.$post(`${this.api.controlDisplayNavigationMenu}?id=${row.id}&menuVisible=${val}`) }, // 预览 preview (row) { diff --git a/src/pages/column/page/aboutUs.vue b/src/pages/column/page/aboutUs.vue index 695a9f9..be3eac7 100644 --- a/src/pages/column/page/aboutUs.vue +++ b/src/pages/column/page/aboutUs.vue @@ -3,55 +3,35 @@

页面设置/关于我们

- 预览 + 预览 保存为草稿 - 发布 + 发布 放弃编辑
- + -
@@ -92,15 +64,10 @@

{{ modules[1].form.subTitle1 }}

{{ modules[1].form.subTitle2 }}

-
+
- -
点击更改图片、标题概述与链接
+ +
点击更改图片、标题概述与链接
@@ -108,125 +75,96 @@
{{ modules[2].form.title }}

{{ modules[2].form.des }}

-
点击更换标题与描述
+
点击更换标题与描述
-
+
{{ modules[3].form.title }}

{{ modules[3].form.des }}

-
点击更换标题与描述
+
点击更换标题与描述
    -
    点击更改图片、标题、概述与链接
    +
    点击更改图片、标题、概述与链接
-
+
-
+
{{ modules[5].form.title }}

{{ modules[5].form.subTitle }}

{{ modules[5].form.des }}

-
点击更换标题与描述
+
点击更换标题与描述
    -
    点击更改图片、标题、概述与链接
    +
    点击更改图片、标题、概述与链接
-
+
{{ modules[7].form.title }}

{{ modules[7].form.subTitle }}

{{ modules[7].form.des }}

-
点击更换标题与描述
+
点击更换标题与描述
- - - + + +
- -
    + +
    -
    点击更改图片
    +
    点击更改图片
@@ -236,116 +174,52 @@
{{ modules[10].form.title }}

{{ modules[10].form.des }}

-
点击更改标题与描述
+
点击更改标题与描述
- +

深圳

- +
- + {{ modules[11].form.siteName }}
- + {{ modules[11].form.address }}
- + {{ modules[11].form.phone }}
- + {{ modules[11].form.mail }}
-
点击更改信息
+
点击更改信息
- +

{{ modules[12].form.title }}

-
点击更改信息
+
点击更改信息
- +

{{ modules[13].form.title }}

-
点击更改信息
-
-
-
-
-
- -
-
- -
-
- +
@@ -361,7 +235,7 @@ export default { data () { return { isImg: Util.isImg, - modules: Modules.aboutUs + modules: Modules.aboutUs, } }, components: { @@ -394,947 +268,1023 @@ export default { \ No newline at end of file diff --git a/src/pages/floatingFrame/index.vue b/src/pages/floatingFrame/index.vue index b6e7118..b33bec0 100644 --- a/src/pages/floatingFrame/index.vue +++ b/src/pages/floatingFrame/index.vue @@ -14,15 +14,15 @@ @selection-change="handleSelectionChange" row-key="id"> - - - - - - + + + + + + - + @@ -136,13 +133,15 @@ import Setting from '@/setting' import Util from '@/libs/util' import Axios from 'axios' -import Cropper from '@/components/img-upload/Cropper' import Editor from '@tinymce/tinymce-vue' import editorConfig from '@/components/editor' import _ from 'lodash' export default { data () { return { + headers: { + token: Util.local.get(Setting.tokenKey) + }, editorConfig, siteId: this.$store.state.content.site.id, siteName: this.$store.state.content.site.siteName, @@ -154,7 +153,6 @@ export default { total: 0, multipleSelection: [], listLoading: false, - range: 0, selectColumn: [], columns: [], columnProps: { @@ -209,6 +207,7 @@ export default { ` } ], + isGlobal: 1, floatingColumnSchemeScopeOfApplications: [], }, originModules: { @@ -239,16 +238,10 @@ export default { { required: true, message: '请输入内容', trigger: 'blur' } ], }, - - cropperModel: false, - isUpload: false, - fixedNumber: [1, 1], - file: {}, // 当前被选择的图片文件 }; }, components: { Editor, - Cropper, }, watch: { keyword: function (val) { @@ -308,7 +301,6 @@ export default { this.columns = data }, add () { - this.range = 0 this.selectColumn = [] this.form = _.cloneDeep(this.originForm) this.moduleVisible = true @@ -337,8 +329,6 @@ export default { this.moduleVisible = true const { data } = await this.$post(`${this.api.findFloating}?id=${row.floatingBarSchemeId}`) const range = data.floatingColumnSchemeScopeOfApplications - // 应用范围数组里有一个对象的applicationScopeId为0,则是网站全局 - this.range = row.isGlobal ? 0 : 1 if (!row.isGlobal) { const column = [] // 选择栏目 @@ -359,12 +349,12 @@ export default { const form = JSON.parse(JSON.stringify(this.form)) if (!form.floatingColumnSchemeModules.length) return Util.warningMsg('请添加内容模块') const column = this.selectColumn - if (this.range && !column.length) return Util.warningMsg('请选择栏目') + if (!form.isGlobal && !column.length) return Util.warningMsg('请选择栏目') this.submiting = true - if (this.range) { + // 选择栏目 + if (!form.isGlobal) { const scope = [] - // debugger column.map(e => { scope.push({ applicationScopeId: typeof e === 'number' ? e : e.join(',') @@ -376,8 +366,8 @@ export default { applicationScopeId: 0 }] } - if (!form.floatingBarSchemeId) form.founderId = form.editorId - // debugger + form.isDisable = 1 + if (!form.floatingBarSchemeId) form.founderId = form.editorId // 新增则创建人即编辑人 try { await this.$post(this.api.saveFloating, form) Util.successMsg('新增成功!') @@ -398,9 +388,11 @@ export default { if (valid) { this.contentVisible = false const row = this.curRow + // 新增 if (this.curModule === -1) { this.form.floatingColumnSchemeModules.push(_.cloneDeep(row)) } else { + // 编辑 const list = this.form.floatingColumnSchemeModules[this.curModule] for (const i in row) { this.$set(list, i, row[i]) @@ -409,57 +401,10 @@ export default { } }) }, - // 图片裁剪上传事件 - customUpload (data) { - const formData = new FormData() - formData.append('file', data, this.file.name) - this.imgUpload(formData) - }, - // 图片上传到服务器 - imgUpload (formData) { - this.isUpload = true - Axios({ - method: 'post', - url: this.api.upload, - data: formData, - headers: { - 'Content-Type': 'multipart/form-data', - token: Util.local.get(Setting.tokenKey) - }, - }).then(({ data }) => { - if (data.code === 401) { - Util.errorMsg("登录过期,请重新登录"); - setTimeout(() => { - this.$store.dispatch('user/logout') - }, 1000); - return false - } - this.$set(this.curRow, 'pictureAddress', data.url) - }).catch(res => { }) - this.$refs.cropper.isDisabled = false - this.isUpload = false - this.cropperModel = false - }, - // 图片改变钩子 - changeFile (file) { - const { size, name } = file - const ext = name.substring(name.lastIndexOf('.') + 1) - if (!Util.isImg(ext)) { - this.$message.error('请上传图片!') - return false - } - if (size / 1024 / 1024 > 100) { - this.$message.error('请上传100M以内的图片!') - return false - } - this.file = file - this.cropperModel = true - this.$nextTick(() => { - this.$refs.cropper.updateImg({ - url: window.URL.createObjectURL(file.raw), - size: file.size - }) - }) + + // 上传成功 + uploadSuccess (res) { + this.curRow.pictureAddress = res.url }, del (row) { @@ -476,20 +421,23 @@ export default { async switchOff (row) { try { const { code, msg } = await this.$post(`${this.api.checkEnableOrDisable}?id=${row.floatingBarSchemeId}&isDisable=${row.isDisable}`) - // debugger if (code === 300) { // 悬浮栏管理里的禁用启用返回300要弹询问框选择是否继续 this.$confirm(msg, '提示', { type: "warning" }).then(async () => { await this.$post(`${this.api.enableOrDisableScheme}?id=${row.floatingBarSchemeId}&isDisable=${row.isDisable}`) + this.getData() }).catch(() => { row.isDisable = row.isDisable ? 0 : 1 }) } else { await this.$post(`${this.api.enableOrDisableScheme}?id=${row.floatingBarSchemeId}&isDisable=${row.isDisable}`) + this.getData() } - } catch (e) { } + } catch (e) { + row.isDisable = row.isDisable ? 0 : 1 + } }, // 批量删除 batchDel () { @@ -516,7 +464,6 @@ export default { }, handleCurrentChange (val) { this.page = val - this.$router.push(`list?page=${val}`) this.getData() }, } @@ -609,4 +556,65 @@ $upload-lg-height: 102px; max-width: 100px; margin: 10px 0; } + +$avatar-width: 140px; +$avatar-height: 80px; + +/deep/.uploader { + .el-upload { + position: relative; + width: $avatar-width; + border: 1px dashed #d9d9d9; + border-radius: 2px; + cursor: pointer; + overflow: hidden; + + &:hover { + border-color: #409EFF; + } + + .uploader-default { + display: flex; + flex-direction: column; + justify-content: center; + width: $avatar-width !important; + height: $avatar-height; + text-align: center; + background: rgba(0, 0, 0, 0.04); + + i { + font-size: 20px; + font-weight: bold; + color: #8c939d; + } + + p { + margin-top: 10px; + font-size: 14px; + color: rgba(0, 0, 0, 0.65); + line-height: 1; + } + } + + .avatar { + display: block; + width: $avatar-width; + height: $avatar-height; + } + } + + .el-upload__tip { + margin-top: 0; + + p { + font-size: 14px; + color: rgba(0, 0, 0, 0.45); + line-height: 1; + + &:first-child { + margin-bottom: 5px; + } + } + } +} \ No newline at end of file diff --git a/src/pages/footer/index.vue b/src/pages/footer/index.vue new file mode 100644 index 0000000..e3b4855 --- /dev/null +++ b/src/pages/footer/index.vue @@ -0,0 +1,550 @@ + + + + + \ No newline at end of file diff --git a/src/router/modules/floatingFrame.js b/src/router/modules/floatingFrame.js index c457c39..84aa822 100644 --- a/src/router/modules/floatingFrame.js +++ b/src/router/modules/floatingFrame.js @@ -2,17 +2,15 @@ import BasicLayout from '@/layouts/home' const meta = {} -const pre = 'article-' - export default { - path: '/floatingFrame', - meta, - component: BasicLayout, - children: [ - { - path: `/floatingFrame`, - component: () => import('@/pages/floatingFrame'), - meta: { title: '悬浮栏设置' } - }, - ] + path: '/floatingFrame', + meta, + component: BasicLayout, + children: [ + { + path: `/floatingFrame`, + component: () => import('@/pages/floatingFrame'), + meta: { title: '悬浮栏设置' } + }, + ] } diff --git a/src/router/modules/footer.js b/src/router/modules/footer.js new file mode 100644 index 0000000..3a7cc83 --- /dev/null +++ b/src/router/modules/footer.js @@ -0,0 +1,16 @@ +import BasicLayout from '@/layouts/home' + +const meta = {} + +export default { + path: '/footer', + meta, + component: BasicLayout, + children: [ + { + path: `/footer`, + component: () => import('@/pages/footer'), + meta: { title: '页脚设置' } + }, + ] +}