Merge branch 'main' of http://git.gpxscs.cn/front/java-mall-app
This commit is contained in:
commit
ee731a4892
@ -1,12 +1,26 @@
|
||||
<template>
|
||||
<view class="loginPopup-container">
|
||||
<uni-popup ref="popup" type="bottom" :mask-click="false" :safe-area="true" :borderRadius="'10px 10x 10px 10px'">
|
||||
<uni-popup
|
||||
ref="popup"
|
||||
type="bottom"
|
||||
:mask-click="false"
|
||||
:safe-area="true"
|
||||
:borderRadius="'10px 10x 10px 10px'"
|
||||
>
|
||||
<view class="popup-box">
|
||||
<view class="head-img"></view>
|
||||
<view class="uni-icon uni-icon-closeempty" color="#888" @click="close"></view>
|
||||
<view
|
||||
class="uni-icon uni-icon-closeempty"
|
||||
color="#888"
|
||||
@click="close"
|
||||
></view>
|
||||
<view class="popup-content">
|
||||
<view class="title"> 微信账号登录小发同城小程序 </view>
|
||||
<button class="btn-login" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
||||
<button
|
||||
class="btn-login"
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber"
|
||||
>
|
||||
<view class="iconfontAili icon-weixin"></view>
|
||||
<view>微信一键登录</view>
|
||||
</button>
|
||||
@ -103,13 +117,13 @@ export default {
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
resolve(res.openid)
|
||||
resolve(res.openid);
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
// 授权用户信息
|
||||
@ -117,10 +131,10 @@ export default {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.getUserInfo({
|
||||
success: (res) => {
|
||||
resolve(res)
|
||||
}
|
||||
})
|
||||
})
|
||||
resolve(res);
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 授权手机信息 服务端解析返回手机号 并回调一键登录注册
|
||||
@ -133,7 +147,7 @@ export default {
|
||||
code: e.detail.code,
|
||||
},
|
||||
success: function (res) {
|
||||
that.doWxUserRegisterAndLogin(res.phoneNumber)
|
||||
that.doWxUserRegisterAndLogin(res.phoneNumber);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
@ -143,9 +157,11 @@ export default {
|
||||
|
||||
// 一键登录注册
|
||||
async doWxUserRegisterAndLogin(phoneNumber) {
|
||||
const openId = await this.getWxOpenId()
|
||||
const {userInfo:{ nickName, avatarUrl }} = await this.getUserprofile()
|
||||
const that = this
|
||||
const openId = await this.getWxOpenId();
|
||||
const {
|
||||
userInfo: { nickName, avatarUrl },
|
||||
} = await this.getUserprofile();
|
||||
const that = this;
|
||||
|
||||
this.$.request({
|
||||
url: this.Config.URL.wx.doWxUserRegisterAndLogin,
|
||||
@ -153,27 +169,27 @@ export default {
|
||||
nickName,
|
||||
avatarUrl,
|
||||
phoneNumber,
|
||||
openId
|
||||
openId,
|
||||
},
|
||||
method: "POST",
|
||||
header: {
|
||||
'Content-Type': 'application/json;charset=utf-8'
|
||||
"Content-Type": "application/json;charset=utf-8",
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (data, status, msg, code) {
|
||||
if (status != 200) {
|
||||
that.$.confirm(that.__(msg || '登录失败,请重试!'));
|
||||
return
|
||||
that.$.confirm(that.__(msg || "登录失败,请重试!"));
|
||||
return;
|
||||
}
|
||||
|
||||
that.loginSuccess(data)
|
||||
that.loginSuccess(data);
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
// 成功登录回调
|
||||
loginSuccess(data) {
|
||||
const that = this
|
||||
const that = this;
|
||||
|
||||
that.$.setStorageSync("uid", data.user_id);
|
||||
that.$.setStorageSync("ukey", data.key);
|
||||
@ -196,7 +212,7 @@ export default {
|
||||
that.close();
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -215,7 +231,7 @@ export default {
|
||||
.head-img {
|
||||
width: 100%;
|
||||
height: 190px;
|
||||
background-image: url("../static/images/login-bg.png");
|
||||
background-image: url("https://media-mall-prod-1259811287.cos.ap-guangzhou.myqcloud.com/static/xcxfile/appicon/login-bg.png");
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 70 KiB |
824
store/index.js
824
store/index.js
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user