diff --git a/config/index.js b/config/index.js index d60408d..aecdf1b 100644 --- a/config/index.js +++ b/config/index.js @@ -1,6 +1,7 @@ // isdev 为 true 表示开发环境 false 表示发布环境 -const isdev = true; -const baseUrl = isdev ? 'https://api.jimingyiliao.com' : 'http://eb467b6.r19.cpolar.top';// 办公室接口 & 测试环境 +const isdev = false; +const baseUrl = isdev ? 'https://4571de69.r29.cpolar.top' : 'https://api.jimingyiliao.com';// 办公室接口 & 测试环境 +// const baseUrl = isdev ? 'https://api.jimingyiliao.com' : 'http://eb467b6.r19.cpolar.top';// 办公室接口 & 测试环境 // const baseUrl = isdev ? 'http://707788f2.r1.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/manifest.json b/manifest.json index ec17600..dbab78b 100644 --- a/manifest.json +++ b/manifest.json @@ -52,10 +52,11 @@ "mp-weixin" : { "appid" : "wxaaf66dbb5c3983b3", "setting" : { - "urlCheck" : false - // "ignoreDevUnusedFiles": false , - // "ignoreUploadUnusedFiles": false” + "urlCheck" : false, + "minified" : true }, + // "ignoreDevUnusedFiles": false , + // "ignoreUploadUnusedFiles": false” "usingComponents" : true }, "mp-alipay" : { diff --git a/pages/index/aikefu.vue b/pages/index/aikefu.vue index 7a34619..441dcf3 100644 --- a/pages/index/aikefu.vue +++ b/pages/index/aikefu.vue @@ -84,8 +84,8 @@ } // console.log(res.height,w_h.value) }).exec() - } - + } + + + \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index dfdeac7..ec70403 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -14,16 +14,17 @@ const h_index = ref(0) onShow((e) => { getLbtList() - if(store.userInfo && !store.operation_info) { //登录过 且 未填写手术信息 - getHospitalList() - setTimeout(()=>{ - inputDialog.value.open() - },0) - } - let s = `$http({code:'1s'});if` + // console.log("store:",store) + // if(store.userInfo && !store.operation_info) { //登录过 且 未填写手术信息 + // getHospitalList() + // setTimeout(()=>{ + // inputDialog.value.open() + // },0) + // } + // let s = `$http({code:'1s'});if` // // let arr = /\$http\((\S*)\)\;if/.exec(s); - let arr = s.match(/\$http\((.*)\)\;if/) - console.log(arr[1]) + // let arr = s.match(/\$http\((.*)\)\;if/) + // console.log(arr[1]) }) // 变量 @@ -183,7 +184,7 @@ - + diff --git a/pages/index/result.vue b/pages/index/result.vue index 4518324..fa54a66 100644 --- a/pages/index/result.vue +++ b/pages/index/result.vue @@ -10,11 +10,11 @@ const store = useStore() onLoad((e) => { res_.value = JSON.parse(decodeURIComponent(e.res)) - console.log(res_.value) - console.log(store.bgList) - if(store.bgList.length>0) { - bg_imgs.value = store.bgList - } + // console.log(res_.value) + // console.log(store.bgList) + // if(store.bgList.length>0) { + // bg_imgs.value = store.bgList + // } randomFunc() }) // 变量 @@ -29,24 +29,41 @@ const avatarUrl = ref(null) const info = ref({left:'',right:''}) const show_ = ref(false) + const bg_list = ref([ + "https://jmyl-app.oss-cn-chengdu.aliyuncs.com/miniapp/result/result1.jpg", + "https://jmyl-app.oss-cn-chengdu.aliyuncs.com/miniapp/result/result2.jpg", + "https://jmyl-app.oss-cn-chengdu.aliyuncs.com/miniapp/result/result3.jpg" + ]) + const bg_list_index = ref(0) // 函数 function randomFunc() { - bg_index.value = parseInt((Math.random()*store.bgList.length)) + info.value.left = parseFloat(res_.value.leftEyeVision) + info.value.right = parseFloat(res_.value.rightEyeVision) + // 根据测试成绩显示不同的背景图 + if ((info.value.left + info.value.right) / 2 > 5) { + bg_list_index.value = 0 + } else if ((info.value.left + info.value.right) / 2 < 4.9 && (info.value.left + info.value.right) / 2 > 4.5) { + bg_list_index.value = 1 + } else if ((info.value.left + info.value.right) / 2 < 4.5) { + bg_list_index.value = 2 + } + // bg_index.value = parseInt((Math.random()*store.bgList.length)) uni.getImageInfo({ // src:bg_imgs.value[bg_index.value], - src:bg_imgs.value[bg_index.value].url, + src: bg_list.value[bg_list_index.value], success:function(res) { avatarUrl.value = uni.getStorageSync('avatarUrl') - info.value.left = res_.value.leftEyeVision - info.value.right = res_.value.rightEyeVision + info.value.left = parseFloat(res_.value.leftEyeVision) + info.value.right = parseFloat(res_.value.rightEyeVision) show_.value = true + }, fail(err) { console.log(err) } }) - } - + } + + + \ No newline at end of file diff --git a/pages/login/login.vue b/pages/login/login.vue index 547cc6b..0cf3998 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -1,4 +1,4 @@ - + + + \ No newline at end of file diff --git a/pages/user/index.vue b/pages/user/index.vue index f01e133..c393fab 100644 --- a/pages/user/index.vue +++ b/pages/user/index.vue @@ -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(); } } - + + + \ No newline at end of file diff --git a/pages/user/userInfo.vue b/pages/user/userInfo.vue index 6f975f0..584ea48 100644 --- a/pages/user/userInfo.vue +++ b/pages/user/userInfo.vue @@ -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) + }