Browse Source

绑定手机号

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

2
components/FormItem.vue

@ -51,7 +51,7 @@
},
data(){
return{
cssUrl: this.cssUrl,
cssUrl: this.cssUrl,
}
},
methods: {

17
components/SelectYear.vue

@ -28,15 +28,16 @@
export default {
data() {
const date = new Date()
const years = []
const year = date.getFullYear()
for (let i = 1990; i <= date.getFullYear(); i++) {
years.push(i)
}
const years = []
const year = date.getFullYear()
for (let i = 1900; i <= date.getFullYear(); i++) {
years.push(i)
}
return {
cssUrl:this.cssUrl,
years: years, //
currentYear: new Date().getFullYear(),
value:[90],
currentYear: 1990,
years: years,
};
},
methods: {
@ -51,7 +52,7 @@ export default {
this.$refs.selectDate.open('bottom')
},
closePop() {
this.$refs.selectDate.close()
this.$refs.selectDate.close()
},
},
};

4
main.js

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

40
pages/index/index.vue

@ -113,7 +113,7 @@
</view>
</view>
</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>
</template>
@ -160,12 +160,6 @@ export default {
this.state = option.state
}
},
onReady() { // 使 onReady onLoad
// #ifdef MP-WEIXIN
// this.triggerGetPhone();
// #endif
},
async onShow() {
this.doctor_id = getApp().globalData.doctorId
if (!this.doctor_id) return
@ -196,42 +190,18 @@ export default {
this.$refs.nameWrap.close()
});
},
//
triggerGetPhone() {
//
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) {
getPhoneNumber(e) {
console.log(e)
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=>{
if(data == -1) return
this.getDoctorInfo()
});
} else {
}
},
toLocation(hospital) {
// #ifdef MP-WEIXIN
var lngLat = hospital.hospital_pos.toString().split(',')
var lng = Number(lngLat[1])
@ -320,7 +290,7 @@ export default {
this.doctorInfo = data;
this.user_type = this.doctorInfo.user_type;
if(!data.realname) {
if(!data.realname && data.aid) {
this.$nextTick(() => {
this.$refs.nameWrap.open('bottom')
})

2
pages/modify_visitor/modify_visitor.vue

@ -178,7 +178,7 @@ export default {
// },
checkSubmit() {
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
},
reback() {

Loading…
Cancel
Save