Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
folacin-front
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ynby
folacin-front
Commits
2c26227e
Commit
2c26227e
authored
Feb 19, 2025
by
罗成兵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取用户信息
parent
c8c30e69
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
30 deletions
+29
-30
debugInfo.vue
folacin-app/src/views/index/debugInfo.vue
+3
-1
index.vue
folacin-app/src/views/index/index.vue
+26
-29
No files found.
folacin-app/src/views/index/debugInfo.vue
View file @
2c26227e
...
...
@@ -15,9 +15,11 @@
finished-text=
""
>
<van-cell
:title=
"'Token: '+userInfo.token"
/>
<van-cell
:title=
"'姓名: '+userInfo.nickName"
/>
<van-cell
:title=
"'性别: '+(userInfo.nickName==1?'男':'女')"
/>
<van-cell
:title=
"'账号: '+userInfo.account"
/>
<van-cell
:title=
"'用户ID: '+userInfo.userId"
/>
<van-cell
:title=
"'Token: '+userInfo.token"
/>
<van-cell
:title=
"'接入地址: '+userInfo.domain"
/>
</van-list>
<br>
...
...
folacin-app/src/views/index/index.vue
View file @
2c26227e
...
...
@@ -39,7 +39,7 @@ export default {
if
(
path
!=
'/'
)
{
return
;
}
vm
.
getUserByToken
(
result
,
false
);
vm
.
getUserByToken
(
result
,
false
);
};
},
mounted
()
{
...
...
@@ -50,55 +50,52 @@ export default {
},
methods
:
{
init
()
{
if
(
process
.
env
.
NODE_ENV
==
"dev"
)
{
let
userInfo
=
{
account
:
'18487125843'
,
token
:
'd2e2c11475a04436bbcf1ca96a7ee056'
,
account
:
null
,
token
:
"349eb2231a36490e88bbbe34eb330a5c"
,
userId
:
null
,
residentId
:
null
,
nickName
:
null
,
realName
:
null
,
gender
:
null
,
headPortrait
:
null
,
domain
:
window
.
location
.
href
};
this
.
initUserInfo
(
userInfo
,
true
);
this
.
getUserByToken
(
userInfo
,
true
);
if
(
process
.
env
.
NODE_ENV
==
"dev1"
)
{
this
.
initUserInfo
(
userInfo
,
true
);
this
.
getUserByToken
(
userInfo
,
true
);
}
else
{
let
query
=
this
.
$route
.
query
;
let
userInfo
=
{
account
:
query
.
account
,
token
:
query
.
token
,
userId
:
null
,
domain
:
window
.
location
.
href
};
this
.
initUserInfo
(
userInfo
,
true
);
if
(
!
userInfo
.
token
&&
!
userInfo
.
account
)
{
this
.
msg
=
"用户信息获取失败!"
userInfo
.
token
=
query
.
token
this
.
initUserInfo
(
userInfo
,
true
);
if
(
!
userInfo
.
token
)
{
this
.
msg
=
"获取用户信息异常!"
callMobile
(
'init'
,
{});
}
else
{
if
(
!
userInfo
.
token
)
{
this
.
msg
=
"Token获取失败!"
return
;
}
if
(
!
userInfo
.
account
)
{
this
.
msg
=
"账号获取失败!"
return
;
}
this
.
getUserByToken
(
userInfo
,
true
)
this
.
getUserByToken
(
userInfo
,
true
)
}
}
},
getUserByToken
(
userInfo
,
isPc
)
{
getUserByToken
(
userInfo
,
isPc
)
{
getUserByToken
(
userInfo
.
token
).
then
(
res
=>
{
if
(
res
.
code
==
'SUCCESS'
)
{
userInfo
.
userId
=
res
.
data
this
.
initUserInfo
(
userInfo
,
isPc
);
userInfo
.
userId
=
res
.
data
.
userId
;
userInfo
.
account
=
res
.
data
.
account
;
userInfo
.
residentId
=
res
.
data
.
residentId
;
userInfo
.
nickName
=
res
.
data
.
nickName
;
userInfo
.
gender
=
res
.
data
.
gender
;
userInfo
.
headPortrait
=
res
.
data
.
headPortrait
;
this
.
initUserInfo
(
userInfo
,
isPc
);
this
.
showMsg
();
}
else
{
this
.
msg
=
"
用户id获取失败
!"
this
.
msg
=
"
获取用户信息异常
!"
}
})
},
handleBack
()
{
callMobile
(
'goIndex'
,
{});
},
initUserInfo
(
val
,
isPc
)
{
initUserInfo
(
val
,
isPc
)
{
if
(
isPc
)
{
window
.
sessionStorage
.
setItem
(
'userInfo'
,
JSON
.
stringify
(
val
));
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment