大平台跳转

master
lion 1 year ago
parent bd3e13f67c
commit 95f919d1af

@ -3,6 +3,7 @@ import store from './store'
import { import {
Message Message
} from 'element-ui' } from 'element-ui'
import { deepCopy } from '@/utils'
import NProgress from 'nprogress' // progress bar import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style import 'nprogress/nprogress.css' // progress bar style
import { import {
@ -39,7 +40,7 @@ router.beforeEach(async (to, from, next) => {
// determine whether the user has obtained his permission roles through getInfo // determine whether the user has obtained his permission roles through getInfo
const hasRoles = store.getters.roles && store.getters.roles.length > 0 const hasRoles = store.getters.roles && store.getters.roles.length > 0
if (hasRoles) { if (hasRoles) {
next() to.query.tourl ? next(to.query.tourl) : next()
} else { } else {
try { try {
// get user info // get user info
@ -56,10 +57,11 @@ router.beforeEach(async (to, from, next) => {
// hack method to ensure that addRoutes is complete // hack method to ensure that addRoutes is complete
// set the replace: true, so the navigation will not leave a history record // set the replace: true, so the navigation will not leave a history record
next({ let resetTo = deepCopy(to)
...to, resetTo.path = to.query.tourl || to.path
replace: true resetTo.replace = true
}) console.log(resetTo)
next(resetTo)
} catch (error) { } catch (error) {
console.log(error) console.log(error)
// remove token and go to login page to re-login // remove token and go to login page to re-login
@ -83,10 +85,15 @@ router.beforeEach(async (to, from, next) => {
try { try {
await store.dispatch('user/loginskip', { await store.dispatch('user/loginskip', {
token: to.query.token, token: to.query.token,
tp: to.query.tp tp: to.query.tp,
loginId: to.query.loginId
}) })
console.log("to.path",to.path) console.log("to.path",to.path)
if(to.query.tourl){
next(to.query.tourl || '/')
}else{
next(to.path || '/') next(to.path || '/')
}
} catch (e) { } catch (e) {
console.log("/login",e) console.log("/login",e)
next('/login') next('/login')

@ -311,7 +311,7 @@
// //
let that = this let that = this
if (this.$route.query.token && this.$route.query.tp){ if (this.$route.query.token && this.$route.query.tp && this.$route.query.notice_id){
if(this.$route.query.notice_id){ if(this.$route.query.notice_id){
this.sendIsRead(this.$route.query.notice_id) this.sendIsRead(this.$route.query.notice_id)

@ -25,7 +25,7 @@ module.exports = {
* Detail: https://cli.vuejs.org/config/#publicpath * Detail: https://cli.vuejs.org/config/#publicpath
*/ */
publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin', publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin',
outputDir: '/Users/mac/Documents/朗业/2024/h-河道处项目/a-安全生产/safety-manage-service/public/admin', outputDir: '/Users/mac/Documents/朗业/2024/h-河道处项目/a-安全生产/safety-manage-service/public/admin_test',
assetsDir: 'static', assetsDir: 'static',
lintOnSave: process.env.NODE_ENV === 'development', lintOnSave: process.env.NODE_ENV === 'development',
productionSourceMap: false, productionSourceMap: false,

Loading…
Cancel
Save