Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
cfcbb836
Commit
cfcbb836
authored
May 06, 2020
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改登录报错问题
parent
96451a43
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
10 deletions
+28
-10
src/pages/login/index.vue
+28
-10
No files found.
src/pages/login/index.vue
View file @
cfcbb836
...
...
@@ -37,6 +37,7 @@ export default {
},
data
()
{
return
{
code
:
""
,
session_key
:
""
,
shopName
:
""
,
logoUrl
:
""
,
...
...
@@ -66,6 +67,32 @@ export default {
};
},
created
()
{},
onShow
()
{
wx
.
checkSession
({
success
:
()
=>
{
//session_key 未过期,并且在本生命周期一直有效
wx
.
login
({
success
:
res
=>
{
this
.
code
=
res
.
code
;
},
fail
:
err
=>
{
reject
(
err
);
}
})
//重新登录
},
fail
:
()
=>
{
// session_key 已经失效,需要重新执行登录流程
wx
.
login
({
success
:
res
=>
{
this
.
code
=
res
.
code
;
},
fail
:
err
=>
{
reject
(
err
);
}
})
//重新登录
}
})
},
onLoad
(
options
)
{
Object
.
assign
(
this
.
$data
,
this
.
$options
.
data
());
//mpvue 的混合周期 使用小程序生命周期数据未初始化
if
(
options
.
back
)
{
...
...
@@ -103,11 +130,8 @@ export default {
},
init
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
login
({
success
:
res
=>
{
if
(
res
.
code
)
{
login
.
miniLogin
({
code
:
re
s
.
code
,
.
miniLogin
({
code
:
thi
s
.
code
,
spokesmanRelId
:
this
.
$store
.
state
.
spokesmanRelId
,
spokesmanGroupId
:
this
.
$store
.
state
.
spokesmanGroupId
,
spokesmanShopId
:
this
.
$store
.
state
.
spokesmanShopId
...
...
@@ -122,12 +146,6 @@ export default {
.
catch
(
err
=>
{
reject
(
err
);
});
}
},
fail
:
err
=>
{
reject
(
err
);
}
});
});
},
getUserInfo
:
function
(
e
)
{
...
...
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