Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
company_app
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
毛细亚
company_app
Commits
703957ab
提交
703957ab
authored
5月 26, 2025
作者:
毛细亚
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调试完成
上级
a127a227
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
29 行增加
和
15 行删除
+29
-15
App.vue
src/App.vue
+2
-5
index.js
src/router/index.js
+2
-1
user.js
src/store/modules/user.js
+1
-1
login.vue
src/views/login.vue
+23
-6
userInfo.vue
src/views/userInfo/userInfo.vue
+1
-2
没有找到文件。
src/App.vue
浏览文件 @
703957ab
<
template
>
<div
id=
"app"
class=
"mobile-app-wrapper"
>
<div
class=
"mobile-menu-bar"
v-if=
"token"
>
<div
class=
"mobile-menu-bar"
v-if=
"token
&& external_userid
"
>
<el-menu
:default-active=
"selectedPath"
mode=
"horizontal"
...
...
@@ -80,10 +80,7 @@ export default {
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
}
...
...
src/router/index.js
浏览文件 @
703957ab
...
...
@@ -7,6 +7,7 @@ import applyRecord from '../views/applyRecord.vue'
import
quickSend
from
'../views/quickSend.vue'
import
addressBook
from
'../views/addressBook.vue'
import
Cookies
from
'js-cookie'
import
store
from
'@/store'
Vue
.
use
(
VueRouter
)
import
{
getParams
}
from
'@/utils/index'
const
routes
=
[
...
...
@@ -84,7 +85,7 @@ router.beforeEach((to, from, next) => {
const
token
=
Cookies
.
get
(
'token'
)
const
urlParams
=
getParams
();
if
(
needAuth
)
{
if
(
wecomUserId
&&
token
)
{
if
(
wecomUserId
&&
token
&&
store
.
state
.
user
.
external_userid
)
{
// 登录信息齐全,允许进入
next
()
}
else
{
...
...
src/store/modules/user.js
浏览文件 @
703957ab
...
...
@@ -27,7 +27,7 @@ const state = {
time
:
''
},
weixin_blongs_id_list
:[],
external_userid
:
Cookies
.
get
(
'external_userid'
)
external_userid
:
''
// 六子的 用户id wm5rUgMgAAjqjOcqp8i3lEhFZDQieWug
// 我的 userid JinDuoXia cser_id 4090 corp_id wweaefe716636df3d1 cser_id 4090 token token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. eyJpc3MiOjQwOTAsImlhdCI6MTc0NzgxMjMxMiwiZXhwIjoxNzQ4NDE3MTEyLCJuYmYiOjE3NDc4MTIzMTIsInN1YiI6InRva2Vu6K6k6K-BIiwianRpIjoiMjBkOTY3MDZiYzI1MDdmY2MxOWI2MjU1YTM0YWQ3M2YifQ.yX7E7QHV7x2ubpa8iK3Avy794EiHNCaW2CtB4A4UQWo
}
...
...
src/views/login.vue
浏览文件 @
703957ab
// UnifiedLogin.vue
<
template
>
<div
class=
"loginContent"
>
<div>
<div
v-if=
"!token"
>
<div>
当前组织:
<span
class=
"current-org"
>
{{
currentOrg
.
name
}}
</span>
<el-button
type=
"text"
@
click=
"showOrgDialog = true"
>
切换组织
</el-button>
...
...
@@ -70,17 +70,19 @@ export default {
qrLoading
:
false
,
// 控制二维码 loading
redirectUri
:
process
.
env
.
NODE_ENV
===
'production'
?
'https://companywx.zwnet.cn/api/api/sidebar_login/ding'
:
'https://companywx.zwwlkj03.top/api/api/sidebar_login/ding'
,
DDTestUrl
:
''
,
token
:
getToken
()
}
},
async
mounted
()
{
await
this
.
initOrganization
();
const
urlParams
=
getParams
();
const
userid
=
Cookies
.
get
(
'userid'
)
console
.
log
(
urlParams
,
'mounted'
)
// 如果是钉钉扫码回调页面
if
(
urlParams
.
type
&&
urlParams
.
type
===
'ding'
)
{
// 钉钉回调
this
.
handleDingCallback
();
}
else
{
}
else
if
(
this
.
token
){
// 已经钉钉扫码过 重新获取授权 获取签名 注册企微js-sdk
await
this
.
getSignature
();
}
else
{
if
(
!
userid
){
//没有企微授权过 并且 钉钉扫码成功 开始微信授权
await
this
.
startWeComSilentAuth
();
}
else
{
...
...
@@ -97,7 +99,7 @@ export default {
...
mapState
(
'user'
,[
'corp_id'
])
},
methods
:
{
...
mapMutations
(
'user'
,[
'set_corp_id'
,
'set_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'
,
'set_external_userid'
]),
// 设置缓存
cacheCorp_id
(
corp_id
){
Cookies
.
set
(
'corp_id'
,
corp_id
,
{
expires
:
7
})
...
...
@@ -167,6 +169,21 @@ export default {
window
.
location
.
href
=
window
.
location
.
origin
+
'/company_app/index.html?corp_id='
+
corp_id
+
'&msg=signerror'
}
},
getCurExternalContact
()
{
ww
.
getCurExternalContact
({
success
:
(
res
)
=>
{
if
(
res
.
err_msg
===
"getCurExternalContact:ok"
)
{
console
.
log
(
res
,
'重新进入获取企微外部联系人'
)
this
.
set_external_userid
(
res
.
userId
)
this
.
$router
.
push
(
'/userInfo'
)
}
},
fail
:
(
err
)
=>
{
console
.
log
(
err
,
'获取企微外部联系人失败'
)
// 错误处理
}
});
},
// 2. 注册企微JS-SDK
registerWeComSDK
()
{
console
.
log
(
'删除企业签名'
,
1231
)
...
...
@@ -188,7 +205,7 @@ export default {
onAgentConfigSuccess
:
(
res
)
=>
{
console
.
log
(
'注册成功可以调用企微 js-sdk'
,
res
)
// 注册成功后不立即获取外部联系人,等钉钉扫码后再获取
this
.
$router
.
push
(
'/'
)
this
.
getCurExternalContact
(
)
},
onAgentConfigFail
:
(
err
)
=>
{
console
.
log
(
'注册失败不能使用企微js-sdk'
,
err
)
...
...
src/views/userInfo/userInfo.vue
浏览文件 @
703957ab
...
...
@@ -53,11 +53,10 @@ export default {
},
methods
:{
...
mapMutations
(
'game'
,[
'set_chatUserInfo'
]),
...
mapMutations
(
'user'
,[
'set_userid'
,
'set_corp_id'
,
'set_
external_userid'
,
'set_
token'
,
'set_cser_info'
,
'set_cser_id'
,
'set_cser_name'
]),
...
mapMutations
(
'user'
,[
'set_userid'
,
'set_corp_id'
,
'set_token'
,
'set_cser_info'
,
'set_cser_id'
,
'set_cser_name'
]),
initVuexValue
(){
this
.
set_userid
(
Cookies
.
get
(
'userid'
))
this
.
set_corp_id
(
Cookies
.
get
(
'corp_id'
))
this
.
set_external_userid
(
Cookies
.
get
(
'external_userid'
))
this
.
set_token
(
Cookies
.
get
(
'token'
))
this
.
set_cser_id
(
Cookies
.
get
(
'cser_id'
))
this
.
set_cser_name
(
Cookies
.
get
(
'cser_name'
))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论