Commit 78288122 by liwk

commit

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