Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
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 35d8f12d
authored
Jan 06, 2021
by
xinlaa
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
js sdk 引入与相关配置
1 parent
9f0cebf8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
7 deletions
linkwe-mobile/src/App.vue
linkwe-mobile/src/main.js
linkwe-mobile/src/utils/jweixin-1.2.0.js
linkwe-mobile/src/App.vue
View file @
35d8f12
<
script
>
export
default
{
name
:
'App'
,
data
()
{
return
{
timestamp
:
''
,
nonceStr
:
''
,
signature
:
''
,
}
},
created
()
{
// 调取服务端signature
},
watch
:
{
// 通过config接口注入权限验证配置
// 所有需要使用JS-SDK的页面必须先注入配置信息,否则将无法调用(同一个url仅需调用一次,对于变化url的SPA(single-page application)的web app可在每次url变化时进行调用)
$router
()
{
wx
.
config
({
beta
:
true
,
// 必须这么写,否则wx.invoke调用形式的jsapi会有问题
debug
:
true
,
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId
:
'123456'
,
// 必填,企业微信的corpID
timestamp
:
this
.
timestamp
,
// 必填,生成签名的时间戳
nonceStr
:
this
.
nonceStr
,
// 必填,生成签名的随机串
signature
:
this
.
signature
,
// 必填,签名,见 附录-JS-SDK使用权限签名算法
jsApiList
:
[],
// 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
})
},
},
}
</
script
>
<
template
>
<div
id=
"app"
>
<div
id=
"nav"
>
...
...
linkwe-mobile/src/main.js
View file @
35d8f12
import
Vue
from
"vue"
;
import
App
from
"./App.vue"
;
import
router
from
"./router"
;
import
store
from
"./store"
;
import
wx
from
'@/utils/jweixin-1.2.0.js'
import
Vue
from
'vue'
import
App
from
'./App.vue'
import
router
from
'./router'
import
store
from
'./store'
Vue
.
config
.
productionTip
=
false
;
window
.
wx
=
wx
Vue
.
config
.
productionTip
=
false
new
Vue
({
router
,
store
,
render
:
h
=>
h
(
App
)
}).
$mount
(
"#app"
);
render
:
(
h
)
=>
h
(
App
),
}).
$mount
(
'#app'
)
linkwe-mobile/src/utils/jweixin-1.2.0.js
0 → 100644
View file @
35d8f12
This diff is collapsed.
Click to expand it.
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