From 0387ac510a827dee1388f1cf4480ed67e3ae7730 Mon Sep 17 00:00:00 2001 From: mabo Date: Wed, 4 Aug 2021 17:51:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=AB=AF=E5=92=8C=E5=95=86?= =?UTF-8?q?=E5=AE=B6=E7=AB=AFuserInfo=E5=AD=97=E6=AE=B5=E5=90=8D=E5=8F=98?= =?UTF-8?q?=E6=9B=B4=EF=BC=8C=E7=AE=A1=E7=90=86=E7=AB=AF=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E8=AF=A6=E6=83=85=EF=BC=8C=E4=BB=96=E7=9A=84=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manager/src/libs/axios.js | 4 ++-- manager/src/libs/util.js | 2 +- manager/src/router/index.js | 4 ++-- manager/src/store/modules/user.js | 2 +- manager/src/views/Main.vue | 2 +- manager/src/views/login.vue | 3 +-- manager/src/views/member/list/memberDetail.vue | 6 +++--- .../views/personal-center/personal-center.vue | 4 ++-- seller/src/config/index.js | 16 ++++++++-------- seller/src/libs/axios.js | 4 ++-- seller/src/libs/util.js | 10 +++++----- seller/src/router/index.js | 4 ++-- seller/src/store/modules/user.js | 2 +- seller/src/views/Main.vue | 2 +- seller/src/views/home/home.vue | 2 +- seller/src/views/lili-components/affix-time.vue | 2 +- seller/src/views/login.vue | 5 ++--- seller/src/views/order/order/orderList.vue | 3 +-- seller/src/views/shop/shopSetting.vue | 2 +- seller/src/views/statistics/goods.vue | 2 +- seller/src/views/statistics/order.vue | 8 ++++---- seller/src/views/statistics/traffic.vue | 2 +- 22 files changed, 44 insertions(+), 47 deletions(-) diff --git a/manager/src/libs/axios.js b/manager/src/libs/axios.js index 0f485681..fbfbbbb2 100644 --- a/manager/src/libs/axios.js +++ b/manager/src/libs/axios.js @@ -52,7 +52,7 @@ service.interceptors.response.use( break; case 401: // 未登录 清除已登录状态 - Cookies.set("userInfo", ""); + Cookies.set("userInfoManager", ""); setStore("accessToken", ""); if (router.history.current.name != "login") { if (data.message !== null) { @@ -95,7 +95,7 @@ service.interceptors.response.use( router.go(0) } } else { - Cookies.set("userInfo", ""); + Cookies.set("userInfoManager", ""); router.push('/login') } isRefreshToken = 0 diff --git a/manager/src/libs/util.js b/manager/src/libs/util.js index eb16c8ab..52de2e1a 100644 --- a/manager/src/libs/util.js +++ b/manager/src/libs/util.js @@ -320,7 +320,7 @@ util.initRouter = function (vm) { // 初始化路由 frontRoute: 'error-page/404' }]; // 判断用户是否登录 - let userInfo = Cookies.get('userInfo') + let userInfo = Cookies.get('userInfoManager') if (!userInfo) { // 未登录 return; diff --git a/manager/src/router/index.js b/manager/src/router/index.js index 07268bff..4064391d 100644 --- a/manager/src/router/index.js +++ b/manager/src/router/index.js @@ -23,12 +23,12 @@ router.beforeEach((to, from, next) => { const name = to.name; - if (!Cookies.get('userInfo') && name !== 'login') { + if (!Cookies.get('userInfoManager') && name !== 'login') { // 判断是否已经登录且前往的页面不是登录页 next({ name: 'login' }); - } else if (Cookies.get('userInfo') && name === 'login') { + } else if (Cookies.get('userInfoManager') && name === 'login') { // 判断是否已经登录且前往的是登录页 Util.title(); next({ diff --git a/manager/src/store/modules/user.js b/manager/src/store/modules/user.js index bd84c739..3ea81fe6 100644 --- a/manager/src/store/modules/user.js +++ b/manager/src/store/modules/user.js @@ -4,7 +4,7 @@ const user = { state: {}, mutations: { logout () { - Cookies.remove('userInfo'); + Cookies.remove('userInfoManager'); // 清空打开的页面等数据 localStorage.clear(); } diff --git a/manager/src/views/Main.vue b/manager/src/views/Main.vue index 564ee54a..add872d9 100644 --- a/manager/src/views/Main.vue +++ b/manager/src/views/Main.vue @@ -96,7 +96,7 @@ export default { methods: { init() { // 菜单初始化 - let userInfo = JSON.parse(Cookies.get("userInfo")); + let userInfo = JSON.parse(Cookies.get("userInfoManager")); this.userInfo = userInfo; this.checkTag(this.$route.name); diff --git a/manager/src/views/login.vue b/manager/src/views/login.vue index 5bde2f62..f0709603 100644 --- a/manager/src/views/login.vue +++ b/manager/src/views/login.vue @@ -87,8 +87,7 @@ export default { userInfo().then((res) => { if (res.success) { // 加载菜单 - this.setStore("userInfo", res.result); - Cookies.set("userInfo", JSON.stringify(res.result)); + Cookies.set("userInfoManager", JSON.stringify(res.result)); this.$store.commit("setAvatarPath", res.result.avatar); util.initRouter(this); this.$router.push({ diff --git a/manager/src/views/member/list/memberDetail.vue b/manager/src/views/member/list/memberDetail.vue index bf7cef94..3ad15726 100644 --- a/manager/src/views/member/list/memberDetail.vue +++ b/manager/src/views/member/list/memberDetail.vue @@ -417,7 +417,7 @@ { title: "变动积分", - key: "point", + key: "variablePoint", width: 150, render: (h, params) => { if (params.row.pointType == 'INCREASE') { @@ -426,7 +426,7 @@ style: { color: 'green' } - }, "+" + params.row.point), + }, "+" + params.row.variablePoint), ]); } else { return h('div', [ @@ -434,7 +434,7 @@ style: { color: 'red' } - }, "-" + params.row.point), + }, "-" + params.row.variablePoint), ]); } diff --git a/manager/src/views/personal-center/personal-center.vue b/manager/src/views/personal-center/personal-center.vue index fd392fa7..1e22aae2 100644 --- a/manager/src/views/personal-center/personal-center.vue +++ b/manager/src/views/personal-center/personal-center.vue @@ -82,7 +82,7 @@ export default { methods: { // 初始化数据 init() { - let v = JSON.parse(Cookies.get("userInfo")); + let v = JSON.parse(Cookies.get("userInfoManager")); // 转换null为"" for (let attr in v) { if (v[attr] == null) { @@ -112,7 +112,7 @@ export default { if (res.success) { this.$Message.success("保存成功"); // 更新用户信息 - Cookies.set("userInfo", this.userForm); + Cookies.set("userInfoManager", this.userForm); // 更新头像 this.$store.commit("setAvatarPath", this.userForm.avatar); setTimeout(()=>{ diff --git a/seller/src/config/index.js b/seller/src/config/index.js index 196a9cc1..5b81c21c 100644 --- a/seller/src/config/index.js +++ b/seller/src/config/index.js @@ -18,14 +18,14 @@ export default { * @description api请求基础路径 */ api_dev: { - // common: "https://common-api.pickmall.cn", - // buyer: "https://buyer-api.pickmall.cn", - // seller: "https://store-api.pickmall.cn", - // manager: "https://admin-api.pickmall.cn" - common: 'http://192.168.0.100:8890', - buyer: 'http://192.168.0.100:8888', - seller: 'http://192.168.0.100:8889', - manager: 'http://192.168.0.100:8887' + common: "https://common-api.pickmall.cn", + buyer: "https://buyer-api.pickmall.cn", + seller: "https://store-api.pickmall.cn", + manager: "https://admin-api.pickmall.cn" + // common: 'http://192.168.0.100:8890', + // buyer: 'http://192.168.0.100:8888', + // seller: 'http://192.168.0.100:8889', + // manager: 'http://192.168.0.100:8887' }, api_prod: { common: "https://common-api.pickmall.cn", diff --git a/seller/src/libs/axios.js b/seller/src/libs/axios.js index 3cc1ccd4..315441d9 100644 --- a/seller/src/libs/axios.js +++ b/seller/src/libs/axios.js @@ -58,7 +58,7 @@ service.interceptors.response.use( break; case 401: // 未登录 清除已登录状态 - Cookies.set("userInfo", ""); + Cookies.set("userInfoSeller", ""); setStore("accessToken", ""); if (router.history.current.name != "login") { if (data.message !== null) { @@ -103,7 +103,7 @@ service.interceptors.response.use( router.go(0); } } else { - Cookies.set("userInfo", ""); + Cookies.set("userInfoSeller", ""); router.push("/login"); } isRefreshToken = 0; diff --git a/seller/src/libs/util.js b/seller/src/libs/util.js index 3f28faae..a3fe02a5 100644 --- a/seller/src/libs/util.js +++ b/seller/src/libs/util.js @@ -318,11 +318,11 @@ util.initRouter = function (vm) { // 初始化路由 component: 'error-page/404' }]; // 判断用户是否登录 - let userInfo = Cookies.get('userInfo') - // if (!userInfo) { - // // 未登录 - // return; - // } + let userInfo = Cookies.get('userInfoSeller') + if (!userInfo) { + // 未登录 + return; + } if (!vm.$store.state.app.added) { // 第一次加载 读取数据 diff --git a/seller/src/router/index.js b/seller/src/router/index.js index 07268bff..88d0bcf9 100644 --- a/seller/src/router/index.js +++ b/seller/src/router/index.js @@ -23,12 +23,12 @@ router.beforeEach((to, from, next) => { const name = to.name; - if (!Cookies.get('userInfo') && name !== 'login') { + if (!Cookies.get('userInfoSeller') && name !== 'login') { // 判断是否已经登录且前往的页面不是登录页 next({ name: 'login' }); - } else if (Cookies.get('userInfo') && name === 'login') { + } else if (Cookies.get('userInfoSeller') && name === 'login') { // 判断是否已经登录且前往的是登录页 Util.title(); next({ diff --git a/seller/src/store/modules/user.js b/seller/src/store/modules/user.js index bd84c739..20366240 100644 --- a/seller/src/store/modules/user.js +++ b/seller/src/store/modules/user.js @@ -4,7 +4,7 @@ const user = { state: {}, mutations: { logout () { - Cookies.remove('userInfo'); + Cookies.remove('userInfoSeller'); // 清空打开的页面等数据 localStorage.clear(); } diff --git a/seller/src/views/Main.vue b/seller/src/views/Main.vue index 4947c187..1fd57c47 100644 --- a/seller/src/views/Main.vue +++ b/seller/src/views/Main.vue @@ -98,7 +98,7 @@ export default { this.$store.commit("addOpenSubmenu", pathArr[1].name); } - let userInfo = JSON.parse(Cookies.get("userInfo")); + let userInfo = JSON.parse(Cookies.get("userInfoSeller")); this.userInfo = userInfo; this.checkTag(this.$route.name); diff --git a/seller/src/views/home/home.vue b/seller/src/views/home/home.vue index ffe4b83a..92c4b8a5 100644 --- a/seller/src/views/home/home.vue +++ b/seller/src/views/home/home.vue @@ -225,7 +225,7 @@ export default { }, // 初始化数据 async init() { - let userInfo = JSON.parse(Cookies.get("userInfo")); + let userInfo = JSON.parse(Cookies.get("userInfoSeller")); this.userData = userInfo; diff --git a/seller/src/views/lili-components/affix-time.vue b/seller/src/views/lili-components/affix-time.vue index 24bdf643..96587dcf 100644 --- a/seller/src/views/lili-components/affix-time.vue +++ b/seller/src/views/lili-components/affix-time.vue @@ -64,7 +64,7 @@ export default { }; }, mounted() { - this.storeId = JSON.parse(Cookies.get("userInfo")).id; + this.storeId = JSON.parse(Cookies.get("userInfoSeller")).id; this.getFiveYears(); }, methods: { diff --git a/seller/src/views/login.vue b/seller/src/views/login.vue index a2f62ae5..9e27307e 100644 --- a/seller/src/views/login.vue +++ b/seller/src/views/login.vue @@ -103,13 +103,12 @@ export default { this.setStore("saveLogin", this.saveLogin); if (this.saveLogin) { // 保存7天 - Cookies.set("userInfo", JSON.stringify(res.result), { + Cookies.set("userInfoSeller", JSON.stringify(res.result), { expires: 7, }); } else { - Cookies.set("userInfo", JSON.stringify(res.result)); + Cookies.set("userInfoSeller", JSON.stringify(res.result)); } - this.setStore("userInfo", res.result); this.$store.commit("setAvatarPath", res.result.storeLogo); // 加载菜单 util.initRouter(this); diff --git a/seller/src/views/order/order/orderList.vue b/seller/src/views/order/order/orderList.vue index bf3b31dc..870a7bb7 100644 --- a/seller/src/views/order/order/orderList.vue +++ b/seller/src/views/order/order/orderList.vue @@ -254,8 +254,7 @@ export default { }, // 导出的待发货订单数据 async exportOrder () { - let userInfo = JSON.parse(Cookies.get("userInfo")); - console.log(userInfo); + let userInfo = JSON.parse(Cookies.get("userInfoSeller")); const params = { // 搜索框初始化对象 pageNumber: 1, // 当前页数 diff --git a/seller/src/views/shop/shopSetting.vue b/seller/src/views/shop/shopSetting.vue index ec564399..7af25ebe 100644 --- a/seller/src/views/shop/shopSetting.vue +++ b/seller/src/views/shop/shopSetting.vue @@ -201,7 +201,7 @@ export default { this.$set(this.form, "address", res.result.storeAddressPath); this.storeName = res.result.storeName; this.form.center = res.result.storeCenter; - Cookies.set("userInfo", JSON.stringify(res.result)); + Cookies.set("userInfoSeller", JSON.stringify(res.result)); //库存预警数赋值 this.$nextTick(() => { diff --git a/seller/src/views/statistics/goods.vue b/seller/src/views/statistics/goods.vue index 98ef9e6b..8dc3a546 100644 --- a/seller/src/views/statistics/goods.vue +++ b/seller/src/views/statistics/goods.vue @@ -31,7 +31,7 @@ export default { searchType: "LAST_SEVEN", year: "", month: "", - storeId: JSON.parse(Cookies.get("userInfo")).id || '', + storeId: JSON.parse(Cookies.get("userInfoSeller")).id || '', type: "NUM" }, columns: [ // 表格表头 diff --git a/seller/src/views/statistics/order.vue b/seller/src/views/statistics/order.vue index 75200feb..4136acff 100644 --- a/seller/src/views/statistics/order.vue +++ b/seller/src/views/statistics/order.vue @@ -397,20 +397,20 @@ export default { orderParams: { searchType: "LAST_SEVEN", // TODAY , YESTERDAY , LAST_SEVEN , LAST_THIRTY year: "", - storeId: JSON.parse(Cookies.get("userInfo")).id || "", + storeId: JSON.parse(Cookies.get("userInfoSeller")).id || "", memberId: "", }, // 订单概念 overViewParams: { month: "", searchType: "LAST_SEVEN", // TODAY , YESTERDAY , LAST_SEVEN , LAST_THIRTY - storeId: JSON.parse(Cookies.get("userInfo")).id || "", + storeId: JSON.parse(Cookies.get("userInfoSeller")).id || "", year: "", }, defaultParams: { month: "", searchType: "LAST_SEVEN", // TODAY , YESTERDAY , LAST_SEVEN , LAST_THIRTY - storeId: JSON.parse(Cookies.get("userInfo")).id || "", + storeId: JSON.parse(Cookies.get("userInfoSeller")).id || "", year: "", }, @@ -420,7 +420,7 @@ export default { pageNumber: 1, pageSize: 10, searchType: "LAST_SEVEN", - storeId: JSON.parse(Cookies.get("userInfo")).id || "", + storeId: JSON.parse(Cookies.get("userInfoSeller")).id || "", year: "", }, diff --git a/seller/src/views/statistics/traffic.vue b/seller/src/views/statistics/traffic.vue index 00d8ed16..4ad03794 100644 --- a/seller/src/views/statistics/traffic.vue +++ b/seller/src/views/statistics/traffic.vue @@ -92,7 +92,7 @@ export default { searchType: "LAST_SEVEN", year: "", month: "", - storeId: JSON.parse(Cookies.get("userInfo")).id || "", + storeId: JSON.parse(Cookies.get("userInfoSeller")).id || "", }, columns: [ {