Commit 78288122 by liwk

commit

1 parent 439ea737
......@@ -17,7 +17,7 @@ import store from './store'
import api from './api'
import { fetchConfig, cfg } from '@/config'
import '@/assets/css/index.scss'
import { bus, tools, store as local } from './utils'
import { bus, tools, store as local, util } from './utils'
import './utils/util'
import 'components'
import { components } from '@/plugins/vant'
......@@ -49,7 +49,9 @@ fetchConfig(!isMock).then(res => {
window.$fetchConfig = res
/**登录过期 重新登录 */
window.reLogin = () => {
console.log(123)
console.log('重新登录')
util.clearSessionId()
store.dispatch('navigation')
}
window.vm = new Vue({
el: '#app',
......
......@@ -10,7 +10,6 @@ import Vue from 'vue'
import Router from 'vue-router'
import routes from './routes'
import store from '@/store'
import util from '@/utils/util'
// hack router push callback
const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
......@@ -40,6 +39,7 @@ router.beforeEach((to, from, next) => {
} else {
store.dispatch('setPageMeta', { title: '客户跟进' })
}
store.commit('SET_LAST_PATH', to.name)
if (to.matched.some(recode => recode.meta.noAuth)) {
store.state.app.showWindow = true
} else {
......
......@@ -13,6 +13,7 @@ import { Notify } from 'vant'
const state = {
pageMeta: '',
keepAlives: [],
lastPath: ''
}
const mutations = {
SET_PAGE_META(state, meta) {
......@@ -31,6 +32,10 @@ const mutations = {
return arr
}, [])
},
SET_LAST_PATH(state, path) {
state.lastPath = path
}
}
const actions = {
......
......@@ -85,6 +85,9 @@ const setSessionId = val => {
const getSessionId = () => {
return window.localStorage.getItem('dj_scrm_session_id')
}
const clearSessionId = () => {
window.localStorage.removeItem('dj_scrm_session_id')
}
const setLocalStorage = (key, item) => {
window.localStorage.setItem(key, JSON.stringify(item))
}
......@@ -167,6 +170,7 @@ const utils = {
jumpChildrenPage,
setLocalStorage,
getLocalStorage,
clearSessionId,
makePhoneCall,
isFullSucreen,
watchPageBack,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!