diff --git a/App.vue b/App.vue index 21d27f8..0fe4984 100644 --- a/App.vue +++ b/App.vue @@ -18,9 +18,10 @@ import {useStore} from '@/store/index.js' const store = useStore() onLaunch((e) => { - console.log('App onLaunch') + console.log('App onLaunch') let userInfo = uni.getStorageSync('userInfo') - if(userInfo) { + if(userInfo) { // 已经登录过 + store.userInfo = userInfo } }) diff --git a/api/index.js b/api/index.js index 4b402df..1a55f8d 100644 --- a/api/index.js +++ b/api/index.js @@ -10,6 +10,8 @@ const API = { // 首页 getHospitalList:data => net.GET('/hospital/list',data), // 获取医院信息 saveVision:data => net.POST("/vision",data),// 保存视力测试结果 + getLbtList:data => net.GET("/banner/list",data),// 获取轮播图 + hospital:data => net.PUT("/user/hospital",data),// 修改医院信息 // 百科 getArticleList:data => net.GET("/article/list",data),// 百科列表 getArticleDetail:data => net.GET("/article/"+data.id),// 百科列表 diff --git a/config/index.js b/config/index.js index 5935324..9f90e1f 100644 --- a/config/index.js +++ b/config/index.js @@ -1,6 +1,6 @@ // isdev 为 true 表示开发环境 false 表示发布环境 const isdev = true; -const baseUrl = isdev ? 'http://18b10cba.r6.cpolar.top' : 'http://18b10cba.r6.cpolar.top';// 办公室接口 & 测试环境 +const baseUrl = isdev ? 'http://eb467b6.r19.cpolar.top' : 'http://eb467b6.r19.cpolar.top';// 办公室接口 & 测试环境 // const baseUrl = isdev ? 'http://192.168.1.133:8899' : 'https://api.gwkjxb.com';// 办公室接口 & 正式环境 // const baseUrl = 'https://api.gwkjxb.com';// 正式环境(由于本地测试后台没有启动,暂时通用正式服) diff --git a/pages/index/index.vue b/pages/index/index.vue index 804ec3a..d76a73b 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -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) { + + } + }