Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
scrm-wx-merchant-activity
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4ba9eecf
authored
Jul 28, 2022
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交代码
1 parent
5923c07f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
59 deletions
src/api/wxConfig.js
src/main.js
src/views/crowdfunding/index.vue
src/api/wxConfig.js
View file @
4ba9eec
...
...
@@ -8,7 +8,6 @@ const WxConfig = {
if
(
e
==
'chooseImage'
)
jsApiList
.
push
(
'getLocalImgData'
)
})
let
[
redirectUrl
]
=
window
.
location
.
href
.
split
(
'#'
)
let
appId
=
util
.
getAppId
()
if
(
isWxWork
)
{
const
STORAGE_PARAMS
=
util
.
getLocalStorage
(
'wx_scrm_link_params'
)
let
data
=
{
...
...
@@ -17,58 +16,70 @@ const WxConfig = {
url
:
redirectUrl
,
appCode
:
'DJQWGJ'
}
window
.
$HTTP
({
url
:
'/rop-scrm-wechat/router'
,
data
}).
then
(
obj
=>
{
if
(
obj
)
{
wx
.
agentConfig
({
corpid
:
obj
.
corpId
,
// 必填,企业微信的corpid,必须与当前登录的企业一致
agentid
:
obj
.
agentId
,
// 必填,企业微信的应用id (e.g. 1000247)
timestamp
:
obj
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
obj
.
nonceStr
,
// 必填,生成签名的随机串
signature
:
obj
.
signature
,
// 必填,签名,见附录-JS-SDK使用权限签名算法,
jsApiList
:
[
'getContext'
,
...
jsApiList
],
success
(
res
)
{
console
.
log
(
res
,
'wx_config'
)
resolve
()
},
fail
(
err
)
{
console
.
log
(
err
,
'wx_config'
)
reject
(
err
)
this
.
getWxConfig
(
jsApiList
).
then
(()
=>
{
console
.
log
(
'wxconfig'
)
wx
.
ready
(()
=>
{
window
.
$HTTP
({
url
:
'/rop-scrm-wechat/router'
,
data
}).
then
(
obj
=>
{
if
(
obj
)
{
wx
.
agentConfig
({
corpid
:
obj
.
corpId
,
// 必填,企业微信的corpid,必须与当前登录的企业一致
agentid
:
obj
.
agentId
,
// 必填,企业微信的应用id (e.g. 1000247)
timestamp
:
obj
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
obj
.
nonceStr
,
// 必填,生成签名的随机串
signature
:
obj
.
signature
,
// 必填,签名,见附录-JS-SDK使用权限签名算法,
jsApiList
:
[
'getContext'
,
...
jsApiList
],
success
(
res
)
{
console
.
log
(
res
,
'ww_config'
)
resolve
()
},
fail
(
err
)
{
console
.
log
(
err
,
'ww_config'
)
reject
(
err
)
}
})
}
else
{
Notify
(
'网络异常'
)
}
})
}
else
{
Notify
(
'网络异常'
)
}
})
})
}
else
{
return
window
.
$HTTP
({
url
:
'/rop-scrm-equity/router'
,
data
:
{
url
:
redirectUrl
,
appId
,
method
:
'scrm.api.equity.common.wechat.jsconfig'
}
}).
then
(
data
=>
{
if
(
data
)
{
let
obj
=
{}
Object
.
keys
(
data
).
map
(
key
=>
{
if
(
data
[
key
])
obj
[
key
]
=
data
[
key
]
})
wx
.
config
({
...
obj
,
jsApiList
,
openTagList
:
[
'wx-open-launch-weapp'
]
})
resolve
()
}
else
{
reject
()
Notify
(
'网络异常'
)
}
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'
,
data
:
{
url
:
redirectUrl
,
appId
:
window
.
$fetchConfig
.
appid
,
method
:
'scrm.api.equity.common.wechat.jsconfig'
}
}).
then
(
data
=>
{
if
(
data
)
{
let
obj
=
{}
Object
.
keys
(
data
).
map
(
key
=>
{
if
(
data
[
key
])
obj
[
key
]
=
data
[
key
]
})
wx
.
config
({
...
obj
,
jsApiList
,
openTagList
:
[
'wx-open-launch-weapp'
]
})
resolve
()
}
else
{
reject
()
Notify
(
'网络异常'
)
}
})
})
},
ready
(
callBack
)
{
...
...
src/main.js
View file @
4ba9eec
...
...
@@ -47,8 +47,8 @@ let body = document.getElementsByTagName('head')[0],
WXJDK
.
src
=
'//res.wx.qq.com/open/js/jweixin-1.6.0.js'
if
(
Boolean
(
ua
.
match
(
/MicroMessenger/i
))
&&
Boolean
(
ua
.
match
(
/wxwork/i
)))
{
//是否企微
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
=
'//res.wx.qq.com/wwopen/js/jsapi/jweixin-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'
ISWXWORK
=
true
}
window
.
$ISWXWORK
=
ISWXWORK
...
...
@@ -70,12 +70,10 @@ fetchConfig(!isMock).then(res => {
util
.
clearSessionId
()
store
.
dispatch
(
'navigation'
)
}
WXJDK
.
onload
=
function
()
{
window
.
vm
=
new
Vue
({
el
:
'#app'
,
router
,
store
,
render
:
h
=>
h
(
App
)
})
}
window
.
vm
=
new
Vue
({
el
:
'#app'
,
router
,
store
,
render
:
h
=>
h
(
App
)
})
})
src/views/crowdfunding/index.vue
View file @
4ba9eec
...
...
@@ -224,8 +224,8 @@ export default {
}
,
mounted
()
{
let
_this
=
this
let
jsApiList
=
window
.
$ISWXWORK
?
[
'launchMiniprogram'
]
:
[
'updateAppMessageShareData'
]
wxConfig
.
init
(
[
'getLocation'
,
'openLocation'
,
'getNetworkType'
,
'onMenuShareAppMessage'
,
...
jsApiList
]
).
then
(()
=>
{
let
jsApiList
=
[
'getLocation'
,
'openLocation'
,
'getNetworkType'
,
'onMenuShareAppMessage'
,
'launchMiniprogram'
,
'updateAppMessageShareData'
]
wxConfig
.
init
(
jsApiList
).
then
(()
=>
{
wxConfig
.
ready
(()
=>
{
this
.
getActivityDetail
()
}
)
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment