Commit 4ba9eecf by 李伟康

提交代码

1 parent 5923c07f
...@@ -8,7 +8,6 @@ const WxConfig = { ...@@ -8,7 +8,6 @@ const WxConfig = {
if (e == 'chooseImage') jsApiList.push('getLocalImgData') if (e == 'chooseImage') jsApiList.push('getLocalImgData')
}) })
let [redirectUrl] = window.location.href.split('#') let [redirectUrl] = window.location.href.split('#')
let appId = util.getAppId()
if (isWxWork) { if (isWxWork) {
const STORAGE_PARAMS = util.getLocalStorage('wx_scrm_link_params') const STORAGE_PARAMS = util.getLocalStorage('wx_scrm_link_params')
let data = { let data = {
...@@ -17,6 +16,9 @@ const WxConfig = { ...@@ -17,6 +16,9 @@ const WxConfig = {
url: redirectUrl, url: redirectUrl,
appCode: 'DJQWGJ' appCode: 'DJQWGJ'
} }
this.getWxConfig(jsApiList).then(() => {
console.log('wxconfig')
wx.ready(() => {
window.$HTTP({ window.$HTTP({
url: '/rop-scrm-wechat/router', url: '/rop-scrm-wechat/router',
data data
...@@ -30,11 +32,11 @@ const WxConfig = { ...@@ -30,11 +32,11 @@ const WxConfig = {
signature: obj.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法, signature: obj.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法,
jsApiList: ['getContext', ...jsApiList], jsApiList: ['getContext', ...jsApiList],
success (res) { success (res) {
console.log(res, 'wx_config') console.log(res, 'ww_config')
resolve() resolve()
}, },
fail (err) { fail (err) {
console.log(err, 'wx_config') console.log(err, 'ww_config')
reject(err) reject(err)
} }
}) })
...@@ -42,12 +44,23 @@ const WxConfig = { ...@@ -42,12 +44,23 @@ const WxConfig = {
Notify('网络异常') Notify('网络异常')
} }
}) })
})
})
} else { } else {
return window.$HTTP({ return this.getWxConfig(jsApiList).then(() => {
resolve()
})
}
})
},
getWxConfig (jsApiList) {
let [redirectUrl] = window.location.href.split('#')
return new Promise((resolve, reject) => {
window.$HTTP({
url: '/rop-scrm-equity/router', url: '/rop-scrm-equity/router',
data: { data: {
url: redirectUrl, url: redirectUrl,
appId, appId: window.$fetchConfig.appid,
method: 'scrm.api.equity.common.wechat.jsconfig' method: 'scrm.api.equity.common.wechat.jsconfig'
} }
}).then(data => { }).then(data => {
...@@ -67,8 +80,6 @@ const WxConfig = { ...@@ -67,8 +80,6 @@ const WxConfig = {
Notify('网络异常') Notify('网络异常')
} }
}) })
}
}) })
}, },
ready (callBack) { ready (callBack) {
......
...@@ -47,8 +47,8 @@ let body = document.getElementsByTagName('head')[0], ...@@ -47,8 +47,8 @@ let body = document.getElementsByTagName('head')[0],
WXJDK.src = '//res.wx.qq.com/open/js/jweixin-1.6.0.js' WXJDK.src = '//res.wx.qq.com/open/js/jweixin-1.6.0.js'
if (Boolean(ua.match(/MicroMessenger/i)) && Boolean(ua.match(/wxwork/i))) { //是否企微 if (Boolean(ua.match(/MicroMessenger/i)) && Boolean(ua.match(/wxwork/i))) { //是否企微
WXJDK.src = '//res.wx.qq.com/open/js/jweixin-1.2.0.js' WXJDK.src = '//res.wx.qq.com/open/js/jweixin-1.2.0.js'
// WWJDK.src = '//open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js' WWJDK.src = '//open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js'
WWJDK.src = '//res.wx.qq.com/wwopen/js/jsapi/jweixin-1.0.0.js' // WWJDK.src = '//res.wx.qq.com/wwopen/js/jsapi/jweixin-1.0.0.js'
ISWXWORK = true ISWXWORK = true
} }
window.$ISWXWORK = ISWXWORK window.$ISWXWORK = ISWXWORK
...@@ -70,12 +70,10 @@ fetchConfig(!isMock).then(res => { ...@@ -70,12 +70,10 @@ fetchConfig(!isMock).then(res => {
util.clearSessionId() util.clearSessionId()
store.dispatch('navigation') store.dispatch('navigation')
} }
WXJDK.onload = function () {
window.vm = new Vue({ window.vm = new Vue({
el: '#app', el: '#app',
router, router,
store, store,
render: h => h(App) render: h => h(App)
}) })
}
}) })
...@@ -224,8 +224,8 @@ export default { ...@@ -224,8 +224,8 @@ export default {
}, },
mounted () { mounted () {
let _this = this let _this = this
let jsApiList = window.$ISWXWORK ? ['launchMiniprogram'] : ['updateAppMessageShareData'] let jsApiList = ['getLocation', 'openLocation', 'getNetworkType', 'onMenuShareAppMessage', 'launchMiniprogram', 'updateAppMessageShareData']
wxConfig.init(['getLocation', 'openLocation', 'getNetworkType', 'onMenuShareAppMessage', ...jsApiList]).then(() => { wxConfig.init(jsApiList).then(() => {
wxConfig.ready(() => { wxConfig.ready(() => {
this.getActivityDetail() this.getActivityDetail()
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!