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. 18
      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

18
components/FormItem.vue

@ -6,7 +6,7 @@
<text>{{ label }}</text>
<image v-if="required" class="required" :src="cssUrl + 'required.svg'" />
</view>
<!-- 输入模式 -->
<input
v-if="type === 'input'"
@ -16,7 +16,7 @@
@input="handleInput"
:disabled="disabled"
/>
<!-- 点击选择模式如性别年份 -->
<view
v-else
@ -32,7 +32,7 @@
</view>
</view>
</template>
<script>
export default {
name: 'FormItem',
@ -51,7 +51,7 @@
},
data(){
return{
cssUrl: this.cssUrl,
cssUrl: this.cssUrl,
}
},
methods: {
@ -66,7 +66,7 @@
},
};
</script>
<style scoped>
.form-item {
display: flex;
@ -79,7 +79,7 @@
width: 26rpx;
height: 26rpx;
}
.label {
display: flex;
align-items: center;
@ -90,7 +90,7 @@
letter-spacing: 2rpx;
color: #222222;
}
.required {
margin-left: 8rpx;
color: #f56c6c;
@ -98,7 +98,7 @@
width: 16rpx;
height: 16rpx;
}
.input,
.picker {
flex: 1;
@ -106,7 +106,7 @@
padding-left: 20rpx;
color: #333;
}
.placeholder {
font-family: PingFang SC;
font-size: 32rpx;

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()
},
},
};

84
pages/index/index.vue

@ -98,10 +98,6 @@
<!-- #ifdef MP-WEIXIN -->
<doctorImport v-if="user_type == '1' || user_type == '2'"></doctorImport>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<button id="getPhoneBtn" open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumber"
style="display: none;"></button>
<!-- #endif -->
<uni-popup ref="nameWrap" :safe-area="false">
<view class="popup-container">
<view class="header">
@ -117,7 +113,7 @@
</view>
</view>
</uni-popup>
<button class="getphone-box" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-if="!doctorInfo.aid"></button>
</view>
</template>
@ -164,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
@ -200,55 +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) {
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 });
},
});
},
getPhoneNumber(e) {
console.log(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.getDoctorInfo()
});
} else {
//
this.setData({ hasRejectedPhone: true });
wx.showToast({ title: "需要手机号才能继续", icon: "none" });
}
},
toLocation(hospital) {
// #ifdef MP-WEIXIN
var lngLat = hospital.hospital_pos.toString().split(',')
var lng = Number(lngLat[1])
@ -332,15 +285,17 @@ export default {
this.pageShow = true;
this.$nextTick(() => {
console.log(this.$refs, 'this.$refs.nameWrap');
this.$refs.nameWrap.open('bottom')
})
let visitFlag = true;
this.doctorInfo = data;
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 + '主页'
uni.setNavigationBarTitle({
title: title
@ -748,7 +703,15 @@ export default {
margin: 0 auto;
}
.getphone-box{
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
z-index: 8999999999;
opacity: 0;
}
}
.popup-container {
@ -831,6 +794,5 @@ export default {
font-size: 26rpx;
font-family: PingFang SC;
}
}
</style>

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

86
pages/usercenter/usercenter.vue

@ -1,9 +1,26 @@
<template>
<view class="page-usercenter">
<view class="user-wrapper" @click="toUserModify">
<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 class="user-wrapper" v-if="uinfo">
<view class="change-account">
<img :src="cssUrl+'switch.svg'">
切换账号
<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 class="menu">
@ -28,7 +45,7 @@
data() {
return {
cssUrl:this.cssUrl,
uinfo:{}
uinfo:false
}
},
components:{
@ -52,7 +69,22 @@
},
toUserModify(){
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>
@ -63,12 +95,52 @@
height: 100vh;
overflow-y: auto;
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{
display: block;
width: 160rpx;
height: 160rpx;
border-radius: 100%;
margin: 20rpx auto 24rpx;
}
.ucode{
width: 80%;

Loading…
Cancel
Save