From 43e17d5c610ad88555ed9f669c9b728fe9b2d427 Mon Sep 17 00:00:00 2001 From: Eddie <102564160@qq.com> Date: Wed, 25 Aug 2021 14:53:07 +0800 Subject: [PATCH] 1 --- .vscode/settings.json | 3 + src/router/index.js | 4 ++ src/router/modules/push-settings.js | 29 ++++++++ src/styles/element-ui.scss | 14 +++- src/utils/request.js | 22 +++--- src/views/home/home.vue | 68 +++++++++---------- .../mob-template/mob-template.vue | 60 ++++++++++++++++ src/views/push-settings/niu-yun/niu-yun.vue | 58 ++++++++++++++++ 8 files changed, 210 insertions(+), 48 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 src/router/modules/push-settings.js create mode 100644 src/views/push-settings/mob-template/mob-template.vue create mode 100644 src/views/push-settings/niu-yun/niu-yun.vue diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c1c99bb --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "vue3snippets.enable-compile-vue-file-on-did-save-code": true +} \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 33300f4..24453d8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -18,6 +18,9 @@ import basicSetting from './modules/basic-setting' import setAdvertising from './modules/set-advertising' import home from './modules/home' +import mobTemplate from './modules/push-settings' + + @@ -96,6 +99,7 @@ export const asyncRoutes = [ booksManagement, sortManagement, setAdvertising, + mobTemplate, // 404 page must be placed at the end !!! { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/router/modules/push-settings.js b/src/router/modules/push-settings.js new file mode 100644 index 0000000..e4cca32 --- /dev/null +++ b/src/router/modules/push-settings.js @@ -0,0 +1,29 @@ +/** When your routing table is too long, you can split it into small modules **/ + +import Layout from '@/layout' + +const mobTemplate = { + path: 'mob-template', + component: Layout, + redirect: 'push-settings', + name: 'push-settings', + meta: { + title: '设置中心', + icon: 'el-icon-s-home' + }, + children: [ + { + path: '/push-settings/mob-template', + component: () => import('@/views/push-settings/mob-template/mob-template'), + name: 'mob-template', + meta: { title: 'mob短信模版设置' } + }, + { + path: '/push-settings/niu-yun', + component: () => import('@/views/push-settings/niu-yun/niu-yun'), + name: 'niu-yun', + meta: { title: '七牛云' } + }, + ] +} +export default mobTemplate diff --git a/src/styles/element-ui.scss b/src/styles/element-ui.scss index 3efd0e2..53fca61 100644 --- a/src/styles/element-ui.scss +++ b/src/styles/element-ui.scss @@ -47,7 +47,7 @@ .el-table th.is-leaf, .el-table td { border-bottom: 0; - } + } el-table__row > td { border: none; @@ -63,4 +63,14 @@ color: #3DA2FF; border: none; box-shadow: 0px 0px 20px rgb(211, 211, 211); -} \ No newline at end of file +} + + + +.mob-template { + .el-form-item__content { + margin-left: 0 !important; + max-width: 400px; + width: 50%; + } +} diff --git a/src/utils/request.js b/src/utils/request.js index 2aa3eb9..ff61a49 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -75,17 +75,17 @@ service.interceptors.response.use( return error.response.data } // 登录超时,重新登录 - // if (error.response.data.code === 403) { - // store.dispatch('user/resetToken').then(() => { - // location.reload() - // }) - // Message({ - // message: '登录超时,请重新登录', - // type: 'error', - // duration: 5 * 1000 - // }) - // return - // } + if (error.response.data.code === 403) { + store.dispatch('user/resetToken').then(() => { + location.reload() + }) + Message({ + message: '登录超时,请重新登录', + type: 'error', + duration: 5 * 1000 + }) + return + } Message({ message: errorMsg ?? error, diff --git a/src/views/home/home.vue b/src/views/home/home.vue index 063cf31..30df363 100644 --- a/src/views/home/home.vue +++ b/src/views/home/home.vue @@ -22,7 +22,7 @@ @click="onBooksAdd(scope.$index)" > {{ - scope.row.value | onValueBooks + scope.row.book_info.book_name }} @@ -167,12 +167,6 @@ import { getHomePage, homeSetting } from "@/api/home"; getHomePage; export default { - filters: { - onValueBooks(data) { - console.log(data); - return data; - }, - }, components: { ActionButton, CustomButton, @@ -182,22 +176,8 @@ export default { return { selectIndex: null, isBooksShow: false, - banner: [ - { name: "", value: "", status: "" }, - { name: "", value: "", status: "" }, - ], - book_show: [ - { - name: "", - value: { style: "", category_id: "" }, - status: "", - }, - { - name: "", - value: { style: "", category_id: "" }, - status: "", - }, - ], + banner: [], + book_show: [], booksData: [], options: [ { @@ -221,8 +201,28 @@ export default { // 初始化 init() { getHomePage().then((res) => { - this.banner = res.data.banner; - this.book_show = res.data.book_show; + + if (res.data.banner) { + this.banner = res.data.banner; + this.book_show = res.data.book_show; + } else { + this.book_show = [ + { + name: "", + value: { style: "", category_id: "" }, + status: "", + }, + { + name: "", + value: { style: "", category_id: "" }, + status: "", + }, + ]; + this.banner = [ + { name: "", value: "", status: "" }, + { name: "", value: "", status: "" }, + ]; + } }); }, @@ -237,16 +237,17 @@ export default { onSelectItem(data) { this.isBooksShow = false; - this.banner[this.selectIndex].value = data.book_name; + this.banner[this.selectIndex].value = data.book_id; + + this.banner[this.selectIndex].book_info = data; }, // 删除banner onDeleteBanner(i) { - this.banner.splice(i,1) + this.banner.splice(i, 1); }, onDeleteBook(i) { - this.book_show.splice(i,1) - + this.book_show.splice(i, 1); }, // 刷新 @@ -280,9 +281,6 @@ export default { }, submitForm() { - console.log(this.book_show); - console.log(this.banner); - homeSetting({ book_show: this.book_show, banner: this.banner, @@ -292,9 +290,9 @@ export default { this.$message.success("保存成功"); }); }, - resetForm(){ - this.init() - } + resetForm() { + this.init(); + }, }, }; diff --git a/src/views/push-settings/mob-template/mob-template.vue b/src/views/push-settings/mob-template/mob-template.vue new file mode 100644 index 0000000..9725038 --- /dev/null +++ b/src/views/push-settings/mob-template/mob-template.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/src/views/push-settings/niu-yun/niu-yun.vue b/src/views/push-settings/niu-yun/niu-yun.vue new file mode 100644 index 0000000..cf7cb0d --- /dev/null +++ b/src/views/push-settings/niu-yun/niu-yun.vue @@ -0,0 +1,58 @@ + + + + +