Browse Source

Merge pull request 'bug-rework-2025-0603' (#14) from bug-rework-2025-0603 into master

Reviewed-on: kuaileadmin/acupuncture_register_system_uniapp#14
master
超级管理员 3 months ago
parent
commit
04bbc43704
  1. 2
      components/FormItem.vue
  2. 17
      components/SelectYear.vue
  3. 84
      pages/index/index.vue
  4. 2
      pages/modify_visitor/modify_visitor.vue
  5. 86
      pages/usercenter/usercenter.vue

2
components/FormItem.vue

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

17
components/SelectYear.vue

@ -28,15 +28,16 @@
export default { export default {
data() { data() {
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: {
@ -51,7 +52,7 @@ export default {
this.$refs.selectDate.open('bottom') this.$refs.selectDate.open('bottom')
}, },
closePop() { closePop() {
this.$refs.selectDate.close() this.$refs.selectDate.close()
}, },
}, },
}; };

84
pages/index/index.vue

@ -98,10 +98,6 @@
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<doctorImport v-if="user_type == '1' || user_type == '2'"></doctorImport> <doctorImport v-if="user_type == '1' || user_type == '2'"></doctorImport>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<button id="getPhoneBtn" open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumber"
style="display: none;"></button>
<!-- #endif -->
<uni-popup ref="nameWrap" :safe-area="false"> <uni-popup ref="nameWrap" :safe-area="false">
<view class="popup-container"> <view class="popup-container">
<view class="header"> <view class="header">
@ -117,7 +113,7 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<button class="getphone-box" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="!doctorInfo.aid"></button>
</view> </view>
</template> </template>
@ -164,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
@ -200,55 +190,18 @@ export default {
this.$refs.nameWrap.close() this.$refs.nameWrap.close()
}); });
}, },
// getPhoneNumber(e) {
triggerGetPhone() { console.log(e)
// if (e.detail.errMsg === 'getPhoneNumber:ok') {
setTimeout(() => { this.$http.req('api/user/bind_phone', {phonecode:e.detail.code}, 'POST').then(data=>{
const query = uni.createSelectorQuery().in(this); if(data == -1) return
query.select('#getPhoneBtn') this.getDoctorInfo()
.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") {
const { code } = e.detail;
// code
wx.login({
success: (loginRes) => {
wx.request({
url: '/api/user/bind_phone',
data: { wxCode: loginRes.code, phoneCode: code },
success: (res) => {
const phone = res.data.phone;
this.setData({ phone });
//
this.setData({ showNameDialog: true });
},
});
},
}); });
} else { } else {
//
this.setData({ hasRejectedPhone: true });
wx.showToast({ title: "需要手机号才能继续", icon: "none" });
} }
}, },
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])
@ -332,15 +285,17 @@ export default {
this.pageShow = true; this.pageShow = true;
this.$nextTick(() => {
console.log(this.$refs, 'this.$refs.nameWrap');
this.$refs.nameWrap.open('bottom')
})
let visitFlag = true; let visitFlag = true;
this.doctorInfo = data; this.doctorInfo = data;
this.user_type = this.doctorInfo.user_type; this.user_type = this.doctorInfo.user_type;
if(!data.realname && data.aid) {
this.$nextTick(() => {
this.$refs.nameWrap.open('bottom')
})
}
var title = this.doctorInfo.doctor_info.doctor_name + '主页' var title = this.doctorInfo.doctor_info.doctor_name + '主页'
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: title title: title
@ -748,7 +703,15 @@ export default {
margin: 0 auto; margin: 0 auto;
} }
.getphone-box{
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
z-index: 8999999999;
opacity: 0;
}
} }
.popup-container { .popup-container {
@ -831,6 +794,5 @@ export default {
font-size: 26rpx; font-size: 26rpx;
font-family: PingFang SC; font-family: PingFang SC;
} }
} }
</style> </style>

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() {

86
pages/usercenter/usercenter.vue

@ -1,9 +1,26 @@
<template> <template>
<view class="page-usercenter"> <view class="page-usercenter">
<view class="user-wrapper" @click="toUserModify"> <view class="user-wrapper" v-if="uinfo">
<img :src="uinfo.user_avatar" class="avator" v-if="uinfo.user_avatar"> <view class="change-account">
<img :src="cssUrl+'user_grey.svg'" class="avator" v-else> <img :src="cssUrl+'switch.svg'">
<view class="ucode PfScMedium over2" v-if="uinfo.user_code">{{uinfo.user_code}}</view> 切换账号
<button class="getphone-box" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"></button>
</view>
<view class="user-info-box flex">
<view class="user-left">
<img :src="uinfo.user_avatar" class="avator" v-if="uinfo.user_avatar">
<img :src="cssUrl+'user_grey.svg'" class="avator" v-else>
<view class="ucode PfScMedium over2" v-if="uinfo.user_code">{{uinfo.user_code}}</view>
</view>
<view class="user-right">
<view class="realname PfScMedium">{{uinfo.realname ? uinfo.realname : '未设置真实姓名'}}</view>
<view class="phone">{{uinfo.phone ? '手机号:'+uinfo.phone : '未设置手机号'}}</view>
</view>
</view>
</view> </view>
<view class="menu"> <view class="menu">
@ -28,7 +45,7 @@
data() { data() {
return { return {
cssUrl:this.cssUrl, cssUrl:this.cssUrl,
uinfo:{} uinfo:false
} }
}, },
components:{ components:{
@ -52,7 +69,22 @@
}, },
toUserModify(){ toUserModify(){
this.$nav.navToPath('/pages/user_modify/user_modify') this.$nav.navToPath('/pages/user_modify/user_modify')
} },
getPhoneNumber(e) {
if (e.detail.errMsg === 'getPhoneNumber:ok') {
this.$http.req('api/user/bind_phone', {phonecode:e.detail.code}, 'POST').then(data=>{
if(data == -1) return
this.getUser()
uni.showToast({
title: '切换成功',
icon: 'none',
mask: true
})
});
} else {
}
},
} }
} }
</script> </script>
@ -63,12 +95,52 @@
height: 100vh; height: 100vh;
overflow-y: auto; overflow-y: auto;
background: #F8F8F8; background: #F8F8F8;
.user-wrapper{
margin: 24rpx 36rpx;
.change-account{
display: flex;
align-items: center;
font-size: 28rpx;
color: #333333;
column-gap: 12rpx;
height: 39rpx;
width: 100%;
position: relative;
justify-content: flex-end;
.getphone-box{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 10;
opacity: 0;
}
img{
width: 32rpx;
height: 32rpx;
}
}
.user-info-box{
align-items: center;
column-gap: 42rpx;
.realname{
font-size: 38rpx;
font-weight: 500;
color: #333333;
}
.phone{
font-size: 26rpx;
color: #666666;
margin-top: 24rpx;
}
}
}
.avator{ .avator{
display: block; display: block;
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
border-radius: 100%; border-radius: 100%;
margin: 20rpx auto 24rpx;
} }
.ucode{ .ucode{
width: 80%; width: 80%;

Loading…
Cancel
Save