From 33a7490e9b4bd48e7f3c8059bdba7676d384986e Mon Sep 17 00:00:00 2001 From: "DESKTOP-369JRHT\\12997" <9> Date: Fri, 12 Jul 2024 17:30:15 +0800 Subject: [PATCH] no message --- fuintAdmin/src/layout/components/Navbar.vue | 3 ++- fuintAdmin/src/permission.js | 11 ++++++++--- fuintAdmin/src/store/modules/user.js | 12 ++++++++++++ fuintAdmin/src/views/login.vue | 8 +++++--- fuintAdmin/vue.config.js | 3 ++- fuintAdmin_zt/src/permission.js | 15 ++++++++++++++- fuintAdmin_zt/src/store/modules/user.js | 9 +++++++-- fuintAdmin_zt/src/views/login.vue | 9 +++++---- fuintAdmin_zt/vue.config.js | 3 ++- fuintCashierWeb/src/permission.js | 11 +++++++++++ 10 files changed, 68 insertions(+), 16 deletions(-) diff --git a/fuintAdmin/src/layout/components/Navbar.vue b/fuintAdmin/src/layout/components/Navbar.vue index 509da99ce..9b8925fab 100644 --- a/fuintAdmin/src/layout/components/Navbar.vue +++ b/fuintAdmin/src/layout/components/Navbar.vue @@ -106,6 +106,7 @@ import ScreenData from '@/components/ScreenData' import {getCountdownApi} from "@/api/store"; import {ljStoreInfo} from "@/api/staff/store"; import screenfull from "screenfull"; +import {getToken} from "@/utils/auth"; export default { data() { @@ -160,7 +161,7 @@ export default { }, goToWebsite() { // window.open('https://cashier.youkerr.com/') - window.open(this.cashierUrl) + window.open(this.cashierUrl+"?token="+getToken()) this.toggleFullscreen() }, toggleFullscreen() { diff --git a/fuintAdmin/src/permission.js b/fuintAdmin/src/permission.js index 17e5fe493..64473d8dd 100644 --- a/fuintAdmin/src/permission.js +++ b/fuintAdmin/src/permission.js @@ -28,9 +28,14 @@ router.beforeEach(async (to, from, next) => { } } if (to.path === '/resource_oilstore') { - if (Cookies.get("IS_BK_LOGIN")) { - setToken(JSON.parse(Cookies.get("IS_BK_LOGIN")).token); - } + // if (Cookies.get("IS_BK_LOGIN")) { + // setToken(JSON.parse(Cookies.get("IS_BK_LOGIN")).token); + // } + const urlParams = new URLSearchParams(window.location.search); + const data = urlParams.get('token'); + console.log(data); // 输出: "value" + setToken(data); + } if (getToken()) { to.meta.title && store.dispatch('settings/setTitle', to.meta.title) diff --git a/fuintAdmin/src/store/modules/user.js b/fuintAdmin/src/store/modules/user.js index 95cd0c1c6..489d14b3c 100644 --- a/fuintAdmin/src/store/modules/user.js +++ b/fuintAdmin/src/store/modules/user.js @@ -58,15 +58,27 @@ const user = { // dutyRoleCode Cookies.remove('DUTY_ROLE_CODE'); + // sessionStorage.removeItem('DUTY_ROLE_CODE'); Cookies.set("DUTY_ROLE_CODE", res.data.dutyRoleCode); + // sessionStorage.setItem("DUTY_ROLE_CODE", res.data.dutyRoleCode); + // + // sessionStorage.removeItem('IS_BK_LOGIN'); if (res.data.ownerId == "3") { setToken(res.data.token) commit('SET_TOKEN', res.data.token) Cookies.remove('IS_ZT_LOGIN'); + // sessionStorage.removeItem('IS_ZT_LOGIN'); + }else { + // Cookies.set("IS_ZT_LOGIN", JSON.stringify(res.data)); Cookies.set("IS_ZT_LOGIN", JSON.stringify(res.data)); + console.log("IS_ZT_LOGIN", Cookies.get("IS_ZT_LOGIN")) + // sessionStorage.setItem("IS_ZT_LOGIN", JSON.stringify(res.data)); + // sessionStorage.getItem('IS_ZT_LOGIN') + // console.log("sessionStorage.getItem('IS_BK_LOGIN')",sessionStorage.getItem('IS_ZT_LOGIN')) + } resolve() }).catch(error => { diff --git a/fuintAdmin/src/views/login.vue b/fuintAdmin/src/views/login.vue index f4797011e..e79fe8eec 100644 --- a/fuintAdmin/src/views/login.vue +++ b/fuintAdmin/src/views/login.vue @@ -282,11 +282,13 @@ export default { // Cookies.set("DUTY_ROLE_CODE", res.data.dutyRoleCode); if (Cookies.get("DUTY_ROLE_CODE") && Cookies.get("DUTY_ROLE_CODE") == 2) { - console.log("123") - location.replace(this.cashierUrl); + // if (sessionStorage.getItem('IS_ZT_LOGIN')&& sessionStorage.getItem('IS_ZT_LOGIN') == 2) { + location.replace(this.cashierUrl); }else { if (Cookies.get("IS_ZT_LOGIN")) { - location.replace(this.ztUrl+"resource_oilbank"); + const data = JSON.parse(Cookies.get("IS_ZT_LOGIN")) + console.log("dataJSON",data) + location.replace(this.ztUrl+"resource_oilbank?token="+data.token); }else { app.$router.push({ path: this.redirect || "/" }).catch(()=>{}); } diff --git a/fuintAdmin/vue.config.js b/fuintAdmin/vue.config.js index e80b019cf..92e52b3a2 100644 --- a/fuintAdmin/vue.config.js +++ b/fuintAdmin/vue.config.js @@ -9,7 +9,8 @@ const CompressionPlugin = require('compression-webpack-plugin') const name = process.env.VUE_APP_TITLE || '百业兴智慧油站系统' // 网页标题 -const port = process.env.port || process.env.npm_config_port || 81 // 端口 +const port = 81 // 端口 +// const port = process.env.port || process.env.npm_config_port || 81 // 端口 const serverUrl = process.env.VUE_APP_SERVER_URL || 'https://www.fuint.cn' diff --git a/fuintAdmin_zt/src/permission.js b/fuintAdmin_zt/src/permission.js index 697442332..708b30134 100644 --- a/fuintAdmin_zt/src/permission.js +++ b/fuintAdmin_zt/src/permission.js @@ -15,7 +15,20 @@ const whiteList = ['/login', '/auth-redirect'] router.beforeEach((to, from, next) => { NProgress.start() if (to.path === '/resource_oilbank') { - setToken(JSON.parse(Cookies.get("IS_ZT_LOGIN")).token); + console.log("111111111111111111111") + const urlParams = new URLSearchParams(window.location.search); + const data = urlParams.get('token'); + console.log(data); // 输出: "value" + // if (Cookies.get("IS_ZT_LOGIN") && JSON.parse(Cookies.get("IS_ZT_LOGIN"))) { + // setToken(JSON.parse(Cookies.get("IS_ZT_LOGIN")).token); + // console.log("IS_ZT_LOGIN",sessionStorage.getItem('IS_ZT_LOGIN')); + // sessionStorage.getItem('IS_ZT_LOGIN') + + // sessionStorage.getItem('IS_ZT_LOGIN') + // console.log("IS_ZT_LOGIN",JSON.parse(sessionStorage.getItem('IS_ZT_LOGIN')).token) + setToken(data); + // + // } } if (getToken()) { to.meta.title && store.dispatch('settings/setTitle', to.meta.title) diff --git a/fuintAdmin_zt/src/store/modules/user.js b/fuintAdmin_zt/src/store/modules/user.js index ae8d5898b..22e8f4112 100644 --- a/fuintAdmin_zt/src/store/modules/user.js +++ b/fuintAdmin_zt/src/store/modules/user.js @@ -60,9 +60,14 @@ const user = { if (res.data.ownerId !== "3") { setToken(res.data.token) commit('SET_TOKEN', res.data.token) - Cookies.remove('IS_BK_LOGIN'); + // Cookies.remove('IS_BK_LOGIN'); + sessionStorage.removeItem('IS_BK_LOGIN'); + }else { - Cookies.set("IS_BK_LOGIN", JSON.stringify(res.data)); + // Cookies.set("IS_BK_LOGIN", JSON.stringify(res.data)); + sessionStorage.setItem("IS_BK_LOGIN", JSON.stringify(res.data)); + const storedValue = sessionStorage.getItem('IS_BK_LOGIN'); + console.log(storedValue); // 输出: "value" } diff --git a/fuintAdmin_zt/src/views/login.vue b/fuintAdmin_zt/src/views/login.vue index 1526d27c8..60d02d51e 100644 --- a/fuintAdmin_zt/src/views/login.vue +++ b/fuintAdmin_zt/src/views/login.vue @@ -281,11 +281,12 @@ export default { } app.$store.dispatch("Login", this.loginForm).then(() => { - - if (Cookies.get("IS_BK_LOGIN")) { - location.replace(this.bkUrl+"resource_oilstore"); + if (sessionStorage.getItem('IS_BK_LOGIN')) { + const data = JSON.parse(Cookies.get("IS_BK_LOGIN")) + console.log("dataJSON",data) + location.replace(this.bkUrl+"resource_oilstore?token="+data.token); }else { - // app.$router.push({ path: "/Service/index" }).catch(()=>{}); + app.$router.push({ path: "/Service/index" }).catch(()=>{}); } app.$router.push({ path: this.redirect || "/" }).catch(()=>{}); diff --git a/fuintAdmin_zt/vue.config.js b/fuintAdmin_zt/vue.config.js index e80b019cf..01f42eb29 100644 --- a/fuintAdmin_zt/vue.config.js +++ b/fuintAdmin_zt/vue.config.js @@ -9,7 +9,8 @@ const CompressionPlugin = require('compression-webpack-plugin') const name = process.env.VUE_APP_TITLE || '百业兴智慧油站系统' // 网页标题 -const port = process.env.port || process.env.npm_config_port || 81 // 端口 +// const port = process.env.port || process.env.npm_config_port || 81 // 端口 +const port = 82 // 端口 const serverUrl = process.env.VUE_APP_SERVER_URL || 'https://www.fuint.cn' diff --git a/fuintCashierWeb/src/permission.js b/fuintCashierWeb/src/permission.js index 0e2cc4107..e1c719ad5 100644 --- a/fuintCashierWeb/src/permission.js +++ b/fuintCashierWeb/src/permission.js @@ -12,6 +12,17 @@ const whiteList = ['/login', '/auth-redirect'] router.beforeEach((to, from, next) => { NProgress.start() + + const urlParams = new URLSearchParams(window.location.search); + const data = urlParams.get('token'); + console.log(data); // 输出: "value" + + if(data) { + console.log(data); // 输出: "value" + setToken(data); + } + + if (getToken()) { to.meta.title && store.dispatch('settings/setTitle', to.meta.title) /* has token*/