Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
company_app
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
毛细亚
company_app
Commits
a127a227
提交
a127a227
authored
5月 26, 2025
作者:
毛细亚
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改授权
上级
f222901a
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
42 行增加
和
43 行删除
+42
-43
App.vue
src/App.vue
+35
-14
index.js
src/router/index.js
+5
-2
login.vue
src/views/login.vue
+2
-27
没有找到文件。
src/App.vue
浏览文件 @
a127a227
<
template
>
<div
id=
"app"
class=
"mobile-app-wrapper"
>
<div
class=
"mobile-menu-bar"
>
<div
class=
"mobile-menu-bar"
v-if=
"token"
>
<el-menu
:default-active=
"selectedPath"
mode=
"horizontal"
class=
"mobile-el-menu"
background-color=
"#fff"
router
@
select=
"handleSelect"
>
<el-menu-item
v-for=
"item in menuList"
:key=
"item.path"
:index=
"item.path"
class=
"mobile-menu-item"
>
{{
item
.
label
}}
</el-menu-item>
</el-menu>
<!-- 绑定的 w 账号 -->
<bindUserList
v-if=
"token"
/>
<bindUserList
/>
</div>
<div
class=
"mobile-content"
>
<router-view></router-view>
...
...
@@ -23,6 +24,7 @@
<
script
>
import
bindUserList
from
'@/views/components/bindGameAccount/bindUserList.vue'
import
{
getToken
}
from
'@/utils/auth'
import
{
mapState
}
from
'vuex'
export
default
{
name
:
'App'
,
components
:
{
...
...
@@ -35,10 +37,10 @@ export default {
label
:
'客户信息'
,
path
:
'/userInfo'
},
//
{
//
label: '快捷回复',
//
path: '/quickReply'
//
},
{
label
:
'快捷回复'
,
path
:
'/quickReply'
},
// {
// label: '礼包记录',
// path: '/giftRecord'
...
...
@@ -61,17 +63,36 @@ export default {
}
},
watch
:
{
// '$route.path'(val) {
// this.selectedPath = val
// }
'$route.path'
(
val
)
{
// 处理各种可能的路径情况
if
(
val
===
'/'
||
val
===
'/index.html'
)
{
this
.
selectedPath
=
'/userInfo'
}
else
{
this
.
selectedPath
=
val
}
}
},
computed
:{
...
mapState
(
'user'
,[
'external_userid'
])
},
created
()
{
// if (this.$route.path === '/' || this.$route.path === '') {
// this.$router.replace('/userInfo')
// } else {
// this.selectedPath = this.$route.path
// }
// 初始化时处理路径
const
currentPath
=
this
.
$route
.
path
if
(
currentPath
===
'/'
||
currentPath
===
''
||
currentPath
===
'/index.html'
)
{
this
.
selectedPath
=
'/userInfo'
// 如果当前路径是根路径或 index.html,重定向到 userInfo
if
(
currentPath
===
'/'
||
currentPath
===
'/index.html'
)
{
this
.
$router
.
replace
(
'/userInfo'
)
}
}
else
{
this
.
selectedPath
=
currentPath
}
},
methods
:{
handleSelect
(
key
,
keyPath
)
{
console
.
log
(
key
,
keyPath
,
window
.
location
.
href
)
}
}
}
</
script
>
...
...
src/router/index.js
浏览文件 @
a127a227
...
...
@@ -15,6 +15,10 @@ const routes = [
redirect
:
'/userInfo'
},
{
path
:
'/index.html'
,
redirect
:
'/userInfo'
},
{
path
:
'/userInfo'
,
name
:
'userInfo'
,
component
:
userInfo
...
...
@@ -78,10 +82,9 @@ router.beforeEach((to, from, next) => {
const
wecomUserId
=
Cookies
.
get
(
'userid'
)
const
cser_id
=
Cookies
.
get
(
'cser_id'
)
const
token
=
Cookies
.
get
(
'token'
)
const
external_userid
=
Cookies
.
get
(
'external_userid'
)
const
urlParams
=
getParams
();
if
(
needAuth
)
{
if
(
wecomUserId
&&
token
&&
external_userid
)
{
if
(
wecomUserId
&&
token
)
{
// 登录信息齐全,允许进入
next
()
}
else
{
...
...
src/views/login.vue
浏览文件 @
a127a227
...
...
@@ -43,8 +43,6 @@
</li>
</ul>
</el-dialog>
<div
v-if=
"dingUserInfo"
>
钉钉用户:
{{
dingUserInfo
.
name
}}
</div>
<div
v-if=
"external_userid"
>
企微外部联系人ID:
{{
external_userid
}}
</div>
</div>
</div>
</
template
>
...
...
@@ -62,7 +60,6 @@ export default {
return
{
wecomUserInfo
:
null
,
// 企微用户信息
dingUserInfo
:
null
,
// 钉钉用户信息
external_userid
:
null
,
// 企微外部联系人ID
signData
:
null
,
// 企微签名数据
orgList
:
[],
urlParams
:{},
...
...
@@ -100,7 +97,7 @@ export default {
...
mapState
(
'user'
,[
'corp_id'
])
},
methods
:
{
...
mapMutations
(
'user'
,[
'set_corp_id'
,
'set_userid'
,
'set_
external_userid'
,
'set_
userInfo'
,
'set_token'
,
'set_cser_info'
,
'set_signData'
,
'set_cser_id'
,
'set_cser_name'
]),
...
mapMutations
(
'user'
,[
'set_corp_id'
,
'set_userid'
,
'set_userInfo'
,
'set_token'
,
'set_cser_info'
,
'set_signData'
,
'set_cser_id'
,
'set_cser_name'
]),
// 设置缓存
cacheCorp_id
(
corp_id
){
Cookies
.
set
(
'corp_id'
,
corp_id
,
{
expires
:
7
})
...
...
@@ -124,10 +121,6 @@ export default {
this
.
set_cser_id
(
cser_id
)
this
.
set_cser_name
(
cser_name
)
},
cacheExternal_userid
(
external_userid
){
Cookies
.
set
(
'external_userid'
,
external_userid
,
{
expires
:
7
})
this
.
set_external_userid
(
external_userid
)
},
cacheSignData
(
signData
){
Cookies
.
set
(
'signData'
,
JSON
.
stringify
(
signData
),
{
expires
:
7
})
this
.
set_signData
(
signData
)
...
...
@@ -174,7 +167,6 @@ export default {
window
.
location
.
href
=
window
.
location
.
origin
+
'/company_app/index.html?corp_id='
+
corp_id
+
'&msg=signerror'
}
},
// 2. 注册企微JS-SDK
registerWeComSDK
()
{
console
.
log
(
'删除企业签名'
,
1231
)
...
...
@@ -196,7 +188,7 @@ export default {
onAgentConfigSuccess
:
(
res
)
=>
{
console
.
log
(
'注册成功可以调用企微 js-sdk'
,
res
)
// 注册成功后不立即获取外部联系人,等钉钉扫码后再获取
this
.
getCurExternalContact
(
)
this
.
$router
.
push
(
'/'
)
},
onAgentConfigFail
:
(
err
)
=>
{
console
.
log
(
'注册失败不能使用企微js-sdk'
,
err
)
...
...
@@ -300,23 +292,6 @@ export default {
}
},
// 8. 获取企微外部联系人
getCurExternalContact
()
{
ww
.
getCurExternalContact
({
success
:
(
res
)
=>
{
if
(
res
.
err_msg
===
"getCurExternalContact:ok"
)
{
this
.
external_userid
=
res
.
userId
;
this
.
cacheExternal_userid
(
this
.
external_userid
)
console
.
log
(
this
.
external_userid
,
'获取企微外部联系人'
)
this
.
$router
.
push
(
'/'
)
// 一切准备工作就绪 所有信息都已获取到
}
},
fail
:
(
err
)
=>
{
console
.
log
(
err
,
'获取企微外部联系人失败'
)
// 错误处理
}
});
},
refreshDingTalkQRCode
()
{
this
.
initDingTalkLogin
();
},
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论