From 5aeda75e21bd848d77c9ce921c9c4f9c1a6772b8 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 26 Jul 2024 17:00:04 +0800 Subject: [PATCH] fix --- src/pages/account/redirect/index.vue | 81 ++++++++++++++-------------- src/pages/product/show/index.vue | 2 + src/pages/station/list/index.vue | 15 +++--- src/pages/station/preview/index.vue | 48 +++++++++-------- 4 files changed, 77 insertions(+), 69 deletions(-) diff --git a/src/pages/account/redirect/index.vue b/src/pages/account/redirect/index.vue index 0f0aa13..6b71611 100644 --- a/src/pages/account/redirect/index.vue +++ b/src/pages/account/redirect/index.vue @@ -5,50 +5,49 @@ import { mapActions, mapMutations } from "vuex"; import util from "@/libs/util"; import Setting from "@/setting"; export default { - data: function() { - return { - token: this.$route.query.auth - }; + data: function () { + return { + token: this.$route.query.auth + }; + }, + mounted () { + localStorage.removeItem('opened') + this.token ? this.setLogin() : this.$router.replace('/login') + }, + methods: { + ...mapMutations("user", [ + "SET_ROLENAME", 'SET_FROM' + ]), + ...mapActions("user", [ + "setCustomer", "setCustomerName" + ]), + setLogin () { + this.SET_FROM(true) + util.local.set(Setting.tokenKey, window.atob(decodeURI(this.token)), Setting.tokenExpires); + this.getRole() + this.queryCustomer() }, - mounted() { - this.token ? this.setLogin() : this.$router.replace('/login') + // 获取当前用户角色 + getRole () { + this.$post(`${this.api.getUserAllRoleByToken}?platformId=${Setting.platformId}`).then(res => { + this.SET_ROLENAME(res) + }).catch(err => { }) }, - methods: { - ...mapMutations("user", [ - "SET_ROLENAME", 'SET_FROM' - ]), - ...mapActions("user", [ - "setCustomer", "setCustomerName" - ]), - setLogin() { - this.SET_FROM(true) - util.local.set(Setting.tokenKey, window.atob(decodeURI(this.token)), Setting.tokenExpires); - this.getRole() - this.queryCustomer() - }, - // 获取当前用户角色 - getRole() { - this.$post(`${this.api.getUserAllRoleByToken}?platformId=${Setting.platformId}`).then(res => { - this.SET_ROLENAME(res) - }).catch(err => {}) - }, - queryCustomer() { // 查询是否是客户 - this.$get(this.api.isClient).then(res => { - util.successMsg('登录成功') - this.setCustomer(res.customer) - this.setCustomerName(res.customerName) - - const path = '/product/list' // 默认路径 - this.$get(`${this.api.getUserRolesPermissionMenu}?platformId=${Setting.platformId}`).then(res => { - const list = res.permissionMenu[0].children - this.$router.push(list.find(e => e.path === path) ? path : list[0].path) - }).catch(err => {}) - }).catch(res => {}) - } + queryCustomer () { // 查询是否是客户 + this.$get(this.api.isClient).then(res => { + util.successMsg('登录成功') + this.setCustomer(res.customer) + this.setCustomerName(res.customerName) + + const path = '/product/list' // 默认路径 + this.$get(`${this.api.getUserRolesPermissionMenu}?platformId=${Setting.platformId}`).then(res => { + const list = res.permissionMenu[0].children + this.$router.push(list.find(e => e.path === path) ? path : list[0].path) + }).catch(err => { }) + }).catch(res => { }) } + } }; - \ No newline at end of file + \ No newline at end of file diff --git a/src/pages/product/show/index.vue b/src/pages/product/show/index.vue index 9cd3dab..fc7b0b9 100644 --- a/src/pages/product/show/index.vue +++ b/src/pages/product/show/index.vue @@ -128,6 +128,7 @@