Commit 8c98b957 by 前端

Merge branch 'develop' into 'master'

分享增加分享时间戳

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