10.25修改

This commit is contained in:
2023-10-25 00:18:08 +08:00
parent f55439859b
commit 6a45185641
7 changed files with 125 additions and 16 deletions

View File

@@ -4,23 +4,31 @@
import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue'
import { onLoad } from "@dcloudio/uni-app"
import mySwiper from "@/components/mySwiper.vue"
import {ref,onMounted,nextTick} from "vue"
import {ref,onMounted,nextTick,watch} from "vue"
import api from '@/api/index.js'
import {useStore} from '@/store/index.js'
// import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
const store = useStore()
onLoad((e) => {
if(!store.userInfo?.has_operation) { // 未填写手术信息
operation_flag.value = true
getLbtList()
if(store.userInfo && !store.operation_info) { //登录过 且 未填写手术信息
// getHospitalList()
setTimeout(()=>{
// console.log(inputDialog.value)
inputDialog.value.open()
},0)
}
})
// 变量
const hospitals = ref(null)
// const hospitals_show = ref(false)
const inputDialog = ref()
const inputClose = ref()
const operation_flag = ref(false)
const choosed_h = ref(null)
const blur_h = ref(0)
const surgery_time = ref(null) // 手术时间
const isSurgery = ref(-1) //是否已经手术 0为手术1已经手术
const lbt_list = ref([
{
banner_name: "首页轮播2",
@@ -44,26 +52,82 @@
weigh: 6,
}
])
// 失去焦点的监听
// watch(blur_h,(val1,val2) => {
// // hospitals.value = null
// console.log('监听 ',choosed_h.value)
// if(!choosed_h) { // 未选择值
// }
// })
// 函数
async function getHospitalList() {
const res = await api.getHospitalList()
if(res.code == 0) {
hospitals.value = res.data.list
}
}
async function getLbtList() { // 获取轮播图
const res = await api.getLbtList()
if(res.code == 0) {
}
}
function toClose() {
inputDialog.value.close()
}
function radioChange(e) {
console.log(e)
isSurgery.value = e.detail.value
}
const single = ref('')
function maskClick(e){
// console.log('maskClick事件:', e);
console.log('maskClick事件:', e);
}
const hValue = ref('') // 医院
const hValueId = ref('') // 医院id
function onClickH(e) {
// console.log(hValue.value)
getHospitalList()
}
function toExam() { // 视力测试
uni.navigateTo({
url:"/pages/index/visionTest"
})
}
function toChooseH(item) {
console.log(item)
choosed_h.value = item
hValue.value = item.name
hospitals.value = null
}
// function blurFunc() {
// blur_h.value = 1
// hospitals.value = null
// // console.log('blurFunc!!',blur_h.value)
// }
function focusFunc() {
// blur_h.value = 0
console.log('focusFunc')
}
function toBlur(){
// console.log('toBlur')
hospitals.value = null
}
async function toSave() {
let user_info = JSON.parse(uni.getStorageSync('userInfo'))
const res = await api.hospital({
isSurgery:isSurgery.value,
surgery_time:surgery_time.value,
userId:user_info.userId,
hospitalId:choosed_h.value.ID
})
console.log(res)
if(res.code == 0) {
}
}
</script>
<template>
<view class="content page-box">
@@ -104,7 +168,7 @@
</view>
</view>
</view>
<uni-popup ref="inputDialog" :is-mask-click='false'>
<uni-popup ref="inputDialog" @tap="toBlur" :is-mask-click='false'>
<view class="pop-box">
<view class="pb-title">完善手术信息</view>
<view class="pb-content">
@@ -121,15 +185,21 @@
<view class="pb-item-left">手术时间</view>
<view class="pb-item-right">
<!-- <uni-datetime-picker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" /> -->
<uniDatetimePicker type="date" :clear-icon="false" v-model="single" @maskClick="maskClick" ></uniDatetimePicker>
<uniDatetimePicker type="date" :clear-icon="false" v-model="surgery_time" @maskClick="maskClick" ></uniDatetimePicker>
</view>
</view>
<view class="pb-item">
<view class="pb-item-left">医院名称</view>
<view class="pb-item-right">
<uniEasyinput suffixIcon="search" v-model="hValue" focus placeholder="请输入内容" @iconClick="onClickH"></uniEasyinput>
<uniEasyinput @tap.stop="focusFunc" suffixIcon="search" v-model="hValue" focus placeholder="请输入内容" @iconClick="onClickH"></uniEasyinput>
<view class="h_res_show_aprt" v-if="hospitals">
<view v-for="(item,i) in hospitals" @tap.stop="toChooseH(item)" class="h_res_show_aprt_row text-ellipsis-1">
{{item.name}}
</view>
</view>
</view>
</view>
<view class="pb-item pb-item-btn" @tap="toSave">提交</view>
</view>
</view>
<view class="pop-close" @tap="toClose">
@@ -141,6 +211,36 @@
</view>
</template>
<style scoped lang="scss">
.pb-item-btn{
padding: 20rpx 0;
text-align: center;
color: white;
background: #26758d;
justify-content: center;
width: 66%;
margin: 0 auto;
border-radius: 10rpx;
}
.h_res_show_aprt{
position: absolute;
bottom: 100%;
width: 100%;
background: white;
z-index: 10;
box-shadow: 1px 2px 10px #02020236;
border: 1px solid #e3e3e3;
max-height: 400rpx;
overflow-y: auto;
left: 0;
.h_res_show_aprt_row{
padding: 20rpx 10rpx;
border-bottom: 2rpx #e3e3e3 solid;
color: gray;
}
.h_res_show_aprt_row:last-child{
border-bottom:unset
}
}
.mc-row{
display:flex;
// width: 100%;
@@ -166,6 +266,7 @@
width: 30%;
}
.pb-item-right{
position: relative;
margin-left: 10rpx;
width: 75%;
}

View File

@@ -77,6 +77,7 @@
avatarUrl.value = file.data.file.url
uni.setStorageSync('avatarUrl', file.data.file.url);//头像链接
const up_res = await updateFunc() // 更新用户信息
// isInfo // 判断是否填过手术信息的字段(是否使用待定)
uni.switchTab({
url:"/pages/user/index"
})

View File

@@ -55,9 +55,12 @@
})
}
function toUserInfo() {
uni.navigateTo({
url:"/pages/user/userInfo"
})
if(is_login.value) {
uni.navigateTo({
url:"/pages/user/userInfo"
})
}
}
function getPhoneNumber (e) {
// tel_code.value = e.detail.code
@@ -81,7 +84,7 @@
const res = await api.getToken(data)
if(res.code === 200) {
if(res.data.newUser) { // 新用户,跳转登录页
toUserInfo()
toLogin()
}
else{
uni.setStorageSync('avatarUrl', res.data.avatar);//avatarUrl