Commit d14d9aec by liwk

修改登录

1 parent c41c37c4
...@@ -50,8 +50,8 @@ fetchConfig(!isMock).then(res => { ...@@ -50,8 +50,8 @@ fetchConfig(!isMock).then(res => {
/**登录过期 重新登录 */ /**登录过期 重新登录 */
window.reLogin = () => { window.reLogin = () => {
console.log('重新登录') console.log('重新登录')
// util.clearSessionId() util.clearSessionId()
// store.dispatch('navigation') store.dispatch('navigation')
} }
window.vm = new Vue({ window.vm = new Vue({
el: '#app', el: '#app',
......
...@@ -65,6 +65,8 @@ const actions = { ...@@ -65,6 +65,8 @@ const actions = {
}, },
login({ dispatch }) { login({ dispatch }) {
let [redirectUrl] = window.location.href.split('?') let [redirectUrl] = window.location.href.split('?')
// 以下是 本地调试
if (process.env.NODE_ENV == 'development') {
const code = getParams('code') const code = getParams('code')
if (code) { if (code) {
const { corpId } = util.getLocalStorage('dj_scrm_corpId') const { corpId } = util.getLocalStorage('dj_scrm_corpId')
...@@ -81,13 +83,7 @@ const actions = { ...@@ -81,13 +83,7 @@ const actions = {
if (code == '0') { if (code == '0') {
if (data.loginList.length) { if (data.loginList.length) {
if (data.loginList.length > 1) { if (data.loginList.length > 1) {
util.setLocalStorage('dj_scrm_loginToken', data.loginToken)
util.setLocalStorage('dj_scrm_accountList', data.loginList)
let redirect_uri = encodeURI(`${redirectUrl}${route}`)
// 先注释
console.log('回调', `${url}common/accountList?redirect_uri=${redirect_uri}`)
// window.location.href = `${url}common/accountList?redirect_uri=${redirect_uri}`
// 以下是 本地调试多账号
let userInfo = data.loginList[0] let userInfo = data.loginList[0]
let { merchantId, accountName } = userInfo let { merchantId, accountName } = userInfo
let loginAccount = accountName let loginAccount = accountName
...@@ -135,9 +131,17 @@ const actions = { ...@@ -135,9 +131,17 @@ const actions = {
const wxUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize' const wxUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize'
window.location.href = `${wxUrl}?appid=${appid}&redirect_uri=${encodeURIComponent(redirectUrl)}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect` window.location.href = `${wxUrl}?appid=${appid}&redirect_uri=${encodeURIComponent(redirectUrl)}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
} }
} else {
const { baseURL } = window.$fetchConfig.request
let url = `${baseURL}/dj-scrm-wx-work-main/#/`
window.location.href = `${url}?redirect_uri=${redirectUrl}`
}
}, },
navigation({ dispatch }) { navigation({ dispatch }) {
const sessionId = getParams('sessionId') const { sessionId, corpId } = getParams()
if (!corpId) corpId = 'ww7ee69c648ae1b7e6'
util.setLocalStorage('dj_scrm_corpId', { corpId })
const storage_sessionId = util.getSessionId() const storage_sessionId = util.getSessionId()
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!