|
@@ -9,6 +9,13 @@
|
|
|
<view class="span">智泊e家</view>
|
|
|
</view>
|
|
|
<view>
|
|
|
+ <button class="login-btn" @click="decryptPhoneNumberTest"
|
|
|
+
|
|
|
+
|
|
|
+ >
|
|
|
+ <u-icon name="phone-fill" size="46"></u-icon> <text>手机号码一键登录test</text>
|
|
|
+ </button>
|
|
|
+
|
|
|
<button class="login-btn" @click="decryptPhoneNumberH5" open-type="getPhoneNumber"
|
|
|
@getphonenumber="decryptPhoneNumber"
|
|
|
|
|
@@ -114,6 +121,32 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ decryptPhoneNumberTest() {
|
|
|
+
|
|
|
+ this.show = false
|
|
|
+ var _this = this
|
|
|
+ uni.showModal({
|
|
|
+ title: '输入手机号测试',
|
|
|
+ editable: true,
|
|
|
+ //content: '这是一个模态弹窗',
|
|
|
+ success: function(res) {
|
|
|
+
|
|
|
+ if (res.confirm) {
|
|
|
+ //_this.createUser(res.content)
|
|
|
+ if (_this.userInfo.id) {
|
|
|
+ _this.changePhoneUser(res.content)
|
|
|
+
|
|
|
+ } else{
|
|
|
+ _this.createUser(res.content)
|
|
|
+
|
|
|
+ }
|
|
|
+ } else if (res.cancel) {
|
|
|
+ //.log('用户点击取消');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
decryptPhoneNumberH5() {
|
|
|
// #ifdef H5
|
|
|
this.show = false
|
|
@@ -181,34 +214,42 @@
|
|
|
|
|
|
|
|
|
} else {
|
|
|
- uni.showLoading({
|
|
|
- title: "加载中",
|
|
|
- mask: true,
|
|
|
- })
|
|
|
- API_weixin.findUserPhoneNumber(e.detail.code).then((res) => {
|
|
|
- if (res.data) {
|
|
|
- this.createUser(res.data)
|
|
|
-
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- icon: 'none',
|
|
|
- title: "获取手机号失败,请检查"
|
|
|
+ if(e.detail.code){
|
|
|
+ uni.showLoading({
|
|
|
+ title: "加载中",
|
|
|
+ mask: true,
|
|
|
})
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }).catch(error => {
|
|
|
-
|
|
|
+ API_weixin.findUserPhoneNumber(e.detail.code).then((res) => {
|
|
|
+ if (res.data) {
|
|
|
+ this.createUser(res.data)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: "获取手机号失败,请检查"
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }).catch(error => {
|
|
|
+
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: error
|
|
|
+ })
|
|
|
+ //this.getPhone()
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ }else{
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|
|
|
- title: error
|
|
|
+ title: "获取手机号失败"
|
|
|
})
|
|
|
- //this.getPhone()
|
|
|
-
|
|
|
- })
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
|
|
|
}
|