From 17dbbc4deb5f2415979e7272c35583df841768e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=98=AF=E5=B0=8F=E7=8E=8B=E5=91=80=5C24601?=
<819653817@qq.com>
Date: Thu, 8 Aug 2024 17:57:07 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8A=9E=E7=90=86=E8=AF=A6=E6=83=85=E5=AE=8C?=
=?UTF-8?q?=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.production | 1 +
src/router/index.js | 26 ++++-
src/utils/request.js | 1 -
src/views/Hotline/index.vue | 93 +++++++++++-------
src/views/HotlineDetail/index.vue | 158 +++++++++++++++++++++++-------
src/views/mine/index.vue | 7 +-
6 files changed, 203 insertions(+), 83 deletions(-)
diff --git a/.env.production b/.env.production
index 8deecc0..ba3bac5 100644
--- a/.env.production
+++ b/.env.production
@@ -2,4 +2,5 @@ NODE_ENV='production'
# must start with VUE_APP_
VUE_APP_ENV = 'production'
outputDir = 'epmet-work-h5-prod'
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
index 5889228..55f819a 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -8,7 +8,6 @@ Router.prototype.push = function push(location, onResolve, onReject) {
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
return originalPush.call(this, location).catch(err => err)
}
-
Vue.use(Router)
const createRouter = () =>
@@ -18,6 +17,31 @@ const createRouter = () =>
})
const router = createRouter()
+function getQueryParams() {
+ const url = window.location.href
+ const paramArr = url.slice(url.indexOf('?') + 1).split('&')
+ const params = {}
+ paramArr.map(param => {
+ const [key, val] = param.split('=')
+ params[key] = decodeURIComponent(val)
+ })
+ return params
+}
+
+router.beforeEach((to, from, next) => {
+ let urlParams = getQueryParams()
+ if(urlParams.worktoken){
+ console.log(urlParams.worktoken,"Sdfsfdjhjh")
+ localStorage.setItem('token_work',urlParams.worktoken)
+ next({ path:'/Hotline'})
+ }else{
+ next()
+ console.log(urlParams.worktoken,"Sdfsfd")
+ }
+
+
+
+})
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
diff --git a/src/utils/request.js b/src/utils/request.js
index 3ae8f19..842153f 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -26,7 +26,6 @@ service.interceptors.request.use(
if (localStorage.getItem('token_work')) {
config.headers['Token'] = localStorage.getItem('token_work')
config.headers['Authorization'] = localStorage.getItem('token_work')
-
}
console.log(config,"sdfkjslf");
config.baseURL = config.baseURL + '/'
diff --git a/src/views/Hotline/index.vue b/src/views/Hotline/index.vue
index 01df2c2..f0c7dde 100644
--- a/src/views/Hotline/index.vue
+++ b/src/views/Hotline/index.vue
@@ -6,11 +6,16 @@