Commit f1178ed2 authored by 俞嘉婷's avatar 俞嘉婷

feat: 活动页&我的页面 授权手机号流程

parent 58d06a09
......@@ -2,6 +2,7 @@
import { ComponentWithStore } from "mobx-miniprogram-bindings";
import { store } from "../../store/store";
import { _asyncThrottle } from "../../utils/util";
import { dbLogin } from "../../utils/request";
ComponentWithStore({
storeBindings: {
......@@ -34,6 +35,20 @@ ComponentWithStore({
store.doLog(508, 5 + item.index)
wx.navigateTo({ url: `/pages/activityDetail/activityDetail?imgUrl=${item.detailImg}` })
}),
getPhoneNumber(e: any) {
if (e.detail?.iv && e.detail?.encryptedData) {
wx.login({
success: async (res) => {
console.log(res.code)
await dbLogin({
code: res.code,
iv: e.detail.iv,
encryptedData: e.detail.encryptedData,
});
},
});
}
},
// onShareAppMessage() {
// return {
......
......@@ -8,6 +8,13 @@ import { _asyncThrottle, defaultInfo } from "../../utils/util";
const app = getApp<IAppOption>()
ComponentWithStore({
storeBindings: {
store,
fields: {
showPhoneBtn: () => !store.homeInfo.mobile,
},
actions: {},
},
data: {
defaultInfo: defaultInfo,
userInfo: {
......@@ -27,6 +34,20 @@ ComponentWithStore({
},
});
},
getPhoneNumber(e: any) {
if (e.detail?.iv && e.detail?.encryptedData) {
wx.login({
success: async (res) => {
console.log(res.code)
await dbLogin({
code: res.code,
iv: e.detail.iv,
encryptedData: e.detail.encryptedData,
});
},
});
}
},
async onChooseAvatar(e: any) {
const { avatarUrl } = e.detail
console.log('avatarUrl', avatarUrl);
......
......@@ -28,4 +28,13 @@
<view class="item_arrow"></view>
</view>
</view>
</view>
\ No newline at end of file
</view>
<!--获取手机号按钮-->
<button
type="primary"
wx:if="{{showPhoneBtn}}"
class="getPhoneBtn"
open-type="getPhoneNumber"
bindgetphonenumber="getPhoneNumber"
></button>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment