From 13ef2f51b9f0f592c147f47f0bf1f0b56ceb74fe Mon Sep 17 00:00:00 2001 From: e <2432808546@qq.com> Date: Thu, 8 Jul 2021 18:11:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E7=99=BB=E5=BD=95=E5=92=8C=E9=92=89?= =?UTF-8?q?=E9=92=89=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 6 +- package.json | 2 +- src/main.js | 13 +--- src/router/index.js | 7 +- src/utils/api.js | 104 ++++++++++++++----------- src/utils/http.js | 11 +-- src/{store => utils}/preventReClick.js | 0 src/views/Login.vue | 88 ++++++++++++++------- src/views/oder/Order.vue | 29 +++---- 9 files changed, 152 insertions(+), 108 deletions(-) rename src/{store => utils}/preventReClick.js (100%) diff --git a/package-lock.json b/package-lock.json index 7df5552..26bf30b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12680,9 +12680,9 @@ "integrity": "sha1-Olh/1oAuFohwnPLFqtrnoAdZUr8=" }, "vue-router": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.1.3.tgz", - "integrity": "sha512-8iSa4mGNXBjyuSZFCCO4fiKfvzqk+mhL0lnKuGcQtO1eoj8nq3CmbEG8FwK5QqoqwDgsjsf1GDuisDX4cdb/aQ==" + "version": "3.5.2", + "resolved": "https://registry.nlark.com/vue-router/download/vue-router-3.5.2.tgz", + "integrity": "sha1-X1Xj8lGXDjbD6NiKfNLWejUK3lw=" }, "vue-schart": { "version": "2.0.0", diff --git a/package.json b/package.json index e8258c7..d009294 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "vue": "^2.6.10", "vue-cropperjs": "^3.0.0", "vue-quill-editor": "^3.0.6", - "vue-router": "^3.0.3", + "vue-router": "^3.5.1", "vue-schart": "^2.0.0", "vuedraggable": "^2.17.0", "vuex": "^3.1.2", diff --git a/src/main.js b/src/main.js index 33188e5..6a1dbbb 100644 --- a/src/main.js +++ b/src/main.js @@ -14,7 +14,7 @@ import store from './store' import config from '@/config' import { systemStatus, systemTypeStatus, systemAttributionStatus, courseTypeStatus, hoursStatus, roleStatus, orderTypeFn, orderStatusFn, orderNatureFn, Percentage, removeByValue, isIE, encodeString, formatDate } from './utils/core'; -import preventReClick from './store/preventReClick' //防多次点击,重复提交 +import preventReClick from './utils/preventReClick' //防多次点击,重复提交 Vue.prototype.api = api; @@ -42,16 +42,7 @@ Vue.prototype.formatDate = formatDate; Vue.config.productionTip = false; Vue.use(ElementUI); -//使用钩子函数对路由进行权限跳转 -router.beforeEach((to, from, next) => { - document.title = `${to.meta.title} | ${config.title}`; - const role = localStorage.getItem('ms_username'); - if (!role && to.path !== '/login') { - next('/login'); - } else { - next(); - } -}); + new Vue({ router, diff --git a/src/router/index.js b/src/router/index.js index 58fe9a4..c97638d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -113,7 +113,12 @@ let router = new Router({ router.beforeEach(function(to,from,next){ // 根据路由元信息设置文档标题 window.document.title = to.meta.title || '中台' - next() + //使用钩子函数对路由进行权限跳转 + if (!sessionStorage.getItem('token') && to.path !== '/login') { + next('/login'); + } else { + next(); + } }) export default router diff --git a/src/utils/api.js b/src/utils/api.js index 4ae60d5..6499981 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -1,11 +1,24 @@ -let host = 'http://39.108.250.202' -let host1 = 'http://192.168.31.151:9000' -let host2 = 'http://192.168.31.125:9000' -let host3 = 'http://192.168.31.140:9000' +// let host = 'http://39.108.250.202' +// let host = 'http://192.168.31.151:9000' +// let host = 'http://192.168.31.125:9000' +// let host = 'http://192.168.31.140:9000' +let host = 'http://192.168.31.137:9000'// 陈赓 export default { - logins: `${host}/liuwanr/userInfo/adminLogins`, //登录 + + logins: `${host}/users/user/login`, //登录 + verification:`${host}/users/user/captcha`,// 验证码 + + // 订单管理 + orderAdd:`${host}/nakadai/order/add`,// 订单添加 + orderDelete:`${host}/nakadai/order/delete`,// 删除定单 + orderDetail:`${host}/nakadai/order/get`,// 订单详情 + orderList:`${host}/nakadai/order/list`,// 订单列表 + orderUpdate:`${host}/nakadai/order/update`,// 订单更新 + + + addUser: `${host}/liuwanr/userInfo/addUser`, //增加用户新版 queryUser: `${host}/liuwanr/userInfo/queryUserInfo`, //查询用户新版 deleteUser: `${host}/liuwanr/userInfo/deleteUserInfo`, //删除用户新版 @@ -27,35 +40,35 @@ export default { updateUserRoleId: `${host}/liuwanr/userInfo/updateUserRoleId`, //更新用户角色id接口 // 客户管理 - deleteCustomer: `${host3}/nakadai/customer/delCustomer`, - updateCustomer: `${host3}/nakadai/customer/updateCustomer`, - addCustomer: `${host3}/nakadai/customer/addCustomer`, - queryCustomer: `${host3}/nakadai/customer/queryCustomer`, - queryCustomerDetails: `${host3}/nakadai/customer/queryCustomerDetails`, - resetPwdCustomer: `${host3}/nakadai/customer/resetPwd`, - queryCustomerIsExists: `${host3}/nakadai/customer/queryCustomerIsExists`, - updateEnabled: `${host3}/nakadai/customer/updateEnabled`, + deleteCustomer: `${host}/nakadai/customer/delCustomer`, + updateCustomer: `${host}/nakadai/customer/updateCustomer`, + addCustomer: `${host}/nakadai/customer/addCustomer`, + queryCustomer: `${host}/nakadai/customer/queryCustomer`, + queryCustomerDetails: `${host}/nakadai/customer/queryCustomerDetails`, + resetPwdCustomer: `${host}/nakadai/customer/resetPwd`, + queryCustomerIsExists: `${host}/nakadai/customer/queryCustomerIsExists`, + updateEnabled: `${host}/nakadai/customer/updateEnabled`, queryCustomerIndustryClass: `${host}/liuwanr/customer/queryCustomerIndustryClass`, queryCustomerIndustry: `${host}/liuwanr/customer/queryCustomerIndustry`, queryPhone: `${host}/liuwanr/user/queryPhone`, - querySchoolData: `${host3}/nakadai/school/querySchool`, + querySchoolData: `${host}/nakadai/school/querySchool`, queryPlatform: `${host}/liuwanr/userInfo/queryPlatform`, // 用户管理 - delUserAccount: `${host3}/users/userAccount/delUserAccount`, - queryUserInfoDetails: `${host3}/users/userAccount/queryUserInfoDetails`, - queryUserInfoList: `${host3}/users/userAccount/queryUserInfoList`, - resetPwd: `${host3}/users/userAccount/resetPwd`, - selectAccountDetail: `${host3}/users/userAccount/selectAccountDetail`, - selectUserSysBind: `${host3}/users/userAccount/selectUserSysBind`, - updatePersonCenter: `${host3}/users/userAccount/updatePersonCenter`, - updateUserAvatars: `${host3}/users/userAccount/updateUserAvatars`, - userInfo: `${host3}/users/userAccount/userInfo`, - checkCode: `${host3}/users/userAccount/checkCode`, - findPasswordByEmail: `${host3}/users/userAccount/findPasswordByEmail`, - findPasswordByPhone: `${host3}/users/userAccount/findPasswordByPhone`, - updateAccountEnable: `${host3}/users/userAccount/updateAccountEnable`, - updateAccountAllEnable: `${host3}/users/userAccount/updateAccountAllEnable`, + delUserAccount: `${host}/users/userAccount/delUserAccount`, + queryUserInfoDetails: `${host}/users/userAccount/queryUserInfoDetails`, + queryUserInfoList: `${host}/users/userAccount/queryUserInfoList`, + resetPwd: `${host}/users/userAccount/resetPwd`, + selectAccountDetail: `${host}/users/userAccount/selectAccountDetail`, + selectUserSysBind: `${host}/users/userAccount/selectUserSysBind`, + updatePersonCenter: `${host}/users/userAccount/updatePersonCenter`, + updateUserAvatars: `${host}/users/userAccount/updateUserAvatars`, + userInfo: `${host}/users/userAccount/userInfo`, + checkCode: `${host}/users/userAccount/checkCode`, + findPasswordByEmail: `${host}/users/userAccount/findPasswordByEmail`, + findPasswordByPhone: `${host}/users/userAccount/findPasswordByPhone`, + updateAccountEnable: `${host}/users/userAccount/updateAccountEnable`, + updateAccountAllEnable: `${host}/users/userAccount/updateAccountAllEnable`, queryOrder: `${host}/liuwanr/order/queryOrder`, //查询订单 queryOrderDetails: `${host}/liuwanr/order/queryOrderDetails`, //查询订单详情 @@ -90,6 +103,7 @@ export default { querySchoolDetails: `${host}/liuwanr/school/querySchoolDetails`, //查询学校详情 queryProvince: `${host}/liuwanr/province/queryProvince`, //查询省份 + queryCity: `${host}/liuwanr/city/queryCity`, //查询城市 queryCourseDiscipline: `${host}/liuwanr/course/queryCourseDiscipline`, //查询课程学科 @@ -109,23 +123,23 @@ export default { downloadFiles: `${host}/liuwanr/aliyun/downloadFiles`, //下载文件 // 数据管理 - getIdQueryTable:`${host1}/data/table/getIdQueryTable`, - getTableByClassification:`${host1}/data/table/getTableByClassification`, - getTableByCondition:`${host1}/data/table/getTableByCondition`, - originalList:`${host1}/data/table/originalList`, - originalListById:`${host1}/data/table/originalListById`, - saveCategory:`${host1}/data/table/saveCategory`, - saveTable:`${host1}/data/table/saveTable`, - updateCategory:`${host1}/data/table/updateCategory`, - deleteCategory:`${host1}/data/table/deleteCategory`, - deleteTable:`${host1}/data/table/deleteTable`, - previewData:`${host2}/data/preview`, + getIdQueryTable:`${host}/data/table/getIdQueryTable`, + getTableByClassification:`${host}/data/table/getTableByClassification`, + getTableByCondition:`${host}/data/table/getTableByCondition`, + originalList:`${host}/data/table/originalList`, + originalListById:`${host}/data/table/originalListById`, + saveCategory:`${host}/data/table/saveCategory`, + saveTable:`${host}/data/table/saveTable`, + updateCategory:`${host}/data/table/updateCategory`, + deleteCategory:`${host}/data/table/deleteCategory`, + deleteTable:`${host}/data/table/deleteTable`, + previewData:`${host}/data/preview`, // 产品管理 - deleteProduct:`${host1}/data/product/delete`, - findById:`${host1}/data/product/findById`, - listByEntity:`${host1}/data/product/listByEntity`, - saveProduct:`${host1}/data/product/save`, - updateProduct:`${host1}/data/product/update`, - saveRecord:`${host1}/data/dataRecord/saveRecord`, + deleteProduct:`${host}/data/product/delete`, + findById:`${host}/data/product/findById`, + listByEntity:`${host}/data/product/listByEntity`, + saveProduct:`${host}/data/product/save`, + updateProduct:`${host}/data/product/update`, + saveRecord:`${host}/data/dataRecord/saveRecord`, } \ No newline at end of file diff --git a/src/utils/http.js b/src/utils/http.js index b282a32..f4ca13b 100644 --- a/src/utils/http.js +++ b/src/utils/http.js @@ -21,7 +21,7 @@ axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'; // 请求拦截器 axios.interceptors.request.use(config => { - let token = store.state.loginToken + let token = sessionStorage.getItem('token') if(token){ config.headers.token = token } @@ -102,7 +102,8 @@ axios.interceptors.request.use(config => { function logouts(){ store.replaceState({}) - localStorage.removeItem('ms_username') + localStorage.clear() + sessionStorage.clear() location.reload() } @@ -276,9 +277,9 @@ export function post(url, params) { this.$message.error( res.data.errmessage ); - router.replace({ - path: '/404', - }); + // router.replace({ + // path: '/404', + // }); break; case 403: this.$message.error( diff --git a/src/store/preventReClick.js b/src/utils/preventReClick.js similarity index 100% rename from src/store/preventReClick.js rename to src/utils/preventReClick.js diff --git a/src/views/Login.vue b/src/views/Login.vue index ce9e518..a2fa503 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -10,19 +10,30 @@
账号登录