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 7867bace
authored
Feb 11, 2021
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
移动侧边栏删减注释等
1 parent
0361679e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
97 deletions
linkwe-mobile/src/App.vue
linkwe-mobile/src/config.js
linkwe-mobile/src/views/chat/List.vue
linkwe-mobile/src/App.vue
View file @
7867bac
...
...
@@ -4,13 +4,11 @@ export default {
name
:
'App'
,
data
()
{
return
{
appId
:
'
ww24262ce93851488f
'
,
appId
:
''
,
agentId
:
'1000005'
,
}
},
created
()
{
// this.wxConfig()
},
created
()
{},
watch
:
{
// 通过config接口注入权限验证配置
// 所有需要使用JS-SDK的页面必须先注入配置信息,否则将无法调用(同一个url仅需调用一次,对于变化url的SPA(single-page application)的web app可在每次url变化时进行调用)
...
...
@@ -43,48 +41,49 @@ export default {
})
})
},
_wxConfig
()
{
// 获取企业的jsapi_ticket
getAppTicket
(
window
.
location
.
href
).
then
(({
data
})
=>
{
let
{
timestamp
,
nonceStr
,
signature
}
=
data
wx
.
config
({
beta
:
true
,
// 必须这么写,否则wx.invoke调用形式的jsapi会有问题
debug
:
true
,
// 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId
:
this
.
appId
,
// 必填,企业微信的corpID
timestamp
,
// 必填,生成签名的时间戳
nonceStr
,
// 必填,生成签名的随机串
signature
,
// 必填,签名,见 附录-JS-SDK使用权限签名算法
jsApiList
:
[
'getContext'
,
'sendChatMessage'
],
// 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
})
wx
.
ready
(()
=>
{
// config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
getAgentTicket
(
window
.
location
.
href
).
then
(({
data
})
=>
{
let
{
timestamp
,
nonceStr
,
signature
}
=
data
wx
.
agentConfig
({
corpid
:
this
.
appId
,
// 必填,企业微信的corpid,必须与当前登录的企业一致
agentid
:
this
.
agentId
,
// 必填,企业微信的应用id (e.g. 1000247)
timestamp
,
// 必填,生成签名的时间戳
nonceStr
,
// 必填,生成签名的随机串
signature
,
// 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList
:
[
'sendChatMessage'
],
//必填
success
:
(
res
)
=>
{
// 回调
},
fail
:
(
res
)
=>
{
if
(
res
.
errMsg
.
indexOf
(
'function not exist'
)
>
-
1
)
{
alert
(
'版本过低请升级'
)
}
},
})
})
})
// 丢弃
// _wxConfig() {
// // 获取企业的jsapi_ticket
// getAppTicket(window.location.href).then(({ data }) => {
// let { timestamp, nonceStr, signature } = data
// wx.config({
// beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
// debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
// appId: this.appId, // 必填,企业微信的corpID
// timestamp, // 必填,生成签名的时间戳
// nonceStr, // 必填,生成签名的随机串
// signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
// jsApiList: ['getContext', 'sendChatMessage'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
// })
// wx.ready(() => {
// // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
// getAgentTicket(window.location.href).then(({ data }) => {
// let { timestamp, nonceStr, signature } = data
// wx.agentConfig({
// corpid: this.appId, // 必填,企业微信的corpid,必须与当前登录的企业一致
// agentid: this.agentId, // 必填,企业微信的应用id (e.g. 1000247)
// timestamp, // 必填,生成签名的时间戳
// nonceStr, // 必填,生成签名的随机串
// signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
// jsApiList: ['sendChatMessage'], //必填
// success: (res) => {
// // 回调
// },
// fail: (res) => {
// if (res.errMsg.indexOf('function not exist') > -1) {
// alert('版本过低请升级')
// }
// },
// })
// })
// })
wx
.
error
(
function
(
res
)
{
console
.
error
(
res
)
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
})
})
},
//
wx.error(function(res) {
//
console.error(res)
//
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
//
})
//
})
//
},
},
}
</
script
>
...
...
linkwe-mobile/src/config.js
View file @
7867bac
...
...
@@ -4,38 +4,9 @@ const config = {
*/
cookieExpires
:
1
,
/**
* @description 是否使用国际化,默认为false
* 如果不使用,则需要在路由中给需要在菜单中展示的路由设置meta: {title: 'xxx'}
* 用来在菜单中显示文字
*/
useI18n
:
false
,
/**
* @description api请求基础路径
*/
// 测试服
domain
:
process
.
env
.
NODE_ENV
===
'development'
?
'http://192.168.1.32:8888'
:
'http://192.168.1.26:8888'
,
//
// 正式服
// domain: process.env.NODE_ENV === 'development' ? 'http://192.168.1.35:8118' : 'https://gateway.visualinsur.cn:8888', //
/**
* @description 默认打开的首页的路由name值,默认为home
*/
homeName
:
'home'
,
/**
* @description 需要加载的插件
*/
plugin
:
{
// 'error-store': {
// showInHeader: true, // 设为false后不会在顶部显示错误日志徽标
// developmentOff: false // 设为true后在开发环境不会收集错误信息,方便开发中排查错误
// }
},
// get domain() {
// return process.env.NODE_ENV === 'development' ? this.baseUrl.dev : this.baseUrl.pro
// }
}
config
.
services
=
{
...
...
linkwe-mobile/src/views/chat/List.vue
View file @
7867bac
...
...
@@ -184,7 +184,7 @@ export default {
}
wx
.
invoke
(
'sendChatMessage'
,
mes
,
function
(
resSend
)
{
if
(
resSend
.
err_msg
==
'sendChatMessage:ok'
)
{
//发送成功
//发送成功
sdk会自动弹出成功提示,无需再加
// _this.$toast('发送成功')
}
else
{
//错误处理
...
...
@@ -215,28 +215,6 @@ export default {
<
template
>
<div>
<!--
<ul>
<li
class=
"li bfc-o"
>
<van-image
width=
"100"
height=
"100"
src=
"https://img01.yzcdn.cn/vant/cat.jpeg"
/>
<span
class=
"title"
>
afsdafddfasfewgoegoeroigwogjrepgerwgowrgjwoerjgweorgjoerwigjir
</span>
</li>
<div
class=
"info"
>
sdv类型
<div
class=
"fr flex"
>
<div
class=
"action"
@
click=
"send(item)"
>
发送
</div>
<div
v-if=
"!!userId"
class=
"action"
@
click=
"collect(item.materialId)"
>
{{
isCollected
(
item
.
materialId
)
?
'取消'
:
''
}}
收藏
</div>
</div>
</div>
</ul>
-->
<van-pull-refresh
v-model=
"refreshing"
success-text=
"刷新成功"
...
...
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