Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Y
ybf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xulili
ybf
Commits
aada0365
Commit
aada0365
authored
5 years ago
by
xd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
精准营销token未获取到
parent
4af504e3
master
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
356 additions
and
27 deletions
+356
-27
index.html
wx_application/public/index.html
+1
-1
aCommon copy.js
wx_application/src/utils/aCommon copy.js
+325
-0
aCommon.js
wx_application/src/utils/aCommon.js
+27
-25
pushStoreInfo.vue
wx_application/src/views/counter/pushStoreInfo.vue
+2
-0
index.vue
wx_application/src/views/mainSale/me/main/index.vue
+1
-1
No files found.
wx_application/public/index.html
View file @
aada0365
...
@@ -15,6 +15,6 @@
...
@@ -15,6 +15,6 @@
</noscript>
</noscript>
<div
id=
"app"
></div>
<div
id=
"app"
></div>
<!-- built files will be auto injected -->
<!-- built files will be auto injected -->
<
script
src=
"http://res.wx.qq.com/open/js/jweixin-1.2.0.js"
></script
>
<
!-- <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> --
>
</body>
</body>
</html>
</html>
This diff is collapsed.
Click to expand it.
wx_application/src/utils/aCommon copy.js
0 → 100644
View file @
aada0365
import
Vue
from
'vue'
import
{
wxRequest
}
from
'./aWxRequest'
import
qs
from
'qs'
import
router
from
'../router'
const
zlog
=
console
.
log
.
bind
(
console
)
// Z-BasicInfo
let
INFO
=
{
// corpId: 'wwd1cdbca7b8b2b6c4',
// agentId: '1000015',
corpId
:
'ww4df265003b43fa0d'
,
agentId
:
'1000033'
,
}
async
function
getXToken
()
{
let
postData
=
{
corpId
:
INFO
.
corpId
,
agentId
:
INFO
.
agentId
,
}
console
.
log
(
'%c--->getXToken: PD ='
,
'background: orange;'
,
postData
)
await
wxRequest
(
'/workWx/common/getToken'
,
postData
,
'get'
).
then
(
res
=>
{
if
(
res
.
result
===
'success'
)
{
sessionStorage
.
setItem
(
'XToken'
,
res
.
data
)
console
.
log
(
'%c--->getXToken: RD ='
,
'background: limegreen;'
,
res
)
}
else
{
console
.
log
(
'%c--->getXToken: N/A. '
,
'background: red;'
)
// this.$message({
// message: res.errorMsg,
// type: 'error'
// })
}
}).
catch
(
err
=>
{
console
.
log
(
'!==>getXToken: err:'
,
err
)
})
}
function
isIosOrAndroid
()
{
let
u
=
navigator
.
userAgent
;
let
isAndroid
=
u
.
indexOf
(
'Android'
)
>
-
1
||
u
.
indexOf
(
'Adr'
)
>
-
1
// android终端
let
isiOS
=
!!
u
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
)
// ios终端
let
isStr
=
''
if
(
isAndroid
)
{
isStr
=
'android'
}
if
(
isiOS
)
{
isStr
=
'ios'
}
return
isStr
}
Vue
.
prototype
.
getAgentAuth
=
function
()
{
zlog
(
'%c--->IN: getAgentAuth: location.href ='
,
'color: orange;'
,
location
.
href
)
// alert(`--->zCommon.js: IN.`)
let
postData
=
{
// businessId: sessionStorage.getItem('businessId'),
// pageUrl: encodeURIComponent(this.isIosOrAndroid() === 'android' ? location.href.split('#')[0] : window.initUrl)
pageUrl
:
encodeURIComponent
(
location
.
href
.
split
(
'#'
)[
0
])
}
// alert(`--->zCommon.js: postData =${JSON.stringify(postData)}`)
let
header
=
{
token
:
sessionStorage
.
getItem
(
'XToken'
),
corpId
:
INFO
.
corpId
,
agentId
:
INFO
.
agentId
,
}
// alert(`--->zCommon.js: header =${JSON.stringify(header)}`)
console
.
log
(
'%c--->getAgentAuth: getJsSdkSignature: PD ='
,
'background: orange;'
,
header
)
wxRequest
(
'/workWx/auth/base/getJsSdkSignature'
,
qs
.
stringify
(
postData
),
header
)
.
then
(
res
=>
{
// alert(`--->zCommon.js: getJsSdkSignature: then.`)
// alert(`--->zCommon.js: getJsSdkSignature: then: res =${JSON.stringify(res)}`)
if
(
res
.
result
===
'success'
)
{
console
.
log
(
'%c--->getAgentAuth: getJsSdkSignature: RD ='
,
'background: limegreen;'
,
res
.
data
)
// alert(`--->zCommon.js: getJsSdkSignature: then: res.result === "success".`)
let
config
=
res
.
data
wx
.
config
({
beta
:
true
,
debug
:
false
,
//调试的时候可以开启
appId
:
config
.
jsApiSignature
.
appId
,
// 必填,公众号的唯一标识
timestamp
:
config
.
jsApiSignature
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
config
.
jsApiSignature
.
nonceStr
,
// 必填,生成签名的随机串
signature
:
config
.
jsApiSignature
.
signature
,
// 必填,签名
// 根据自己的需求,填写 jsapilist 内容
jsApiList
:
[
'agentConfig'
]
})
// alert(`--->zCommon.js: getJsSdkSignature: then: wx.config: end.`)
wx
.
ready
(
function
()
{
zlog
(
'%c--->getAgentAuth: getJsSdkSignature: Ready.'
,
'color: red;'
)
// alert(`--->zCommon.js: getJsSdkSignature: then: wx.ready: IN.`)
// JS-SDK配置信息验证失败时会进入此方法
wx
.
error
(
function
(
res
)
{
// alert("JS-SDK配置信息验证失败 \r\n" + JSON.stringify(res));
})
// 配置成功后验证API接口在当前客户端是否支持:判断当前客户端版本是否支持指定JS接口
wx
.
checkJsApi
(
{
jsApiList
:
[
'agentConfig'
,
'sendChatMessage'
],
success
:
function
(
res
)
{
if
(
res
.
errMsg
!=
"checkJsApi:ok"
)
{
// alert("JS-SDK接口检测失败:" + JSON.stringify(res));
return
false
;
}
else
{
wxRequest
(
'/workWx/auth/base/getAgentJsSdkSignature'
,
qs
.
stringify
(
postData
),
header
)
.
then
(
res
=>
{
// alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: res.`)
// alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: res =${JSON.stringify(res)}`)
// alert('getAgentJsSdkSignature:ok')
if
(
res
.
result
===
'success'
)
{
let
agentConfig
=
res
.
data
wx
.
agentConfig
({
corpid
:
agentConfig
.
agentJsApiSignature
.
appId
,
// 必填,企业微信的 corpid,必须与当前登录的企业一致
agentid
:
agentConfig
.
agentId
,
// 必填,企业微信的应用id
timestamp
:
agentConfig
.
agentJsApiSignature
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
agentConfig
.
agentJsApiSignature
.
nonceStr
,
// 必填,生成签名的随机串
signature
:
agentConfig
.
agentJsApiSignature
.
signature
,
// 必填,签名,agentConfig所以为应用签名
jsApiList
:
[
'sendChatMessage'
],
//必填
success
:
function
(
res
)
{
// alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: wx.agentConfig: res.`)
// alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: wx.agentConfig: res =${JSON.stringify(res)}`)
// alert('agentConfig:ok')
// router.push(to)
// 回调
//1、发起申请申请时后,审批状态发生变化时
//2、发起申请申请时后,在“审批中”状态,有任意审批人进行审批操作时
// alert('wx.agentConfig 回调'+res.errMsg);
},
fail
:
function
(
res
)
{
// alert('回调失败:'+res.errMsg)
if
(
res
.
errMsg
.
indexOf
(
'is not a function'
)
>
-
1
)
{
alert
(
'<i class="weui-icon-warn">版本过低请升级</i>'
)
}
}
})
}
})
.
catch
(
err
=>
{
// alert(`--->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: err.`)
// alert(`--->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: err =${JSON.stringify(err)}`)
})
}
}
}
)
})
}
else
{
// this.$message({
// type: 'error',
// message: res.errorMsg
// })
}
})
.
catch
(
err
=>
{
// alert(`--->zCommon.js: getJsSdkSignature: catch.`)
// alert(`--->zCommon.js: getJsSdkSignature: catch: err =${JSON.stringify(err)}`)
console
.
log
(
err
,
'err'
)
})
}
function
configWx
(
to
)
{
let
postData
=
{
// businessId: sessionStorage.getItem('businessId'),
// pageUrl: encodeURIComponent(this.isIosOrAndroid() === 'android' ? location.href.split('#')[0] : window.initUrl)
pageUrl
:
encodeURIComponent
(
location
.
href
.
split
(
'#'
)[
0
])
}
let
header
=
{
token
:
sessionStorage
.
getItem
(
'XToken'
),
corpId
:
INFO
.
corpId
,
agentId
:
INFO
.
agentId
,
}
wxRequest
(
'/workWx/auth/base/getJsSdkSignature'
,
qs
.
stringify
(
postData
),
header
).
then
(
res
=>
{
if
(
res
.
result
==
'success'
)
{
let
config
=
res
.
data
wx
.
config
({
beta
:
true
,
debug
:
false
,
//调试的时候可以开启
appId
:
config
.
jsApiSignature
.
appId
,
// 必填,公众号的唯一标识
timestamp
:
config
.
jsApiSignature
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
config
.
jsApiSignature
.
nonceStr
,
// 必填,生成签名的随机串
signature
:
config
.
jsApiSignature
.
signature
,
// 必填,签名
// 根据自己的需求,填写 jsapilist 内容
jsApiList
:
[
'agentConfig'
,
'getCurExternalContact'
]
})
wx
.
ready
(
function
()
{
// JS-SDK配置信息验证失败时会进入此方法
wx
.
error
(
function
(
res
)
{
// alert("JS-SDK配置信息验证失败 \r\n" + JSON.stringify(res))
})
// 配置成功后验证API接口在当前客户端是否支持:判断当前客户端版本是否支持指定JS接口
wx
.
checkJsApi
({
jsApiList
:
[
'agentConfig'
,
'getCurExternalContact'
],
success
:
function
(
res
)
{
// alert(`--->wx.checkJsApi: success. res =${JSON.stringify(res)}`);
// router.push(to)
if
(
res
.
errMsg
!=
"checkJsApi:ok"
)
{
// alert("JS-SDK接口检测失败:" + JSON.stringify(res));
return
false
;
}
}
})
// alert(`--->configWx/getJsSdkSignature: next: getAgentJsSdkSignature.`)
// alert(`--->configWx/getJsSdkSignature: next: getAgentJsSdkSignature: data =${qs.stringify(postData)}. header =${JSON.stringify(header)}`)
wxRequest
(
'/workWx/auth/base/getAgentJsSdkSignature'
,
qs
.
stringify
(
postData
),
header
)
.
then
(
res
=>
{
// alert(`--->configWx/getJsSdkSignature/getAgentJsSdkSignature: then: IN.`)
// alert(`--->configWx/getJsSdkSignature/getAgentJsSdkSignature: then: res =${JSON.stringify(res)}`)
if
(
res
.
result
==
'success'
)
{
let
agentConfig
=
res
.
data
// alert(`--->configWx/getJsSdkSignature/getAgentJsSdkSignature: then: res.result == 'success'.`)
wx
.
agentConfig
({
corpid
:
agentConfig
.
agentJsApiSignature
.
appId
,
// 必填,企业微信的corpid,必须与当前登录的企业一致
agentid
:
agentConfig
.
agentId
,
// 必填,企业微信的应用id
timestamp
:
agentConfig
.
agentJsApiSignature
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
agentConfig
.
agentJsApiSignature
.
nonceStr
,
// 必填,生成签名的随机串
signature
:
agentConfig
.
agentJsApiSignature
.
signature
,
// 必填,签名,agentConfig所以为应用签名
jsApiList
:
[
'getCurExternalContact'
],
//必填
success
:
function
(
res
)
{
// alert('agentConfig:ok')
// alert(`--->configWx/getJsSdkSignature/getAgentJsSdkSignature: then: agentConfig: res =${res}`)
// alert(`--->configWx/getJsSdkSignature/getAgentJsSdkSignature: then: agentConfig: to =${JSON.stringify(to)}`)
sessionStorage
.
setItem
(
'zConfigWx'
,
'Pass'
)
router
.
push
(
to
)
// getUnionid(to)
// 回调
//1、发起申请申请时后,审批状态发生变化时
//2、发起申请申请时后,在“审批中”状态,有任意审批人进行审批操作时
// alert('wx.agentConfig 回调'+res.errMsg);
},
fail
:
function
(
res
)
{
// alert(`--->A: err =${res}`)
// alert(`--->A: err =${JSON.stringify(res)}`)
if
(
res
.
errMsg
.
indexOf
(
'is not a function'
)
>
-
1
)
{
// alert('<i class="weui-icon-warn">版本过低请升级</i>')
}
}
})
}
})
.
catch
(
err
=>
{
// alert(`--->configWx/getJsSdkSignature/getAgentJsSdkSignature: catch: err.`)
// alert(`--->configWx/getJsSdkSignature/getAgentJsSdkSignature: catch: err =${JSON.stringify(err)}`)
})
})
}
else
{
// this.$message({
// type: 'error',
// message: res.errorMsg
// })
}
}).
catch
(
err
=>
{
console
.
log
(
err
,
'err'
)
})
}
function
getUnionid
(
to
)
{
wx
.
invoke
(
'getCurExternalContact'
,
{},
function
(
res
)
{
if
(
res
.
err_msg
==
"getCurExternalContact:ok"
)
{
let
header
=
{
token
:
sessionStorage
.
getItem
(
'XToken'
),
corpId
:
INFO
.
corpId
,
agentId
:
INFO
.
agentId
,
}
let
postData
=
{
userId
:
res
.
userId
}
wxRequest
(
'/workWx/auth/contact/getExternalContact'
,
postData
,
header
,
'get'
).
then
(
res
=>
{
if
(
res
.
result
==
'success'
)
{
sessionStorage
.
setItem
(
'unionid'
,
res
.
data
.
externalContact
.
unionId
)
console
.
log
(
'%c--->UnionId: RES: '
,
'background: limegreen;'
,
res
.
data
.
externalContact
.
unionId
)
router
.
push
(
to
)
}
})
}
else
{
console
.
log
(
'%c--->UnionId: N/A'
,
'background: red;'
)
console
.
log
(
res
,
'res'
)
}
});
}
function
getUserInfo
(
inData
)
{
wx
.
invoke
(
'getUserInfo'
,
{},
function
(
res
)
{
if
(
res
.
err_msg
==
"getUserInfo:ok"
)
{
let
header
=
{
token
:
sessionStorage
.
getItem
(
'XToken'
),
corpId
:
INFO
.
corpId
,
agentId
:
INFO
.
agentId
,
}
let
postData
=
{
code
:
inData
.
code
}
wxRequest
(
'/workWx/auth/oauth2/getUserInfo'
,
postData
,
header
,
'post'
).
then
(
res
=>
{
if
(
res
.
result
==
'success'
)
{
sessionStorage
.
setItem
(
'userInfo'
,
res
.
data
)
console
.
log
(
'%c--->getUserInfo: RES: '
,
'background: limegreen;'
,
res
.
data
)
// router.push(to)
}
})
}
else
{
console
.
log
(
'%c--->UnionId: N/A'
,
'background: red;'
)
console
.
log
(
res
,
'res'
)
}
});
}
export
{
getXToken
,
configWx
,
getUnionid
,
getUserInfo
}
This diff is collapsed.
Click to expand it.
wx_application/src/utils/aCommon.js
View file @
aada0365
...
@@ -18,13 +18,14 @@ async function getXToken() {
...
@@ -18,13 +18,14 @@ async function getXToken() {
corpId
:
INFO
.
corpId
,
corpId
:
INFO
.
corpId
,
agentId
:
INFO
.
agentId
,
agentId
:
INFO
.
agentId
,
}
}
alert
(
'获取token'
)
console
.
log
(
'%c--->getXToken: PD ='
,
'background: orange;'
,
postData
)
await
wxRequest
(
'/workWx/auth/oauth2/getAccessToken'
,
postData
,
'get'
).
then
(
res
=>
{
await
wxRequest
(
'/workWx/auth/oauth2/getAccessToken'
,
qs
.
stringify
(
postData
),
'get'
).
then
(
res
=>
{
if
(
res
.
result
===
'success'
)
{
if
(
res
.
result
===
'success'
)
{
alert
(
'token获取成功'
)
sessionStorage
.
setItem
(
'XToken'
,
res
.
data
)
sessionStorage
.
setItem
(
'XToken'
,
res
.
data
)
console
.
log
(
'%c--->getXToken: RD ='
,
'background: limegreen;'
,
res
)
console
.
log
(
'%c--->getXToken: RD ='
,
'background: limegreen;'
,
res
)
}
else
{
}
else
{
alert
(
'token获取失败'
)
console
.
log
(
'%c--->getXToken: N/A. '
,
'background: red;'
)
console
.
log
(
'%c--->getXToken: N/A. '
,
'background: red;'
)
// this.$message({
// this.$message({
...
@@ -33,11 +34,13 @@ async function getXToken() {
...
@@ -33,11 +34,13 @@ async function getXToken() {
// })
// })
}
}
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
alert
(
'TOKEN失败'
)
console
.
log
(
'!==>getXToken: err:'
,
err
)
console
.
log
(
'!==>getXToken: err:'
,
err
)
})
})
}
}
function
isIosOrAndroid
()
{
function
isIosOrAndroid
()
{
alert
(
'isIosOrAndroid'
)
let
u
=
navigator
.
userAgent
;
let
u
=
navigator
.
userAgent
;
let
isAndroid
=
u
.
indexOf
(
'Android'
)
>
-
1
||
u
.
indexOf
(
'Adr'
)
>
-
1
// android终端
let
isAndroid
=
u
.
indexOf
(
'Android'
)
>
-
1
||
u
.
indexOf
(
'Adr'
)
>
-
1
// android终端
let
isiOS
=
!!
u
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
)
// ios终端
let
isiOS
=
!!
u
.
match
(
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/
)
// ios终端
...
@@ -52,15 +55,12 @@ function isIosOrAndroid() {
...
@@ -52,15 +55,12 @@ function isIosOrAndroid() {
}
}
Vue
.
prototype
.
getAgentAuth
=
function
()
{
Vue
.
prototype
.
getAgentAuth
=
function
()
{
zlog
(
'%c--->IN: getAgentAuth: location.href ='
,
'color: orange;'
,
location
.
href
)
// alert(`--->zCommon.js: IN.`)
let
postData
=
{
let
postData
=
{
// businessId: sessionStorage.getItem('businessId'),
// businessId: sessionStorage.getItem('businessId'),
// pageUrl: encodeURIComponent(this.isIosOrAndroid() === 'android' ? location.href.split('#')[0] : window.initUrl)
// pageUrl: encodeURIComponent(this.isIosOrAndroid() === 'android' ? location.href.split('#')[0] : window.initUrl)
pageUrl
:
encodeURIComponent
(
location
.
href
.
split
(
'#'
)[
0
])
pageUrl
:
encodeURIComponent
(
location
.
href
.
split
(
'#'
)[
0
])
}
}
//
alert(`--->zCommon.js: postData =${JSON.stringify(postData)}`)
alert
(
`--->zCommon.js: postData =
${
JSON
.
stringify
(
postData
)}
`
)
let
header
=
{
let
header
=
{
token
:
sessionStorage
.
getItem
(
'XToken'
),
token
:
sessionStorage
.
getItem
(
'XToken'
),
...
@@ -74,7 +74,7 @@ Vue.prototype.getAgentAuth = function () {
...
@@ -74,7 +74,7 @@ Vue.prototype.getAgentAuth = function () {
wxRequest
(
'/workWx/auth/base/getJsSdkSignature'
,
qs
.
stringify
(
postData
),
header
)
wxRequest
(
'/workWx/auth/base/getJsSdkSignature'
,
qs
.
stringify
(
postData
),
header
)
.
then
(
res
=>
{
.
then
(
res
=>
{
// alert(`--->zCommon.js: getJsSdkSignature: then.`)
// alert(`--->zCommon.js: getJsSdkSignature: then.`)
//
alert(`--->zCommon.js: getJsSdkSignature: then: res =${JSON.stringify(res)}`)
alert
(
`--->zCommon.js: getJsSdkSignature: then: res =
${
JSON
.
stringify
(
res
)}
`
)
if
(
res
.
result
===
'success'
)
{
if
(
res
.
result
===
'success'
)
{
console
.
log
(
'%c--->getAgentAuth: getJsSdkSignature: RD ='
,
'background: limegreen;'
,
res
.
data
)
console
.
log
(
'%c--->getAgentAuth: getJsSdkSignature: RD ='
,
'background: limegreen;'
,
res
.
data
)
...
@@ -83,29 +83,33 @@ Vue.prototype.getAgentAuth = function () {
...
@@ -83,29 +83,33 @@ Vue.prototype.getAgentAuth = function () {
let
config
=
res
.
data
let
config
=
res
.
data
wx
.
config
({
wx
.
config
({
beta
:
true
,
beta
:
true
,
debug
:
fals
e
,
//调试的时候可以开启
debug
:
tru
e
,
//调试的时候可以开启
appId
:
config
.
jsApiSignature
.
appId
,
// 必填,公众号的唯一标识
appId
:
config
.
jsApiSignature
.
appId
,
// 必填,公众号的唯一标识
timestamp
:
config
.
jsApiSignature
.
timestamp
,
// 必填,生成签名的时间戳
timestamp
:
config
.
jsApiSignature
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
config
.
jsApiSignature
.
nonceStr
,
// 必填,生成签名的随机串
nonceStr
:
config
.
jsApiSignature
.
nonceStr
,
// 必填,生成签名的随机串
signature
:
config
.
jsApiSignature
.
signature
,
// 必填,签名
signature
:
config
.
jsApiSignature
.
signature
,
// 必填,签名
// 根据自己的需求,填写 jsapilist 内容
// 根据自己的需求,填写 jsapilist 内容
jsApiList
:
[
'agentConfig'
]
jsApiList
:
[
'agentConfig'
,
'sendChatMessage'
],
success
:
function
(
res
)
{
},
fail
:
function
(
err
)
{
}
})
})
//
alert(`--->zCommon.js: getJsSdkSignature: then: wx.config: end.`)
alert
(
`--->zCommon.js: getJsSdkSignature: then: wx.config: end.`
)
wx
.
ready
(
function
()
{
wx
.
ready
(
function
()
{
zlog
(
'%c--->getAgentAuth: getJsSdkSignature: Ready.'
,
'color: red;'
)
zlog
(
'%c--->getAgentAuth: getJsSdkSignature: Ready.'
,
'color: red;'
)
//
alert(`--->zCommon.js: getJsSdkSignature: then: wx.ready: IN.`)
alert
(
`--->zCommon.js: getJsSdkSignature: then: wx.ready: IN.`
)
// JS-SDK配置信息验证失败时会进入此方法
// JS-SDK配置信息验证失败时会进入此方法
wx
.
error
(
function
(
res
)
{
wx
.
error
(
function
(
res
)
{
// alert("JS-SDK配置信息验证失败 \r\n" + JSON.stringify(res));
alert
(
'sdk配置失败'
)
})
})
// 配置成功后验证API接口在当前客户端是否支持:判断当前客户端版本是否支持指定JS接口
// 配置成功后验证API接口在当前客户端是否支持:判断当前客户端版本是否支持指定JS接口
wx
.
checkJsApi
(
wx
.
checkJsApi
(
{
{
jsApiList
:
[
'agentConfig'
,
'sendChatMessage'
],
jsApiList
:
[
'
config'
,
'
agentConfig'
,
'sendChatMessage'
],
success
:
function
(
res
)
{
success
:
function
(
res
)
{
if
(
res
.
errMsg
!=
"checkJsApi:ok"
)
{
if
(
res
.
errMsg
!=
"checkJsApi:ok"
)
{
// alert("JS-SDK接口检测失败:" + JSON.stringify(res));
// alert("JS-SDK接口检测失败:" + JSON.stringify(res));
...
@@ -116,7 +120,7 @@ Vue.prototype.getAgentAuth = function () {
...
@@ -116,7 +120,7 @@ Vue.prototype.getAgentAuth = function () {
// alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: res.`)
// alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: res.`)
// alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: res =${JSON.stringify(res)}`)
// alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: res =${JSON.stringify(res)}`)
//
alert('getAgentJsSdkSignature:ok')
alert
(
'getAgentJsSdkSignature:ok'
)
if
(
res
.
result
===
'success'
)
{
if
(
res
.
result
===
'success'
)
{
let
agentConfig
=
res
.
data
let
agentConfig
=
res
.
data
wx
.
agentConfig
({
wx
.
agentConfig
({
...
@@ -127,6 +131,7 @@ Vue.prototype.getAgentAuth = function () {
...
@@ -127,6 +131,7 @@ Vue.prototype.getAgentAuth = function () {
signature
:
agentConfig
.
agentJsApiSignature
.
signature
,
// 必填,签名,agentConfig所以为应用签名
signature
:
agentConfig
.
agentJsApiSignature
.
signature
,
// 必填,签名,agentConfig所以为应用签名
jsApiList
:
[
'sendChatMessage'
],
//必填
jsApiList
:
[
'sendChatMessage'
],
//必填
success
:
function
(
res
)
{
success
:
function
(
res
)
{
alert
(
'agentConfigSuccess'
)
// alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: wx.agentConfig: res.`)
// alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: wx.agentConfig: res.`)
// alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: wx.agentConfig: res =${JSON.stringify(res)}`)
// alert(`!-->zCommon.js: getJsSdkSignature: then: wx.ready: wx.checkJsApi: getAgentJsSdkSignature: wx.agentConfig: res =${JSON.stringify(res)}`)
// alert('agentConfig:ok')
// alert('agentConfig:ok')
...
@@ -134,9 +139,10 @@ Vue.prototype.getAgentAuth = function () {
...
@@ -134,9 +139,10 @@ Vue.prototype.getAgentAuth = function () {
// 回调
// 回调
//1、发起申请申请时后,审批状态发生变化时
//1、发起申请申请时后,审批状态发生变化时
//2、发起申请申请时后,在“审批中”状态,有任意审批人进行审批操作时
//2、发起申请申请时后,在“审批中”状态,有任意审批人进行审批操作时
//
alert('wx.agentConfig 回调'+res.errMsg);
alert
(
'wx.agentConfig 回调'
+
res
.
errMsg
);
},
},
fail
:
function
(
res
)
{
fail
:
function
(
res
)
{
alert
(
'agentConfigFailed'
)
// alert('回调失败:'+res.errMsg)
// alert('回调失败:'+res.errMsg)
if
(
res
.
errMsg
.
indexOf
(
'is not a function'
)
>
-
1
)
{
if
(
res
.
errMsg
.
indexOf
(
'is not a function'
)
>
-
1
)
{
alert
(
'<i class="weui-icon-warn">版本过低请升级</i>'
)
alert
(
'<i class="weui-icon-warn">版本过低请升级</i>'
)
...
@@ -185,7 +191,7 @@ function configWx(to) {
...
@@ -185,7 +191,7 @@ function configWx(to) {
let
config
=
res
.
data
let
config
=
res
.
data
wx
.
config
({
wx
.
config
({
beta
:
true
,
beta
:
true
,
debug
:
fals
e
,
//调试的时候可以开启
debug
:
tru
e
,
//调试的时候可以开启
appId
:
config
.
jsApiSignature
.
appId
,
// 必填,公众号的唯一标识
appId
:
config
.
jsApiSignature
.
appId
,
// 必填,公众号的唯一标识
timestamp
:
config
.
jsApiSignature
.
timestamp
,
// 必填,生成签名的时间戳
timestamp
:
config
.
jsApiSignature
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
config
.
jsApiSignature
.
nonceStr
,
// 必填,生成签名的随机串
nonceStr
:
config
.
jsApiSignature
.
nonceStr
,
// 必填,生成签名的随机串
...
@@ -196,17 +202,16 @@ function configWx(to) {
...
@@ -196,17 +202,16 @@ function configWx(to) {
wx
.
ready
(
function
()
{
wx
.
ready
(
function
()
{
// JS-SDK配置信息验证失败时会进入此方法
// JS-SDK配置信息验证失败时会进入此方法
wx
.
error
(
function
(
res
)
{
wx
.
error
(
function
(
res
)
{
// alert("JS-SDK配置信息验证失败 \r\n" + JSON.stringify(res))
})
})
// 配置成功后验证API接口在当前客户端是否支持:判断当前客户端版本是否支持指定JS接口
// 配置成功后验证API接口在当前客户端是否支持:判断当前客户端版本是否支持指定JS接口
wx
.
checkJsApi
({
wx
.
checkJsApi
({
jsApiList
:
[
'agentConfig'
,
'getCurExternalContact'
],
jsApiList
:
[
'agentConfig'
,
'getCurExternalContact'
],
success
:
function
(
res
)
{
success
:
function
(
res
)
{
//
alert(`--->wx.checkJsApi: success. res =${JSON.stringify(res)}`);
alert
(
`--->wx.checkJsApi: success. res =
${
JSON
.
stringify
(
res
)}
`
);
// router.push(to)
// router.push(to)
if
(
res
.
errMsg
!=
"checkJsApi:ok"
)
{
if
(
res
.
errMsg
!=
"checkJsApi:ok"
)
{
//
alert("JS-SDK接口检测失败:" + JSON.stringify(res));
alert
(
"JS-SDK接口检测失败:"
+
JSON
.
stringify
(
res
));
return
false
;
return
false
;
}
}
}
}
...
@@ -232,7 +237,7 @@ function configWx(to) {
...
@@ -232,7 +237,7 @@ function configWx(to) {
signature
:
agentConfig
.
agentJsApiSignature
.
signature
,
// 必填,签名,agentConfig所以为应用签名
signature
:
agentConfig
.
agentJsApiSignature
.
signature
,
// 必填,签名,agentConfig所以为应用签名
jsApiList
:
[
'getCurExternalContact'
],
//必填
jsApiList
:
[
'getCurExternalContact'
],
//必填
success
:
function
(
res
)
{
success
:
function
(
res
)
{
//
alert('agentConfig:ok')
alert
(
'agentConfig:ok'
)
// alert(`--->configWx/getJsSdkSignature/getAgentJsSdkSignature: then: agentConfig: res =${res}`)
// alert(`--->configWx/getJsSdkSignature/getAgentJsSdkSignature: then: agentConfig: res =${res}`)
// alert(`--->configWx/getJsSdkSignature/getAgentJsSdkSignature: then: agentConfig: to =${JSON.stringify(to)}`)
// alert(`--->configWx/getJsSdkSignature/getAgentJsSdkSignature: then: agentConfig: to =${JSON.stringify(to)}`)
sessionStorage
.
setItem
(
'zConfigWx'
,
'Pass'
)
sessionStorage
.
setItem
(
'zConfigWx'
,
'Pass'
)
...
@@ -245,11 +250,8 @@ function configWx(to) {
...
@@ -245,11 +250,8 @@ function configWx(to) {
// alert('wx.agentConfig 回调'+res.errMsg);
// alert('wx.agentConfig 回调'+res.errMsg);
},
},
fail
:
function
(
res
)
{
fail
:
function
(
res
)
{
// alert(`--->A: err =${res}`)
// alert(`--->A: err =${JSON.stringify(res)}`)
if
(
res
.
errMsg
.
indexOf
(
'is not a function'
)
>
-
1
)
{
if
(
res
.
errMsg
.
indexOf
(
'is not a function'
)
>
-
1
)
{
//
alert('<i class="weui-icon-warn">版本过低请升级</i>')
alert
(
'<i class="weui-icon-warn">版本过低请升级</i>'
)
}
}
}
}
})
})
...
...
This diff is collapsed.
Click to expand it.
wx_application/src/views/counter/pushStoreInfo.vue
View file @
aada0365
...
@@ -42,9 +42,11 @@ export default {
...
@@ -42,9 +42,11 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
getAgentAuth
()
this
.
getAgentAuth
()
this
.
getList
()
},
},
methods
:
{
methods
:
{
getList
()
{
getList
()
{
alert
(
'getList'
)
wx
.
invoke
(
'selectExternalContact'
,
{
wx
.
invoke
(
'selectExternalContact'
,
{
"filterType"
:
0
,
"filterType"
:
0
,
},
},
...
...
This diff is collapsed.
Click to expand it.
wx_application/src/views/mainSale/me/main/index.vue
View file @
aada0365
...
@@ -125,7 +125,7 @@ export default {
...
@@ -125,7 +125,7 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
checkNowMenuBar
()
this
.
checkNowMenuBar
()
//
this.zReadyUserId()
this
.
zReadyUserId
()
this
.
zTestGetNowUrlInfo
()
this
.
zTestGetNowUrlInfo
()
},
},
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment