Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
self-support
Project
Project
Details
Activity
Releases
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
李俊赕
self-support
Commits
983dfe1e
Commit
983dfe1e
authored
Apr 21, 2021
by
Morson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复页面回调问题
parent
0027a4a4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
7 deletions
+19
-7
App.vue
src/App.vue
+2
-2
index.vue
src/pages/index/index.vue
+1
-1
index.vue
src/pages/login/index.vue
+12
-0
login.js
src/utils/login.js
+4
-4
No files found.
src/App.vue
View file @
983dfe1e
...
@@ -129,10 +129,10 @@ export default {
...
@@ -129,10 +129,10 @@ export default {
if
(
userInfo
&&
userInfo
.
token
)
{
if
(
userInfo
&&
userInfo
.
token
)
{
// 如果已经登录则直接获取相关信息
// 如果已经登录则直接获取相关信息
util
.
setOpenid
(
userInfo
.
wxopenid
);
util
.
setOpenid
(
userInfo
.
wxopenid
);
this
.
$u
.
vuex
(
"vuex_token"
,
userInfo
.
token
);
this
.
$u
.
vuex
(
'vuex_token'
,
userInfo
.
token
);
uni
.
setStorageSync
(
"user-info"
,
userInfo
);
uni
.
setStorageSync
(
"user-info"
,
userInfo
);
}
else
{
}
else
{
this
.
$u
.
vuex
(
"vuex_token"
,
""
);
this
.
$u
.
vuex
(
'vuex_token'
,
''
);
}
}
},
},
...
...
src/pages/index/index.vue
View file @
983dfe1e
...
@@ -144,7 +144,7 @@ export default {
...
@@ -144,7 +144,7 @@ export default {
watch
:
{
watch
:
{
vuex_token
(
val
){
vuex_token
(
val
){
// 监听token变化,如果更新则重新加载页面数据
// 监听token变化,如果更新则重新加载页面数据
this
.
initSettleInfo
()
val
&&
this
.
initSettleInfo
()
}
}
},
},
computed
:
{
computed
:
{
...
...
src/pages/login/index.vue
View file @
983dfe1e
...
@@ -90,6 +90,7 @@ export default {
...
@@ -90,6 +90,7 @@ export default {
}).
then
(
res
=>
{
}).
then
(
res
=>
{
uni
.
hideLoading
();
uni
.
hideLoading
();
if
(
res
)
{
if
(
res
)
{
that
.
setUserData
(
res
.
data
)
that
.
goBackPage
()
that
.
goBackPage
()
}
else
{
}
else
{
this
.
setLoginStatus
()
this
.
setLoginStatus
()
...
@@ -124,6 +125,7 @@ export default {
...
@@ -124,6 +125,7 @@ export default {
}).
then
(
res
=>
{
}).
then
(
res
=>
{
uni
.
hideLoading
()
uni
.
hideLoading
()
if
(
res
)
{
if
(
res
)
{
that
.
setUserData
(
res
.
data
)
that
.
goBackPage
()
that
.
goBackPage
()
}
else
{
}
else
{
uni
.
showToast
({
uni
.
showToast
({
...
@@ -167,6 +169,16 @@ export default {
...
@@ -167,6 +169,16 @@ export default {
}
}
},
},
setUserData
(
userInfo
)
{
if
(
userInfo
&&
userInfo
.
token
)
{
// 如果已经登录则直接获取相关信息
util
.
setOpenid
(
userInfo
.
wxopenid
);
this
.
$u
.
vuex
(
'vuex_token'
,
userInfo
.
token
);
uni
.
setStorageSync
(
"user-info"
,
userInfo
);
}
else
{
this
.
$u
.
vuex
(
'vuex_token'
,
''
);
}
},
setLoginStatus
(
authed
=
true
)
{
setLoginStatus
(
authed
=
true
)
{
if
(
authed
)
{
if
(
authed
)
{
...
...
src/utils/login.js
View file @
983dfe1e
...
@@ -33,8 +33,8 @@ function authorization(data) {
...
@@ -33,8 +33,8 @@ function authorization(data) {
const
res
=
await
app
.
$vm
.
$u
.
api
.
loginWechatAuth
(
data
)
const
res
=
await
app
.
$vm
.
$u
.
api
.
loginWechatAuth
(
data
)
if
(
res
)
{
if
(
res
)
{
if
(
res
.
code
==
200
&&
res
.
data
)
{
if
(
res
.
code
==
200
&&
res
.
data
)
{
app
.
setUserData
(
res
.
data
)
//
app.setUserData(res.data)
app
.
getBaseInfo
(
app
.
$vm
)
//
app.getBaseInfo(app.$vm)
resolve
(
res
);
resolve
(
res
);
}
else
{
}
else
{
reject
(
res
);
reject
(
res
);
...
@@ -55,8 +55,8 @@ function signup(data) {
...
@@ -55,8 +55,8 @@ function signup(data) {
const
res
=
await
app
.
$vm
.
$u
.
api
.
loginWechatAuth
(
data
)
const
res
=
await
app
.
$vm
.
$u
.
api
.
loginWechatAuth
(
data
)
if
(
res
)
{
if
(
res
)
{
if
(
res
.
code
==
200
&&
res
.
data
)
{
if
(
res
.
code
==
200
&&
res
.
data
)
{
app
.
setUserData
(
res
.
data
)
//
app.setUserData(res.data)
app
.
getBaseInfo
(
app
.
$vm
)
//
app.getBaseInfo(app.$vm)
resolve
(
res
);
resolve
(
res
);
}
else
{
}
else
{
uni
.
showModal
({
uni
.
showModal
({
...
...
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