2024.2.8修改
This commit is contained in:
@@ -86,6 +86,7 @@
|
||||
const res = await api.getToken(data)
|
||||
if(res.code === 200) {
|
||||
// newUser.value = res.data.newUser
|
||||
// res.data.newUser = true // 开发阶段专用,正式版请删除
|
||||
if(res.data.newUser) { // 新用户,不做任何缓存动作,跳转登录页
|
||||
let userId = res.data.userId
|
||||
let res_p=await new Promise(resolve=>{
|
||||
@@ -97,6 +98,7 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
// 正式版记住放开下面这行注释掉的代码
|
||||
uni.setStorageSync('access_token','Bearer '+res.data.access_token);// token单独缓存一次
|
||||
let res2=await api.wx_login({code:res_p.code},userId);
|
||||
if(res2.code === 0) {
|
||||
@@ -145,7 +147,7 @@
|
||||
uni.clearStorage();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
<template>
|
||||
<view class="user-box page-box">
|
||||
<view class="userinfo-box" @tap="toUserInfo">
|
||||
@@ -207,8 +209,8 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.buy-btn{
|
||||
display: inline-block;
|
||||
@@ -282,5 +284,5 @@
|
||||
}
|
||||
.user-box{
|
||||
background: #f6f6f6;
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -6,20 +6,32 @@
|
||||
import {useStore} from '@/store/index.js'
|
||||
const store = useStore()
|
||||
import api from "@/api/index.js"
|
||||
import custom from "@/utils/index.js"
|
||||
const h_index = ref(0)
|
||||
onLoad(() => {
|
||||
getHospitalList()
|
||||
onLoad(async () => {
|
||||
await getHospitalList()
|
||||
// console.log(useStore.userInfo)
|
||||
userinfo.value = JSON.parse(uni.getStorageSync('userInfo'))
|
||||
console.log(userinfo.value)
|
||||
avatar.value = uni.getStorageSync('avatarUrl')
|
||||
if(uni.getStorageSync('operation_info')) {
|
||||
h_info.value = JSON.parse(uni.getStorageSync('operation_info'))
|
||||
if(h_info.value) {
|
||||
// console.log(h_info.value)
|
||||
getHospital(h_info.value.hospitalId)
|
||||
}
|
||||
h_info.value = userinfo.value
|
||||
h_info.value.surgery_time = h_info.value.SurgeryTime
|
||||
// console.log("userinfo is :",userinfo.value)
|
||||
userinfo.value.avatar = uni.getStorageSync('avatarUrl')
|
||||
h_index.value = hospitals.value.findIndex((item,i) => {
|
||||
return item.ID == userinfo.value.HospitalId
|
||||
})
|
||||
if(userinfo.value.HospitalId) {
|
||||
getHospital(userinfo.value.HospitalId)
|
||||
}
|
||||
|
||||
// if(uni.getStorageSync('operation_info')) {
|
||||
// h_info.value = JSON.parse(uni.getStorageSync('operation_info'))
|
||||
// if(h_info.value) {
|
||||
// h_index.value = hospitals.value.findIndex((item,i) => {
|
||||
// return item.ID == h_info.value.hospitalId
|
||||
// })
|
||||
// getHospital(h_info.value.hospitalId)
|
||||
// }
|
||||
// }
|
||||
})
|
||||
// 变量
|
||||
const h_queryParams = ref({
|
||||
@@ -115,17 +127,31 @@
|
||||
// hospitals.value = null
|
||||
}
|
||||
async function sumbmitFunc() {
|
||||
// console.log(choosed_h.value,h_info.value,userinfo.value)
|
||||
// console.log(h_index.value)
|
||||
// console.log(hospitals.value)
|
||||
// console.log(hospitals.value[h_index.value])
|
||||
await custom.uploadImage(userinfo.value.avatar, async (file) => {
|
||||
userinfo.value.avatar = file.data.file.url
|
||||
})
|
||||
let obj = {
|
||||
id: userinfo.value.userId,
|
||||
// isSurgery: 1, //是否已经手术 0为手术,1已经手术
|
||||
// isSurgery: userinfo.value.isSurgery,//是否已经手术 0 - 未手术,1 - 已经手术
|
||||
surgery_time: h_info.value?.surgery_time, //手术时间
|
||||
nickname: userinfo.value.nickname,
|
||||
// avatar: '',
|
||||
avatar: userinfo.value.avatar,
|
||||
phone: userinfo.value.phone,
|
||||
// hospitalId:choosed_h.value?.ID
|
||||
hospitalId:hospitals.value[h_index.value].ID
|
||||
hospitalId:hospitals.value[h_index.value]?.ID
|
||||
}
|
||||
if(!obj.hospitalId) {
|
||||
uni.showToast({
|
||||
title: "请选择医院",
|
||||
icon: "error",
|
||||
duration: 2000
|
||||
})
|
||||
return
|
||||
}
|
||||
obj.isSurgery = parseInt(userinfo.value.IsSurgery)
|
||||
const res = await api.userinfoUpdae(obj)
|
||||
// console.log('res is ',res)
|
||||
if(res.code === 0) {
|
||||
@@ -159,7 +185,12 @@
|
||||
});
|
||||
let res2=await api.wx_login({code:res.code},userId);
|
||||
if(res2.code === 0) {
|
||||
userinfo.value.HospitalId = hospitals.value[h_index.value].ID
|
||||
h_info.value.hospitalId = userinfo.value.HospitalId
|
||||
// console.log("h_info.value is:", h_info.value)
|
||||
uni.setStorageSync('avatarUrl', userinfo.value.avatar);//avatarUrl
|
||||
uni.setStorageSync('userInfo',JSON.stringify(userinfo.value))
|
||||
uni.setStorageSync('operation_info', JSON.stringify(h_info.value))
|
||||
// is_login.value = custom.checkLogin()
|
||||
store.checkLogin()
|
||||
}
|
||||
@@ -171,11 +202,33 @@
|
||||
console.log(hospitals.value )
|
||||
h_index.value = e.detail.value
|
||||
}
|
||||
function onChooseAvatar(e) {
|
||||
// const { avatarUrl } = e.detail
|
||||
// console.log(avatarUrl)
|
||||
userinfo.value.avatar = e.detail.avatarUrl
|
||||
}
|
||||
var isOperation = ref([
|
||||
{
|
||||
index:0,
|
||||
name:"否"
|
||||
},
|
||||
{
|
||||
index: 1,
|
||||
name: "是"
|
||||
}
|
||||
])
|
||||
function bindOperationPickerChange(e) {
|
||||
userinfo.value.IsSurgery = e.detail.value
|
||||
console.log("userinfo.value.IsSurgery is :",userinfo.value.IsSurgery)
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<view class="userInfoBox page-box page-bg-gray">
|
||||
<view class="avatar-box">
|
||||
<image :src="avatar" mode="aspectFill"></image>
|
||||
<!-- <image :src="avatar" mode="aspectFill"></image> -->
|
||||
<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar" style="border-radius: 50%;">
|
||||
<image :src="userinfo?.avatar" mode="aspectFill"></image>
|
||||
</button>
|
||||
</view>
|
||||
<view class="row-box">
|
||||
<view class="rb-card" @tap="toDetail(1)">
|
||||
@@ -200,37 +253,57 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rb-card" @tap="toDetail(3)">
|
||||
<view class="rbc-content">
|
||||
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
|
||||
<uni-icons type="calendar" color="gray" size="26"></uni-icons>
|
||||
手术时间</view>
|
||||
<view class="rbc-content-row rbc-content-right">
|
||||
<!-- {{h_info?.surgery_time}} -->
|
||||
<picker mode="date" :value="h_info?.surgery_time" :start="startDate" :end="endDate" @change="bindDateChange">
|
||||
<view class="rbc-content-row rbc-content-right">
|
||||
<view class="uni-input"> {{h_info?.surgery_time}}</view>
|
||||
<uni-icons type="forward" color="gray" size="20"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
<view class="rb-card" @tap="toDetail(5)">
|
||||
<view class="rbc-content">
|
||||
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
|
||||
<uni-icons type="paperplane" color="gray" size="26"></uni-icons>
|
||||
已经手术</view>
|
||||
<view class="rbc-content-row rbc-content-right">
|
||||
<picker @change="bindOperationPickerChange" :value="userinfo.IsSurgery" :range="isOperation" range-key="name" >
|
||||
<view class="rbc-content-row rbc-content-right">
|
||||
<view class="uni-input">{{ isOperation[userinfo.IsSurgery]?.name }}</view>
|
||||
<uni-icons type="forward" color="gray" size="20"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rb-card" @tap="toDetail(4)">
|
||||
<view class="rbc-content">
|
||||
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
|
||||
<uni-icons type="paperplane" color="gray" size="26"></uni-icons>
|
||||
手术医院</view>
|
||||
<view class="rbc-content-row rbc-content-right">
|
||||
<!-- {{h_info?.name}} -->
|
||||
<!-- <uni-combox :border="false" @input="onInputH" :candidates="hospitals" placeholder="请选择医院" @choosed="toChooseH" v-model="userinfo.HospitalId"></uni-combox> -->
|
||||
<!-- <uni-icons type="forward" color="gray" size="20"></uni-icons> -->
|
||||
<picker @change="bindPickerChange" :value="h_index" :range="hospitals" range-key="name">
|
||||
<view class="uni-input">{{hospitals[h_index]?.name}}</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="userinfo.IsSurgery == 1">
|
||||
<view class="rb-card" @tap="toDetail(3)">
|
||||
<view class="rbc-content">
|
||||
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
|
||||
<uni-icons type="calendar" color="gray" size="26"></uni-icons>
|
||||
手术时间</view>
|
||||
<view class="rbc-content-row rbc-content-right">
|
||||
<!-- {{h_info?.surgery_time}} -->
|
||||
<picker mode="date" :value="h_info?.surgery_time" :start="startDate" :end="endDate" @change="bindDateChange">
|
||||
<view class="rbc-content-row rbc-content-right">
|
||||
<view class="uni-input"> {{h_info?.surgery_time}}</view>
|
||||
<uni-icons type="forward" color="gray" size="20"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rb-card" @tap="toDetail(4)">
|
||||
<view class="rbc-content">
|
||||
<view class="rbc-content-row rbc-content-left rbc-content-left-box">
|
||||
<uni-icons type="paperplane" color="gray" size="26"></uni-icons>
|
||||
手术医院</view>
|
||||
<view class="rbc-content-row rbc-content-right">
|
||||
<!-- {{h_info?.name}} -->
|
||||
<!-- <uni-combox :border="false" @input="onInputH" :candidates="hospitals" placeholder="请选择医院" @choosed="toChooseH" v-model="userinfo.HospitalId"></uni-combox> -->
|
||||
<!-- <uni-icons type="forward" color="gray" size="20"></uni-icons> -->
|
||||
<picker @change="bindPickerChange" :value="h_index" :range="hospitals" range-key="name">
|
||||
<view class="rbc-content-row rbc-content-right">
|
||||
<view class="uni-input">{{hospitals[h_index]?.name}}</view>
|
||||
<uni-icons type="forward" color="gray" size="20"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<!--修改姓名/电话 弹窗 -->
|
||||
<uni-popup ref="inputDialog" >
|
||||
@@ -254,6 +327,19 @@
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.avatar-wrapper{
|
||||
width: 160rpx !important;
|
||||
height: 160rpx;
|
||||
padding: 0px;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
margin-bottom: 40rpx;
|
||||
// border: 1px solid #26758d;
|
||||
background: #ececec;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.avatar-box{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -261,6 +347,14 @@
|
||||
width: 100%;
|
||||
padding: 20rpx 0;
|
||||
background: #26758d;
|
||||
button{
|
||||
image{
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
background-color: white;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
image{
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
|
Reference in New Issue
Block a user