Browse Source

首页

master
tianyi 8 months ago
parent
commit
19b11d93c9
  1. 30
      pages/index/index.vue

30
pages/index/index.vue

@ -67,7 +67,7 @@
<view class="like-box">
<view class="like-title">
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/e0c44bc9b69a46559d3aa4160d3cf4a5.png" alt="" />
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">获取手机号</button>
</view>
<view class="like-content-box">
@ -590,34 +590,6 @@
}
},
methods: {
getPhoneNumber (e) {
console.log(e)
if (e.detail.code) {
// 将 code 发送给后端
this.tui.request("/social/wechat/getPhone", "POST", {
code: e.detail.code
}, false, true).then((res) => {
if (res.code == 200) {
// 授权成功后的处理逻辑
this.tui.toast('获取手机号成功'+res.result);
// 如果后端返回了 phone,将其存入缓存,方便以后使用
if (res.result) {
uni.setStorageSync('phone', res.result);
}
} else {
this.tui.toast(res.message || '获取失败');
}
}).catch((err) => {
console.log("请求异常: ", err);
this.tui.toast('请求获取手机号失败');
});
} else {
// 用户拒绝授权
console.log('用户取消授权', e.detail.errMsg);
this.tui.toast('您取消了手机号授权');
}
},
//本方法展示所有已经完成页面,方便查找
aaaaaaa(item){
uni.navigateTo({

Loading…
Cancel
Save