From 9367ff2fedea3fdcf0bebdd44639bdb06ce9adba Mon Sep 17 00:00:00 2001 From: wangxia <779219182@qq.com> Date: Thu, 23 Nov 2023 15:20:21 +0800 Subject: [PATCH] =?UTF-8?q?title=E8=B7=B3=E8=BD=AC=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/index.js | 1 + src/utils/request.js | 1 + src/views/main.vue | 122 +++++++++++++++++++++++++++++---------------------- 3 files changed, 71 insertions(+), 53 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 12d9c7e..a82033f 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -6,6 +6,7 @@ Vue.use(Vuex); export default new Vuex.Store({ state: { joblist: {}, + isLogin: false }, mutations: {}, actions: {}, diff --git a/src/utils/request.js b/src/utils/request.js index d33ca3f..da0ba1a 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -53,6 +53,7 @@ service.interceptors.response.use( (response) => { // console.log(response); let { msg, status } = response.data; + // status = 9999 // return response; // console.log(status); if (status == 9999) { diff --git a/src/views/main.vue b/src/views/main.vue index 5a771de..ce680ef 100644 --- a/src/views/main.vue +++ b/src/views/main.vue @@ -101,19 +101,16 @@ - +
- 商家后台and1.0
-
+
-
+
商家后台and4.0 @@ -339,33 +336,34 @@ export default { }, userbaseInfo: JSON.parse(localStorage.getItem('LOGIN_DATA')), loginPage: false, + routertitleindex: 0, } }, // 计算属性 computed: { - routertitleindex: { - set() {}, - get() { - const path = this.$route.fullPath - if (path.indexOf('serviceoutlets') > -1) { - return 2 - } else if (path.indexOf('list') > -1 || path.indexOf('detail') > -1) { - return 1 - } else if (path.indexOf('aboutus') > -1) { - return 3 - } else if (path.indexOf('main') > -1) { - return 0 - } else if (path.indexOf('mytownsman') > -1) { - return 4 - } else if (path.indexOf('mybill') > -1) { - return 5 - } else if (path.indexOf('dataStatistics') > -1) { - return 6 - } else { - return 7 - } - }, - }, + // routertitleindex: { + // set() {}, + // get() { + // const path = this.$route.fullPath + // if (path.indexOf('serviceoutlets') > -1) { + // return 2 + // } else if (path.indexOf('list') > -1 || path.indexOf('detail') > -1) { + // return 1 + // } else if (path.indexOf('aboutus') > -1) { + // return 3 + // } else if (path.indexOf('main') > -1) { + // return 0 + // } else if (path.indexOf('mytownsman') > -1) { + // return 4 + // } else if (path.indexOf('mybill') > -1) { + // return 5 + // } else if (path.indexOf('dataStatistics') > -1) { + // return 6 + // } else { + // return 7 + // } + // }, + // }, // isLogin() { // return localStorage.getItem("LOGIN_DATA") !== null ? true : false; // }, @@ -379,16 +377,16 @@ export default { // 侦听器 watch: { routertitleindex() { - const path = this.$route.fullPath - if (path.indexOf('serviceoutlets') > -1) { - this.laoxiangshow = true - } else if (path.indexOf('list') > -1 || path.indexOf('detail') > -1) { - this.laoxiangshow = true - } else if (path.indexOf('aboutus') > -1) { - this.laoxiangshow = false - } else { - this.laoxiangshow = true - } + // const path = this.$route.fullPath + // if (path.indexOf('serviceoutlets') > -1) { + // this.laoxiangshow = true + // } else if (path.indexOf('list') > -1 || path.indexOf('detail') > -1) { + // this.laoxiangshow = true + // } else if (path.indexOf('aboutus') > -1) { + // this.laoxiangshow = false + // } else { + // this.laoxiangshow = true + // } this.showfooter() }, $route: { @@ -400,8 +398,26 @@ export default { // console.dir(this.navigationBarLocation); window.addEventListener('scroll', this.navigationBarLocation) window.addEventListener('scroll', this.windowScroll) //监听页面滚动 + if (to.fullPath.indexOf('serviceoutlets') > -1) { + this.routertitleindex = 2 + } else if (to.fullPath.indexOf('list') > -1 || to.fullPath.indexOf('detail') > -1) { + this.routertitleindex = 1 + } else if (to.fullPath.indexOf('aboutus') > -1) { + this.routertitleindex = 3 + } else if (to.fullPath.indexOf('main') > -1) { + this.routertitleindex = 0 + } else if (to.fullPath.indexOf('mytownsman') > -1) { + this.routertitleindex = 4 + } else if (to.fullPath.indexOf('mybill') > -1) { + this.routertitleindex = 5 + } else if (to.fullPath.indexOf('dataStatistics') > -1) { + this.routertitleindex = 6 + } else { + this.routertitleindex = 7 + } if (to.fullPath == '/login') { this.loginPage = true + this.isLogin = false } else { this.loginPage = false } @@ -647,20 +663,20 @@ export default { // window.location.reload(); this.reload() }, - - goAdmin(){ - let obj = JSON.parse(localStorage.getItem("LOGIN_DATA")); - if(window.location.hostname == 'localhost'){ - // 测试环境,通过URL获取token - window.location.href = 'http://localhost:3000/merchantManagement/homePage?token=' + obj.token + '&username=' + obj.user.userName + '&avatar=' + obj.imgSrc - }else{ - // 正式环境,通过缓存获取 - localStorage.setItem('daotian_to_admin_token',obj.token) - localStorage.setItem('daotian_to_admin_avatar',obj.imgSrc) - localStorage.setItem('daotian_to_admin_username',obj.user.userName) - window.location.href = 'http://idaotian.com/dist2.0.0/#/merchantManagement/homePage'; - } - } + + goAdmin() { + let obj = JSON.parse(localStorage.getItem('LOGIN_DATA')) + if (window.location.hostname == 'localhost') { + // 测试环境,通过URL获取token + window.location.href = 'http://localhost:3000/merchantManagement/homePage?token=' + obj.token + '&username=' + obj.user.userName + '&avatar=' + obj.imgSrc + } else { + // 正式环境,通过缓存获取 + localStorage.setItem('daotian_to_admin_token', obj.token) + localStorage.setItem('daotian_to_admin_avatar', obj.imgSrc) + localStorage.setItem('daotian_to_admin_username', obj.user.userName) + window.location.href = 'http://idaotian.com/dist2.0.0/#/merchantManagement/homePage' + } + }, }, }