Commit e37d693f by 李伟康

commit

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