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
6060b637
Commit
6060b637
authored
Jan 19, 2020
by
程默
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录逻辑修改
parent
7f315e02
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
26 deletions
+49
-26
src/pages/login/index.vue
+49
-26
No files found.
src/pages/login/index.vue
View file @
6060b637
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<!--
<div>
{{
testd
}}
</div>
<!--
<div>
{{
testd
}}
</div>
<div>
{{
test_sessionId
}}
</div>
--sessionId
<div>
{{
test_sessionId
}}
</div>
--sessionId
<div>
{{
unionId
}}
</div>
--unionId
<div>
{{
unionId
}}
</div>
--unionId
<div>
{{
test_isHaveUnion
}}
</div>
--isHaveUnion
-->
<div>
{{
test_isHaveUnion
}}
</div>
--isHaveUnion-->
<!--
<div
class=
"enterpriseLogin"
@
click=
"eLogin"
>
账号登录
</div>
-->
<!--
<div
class=
"enterpriseLogin"
@
click=
"eLogin"
>
账号登录
</div>
-->
</div>
</div>
<div
class=
"toCLogin1"
v-if=
"isShowPhone"
>
<div
class=
"toCLogin1"
v-if=
"isShowPhone"
>
...
@@ -74,39 +74,70 @@ export default {
...
@@ -74,39 +74,70 @@ export default {
this
.
backParams
=
serialize
(
options
.
params
);
this
.
backParams
=
serialize
(
options
.
params
);
}
}
this
.
getshop
();
this
.
getshop
();
this
.
init
();
},
},
methods
:
{
methods
:
{
getshop
()
{
getshop
()
{
this
.
shopName
=
wx
.
getStorageSync
(
"shopName"
);
this
.
logoUrl
=
wx
.
getStorageSync
(
"logoUrl"
);
if
(
!
(
this
.
shopName
&&
this
.
logoUrl
))
{
shop
.
getShopInfo
().
then
(
res
=>
{
shop
.
getShopInfo
().
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
this
.
shopName
=
res
.
data
.
data
.
shopName
;
this
.
shopName
=
res
.
data
.
data
.
shopName
;
this
.
logoUrl
=
process
.
env
.
IMG_DOMAIN
+
res
.
data
.
data
.
logoUrl
;
this
.
logoUrl
=
process
.
env
.
IMG_DOMAIN
+
res
.
data
.
data
.
logoUrl
;
}
else
{
wx
.
setStorage
({
key
:
"shopName"
,
data
:
res
.
data
.
data
.
shopName
});
wx
.
setStorage
({
key
:
"logoUrl"
,
data
:
process
.
env
.
IMG_DOMAIN
+
res
.
data
.
data
.
logoUrl
});
}
}
});
});
}
},
},
init
()
{
init
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
login
({
wx
.
login
({
success
:
res
=>
{
success
:
res
=>
{
if
(
res
.
code
)
{
if
(
res
.
code
)
{
login
login
.
miniLogin
({
code
:
res
.
code
})
.
miniLogin
({
code
:
res
.
code
})
.
then
(
res
=>
{
.
then
(
res
=>
{
// wx.showToast({ title: res.data.code, icon: "none" });
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
this
.
testd
=
JSON
.
stringify
(
res
.
data
);
resolve
(
res
);
this
.
test_isHaveUnion
=
res
.
data
.
data
.
isHaveUnion
;
}
else
{
console
.
log
(
"login---"
,
res
.
data
);
reject
(
res
.
data
.
msg
);
}
})
.
catch
(
err
=>
{
reject
(
err
);
});
}
},
fail
:
err
=>
{
reject
(
err
);
}
});
});
},
getUserInfo
:
function
(
e
)
{
wx
.
showLoading
({
title
:
"加载中"
});
if
(
e
.
target
.
errMsg
==
"getUserInfo:ok"
)
{
this
.
init
()
.
then
(
res
=>
{
console
.
log
(
"promise"
,
res
);
wx
.
hideLoading
();
//存入openid
wx
.
setStorage
({
wx
.
setStorage
({
key
:
"openid"
,
key
:
"openid"
,
data
:
res
.
data
.
data
.
openid
data
:
res
.
data
.
data
.
openid
});
});
if
(
res
.
data
.
data
.
isHaveUnion
==
"true"
)
{
if
(
res
.
data
.
data
.
isHaveUnion
==
"true"
)
{
//有账号
//有账号
this
.
backParams
+=
`&sessionid=
${
this
.
backParams
+=
`&sessionid=
${
res
.
data
.
data
.
sessionId
res
.
data
.
data
.
sessionId
}
&needCertified=
${
res
.
data
.
data
.
NEED_CERTIFIED
}
`
;
}
&needCertified=
${
res
.
data
.
data
.
NEED_CERTIFIED
}
`
;
...
@@ -126,24 +157,20 @@ export default {
...
@@ -126,24 +157,20 @@ export default {
this
.
openid
=
res
.
data
.
data
.
openid
;
this
.
openid
=
res
.
data
.
data
.
openid
;
this
.
isShow
=
true
;
this
.
isShow
=
true
;
this
.
test_sessionId
=
wx
.
getStorageSync
(
"sessionid"
);
//checkLogin
}
else
{
this
.
checkLogin
();
wx
.
showToast
({
title
:
res
.
data
.
msg
,
icon
:
"none"
});
}
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
console
.
log
(
"err"
,
err
);
wx
.
hideLoading
();
wx
.
showToast
({
title
:
err
,
icon
:
"none"
});
wx
.
showToast
({
title
:
err
,
icon
:
"none"
});
});
});
}
else
{
wx
.
hideLoading
();
wx
.
showToast
({
title
:
"获取用户信息失败"
,
icon
:
"none"
});
}
}
}
});
},
},
getUserInfo
:
function
(
e
)
{
checkLogin
()
{
wx
.
showLoading
({
title
:
"加载中"
});
if
(
e
.
target
.
errMsg
==
"getUserInfo:ok"
&&
this
.
isShow
)
{
wx
.
hideLoading
();
if
(
this
.
isHaveUnion
)
{
if
(
this
.
isHaveUnion
)
{
//是会员 直接登录
//是会员 直接登录
wx
.
reLaunch
({
wx
.
reLaunch
({
...
@@ -162,7 +189,6 @@ export default {
...
@@ -162,7 +189,6 @@ export default {
this
.
userInfo
=
JSON
.
parse
(
e
.
target
.
rawData
);
this
.
userInfo
=
JSON
.
parse
(
e
.
target
.
rawData
);
console
.
log
(
this
.
userInfo
,
"this.userInfo"
);
console
.
log
(
this
.
userInfo
,
"this.userInfo"
);
// return
if
(
this
.
unionId
)
{
if
(
this
.
unionId
)
{
login
login
.
checkUnionid
({
unionId
:
this
.
unionId
,
openId
:
this
.
openid
})
.
checkUnionid
({
unionId
:
this
.
unionId
,
openId
:
this
.
openid
})
...
@@ -196,9 +222,6 @@ export default {
...
@@ -196,9 +222,6 @@ export default {
this
.
isShowPhone
=
true
;
this
.
isShowPhone
=
true
;
}
}
}
}
}
else
{
wx
.
hideLoading
();
}
},
},
getPhoneNumber
(
e
)
{
getPhoneNumber
(
e
)
{
wx
.
checkSession
({
wx
.
checkSession
({
...
...
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