Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
仟微科技
Link Wechat
提交
0b0758fa
Link Wechat
项目概览
仟微科技
/
Link Wechat
通知
48
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Link Wechat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0b0758fa
编写于
3月 11, 2021
作者:
X
xinla
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
h5配置修改
上级
4ba1ec81
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
193 addition
and
129 deletion
+193
-129
linkwe-mobile/src/App.vue
linkwe-mobile/src/App.vue
+53
-30
linkwe-mobile/src/api/common.js
linkwe-mobile/src/api/common.js
+4
-4
linkwe-mobile/src/store/index.js
linkwe-mobile/src/store/index.js
+8
-6
linkwe-mobile/src/utils/index.js
linkwe-mobile/src/utils/index.js
+20
-0
linkwe-mobile/src/views/chat/index.vue
linkwe-mobile/src/views/chat/index.vue
+7
-41
linkwe-mobile/src/views/portrait/index.vue
linkwe-mobile/src/views/portrait/index.vue
+101
-48
未找到文件。
linkwe-mobile/src/App.vue
浏览文件 @
0b0758fa
<
script
>
import
{
getUserInfo
}
from
'
@/api/common
'
import
{
getAgentTicket
,
getAppTicket
}
from
'
@/api/common
'
import
{
param2Obj
}
from
'
@/utils/index
'
export
default
{
name
:
'
App
'
,
data
()
{
return
{
ap
pId
:
''
,
agentId
:
'
1000005
'
,
cor
pId
:
''
,
agentId
:
''
,
}
},
created
()
{},
async
created
()
{
// http://106.13.201.219/?code=xxx&state=linkwechat#/route
// console.log('routerbeforeCreate', this.$route);
// this.$dialog({ message: 'url' + JSON.stringify(window.location) })
let
query
=
param2Obj
(
window
.
location
.
search
)
let
code
=
query
.
code
this
.
corpId
=
query
.
corpId
this
.
agentId
=
query
.
agentId
if
(
!
code
)
{
this
.
$toast
(
'
未获得授权
'
)
return
}
let
{
data
}
=
await
getUserInfo
(
code
,
query
.
agentId
)
this
.
$store
.
state
.
userId
=
data
.
userId
// this.$toast('userId:' + this.$store.state.userId)
},
watch
:
{
// 通过config接口注入权限验证配置
// 所有需要使用JS-SDK的页面必须先注入配置信息,否则将无法调用(同一个url仅需调用一次,对于变化url的SPA(single-page application)的web app可在每次url变化时进行调用)
//
$route() {
//
this.wxConfig()
//
},
$route
()
{
this
.
wxConfig
()
},
},
methods
:
{
wxConfig
()
{
getAgentTicket
(
window
.
location
.
href
.
split
(
'
#
'
)[
0
]).
then
(({
data
})
=>
{
let
{
timestamp
,
nonceStr
,
signature
}
=
data
wx
.
agentConfig
({
debug
:
true
,
corpid
:
this
.
appId
,
// 必填,企业微信的corpid,必须与当前登录的企业一致
agentid
:
this
.
agentId
,
// 必填,企业微信的应用id (e.g. 1000247)
timestamp
,
// 必填,生成签名的时间戳
nonceStr
,
// 必填,生成签名的随机串
signature
,
// 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList
:
[
'
sendChatMessage
'
,
'
getContext
'
],
//必填
success
:
(
res
)
=>
{
// 回调
// this.$toast('agentId成功:')
},
fail
:
(
res
)
=>
{
this
.
$toast
(
'
agentId失败:
'
+
JSON
.
stringify
(
res
))
if
(
res
.
errMsg
.
indexOf
(
'
function not exist
'
)
>
-
1
)
{
alert
(
'
版本过低请升级
'
)
}
},
})
})
getAgentTicket
(
window
.
location
.
href
.
split
(
'
#
'
)[
0
],
this
.
agentId
).
then
(
({
data
})
=>
{
let
{
timestamp
,
nonceStr
,
signature
}
=
data
wx
.
agentConfig
({
debug
:
true
,
corpid
:
this
.
corpId
,
// 必填,企业微信的corpid,必须与当前登录的企业一致
agentid
:
this
.
agentId
,
// 必填,企业微信的应用id (e.g. 1000247)
timestamp
,
// 必填,生成签名的时间戳
nonceStr
,
// 必填,生成签名的随机串
signature
,
// 必填,签名,见附录-JS-SDK使用权限签名算法
jsApiList
:
[
'
sendChatMessage
'
,
'
getContext
'
,
'
getCurExternalContact
'
,
],
//必填
success
:
(
res
)
=>
{
// 回调
// this.$toast('agentId成功:')
},
fail
:
(
res
)
=>
{
this
.
$toast
(
'
agentId失败:
'
+
JSON
.
stringify
(
res
))
if
(
res
.
errMsg
.
indexOf
(
'
function not exist
'
)
>
-
1
)
{
alert
(
'
版本过低请升级
'
)
}
},
})
}
)
},
// 丢弃
// _wxConfig() {
...
...
@@ -49,7 +72,7 @@ export default {
// wx.config({
// beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
// debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
//
appId: this.ap
pId, // 必填,企业微信的corpID
//
corpId: this.cor
pId, // 必填,企业微信的corpID
// timestamp, // 必填,生成签名的时间戳
// nonceStr, // 必填,生成签名的随机串
// signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
...
...
@@ -60,7 +83,7 @@ export default {
// getAgentTicket(window.location.href).then(({ data }) => {
// let { timestamp, nonceStr, signature } = data
// wx.agentConfig({
// corpid: this.
ap
pId, // 必填,企业微信的corpid,必须与当前登录的企业一致
// corpid: this.
cor
pId, // 必填,企业微信的corpid,必须与当前登录的企业一致
// agentid: this.agentId, // 必填,企业微信的应用id (e.g. 1000247)
// timestamp, // 必填,生成签名的时间戳
// nonceStr, // 必填,生成签名的随机串
...
...
linkwe-mobile/src/api/common.js
浏览文件 @
0b0758fa
...
...
@@ -6,12 +6,12 @@ const service = config.services.wecom
* 获取应用的jsapi_ticket
* @param {*} url 页面url
*/
export
function
getAgentTicket
(
url
)
{
export
function
getAgentTicket
(
url
,
agentId
)
{
return
request
({
url
:
service
+
'
/ticket/getAgentTicket
'
,
params
:
{
url
,
agentId
:
'
1000005
'
,
agentId
,
},
})
}
...
...
@@ -33,12 +33,12 @@ export function getAppTicket(url) {
* 获取登录用户id
* @param {*} url 页面url
*/
export
function
getUserInfo
(
code
)
{
export
function
getUserInfo
(
code
,
agentId
)
{
return
request
({
url
:
service
+
'
/user/getUserInfo
'
,
params
:
{
code
,
agentId
:
'
1000005
'
,
agentId
,
},
})
}
linkwe-mobile/src/store/index.js
浏览文件 @
0b0758fa
import
Vue
from
"
vue
"
;
import
Vuex
from
"
vuex
"
;
import
Vue
from
'
vue
'
import
Vuex
from
'
vuex
'
Vue
.
use
(
Vuex
)
;
Vue
.
use
(
Vuex
)
export
default
new
Vuex
.
Store
({
state
:
{},
state
:
{
userId
:
''
,
},
mutations
:
{},
actions
:
{},
modules
:
{}
})
;
modules
:
{}
,
})
linkwe-mobile/src/utils/index.js
0 → 100644
浏览文件 @
0b0758fa
/**
* 请求路径参数转为对象
* @param {*} url
*/
export
function
param2Obj
(
url
)
{
const
search
=
decodeURIComponent
(
url
)
.
split
(
'
?
'
)[
1
]
.
split
(
'
#
'
)[
0
]
if
(
!
search
)
{
return
{}
}
return
JSON
.
parse
(
'
{"
'
+
search
.
replace
(
/"/g
,
'
\\
"
'
)
.
replace
(
/&/g
,
'
","
'
)
.
replace
(
/=/g
,
'
":"
'
)
+
'
"}
'
)
}
linkwe-mobile/src/views/chat/index.vue
浏览文件 @
0b0758fa
<
script
>
import
{
getUserInfo
}
from
'
@/api/common
'
import
{
getTypeList
}
from
'
@/api/chat
'
import
List
from
'
./List
'
export
default
{
...
...
@@ -13,51 +12,18 @@ export default {
loading
:
false
,
finished
:
false
,
show
:
false
,
userId
:
''
,
// userId: this.$store.state.userId
,
}
},
watch
:
{},
computed
:
{},
beforeCreate
()
{
// http://106.13.201.219/?auth_code=xxx#/authWehatCallback
// console.log('routerbeforeCreate', this.$route);
// let auth_code = location.search
// .slice(1)
// .split('&')[0]
// .split('=')[1]
// if (!auth_code) {
// this.$toast('未获得授权')
// return
// }
// getUserInfo(auth_code)
// .then(({ data }) => {
// this.userId = data.userId
// this.$toast('userId:' + this.userId)
// })
// .catch((err) => {
// this.$toast('err:' + err)
// })
computed
:
{
userId
()
{
return
this
.
$store
.
state
.
userId
},
},
beforeCreate
()
{},
created
()
{
let
auth_code
=
location
.
search
.
slice
(
1
)
.
split
(
'
&
'
)[
0
]
.
split
(
'
=
'
)[
1
]
if
(
!
auth_code
)
{
this
.
$toast
(
'
未获得授权
'
)
return
}
getUserInfo
(
auth_code
)
.
then
(({
data
})
=>
{
this
.
userId
=
data
.
userId
// this.$toast('userId:' + this.userId)
})
.
catch
((
err
)
=>
{
Dialog
.
confirm
({
title
:
'
标题
'
,
message
:
err
,
})
})
// this.$toast('userId:' + this.$store.state.userId)
this
.
getList
()
},
mounted
()
{},
...
...
linkwe-mobile/src/views/portrait/index.vue
浏览文件 @
0b0758fa
...
...
@@ -333,7 +333,7 @@
</
template
>
<
script
>
import
{
getCustomerInfo
}
from
'
@/api/portrait
'
import
{
getCustomerInfo
}
from
'
@/api/portrait
'
export
default
{
data
()
{
return
{
...
...
@@ -341,71 +341,136 @@ export default {
show
:
false
,
// 客户待办的弹出框开始
usershow
:
false
,
conagency
:
""
,
// 待办内容
conagency
:
''
,
// 待办内容
// 待办日期
dateagency
:
""
,
dateagency
:
''
,
dateshow
:
false
,
minDate
:
new
Date
(
2021
,
0
,
1
),
maxDate
:
new
Date
(
2021
,
12
,
31
),
// 待办时间
timeagency
:
""
,
timeagency
:
''
,
starttimeshow
:
false
,
endtimeshow
:
false
,
currentTime
:
"
12:00
"
,
startTime
:
""
,
endTime
:
""
,
currentTime
:
'
12:00
'
,
startTime
:
''
,
endTime
:
''
,
// 客户待办的弹出框结束
actions
:
[{
name
:
"
选项一
"
},
{
name
:
"
选项二
"
},
{
name
:
"
选项三
"
}],
actions
:
[{
name
:
'
选项一
'
},
{
name
:
'
选项二
'
},
{
name
:
'
选项三
'
}],
// 步骤条
active
:
-
1
,
// 客户轨迹
// 待办动态
todonewsshow
:
false
,
// 接口开始
externalUserid
:
""
,
// 客户Id
userid
:
""
,
// 员工Id
};
externalUserid
:
''
,
// 客户Id
userId
:
''
,
// 员工Id
}
},
watch
:
{
'
$store.state.userId
'
(
val
)
{
this
.
userId
=
val
this
.
getDetail
()
},
},
methods
:
{
getDetail
()
{
this
.
$toast
.
loading
({
message
:
'
正在加载...
'
,
duration
:
0
,
forbidClick
:
true
,
})
let
entry
=
undefined
let
_this
=
this
wx
.
invoke
(
'
getContext
'
,
{},
function
(
res
)
{
if
(
res
.
err_msg
==
'
getContext:ok
'
)
{
entry
=
res
.
entry
//返回进入H5页面的入口类型,目前有normal、contact_profile、single_chat_tools、group_chat_tools
if
(
!
[
'
single_chat_tools
'
,
'
group_chat_tools
'
,
'
contact_profile
'
,
].
includes
(
entry
)
)
{
// _this.$toast.clear()
_this
.
$toast
(
'
入口错误:
'
+
entry
)
return
}
wx
.
invoke
(
'
getCurExternalContact
'
,
{},
function
(
resContact
)
{
if
(
resContact
.
err_msg
==
'
getCurExternalContact:ok
'
)
{
this
.
externalUserid
=
resContact
.
userId
//返回当前外部联系人userId
// 获取客户详细信息
getCustomerInfo
({
externalUserid
:
this
.
externalUserid
,
userid
:
this
.
userId
,
})
.
then
(({
data
})
=>
{
_this
.
$toast
.
clear
()
console
.
log
(
data
)
_this
.
$dialog
({
message
:
'
获取客户失败:
'
+
JSON
.
stringify
(
data
),
})
})
.
catch
((
err
)
=>
{
_this
.
$toast
.
clear
()
console
.
log
(
err
)
_this
.
$dialog
({
message
:
'
获取客户失败:
'
+
JSON
.
stringify
(
err
),
})
})
}
else
{
_this
.
$toast
.
clear
()
//错误处理
_this
.
$dialog
({
message
:
'
获取客户id失败:
'
+
JSON
.
stringify
(
resContact
),
})
}
})
}
else
{
_this
.
$toast
.
clear
()
//错误处理
_this
.
$dialog
({
message
:
'
进入失败:
'
+
JSON
.
stringify
(
res
)
})
}
})
},
// 添加代办
// 表单提交
onSubmit
()
{},
// 待办日期
formatDate
(
dateagency
)
{
return
`
${
dateagency
.
getFullYear
()}
-
${
dateagency
.
getMonth
()
+
1
}
-
${
dateagency
.
getDate
()}
`
;
1
}
-
${
dateagency
.
getDate
()}
`
},
onConfirm
(
dateagency
)
{
this
.
dateshow
=
false
;
this
.
dateagency
=
this
.
formatDate
(
dateagency
)
;
this
.
dateshow
=
false
this
.
dateagency
=
this
.
formatDate
(
dateagency
)
},
// 待办时间
timecancel
()
{
this
.
starttimeshow
=
false
;
this
.
starttimeshow
=
false
},
starttimeconfirm
(
value
)
{
this
.
startTime
=
value
;
this
.
starttimeshow
=
false
;
this
.
endtimeshow
=
true
;
this
.
startTime
=
value
this
.
starttimeshow
=
false
this
.
endtimeshow
=
true
},
endtimeconfirm
(
value
)
{
this
.
endTime
=
value
;
this
.
endtimeshow
=
false
;
let
time
=
""
;
this
.
endTime
=
value
this
.
endtimeshow
=
false
let
time
=
''
if
(
this
.
startTime
>
this
.
endTime
)
{
time
=
this
.
startTime
;
this
.
startTime
=
this
.
endTime
;
this
.
endTime
=
time
;
time
=
this
.
startTime
this
.
startTime
=
this
.
endTime
this
.
endTime
=
time
}
// console.log(this.startTime, this.endTime);
this
.
endtimeshow
=
false
;
this
.
timeagency
=
this
.
formatTime
()
;
this
.
endtimeshow
=
false
this
.
timeagency
=
this
.
formatTime
()
},
formatTime
()
{
return
`
${
this
.
startTime
}
-
${
this
.
endTime
}
`
;
return
`
${
this
.
startTime
}
-
${
this
.
endTime
}
`
},
// 待办动态
// 点击删除按钮
...
...
@@ -413,44 +478,32 @@ export default {
goRoute
()
{
this
.
$router
.
push
({
path
:
"
/detail
"
,
path
:
'
/detail
'
,
query
:
{
// type
},
})
;
})
},
detailGoRoute
()
{
this
.
$router
.
push
({
path
:
"
/community
"
,
path
:
'
/community
'
,
query
:
{
// type
},
})
;
})
},
// 第一层标签
userLabel
()
{
console
.
log
(
123
)
;
console
.
log
(
123
)
},
// 第二层标签
changeLabel
()
{
console
.
log
(
456
)
;
console
.
log
(
456
)
},
saveInfo
()
{},
},
created
()
{
// 获取客户详细信息
getCustomerInfo
({
externalUserid
:
this
.
externalUserid
,
userid
:
this
.
userid
,
})
.
then
(({
data
})
=>
{
console
.
log
(
data
);
})
.
catch
((
err
)
=>
{
console
.
log
(
err
);
});
},
};
created
()
{},
}
</
script
>
<
style
lang=
"less"
scoped
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录