Files
RentWeAppFront/components/AuthPopup/PhoneSelect.vue
2025-11-14 11:39:33 +08:00

51 lines
1.1 KiB
Vue

<template>
<u-popup v-model="show" mode="center" border-radius="20">
<view class="p-30" v-if="phoneList.length">
<view class="text-center u-font-32 u-m-b-30">选择绑定手机号</view>
<view v-for="item in phoneList" :key="item" class="u-m-b-20">
<u-button type="primary" @click="bind(item)">
{{ item }}
</u-button>
</view>
</view>
</u-popup>
</template>
<script>
export default {
data() {
return {
show: false,
openid: '',
phoneList: []
}
},
methods: {
open(openid, list) {
this.openid = openid
this.phoneList = list
this.show = true
},
async bind(phone) {
uni.showLoading({ title: "绑定中..." })
let res = await this.$u.post('/api/bindPhone', {
openid: this.openid,
phone: phone
})
// 绑定后直接登录
this.$u.vuex('vuex_token', res.token)
this.$u.vuex('vuex_user', res.loginUser)
uni.hideLoading()
this.show = false
uni.switchTab({ url:'/pages/index/index' })
}
}
}
</script>