From 44b3e9a34bb435770d21c0a6b483ecdc50a7f816 Mon Sep 17 00:00:00 2001 From: yujt Date: Tue, 23 Jun 2020 10:33:36 +0800 Subject: [PATCH] =?UTF-8?q?banner=E9=80=BB=E8=BE=91=E8=B7=9F=E9=9A=8F?= =?UTF-8?q?=E6=96=B0=E9=97=BB=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 2 +- .../modules/news/banner-add-or-update.vue | 89 +++++-------------- src/views/modules/news/banner.vue | 26 ++++-- src/views/modules/news/news-safety.vue | 26 ++++++ .../news/newscategory-add-or-update.vue | 1 - 5 files changed, 68 insertions(+), 76 deletions(-) diff --git a/public/index.html b/public/index.html index b6e9809..5904ade 100644 --- a/public/index.html +++ b/public/index.html @@ -35,7 +35,7 @@ <% if (process.env.VUE_APP_NODE_ENV === 'dev') { %> <% } %> diff --git a/src/views/modules/news/banner-add-or-update.vue b/src/views/modules/news/banner-add-or-update.vue index 1ed9b11..b0bddff 100644 --- a/src/views/modules/news/banner-add-or-update.vue +++ b/src/views/modules/news/banner-add-or-update.vue @@ -14,7 +14,7 @@ + placeholder="链接地址(必须在微信公众平台添加安全业务域名)" /> @@ -23,6 +23,11 @@ show-word-limit placeholder="标题"> + + + + + { }) - this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street')) this.getListFromDict('bannerType') this.getListFromDict('bannerPosition') }, @@ -156,13 +150,12 @@ export default { this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}` this.visible = true this.$nextTick(() => { - this.dataForm.communityId = this.dataForm.streetId = this.dataForm.gridId = null - this.communityList = this.gridList = [] this.$refs['dataForm'].resetFields() if (this.dataForm.id) { this.getInfo() } }) + this.getsectionCodeList() }, // 获取信息 getInfo () { @@ -171,20 +164,18 @@ export default { return this.$message.error(res.msg) } this.dataForm = res.data - if (this.dataForm.streetId) { - if (this.dataForm.communityId === 0) { - this.dataForm.communityId = this.dataForm.gridId = null - } - this.getDeptInfoList('community', this.dataForm.streetId) - } - if (this.dataForm.communityId) { - if (this.dataForm.gridId === 0) { - this.dataForm.gridId = null - } - this.getDeptInfoList('grid', this.dataForm.communityId) - } }).catch(() => { }) }, + getsectionCodeList () { + this.$http.get(`/sys/dict/listSimple/function_section_article`) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.sectionCodeList = res.data + }) + .catch(() => {}) + }, // 表单提交 dataFormSubmitHandle: debounce(function () { this.$refs['dataForm'].validate((valid) => { @@ -229,46 +220,6 @@ export default { this.positionList = res.data } }).catch(() => { }) - }, - // 获取部门列表 - getDeptInfoList (dataReceiver, faDeptId) { - this.$http.get(`/sys/dept/sublist/` + faDeptId).then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) - } - if (dataReceiver === 'street') { - this.streetList = res.data - } else if (dataReceiver === 'community') { - this.communityList = res.data - } else if (dataReceiver === 'grid') { - this.gridList = res.data - } - }).catch(() => { }) - }, - changeStreet () { - // 给街道变量赋值 - let choosenItem = this.streetList.filter(item => item.id === this.dataForm.streetId)[0] - this.dataForm.street = choosenItem.name - // 清空社区与网格的变量值 - this.dataForm.communityId = this.dataForm.gridId = this.dataForm.community = this.dataForm.grid = null - this.communityList = this.gridList = [] - // 获取街道下属社区 - this.getDeptInfoList('community', this.dataForm.streetId) - }, - changeCommunity () { - // 给社区变量赋值 - let choosenItem = this.communityList.filter(item => item.id === this.dataForm.communityId)[0] - this.dataForm.community = choosenItem.name - // 情况网格的变量值 - this.dataForm.gridId = this.dataForm.grid = null - this.gridList = [] - // 获取社区下属网格 - this.getDeptInfoList('grid', this.dataForm.communityId) - }, - changeGrid () { - // 给网格变量赋值 - let choosenItem = this.gridList.filter(item => item.id === this.dataForm.gridId)[0] - this.dataForm.grid = choosenItem.name } } } diff --git a/src/views/modules/news/banner.vue b/src/views/modules/news/banner.vue index 5a1395e..d9adc0e 100644 --- a/src/views/modules/news/banner.vue +++ b/src/views/modules/news/banner.vue @@ -2,10 +2,13 @@
- - + + + + + + + @@ -122,8 +125,10 @@ export default { }, dataForm: { id: '', - title: '' + title: '', + sectionCode: '' }, + sectionCodeList: [], bannerOptions: [], positionList: [] } @@ -134,11 +139,22 @@ export default { created () { this.getListFromDict('bannerType') this.getListFromDict('bannerPosition') + this.getsectionCodeList() }, methods: { bannerState: function (row, column) { return row.state === '1' ? '已上架' : row.state === '0' ? '已下架' : '未知' }, + getsectionCodeList () { + this.$http.get(`/sys/dict/listSimple/function_section_article`) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.sectionCodeList = res.data + }) + .catch(() => {}) + }, soltOut (id) { this.$confirm(this.$t('prompt.info', { 'handle': '下架' }), this.$t('下架'), { confirmButtonText: this.$t('confirm'), diff --git a/src/views/modules/news/news-safety.vue b/src/views/modules/news/news-safety.vue index 06433ad..63a1a3e 100644 --- a/src/views/modules/news/news-safety.vue +++ b/src/views/modules/news/news-safety.vue @@ -115,6 +115,11 @@ type="text" size="small" @click="modifyOnLine(scope.row)">下线 + 上banner @@ -264,6 +269,27 @@ export default { }).catch(() => { this.dataListLoading = false }) + }, + newsToBanner (row) { + this.$confirm(this.$t('prompt.info', { 'handle': '上banner' }), this.$t('上banner'), { + confirmButtonText: this.$t('confirm'), + cancelButtonText: this.$t('cancel'), + type: 'warning' + }).then(() => { + this.$http.post(`/news/news/newsToBanner/` + row.id).then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) + } + this.$message({ + message: this.$t('prompt.success'), + type: 'success', + duration: 500, + onClose: () => { + } + }) + this.getDataList() + }).catch(() => { }) + }).catch(() => { }) } }, components: { diff --git a/src/views/modules/news/newscategory-add-or-update.vue b/src/views/modules/news/newscategory-add-or-update.vue index ddd1e32..b52cdea 100644 --- a/src/views/modules/news/newscategory-add-or-update.vue +++ b/src/views/modules/news/newscategory-add-or-update.vue @@ -95,7 +95,6 @@ export default { }) this.getsectionCodeList() }, - // 获取信息 getsectionCodeList () { this.$http.get(`/sys/dict/listSimple/function_section_article`) .then(({ data: res }) => {