Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jz_Travel
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
zhengke
jz_Travel
Commits
60c0f1cd
Commit
60c0f1cd
authored
Mar 04, 2025
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善登录流程
parent
bb2971ce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
112 additions
and
190 deletions
+112
-190
index.vue
components/auth/index.vue
+110
-180
index.vue
pages/index/index.vue
+2
-10
No files found.
components/auth/index.vue
View file @
60c0f1cd
...
...
@@ -175,8 +175,6 @@
uni
.
hideLoading
();
if
(
res
.
resultCode
==
1
)
{
this
.
showDialog
=
false
;
//小程序用户名称
let
mallUserName
=
res
.
data
.
Name
;
uni
.
setStorageSync
(
"mall_UserInfo"
,
res
.
data
);
that
.
$emit
(
"changeuserinfo"
);
if
(
res
.
couponResultCode
==
1
)
{
...
...
@@ -191,65 +189,119 @@
uni
.
removeStorageSync
(
"Up"
);
uni
.
removeStorageSync
(
"CounponPassword"
);
uni
.
removeStorageSync
(
"KeyWord"
);
let
uid
=
uni
.
getStorageSync
(
"mall_UserInfo"
).
UserId
;
that
.
msg
.
Id
=
uid
;
//HK 2023-10-31 新增
let
b2bLoginParam
=
{
OpenId
:
res
.
data
.
OpenId
}
let
b2bResult
=
{
accountId
:
0
,
customerId
:
0
,
customerInfoChildrenId
:
0
,
realNameAuthentication
:
0
,
account
:
""
,
name
:
mallUserName
,
customerName
:
""
,
photo
:
""
,
secretKey
:
""
,
token
:
""
,
groupId
:
0
,
isMember
:
0
,
createBy
:
""
,
EmLoginMobile
:
""
,
contactNumber
:
""
,
salesBaseInfo
:
{},
count
:
0
,
customerType
:
2
,
//直客,2-同行
directCustomerId
:
0
,
//直客Id
}
that
.
apipost
(
"LvXiaoYou_post_GetLvXiaoYouCustomerLogin"
,
b2bLoginParam
,
b2bRes
=>
{
var
b2bData
=
b2bRes
.
data
;
if
(
b2bRes
.
resultCode
==
1
)
{
b2bResult
.
accountId
=
b2bData
.
customerAccountId
;
b2bResult
.
customerId
=
b2bData
.
customerId
;
b2bResult
.
customerInfoChildrenId
=
b2bData
.
customerInfoChildrenId
;
b2bResult
.
name
=
b2bData
.
name
;
b2bResult
.
customerName
=
b2bData
.
customerName
;
b2bResult
.
token
=
b2bData
.
token
;
b2bResult
.
isMember
=
b2bData
.
isMember
;
b2bResult
.
account
=
b2bData
.
account
;
b2bResult
.
createBy
=
b2bData
.
createBy
;
b2bResult
.
salesBaseInfo
=
b2bData
.
salesBaseInfo
;
b2bResult
.
groupId
=
b2bData
.
groupId
;
b2bResult
.
contactNumber
=
b2bData
.
contactNumber
;
uni
.
setStorageSync
(
'b2b_user'
,
b2bResult
)
that
.
$emit
(
"changeuserinfo"
);
uni
.
setStorageSync
(
"lastLogin"
,
new
Date
().
getTime
())
}
else
{
uni
.
redirectTo
({
url
:
'/pages/jiuzhai/bind_Customer'
})
}
},
(
error2
)
=>
{
uni
.
redirectTo
({
url
:
'/pages/jiuzhai/bind_Customer'
})
});
const
{
OpenId
,
Unoinid
,
Name
}
=
res
.
data
// let uid = uni.getStorageSync("mall_UserInfo").UserId;
// that.msg.Id = uid;
// #ifdef MP-AG
this
.
agentUserLoginHandle
(
OpenId
,
Name
)
// #endif
// #ifdef MP-DI
this
.
directUserLoginHandle
(
OpenId
,
Unoinid
,
Name
)
// #endif
}
}
);
},
directUserLoginHandle
(
OpenId
,
Unoinid
,
Name
){
let
Pid
=
0
if
(
uni
.
getStorageSync
(
'direct_user_id'
)){
Pid
=
uni
.
getStorageSync
(
'direct_user_id'
)
if
(
isNaN
(
Pid
))
Pid
=
0
}
const
parameters
=
{
OpenId
,
Unoinid
,
Pid
}
this
.
apipost
(
"HePingGuoLvLogin_post"
,
parameters
,
r
=>
{
const
u
=
r
.
data
const
user
=
{
accountId
:
u
.
directCustomerId
,
customerId
:
u
.
directCustomerId
,
customerInfoChildrenId
:
u
.
directCustomerId
,
realNameAuthentication
:
0
,
account
:
""
,
name
:
Name
,
customerName
:
u
.
name
,
photo
:
u
.
photo
,
secretKey
:
""
,
token
:
u
.
token
,
groupId
:
0
,
isMember
:
0
,
createBy
:
u
.
pid
,
EmLoginMobile
:
u
.
moblie
,
contactNumber
:
u
.
moblie
,
salesBaseInfo
:
u
.
salesBaseInfo
,
count
:
0
,
customerType
:
1
,
//直客,2-同行
directCustomerId
:
u
.
directCustomerId
//直客Id
}
uni
.
setStorageSync
(
'b2b_user'
,
user
)
this
.
$emit
(
"changeuserinfo"
);
uni
.
setStorageSync
(
"lastLogin"
,
new
Date
().
getTime
())
},
e
=>
{
uni
.
showToast
({
title
:
'用户登录失败'
,
icon
:
'none'
})
})
},
agentUserLoginHandle
(
openId
,
Name
){
var
that
=
this
;
let
b2bLoginParam
=
{
OpenId
:
openId
}
let
b2bResult
=
{
accountId
:
0
,
customerId
:
0
,
customerInfoChildrenId
:
0
,
realNameAuthentication
:
0
,
account
:
""
,
name
:
Name
,
customerName
:
""
,
photo
:
""
,
secretKey
:
""
,
token
:
""
,
groupId
:
0
,
isMember
:
0
,
createBy
:
""
,
EmLoginMobile
:
""
,
contactNumber
:
""
,
salesBaseInfo
:
{},
count
:
0
,
customerType
:
2
,
//直客,2-同行
directCustomerId
:
0
,
//直客Id
}
that
.
apipost
(
"LvXiaoYou_post_GetLvXiaoYouCustomerLogin"
,
b2bLoginParam
,
b2bRes
=>
{
var
b2bData
=
b2bRes
.
data
;
if
(
b2bRes
.
resultCode
==
1
)
{
b2bResult
.
accountId
=
b2bData
.
customerAccountId
;
b2bResult
.
customerId
=
b2bData
.
customerId
;
b2bResult
.
customerInfoChildrenId
=
b2bData
.
customerInfoChildrenId
;
b2bResult
.
name
=
b2bData
.
name
;
b2bResult
.
customerName
=
b2bData
.
customerName
;
b2bResult
.
token
=
b2bData
.
token
;
b2bResult
.
isMember
=
b2bData
.
isMember
;
b2bResult
.
account
=
b2bData
.
account
;
b2bResult
.
createBy
=
b2bData
.
createBy
;
b2bResult
.
salesBaseInfo
=
b2bData
.
salesBaseInfo
;
b2bResult
.
groupId
=
b2bData
.
groupId
;
b2bResult
.
contactNumber
=
b2bData
.
contactNumber
;
uni
.
setStorageSync
(
'b2b_user'
,
b2bResult
)
that
.
$emit
(
"changeuserinfo"
);
uni
.
setStorageSync
(
"lastLogin"
,
new
Date
().
getTime
())
}
else
{
uni
.
redirectTo
({
url
:
'/pages/jiuzhai/bind_Customer'
})
}
},
(
error2
)
=>
{
uni
.
redirectTo
({
url
:
'/pages/jiuzhai/bind_Customer'
})
});
},
updateuserinfo
(
msg
)
{
this
.
request2
({
url
:
"/api/MemberUser/SetMemberPhoto"
,
...
...
@@ -266,129 +318,7 @@
},
closeBtn
()
{
this
.
showCoupons
=
false
;
},
// -------------------------------支付宝登录---------------------------------
onGetAuthorize
(
res
)
{
let
that
=
this
;
my
.
getOpenUserInfo
({
success
:
(
_res
)
=>
{
let
userInfo
=
JSON
.
parse
(
_res
.
response
).
response
;
// 以下方的报文格式解析两层 response
that
.
getUserInfoAli
(
userInfo
);
},
});
},
getUserInfoAli
(
info
)
{
var
that
=
this
;
that
.
showDialog
=
true
;
my
.
getAuthCode
({
scopes
:
"auth_base"
,
// 主动授权(弹框):auth_user,静默授权(不弹框):auth_base
success
:
(
res
)
=>
{
if
(
res
.
authCode
)
{
let
obj
=
{
Name
:
info
.
nickName
,
Photo
:
info
.
avatar
?
info
.
avatar
:
"123"
,
Gender
:
info
.
gender
===
"m"
?
1
:
info
.
gender
===
"f"
?
2
:
0
,
Moblie
:
""
,
code
:
res
.
authCode
,
};
that
.
getCodeAli
(
obj
);
}
},
fail
:
()
=>
{
uni
.
showToast
({
title
:
"授权失败"
,
icon
:
"none"
,
});
},
});
},
//调用获取code
getCodeAli
(
obj
)
{
var
that
=
this
;
uni
.
showLoading
({
title
:
"登录中.."
,
});
//这里请求接口
that
.
request2
({
url
:
"/api/mall/GetAliCode"
,
data
:
{
Code
:
obj
.
code
,
},
},
(
res
)
=>
{
if
(
res
.
resultCode
==
1
)
{
obj
.
OpenId
=
res
.
data
;
that
.
getLoginAli
(
obj
);
}
}
);
},
//登录
getLoginAli
(
obj
)
{
var
that
=
this
;
that
.
showLogin
=
false
;
let
pid
=
uni
.
getStorageSync
(
"pid"
)
?
uni
.
getStorageSync
(
"pid"
).
pid
:
0
;
let
Up
=
uni
.
getStorageSync
(
"Up"
)
?
uni
.
getStorageSync
(
"Up"
).
Up
:
0
;
let
SmallShopId
=
uni
.
getStorageSync
(
"SmallShopId"
)
?
uni
.
getStorageSync
(
"SmallShopId"
).
SmallShopId
:
0
;
let
CounponPassword
=
uni
.
getStorageSync
(
"CounponPassword"
)
?
uni
.
getStorageSync
(
"CounponPassword"
).
CounponPassword
:
0
;
let
KeyWord
=
uni
.
getStorageSync
(
"KeyWord"
)
?
uni
.
getStorageSync
(
"KeyWord"
).
KeyWord
:
""
;
that
.
request2
({
url
:
"/api/AppletLogin/Login"
,
data
:
{
Source
:
2
,
OpenId
:
obj
.
OpenId
,
Name
:
obj
.
Name
,
Photo
:
obj
.
Photo
,
Gender
:
obj
.
Gender
,
Moblie
:
""
,
SuperiorId
:
pid
,
SmallShopId
:
SmallShopId
,
UserPageType
:
Up
,
CounponPassword
:
CounponPassword
,
KeyWord
:
KeyWord
,
},
},
(
res
)
=>
{
uni
.
hideLoading
();
that
.
showLogin
=
true
;
//防止多次点击登录
if
(
res
.
resultCode
==
1
)
{
this
.
showDialog
=
false
;
uni
.
setStorageSync
(
"mall_UserInfo"
,
res
.
data
);
that
.
$emit
(
"changeuserinfo"
);
if
(
res
.
couponResultCode
==
1
)
{
if
(
uni
.
getStorageSync
(
"ComeFrom"
))
{
that
.
ComeFrom
=
uni
.
getStorageSync
(
"ComeFrom"
).
ComeFrom
;
}
that
.
showCoupons
=
true
;
that
.
couponMessage
=
res
.
couponMessage
;
}
uni
.
removeStorageSync
(
"pid"
);
uni
.
removeStorageSync
(
"SmallShopId"
);
uni
.
removeStorageSync
(
"Up"
);
uni
.
removeStorageSync
(
"CounponPassword"
);
uni
.
removeStorageSync
(
"KeyWord"
);
let
uid
=
uni
.
getStorageSync
(
"mall_UserInfo"
).
UserId
;
that
.
msg
.
Id
=
uid
;
let
IsOpenMiAi
=
uni
.
getStorageSync
(
"basedata"
)
?
uni
.
getStorageSync
(
"basedata"
).
mall
.
setting
.
is_show_miai
:
0
;
//是否开启相亲模式
if
(
IsOpenMiAi
==
0
)
{
//不是相亲模式的时候去更新头像和昵称
// #ifdef MP-WEIXIN
that
.
updateuserinfo
(
that
.
msg
);
//更新用户头像
// #endif
}
}
}
);
},
}
},
};
</
script
>
...
...
pages/index/index.vue
View file @
60c0f1cd
...
...
@@ -54,16 +54,6 @@
</
template
>
</view>
</template>
<!-- #ifdef MP-DI -->
<view
class=
""
>
直客 MP
</view>
<!-- #endif -->
<!-- #ifdef MP-AG -->
<view
class=
""
>
同业 MP
</view>
<!-- #endif -->
<coupon
v-if=
"showCoupons"
:coupon-message=
"couponMessage"
:cform=
"ComeFrom"
@
goLook=
"()=>showCoupons = false"
@
closeBtn=
"()=>showCoupons = false"
></coupon>
<auth
v-if=
"showAuth"
@
changeuserinfo=
"reloadUserinfo"
@
gbAuth=
"gbAuth"
></auth>
<official-account></official-account>
...
...
@@ -167,7 +157,9 @@
}
const
mu
=
uni
.
getStorageSync
(
'mall_UserInfo'
)
const
bu
=
uni
.
getStorageSync
(
'b2b_user'
)
if
(
!
mu
||
!
bu
)
this
.
showAuth
=
true
this
.
init
()
uni
.
showNavigationBarLoading
();
if
(
uni
.
getStorageSync
(
'coupons'
))
{
...
...
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