From 8c6bc1a60e45a5d45cb8e529fac40fade75048e0 Mon Sep 17 00:00:00 2001 From: x ronger Date: Tue, 8 Sep 2020 08:00:32 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E8=B7=AF=E5=BE=84=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/admin.vue | 8 ++++---- pages/admin/{role.vue => roles.vue} | 10 +++++----- pages/admin/{user.vue => users.vue} | 12 ++++++------ store/article.js | 1 - 4 files changed, 15 insertions(+), 16 deletions(-) rename pages/admin/{role.vue => roles.vue} (96%) rename pages/admin/{user.vue => users.vue} (95%) diff --git a/pages/admin.vue b/pages/admin.vue index f6daa2b..339e2bf 100644 --- a/pages/admin.vue +++ b/pages/admin.vue @@ -10,19 +10,19 @@ Dashboard - + 用户管理 - + 角色管理 - + 专题管理 - + 标签管理 diff --git a/pages/admin/role.vue b/pages/admin/roles.vue similarity index 96% rename from pages/admin/role.vue rename to pages/admin/roles.vue index 1bd09f5..8d545a5 100644 --- a/pages/admin/role.vue +++ b/pages/admin/roles.vue @@ -89,7 +89,7 @@ import {mapState} from 'vuex'; export default { - name: "role", + name: "roles", fetch({store, params, error}) { return Promise.all([ store @@ -122,7 +122,7 @@ let _ts = this; _ts.$set(_ts, 'dialogVisible', true); _ts.$set(_ts, 'title', '编辑角色信息'); - _ts.$set(_ts, 'role', role); + _ts.$set(_ts, 'role', roles); }, updateRole() { let _ts = this; @@ -144,20 +144,20 @@ toggleStatus(index, role) { let _ts = this; let title, status; - if (role.status == 0) { + if (roles.status == 0) { title = '禁用'; status = 1; } else { title = '启用'; status = 0; } - _ts.$confirm('确定' + title + '角色 ' + role.name + '?', '提示', { + _ts.$confirm('确定' + title + '角色 ' + roles.name + '?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { _ts.$axios.$patch('/api/admin/role/update-status', { - idRole: role.idRole, + idRole: roles.idRole, status: status }).then(function (res) { if (res && res.message) { diff --git a/pages/admin/user.vue b/pages/admin/users.vue similarity index 95% rename from pages/admin/user.vue rename to pages/admin/users.vue index f0aa165..c0f6607 100644 --- a/pages/admin/user.vue +++ b/pages/admin/users.vue @@ -98,7 +98,7 @@ import {mapState} from 'vuex'; export default { - name: "user", + name: "users", fetch({store, params, error}) { return Promise.all([ store @@ -130,8 +130,8 @@ }, handleRole(index, user) { let _ts = this; - _ts.$set(_ts, 'idUser', user.idUser); - _ts.$axios.$get('/api/admin/user/' + user.idUser + '/role') + _ts.$set(_ts, 'idUser', users.idUser); + _ts.$axios.$get('/api/admin/user/' + users.idUser + '/role') .then(function (res) { _ts.$set(_ts, 'dialogVisible', true); _ts.$set(_ts, 'idRole', res[0].idRole); @@ -140,20 +140,20 @@ toggleStatus(index, user) { let _ts = this; let title, status; - if (user.status == 0) { + if (users.status == 0) { title = '禁用'; status = 1; } else { title = '启用'; status = 0; } - _ts.$confirm('确定' + title + '用户' + user.nickname + '(' + user.account + ')?', '提示', { + _ts.$confirm('确定' + title + '用户' + users.nickname + '(' + users.account + ')?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { _ts.$axios.$patch('/api/admin/user/update-status', { - idUser: user.idUser, + idUser: users.idUser, status: status }).then(function (res) { if (res && res.message) { diff --git a/store/article.js b/store/article.js index 49d4d63..464f810 100644 --- a/store/article.js +++ b/store/article.js @@ -1,5 +1,4 @@ import Vue from 'vue'; -import { isBrowser } from '~/environment'; export const ARTICLE_API_PATH = '/api/article' export const BASE_API_PATH = '/api/console'