Commit 09d50f8b by 李伟康

commit

1 parent fe39c4eb
...@@ -61,9 +61,11 @@ export default { ...@@ -61,9 +61,11 @@ export default {
let options = this.tools.deepClone(staticOptions) let options = this.tools.deepClone(staticOptions)
if (apiName == 'couponApi' || apiName == 'boutiquecouponApi' || apiName == 'equityApi') { if (apiName == 'couponApi' || apiName == 'boutiquecouponApi' || apiName == 'equityApi') {
options[1].className = 'disabled' options[1].className = 'disabled'
this.options = options
this.showShare = true this.showShare = true
return return
} }
console.log(options)
this.options = options this.options = options
if (apiName == 'activityApi' || apiName == 'liveApi') { if (apiName == 'activityApi' || apiName == 'liveApi') {
this.showLoading() this.showLoading()
......
...@@ -35,7 +35,6 @@ const mutations = { ...@@ -35,7 +35,6 @@ const mutations = {
SET_LAST_PATH(state, path) { SET_LAST_PATH(state, path) {
state.lastPath = path state.lastPath = path
} }
} }
const actions = { const actions = {
setPageMeta({ commit }, meta) { setPageMeta({ commit }, meta) {
...@@ -58,37 +57,36 @@ const actions = { ...@@ -58,37 +57,36 @@ const actions = {
let [redirectUrl] = window.location.href.split('?') let [redirectUrl] = window.location.href.split('?')
// 以下是 本地调试 // 以下是 本地调试
if (process.env.NODE_ENV == 'development') { 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')
ssoApi.login({ ssoApi
.login({
code, code,
corpId corpId
}).then(({ code, data, message }) => { })
.then(({ code, data, message }) => {
let route = state.lastPath == 'coupon' ? '' : state.lastPath || '' let route = state.lastPath == 'coupon' ? '' : state.lastPath || ''
route = route.replace('.', '/') route = route.replace('.', '/')
state.showWindow = true
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 userInfo = data.loginList[2] let userInfo = data.loginList[2]
let { merchantId, accountName } = userInfo let { merchantId, accountName } = userInfo
let loginAccount = accountName let loginAccount = accountName
ssoApi.selectAccount({ ssoApi
.selectAccount({
loginAccount, loginAccount,
merchantId, merchantId,
loginToken: data.loginToken, loginToken: data.loginToken,
loginSource: 'WW', loginSource: 'WW',
loginType: 3 loginType: 3
}).then(res => { })
util.removeLocalStorage('dj_scrm_loginToken') .then(res => {
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
window.location.replace(`${redirectUrl}#/${route}`) window.location.replace(`${redirectUrl}#/${route}`)
}) })
} else { } else {
...@@ -98,10 +96,12 @@ const actions = { ...@@ -98,10 +96,12 @@ const actions = {
dispatch('registerHttp', userInfo.sessionId) dispatch('registerHttp', userInfo.sessionId)
// 只有一个账号 history.back() // 只有一个账号 history.back()
console.log(`${redirectUrl}${route}`) console.log(`${redirectUrl}${route}`)
state.showWindow = true
window.location.replace(`${redirectUrl}#/${route}`) window.location.replace(`${redirectUrl}#/${route}`)
} }
} else { } else {
/**没有账号 */ /**没有账号 */
Notify('没有账号')
// window.location.href = `${url}common/nothing` // window.location.href = `${url}common/nothing`
} }
} else { } else {
...@@ -114,8 +114,7 @@ const actions = { ...@@ -114,8 +114,7 @@ const actions = {
util.showLoading() util.showLoading()
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'
...@@ -132,7 +131,7 @@ const actions = { ...@@ -132,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
...@@ -147,7 +146,7 @@ const actions = { ...@@ -147,7 +146,7 @@ const actions = {
state.showWindow = true state.showWindow = true
}, },
registerHttp({}, sessionId = '') { registerHttp({}, sessionId = '') {
window.$HTTP = new Http({...window.$fetchConfig, alert: Notify, headers: { token: sessionId } }) window.$HTTP = new Http({ ...window.$fetchConfig, alert: Notify, headers: { token: sessionId } })
} }
} }
const getParams = name => { const getParams = name => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!