Commit 8c98b957 by 前端

Merge branch 'develop' into 'master'

分享增加分享时间戳

See merge request !4
2 parents c610f09b 2e52e763
......@@ -11,7 +11,7 @@ module.exports = {
envVersion: 'trial',
title: '嘀加企微管家',
request: {
baseURL: 'http://scrm.dev.glsx.com.cn', // 本地测试项目地址,
baseURL: 'http://scrm.test.glsx.com.cn', // 本地测试项目地址,
// 设置超时时间
timeout: 180000,
// 携带凭证
......
......@@ -23,7 +23,7 @@ export default {
const { entry } = this
const { materialName, id, titleUrl, materialTitle, description } = i
const imgUrl = 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/test/test.jpg'
let query = `merchantId=${merchantId}&id=${id}&staffUuid=${uuid}`
let query = `merchantId=${merchantId}&id=${id}&staffUuid=${uuid}&shareTime=${Date.now()}`
if (sapCode) query = `${query}&storeCode=${sapCode}`
wxConfig.createMiniprogramUrlLink({
path,
......
......@@ -70,11 +70,12 @@ const actions = {
let [redirectUrl] = window.location.href.split('?')
const code = getParams('code')
if (code) {
const { corpId } = util.getLocalStorage('dj_scrm_corpId')
const { corpId, agentId } = util.getLocalStorage('dj_scrm_corpId')
ssoApi
.login({
code,
corpId
corpId,
getUserInfoFlag: agentId ? true : false
})
.then(({ code, data }) => {
let url = `${redirectUrl.split('#')[0]}#/`
......@@ -121,11 +122,13 @@ const actions = {
} else {
util.showLoading()
let appid = getParams('corpId') //从链接获取
let agentid = getParams('agentId') //从链接获取
let dj_scrm = util.getLocalStorage('dj_scrm_corpId')
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
if (!appid) {
if (dj_scrm) {
appid = dj_scrm.corpId
agentid = dj_scrm.agentId
} else {
if (IS_PROD) {
Notify({
......@@ -133,12 +136,23 @@ const actions = {
duration: 15000
})
return
} else appid = 'ww7ee69c648ae1b7e6'
} else {
appid = 'ww7ee69c648ae1b7e6'
agentid = 1000035
// appid = 'wwc1fefc2a3f70bd0b'
// agentid = 1000002
}
}
}
util.setLocalStorage('dj_scrm_corpId', { corpId: appid })
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`
let dj_scrm_storage = { corpId: appid }
let wxUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize'
wxUrl = `${wxUrl}?appid=${appid}&redirect_uri=${encodeURIComponent(redirectUrl)}&response_type=code&scope=snsapi_privateinfo`
if (agentid) {
wxUrl = `${wxUrl}&agentid=${agentid}`
dj_scrm_storage.agentId = agentid
}
util.setLocalStorage('dj_scrm_corpId', dj_scrm_storage)
window.location.href = `${wxUrl}&state=STATE#wechat_redirect`
}
},
navigation ({ dispatch }, to) {
......
......@@ -83,7 +83,7 @@ export default {
let redirect_uri = this.getLocalStorage('dj_scrm_redirect_uri')
this.setLocalStorage('dj_scrm_userInfo', data)
this.setSessionId(data.sessionId)
let { corpId } = this.getLocalStorage('dj_scrm_corpId')
let { corpId, agentId } = this.getLocalStorage('dj_scrm_corpId')
store.dispatch('registerHttp', data.sessionId)
this.removeLocalStorage('dj_scrm_redirect_uri')
this.showLoading('登录成功', () => {
......@@ -91,6 +91,7 @@ export default {
if (redirect_uri) {
let [URL, query] = decodeURIComponent(redirect_uri).split('?')
URL = `${URL}?sessionId=${data.sessionId}&corpId=${corpId}`
if(agentId) URL = `${URL}&agentId=${agentId}`
if (query) URL = `${URL}&${query}`
window.location.href = URL
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!