Browse Source

绑定手机号

master
kuaileWu 3 months ago
parent
commit
2c87374500
  1. 7
      components/SelectYear.vue
  2. 4
      main.js
  3. 40
      pages/index/index.vue
  4. 2
      pages/modify_visitor/modify_visitor.vue

7
components/SelectYear.vue

@ -30,13 +30,14 @@ export default {
const date = new Date() const date = new Date()
const years = [] const years = []
const year = date.getFullYear() const year = date.getFullYear()
for (let i = 1990; i <= date.getFullYear(); i++) { for (let i = 1900; i <= date.getFullYear(); i++) {
years.push(i) years.push(i)
} }
return { return {
cssUrl:this.cssUrl, cssUrl:this.cssUrl,
years: years, // value:[90],
currentYear: new Date().getFullYear(), currentYear: 1990,
years: years,
}; };
}, },
methods: { methods: {

4
main.js

@ -152,8 +152,8 @@ try{
Vue.prototype.isMobile = isMobile(); Vue.prototype.isMobile = isMobile();
} }
const NODE_ENV = 'development'; // const NODE_ENV = 'development';
// const NODE_ENV = 'production'; const NODE_ENV = 'production';
if(Vue.prototype.provider == Vue.prototype.provider_weixin){ if(Vue.prototype.provider == Vue.prototype.provider_weixin){
if (NODE_ENV == "development") { if (NODE_ENV == "development") {
Vue.prototype.request_domain = 'http://jasonyizherenxin.checkcopy.com/'; Vue.prototype.request_domain = 'http://jasonyizherenxin.checkcopy.com/';

40
pages/index/index.vue

@ -113,7 +113,7 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<button class="getphone-box" open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumber" v-if="!doctorInfo.aid"></button> <button class="getphone-box" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="!doctorInfo.aid"></button>
</view> </view>
</template> </template>
@ -160,12 +160,6 @@ export default {
this.state = option.state this.state = option.state
} }
}, },
onReady() { // 使 onReady onLoad
// #ifdef MP-WEIXIN
// this.triggerGetPhone();
// #endif
},
async onShow() { async onShow() {
this.doctor_id = getApp().globalData.doctorId this.doctor_id = getApp().globalData.doctorId
if (!this.doctor_id) return if (!this.doctor_id) return
@ -196,42 +190,18 @@ export default {
this.$refs.nameWrap.close() this.$refs.nameWrap.close()
}); });
}, },
// getPhoneNumber(e) {
triggerGetPhone() { console.log(e)
//
setTimeout(() => {
const query = uni.createSelectorQuery().in(this);
query.select('#getPhoneBtn')
.node()
.exec((res) => {
const node = res[0]?.node;
if (node) {
node.dispatchEvent(new CustomEvent('tap'));
} else {
console.error('节点未找到,请检查:', res);
//
wx.showModal({
title: '提示',
content: '请手动点击授权按钮',
});
}
});
}, 800);
},
//
onGetPhoneNumber(e) {
if (e.detail.errMsg === 'getPhoneNumber:ok') { if (e.detail.errMsg === 'getPhoneNumber:ok') {
console.log(e.detail.code)
this.$http.req('api/user/bind_phone', {phonecode:e.detail.code}, 'POST').then(data=>{ this.$http.req('api/user/bind_phone', {phonecode:e.detail.code}, 'POST').then(data=>{
if(data == -1) return if(data == -1) return
this.getDoctorInfo()
}); });
} else { } else {
} }
}, },
toLocation(hospital) { toLocation(hospital) {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
var lngLat = hospital.hospital_pos.toString().split(',') var lngLat = hospital.hospital_pos.toString().split(',')
var lng = Number(lngLat[1]) var lng = Number(lngLat[1])
@ -320,7 +290,7 @@ export default {
this.doctorInfo = data; this.doctorInfo = data;
this.user_type = this.doctorInfo.user_type; this.user_type = this.doctorInfo.user_type;
if(!data.realname) { if(!data.realname && data.aid) {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.nameWrap.open('bottom') this.$refs.nameWrap.open('bottom')
}) })

2
pages/modify_visitor/modify_visitor.vue

@ -178,7 +178,7 @@ export default {
// }, // },
checkSubmit() { checkSubmit() {
this.canSubmit = false this.canSubmit = false
if (!this.name || !this.sex || !this.year) return if (!this.name || (this.sex !=0 && this.sex!=1) || !this.year) return
this.canSubmit = true this.canSubmit = true
}, },
reback() { reback() {

Loading…
Cancel
Save