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
7e35809d
Commit
7e35809d
authored
Aug 03, 2022
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信一键登录绑定企业账号
parent
bcc6faa4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
53 deletions
+70
-53
config/dev.env.js
+1
-1
src/pages/login/index.vue
+69
-52
No files found.
config/dev.env.js
View file @
7e35809d
...
...
@@ -15,7 +15,7 @@ module.exports = merge(prodEnv, {//zjgyl
NODE_ENV
:
'"development"'
,
// BASE_URL:"'https://shop.mayi888.com'",
// BASE_URL:"'http://192.168.1.146:3005'",
// BASE_URL:"'http://1
92.168.1.127
:3000'",
// BASE_URL:"'http://1
72.16.1.18
:3000'",
BASE_URL
:
"'https://test-m-shop.mayi888.cn'"
,
ADMIN_URL
:
"'https://test-ant.mayi888.cn'"
,
// BASE_URL:"'http://192.168.137.1:3004'",
...
...
src/pages/login/index.vue
View file @
7e35809d
...
...
@@ -142,7 +142,6 @@ export default {
fromType
:
''
,
//来源类型 mini:小程序跳转到当前登录页
scene
:
''
,
//场景
ossLink
:
''
,
//第三方点击进入链接
wxUserInfo
:{},
queryOptions
:{},
isOnLoad
:
false
,
systemInfo
:
{},
...
...
@@ -150,13 +149,19 @@ export default {
pageInfo
:
{},
pageData
:
{},
hideBack
:
0
,
//0显示返回按钮 1隐藏
selectEnterpriseAccountOpenType
:
0
,
//0输入手机号登录 1微信一键登录 2一键登录后绑定手机号登录
sessionId
:
""
,
};
},
computed
:
{
showGetPhoneBtn
()
{
// 梵蜜琳隐藏一键获取手机号
return
this
.
$store
.
state
.
mixid
!=
'sivrl5'
;
}
},
// 是否开启企业要货
whetherOpenEnterprisesWantGoods
(){
return
this
.
mpApp
.
globalData
.
shopInfo
.
whetherOpenEnterprisesWantGoods
==
1
?
1
:
0
},
},
onShow
()
{
if
(
!
this
.
isOnLoad
){
...
...
@@ -390,8 +395,8 @@ export default {
spokesmanRelId
:
''
,
spokesmanGroupId
:
''
,
spokesmanShopId
:
''
,
nickname
:
_this
.
wxU
serInfo
.
nickName
,
headImgUrl
:
_this
.
wxU
serInfo
.
avatarUrl
nickname
:
_this
.
u
serInfo
.
nickName
,
headImgUrl
:
_this
.
u
serInfo
.
avatarUrl
};
login
.
miniLogin
(
query
)
...
...
@@ -449,11 +454,12 @@ export default {
wx
.
getUserProfile
({
desc
:
'用于完善会员资料'
,
// 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success
:
(
e
)
=>
{
_this
.
wxU
serInfo
=
e
.
userInfo
;
log
.
info
(
'获取wx.getUserProfile用户信息'
,
_this
.
wxU
serInfo
);
console
.
log
(
_this
.
wxUserInfo
,
'--_this.wxU
serInfo'
)
this
.
u
serInfo
=
e
.
userInfo
;
log
.
info
(
'获取wx.getUserProfile用户信息'
,
this
.
u
serInfo
);
console
.
log
(
this
.
userInfo
,
'--this.u
serInfo'
)
this
.
initUser
()
.
then
(
res
=>
{
wx
.
hideLoading
();
//存入openid
try
{
wx
.
setStorageSync
(
'openid'
,
res
.
data
.
data
.
openid
)
...
...
@@ -464,35 +470,40 @@ export default {
// haveBindUserPhone
// 是否必须绑定手机号(0必须绑定,1不需要绑定
//有账号或不需要绑定手机号
this
.
appid
=
res
.
data
.
data
.
appid
;
this
.
session_key
=
res
.
data
.
data
.
session_key
;
this
.
openid
=
res
.
data
.
data
.
openid
;
this
.
unionId
=
res
.
data
.
data
.
unionId
||
''
;
this
.
sessionId
=
res
.
data
.
data
.
sessionId
||
''
;
this
.
isShow
=
true
;
if
(
res
.
data
.
data
.
isHaveUnion
==
"true"
||
this
.
mpApp
.
globalData
.
shopInfo
.
haveBindUserPhone
==
'1'
)
{
this
.
backParams
+=
`&sessionid=
${
res
.
data
.
data
.
sessionId
}
&needCertified=
${
res
.
data
.
data
.
NEED_CERTIFIED
}
`
;
this
.
NEED_CERTIFIED
=
res
.
data
.
data
.
NEED_CERTIFIED
;
wx
.
setStorage
({
key
:
"sessionid"
,
data
:
res
.
data
.
data
.
sessionId
});
this
.
isHaveUnion
=
true
;
console
.
log
(
this
.
whetherOpenEnterprisesWantGoods
==
1
,
res
.
data
.
data
.
masterAccount
,
'-----------------------------482'
)
if
(
this
.
whetherOpenEnterprisesWantGoods
==
1
&&
res
.
data
.
data
.
masterAccount
&&
res
.
data
.
data
.
masterAccount
.
length
>
0
){
this
.
selectEnterpriseAccountOpenType
=
1
;
this
.
$refs
.
SelectEnterpriseAccount
.
open
(
res
.
data
.
data
.
masterAccount
);
}
else
{
wx
.
setStorage
({
key
:
"sessionid"
,
data
:
res
.
data
.
data
.
sessionId
});
this
.
checkLogin
();
}
}
else
{
//需要绑定
this
.
isHaveUnion
=
false
;
}
this
.
appid
=
res
.
data
.
data
.
appid
;
this
.
session_key
=
res
.
data
.
data
.
session_key
;
this
.
openid
=
res
.
data
.
data
.
openid
;
this
.
unionId
=
res
.
data
.
data
.
unionId
||
''
;
this
.
isShow
=
true
;
//checkLogind
this
.
checkLogin
(
e
);
//checkLogind
this
.
checkLogin
();
}
})
.
catch
(
err
=>
{
log
.
info
(
"err"
,
err
);
wx
.
hideLoading
();
wx
.
showToast
({
title
:
err
,
icon
:
"none"
});
});
},
fail
:
(
e
)
=>
{
...
...
@@ -501,8 +512,7 @@ export default {
}
})
},
checkLogin
(
e
)
{
this
.
userInfo
=
e
.
userInfo
;
checkLogin
()
{
this
.
$store
.
commit
(
'setUserInfo'
,
this
.
userInfo
)
if
(
this
.
isHaveUnion
)
{
wx
.
hideLoading
();
...
...
@@ -518,23 +528,24 @@ export default {
log
.
info
(
'checkUnionid'
,
res
)
wx
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
this
.
sessionId
=
res
.
data
.
data
.
sessionId
||
''
;
if
(
res
.
data
.
data
.
isHaveUnion
==
"true"
)
{
this
.
NEED_CERTIFIED
=
res
.
data
.
data
.
NEED_CERTIFIED
;
this
.
backParams
+=
`&sessionid=
${
res
.
data
.
data
.
sessionId
}
&needCertified=
${
res
.
data
.
data
.
NEED_CERTIFIED
}
`
;
wx
.
setStorage
({
key
:
"sessionid"
,
data
:
res
.
data
.
data
.
sessionId
});
this
.
addRecord
(
false
)
// 跳转回小程序页面
this
.
pushPageType
();
// wx.reLaunch({
// url: `../index/main?from=login&backpath=${
// this.backPath
// }¶ms=${encodeURIComponent(this.backParams)}`
// });
if
(
this
.
whetherOpenEnterprisesWantGoods
==
1
&&
res
.
data
.
data
.
masterAccount
&&
res
.
data
.
data
.
masterAccount
.
length
>
0
){
this
.
selectEnterpriseAccountOpenType
=
0
;
this
.
$refs
.
SelectEnterpriseAccount
.
open
(
res
.
data
.
data
.
masterAccount
);
}
else
{
wx
.
setStorage
({
key
:
"sessionid"
,
data
:
res
.
data
.
data
.
sessionId
});
this
.
pushPageType
();
}
}
else
{
//不是会员需要绑定手机号
this
.
isShowPhone
=
true
;
...
...
@@ -692,21 +703,21 @@ export default {
wx
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
wx
.
setStorageSync
(
this
.
$store
.
state
.
mixid
+
'articleId'
,
false
)
this
.
sessionId
=
res
.
data
.
data
.
sessionId
||
''
;
this
.
NEED_CERTIFIED
=
res
.
data
.
data
.
NEED_CERTIFIED
;
this
.
backParams
+=
`&sessionid=
${
res
.
data
.
data
.
sessionId
}
&needCertified=
${
res
.
data
.
data
.
NEED_CERTIFIED
}
`
;
wx
.
setStorage
({
key
:
"sessionid"
,
data
:
res
.
data
.
data
.
sessionId
});
// 跳转回小程序页面
this
.
pushPageType
();
// wx.reLaunch({
// url: `../index/main?from=login&backpath=${
// this.backPath
// }¶ms=${encodeURIComponent(this.backParams)}`
// });
if
(
this
.
whetherOpenEnterprisesWantGoods
==
1
&&
res
.
data
.
data
.
masterAccount
&&
res
.
data
.
data
.
masterAccount
.
length
>
0
){
this
.
selectEnterpriseAccountOpenType
=
0
;
this
.
$refs
.
SelectEnterpriseAccount
.
open
(
res
.
data
.
data
.
masterAccount
);
}
else
{
wx
.
setStorage
({
key
:
"sessionid"
,
data
:
res
.
data
.
data
.
sessionId
});
this
.
pushPageType
();
}
}
})
.
catch
(
err
=>
{
...
...
@@ -798,17 +809,15 @@ export default {
.
then
(
res
=>
{
wx
.
hideLoading
();
if
(
res
.
data
.
code
==
200
)
{
this
.
sessionId
=
res
.
data
.
data
.
sessionId
||
''
;
this
.
backParams
+=
`&sessionid=
${
res
.
data
.
data
.
sessionId
}
&needCertified=
${
res
.
data
.
data
.
NEED_CERTIFIED
}
`
;
this
.
NEED_CERTIFIED
=
res
.
data
.
data
.
NEED_CERTIFIED
;
console
.
log
(
this
.
mpApp
.
globalData
.
shopInfo
,
"------------------this.mpApp.globalData.shopInfo"
)
if
(
this
.
mpApp
.
globalData
.
shopInfo
.
whetherOpenEnterprisesWantGoods
==
1
&&
res
.
data
.
data
.
masterAccount
&&
res
.
data
.
data
.
masterAccount
.
length
>
0
){
if
(
this
.
whetherOpenEnterprisesWantGoods
==
1
&&
res
.
data
.
data
.
masterAccount
&&
res
.
data
.
data
.
masterAccount
.
length
>
0
){
this
.
selectEnterpriseAccountOpenType
=
0
;
this
.
$refs
.
SelectEnterpriseAccount
.
open
(
res
.
data
.
data
.
masterAccount
);
wx
.
setStorage
({
key
:
"sessionid"
,
data
:
res
.
data
.
data
.
sessionId
});
}
else
{
wx
.
setStorage
({
key
:
"sessionid"
,
...
...
@@ -855,10 +864,18 @@ export default {
},
getEnterpriseAccount
(
val
)
{
console
.
log
(
val
,
'----getEnterpriseAccount'
)
wx
.
setStorage
({
key
:
"sessionid"
,
data
:
this
.
sessionId
});
if
(
val
)
{
this
.
backParams
+=
`&enterpriseAccount=
${
wx
.
getStorageSync
(
"enterpriseAccount"
)}
`
}
this
.
pushPageType
();
if
(
this
.
selectEnterpriseAccountOpenType
==
0
)
{
this
.
pushPageType
();
}
else
{
this
.
checkLogin
();
}
},
}
};
...
...
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