Commit e37d693f by 李伟康

commit

1 parent 223d5108
......@@ -39,7 +39,7 @@ Vue.prototype.to = function (name, params) {
Vue.config.productionTip = false
import VConsole from 'vconsole'
const vConsole = new VConsole()
// const vConsole = new VConsole()
const isMock = true
fetchConfig(!isMock).then(res => {
......@@ -47,7 +47,7 @@ fetchConfig(!isMock).then(res => {
// 设置 js中可以访问 $cdn
Vue.use(cfg)
window.$fetchConfig = res
/**登录过期 重新登录 */
/**登录过期 重新登录 */
window.reLogin = () => {
console.log('重新登录')
util.clearSessionId()
......@@ -59,4 +59,4 @@ fetchConfig(!isMock).then(res => {
store,
render: h => h(App)
})
})
})
\ No newline at end of file
......@@ -40,6 +40,8 @@ router.beforeEach((to, from, next) => {
store.dispatch('setPageMeta', { title: '客户跟进' })
}
store.commit('SET_LAST_PATH', to.name)
/* 路由发生变化修改页面背景色 */
document.documentElement.style.backgroundColor = to.meta.backgroundColor || '#fff'
if (to.matched.some(recode => recode.meta.noAuth)) {
store.state.app.showWindow = true
} else {
......
......@@ -37,11 +37,6 @@ const mutations = {
}
}
const actions = {
// 设置name
setUserInfo({ commit }, user) {
commit('SET_USER_INFO', user)
store.set(store.consts.USER_KEY, user)
},
setPageMeta({ commit }, meta) {
document.title = meta.title
commit('SET_PAGE_META', meta)
......@@ -52,9 +47,6 @@ const actions = {
setAccountList({ commit }, list) {
commit('SET_ACCOUNT_LIST', list)
},
setSessionId({ commit }, id) {
commit('SET_SESSION_ID', id)
},
pushKeep({ commit }, name) {
commit('PUSH_KEEP', name)
},
......@@ -74,10 +66,6 @@ const actions = {
corpId
})
.then(({ code, data, message }) => {
console.log(data)
// const { baseURL } = window.$fetchConfig.request
const [baseURL] = redirectUrl.split('/dj-scrm-wx-work-main/')
let url = `${baseURL}/dj-scrm-wx-work-main/#/`
let route = state.lastPath == 'coupon' ? '' : state.lastPath || ''
route = route.replace('.', '/')
if (code == '0') {
......@@ -95,13 +83,11 @@ const actions = {
loginType: 3
})
.then(res => {
util.removeLocalStorage('dj_scrm_loginToken')
util.removeLocalStorage('dj_scrm_accountList')
util.setLocalStorage('dj_scrm_userInfo', res.data)
util.setSessionId(res.data.sessionId)
dispatch('registerHttp', res.data.sessionId)
state.showWindow = true
window.location.replace(`${url}${route}`)
window.location.replace(`${redirectUrl}#/${route}`)
})
} else {
let [userInfo] = data.loginList
......@@ -111,7 +97,7 @@ const actions = {
// 只有一个账号 history.back()
console.log(`${redirectUrl}${route}`)
state.showWindow = true
window.location.replace(`${redirectUrl}${route}`)
window.location.replace(`${redirectUrl}#/${route}`)
}
} else {
/**没有账号 */
......@@ -129,7 +115,6 @@ const actions = {
let appid = getParams('corpId') //从链接获取
let dj_scrm = util.getLocalStorage('dj_scrm_corpId')
if (!appid) appid = (dj_scrm && dj_scrm.corpId) || 'ww7ee69c648ae1b7e6'
//
util.setLocalStorage('dj_scrm_corpId', { corpId: appid })
// 'ww657a2d4ae89a4424'
const wxUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize'
......@@ -146,7 +131,7 @@ const actions = {
let { sessionId, corpId } = getParams()
const storage_sessionId = util.getSessionId()
const storage_corpId = util.getLocalStorage('dj_scrm_corpId')
if (!corpId) corpId = (storage_corpId && storage_corpId.corpId) || 'ww7ee69c648ae1b7e6'
if (!corpId) corpId = storage_corpId && storage_corpId.corpId || 'ww7ee69c648ae1b7e6'
util.setLocalStorage('dj_scrm_corpId', { corpId })
if (sessionId || storage_sessionId) {
state.showWindow = true
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!