10.23修改

prod
阿怪 11 months ago
parent 23f37bc1a5
commit f55439859b

@ -1,18 +1,30 @@
<script> <!-- // <script>
import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue' //
export default { // export default {
onLaunch: function() { // onLaunch: function() {
console.log('App Launch') // console.log('App Launch')
}, // },
onShow: function() { // onShow: function() {
console.log('App Show') // console.log('App Show')
}, // },
onHide: function() { // onHide: function() {
console.log('App Hide') // console.log('App Hide')
} // }
} // }
// </script> -->
<script setup>
import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
import { onLoad,onLaunch } from "@dcloudio/uni-app"
import {useStore} from '@/store/index.js'
const store = useStore()
onLaunch((e) => {
console.log('App onLaunch')
let userInfo = uni.getStorageSync('userInfo')
if(userInfo) {
store.userInfo = userInfo
}
})
</script> </script>
<style lang="scss"> <style lang="scss">
/*每个页面公共css */ /*每个页面公共css */
.page-bg-gray{ .page-bg-gray{

@ -9,6 +9,7 @@ const API = {
userinfoUpdae:data => net.PUT('/user/info',data), // 更新用户信息 userinfoUpdae:data => net.PUT('/user/info',data), // 更新用户信息
// 首页 // 首页
getHospitalList:data => net.GET('/hospital/list',data), // 获取医院信息 getHospitalList:data => net.GET('/hospital/list',data), // 获取医院信息
saveVision:data => net.POST("/vision",data),// 保存视力测试结果
// 百科 // 百科
getArticleList:data => net.GET("/article/list",data),// 百科列表 getArticleList:data => net.GET("/article/list",data),// 百科列表
getArticleDetail:data => net.GET("/article/"+data.id),// 百科列表 getArticleDetail:data => net.GET("/article/"+data.id),// 百科列表

@ -1,6 +1,6 @@
// isdev 为 true 表示开发环境 false 表示发布环境 // isdev 为 true 表示开发环境 false 表示发布环境
const isdev = true; const isdev = true;
const baseUrl = isdev ? 'https://62bafc5f.r16.cpolar.top' : 'http://niunai.zhitou1688.com';// 办公室接口 & 测试环境 const baseUrl = isdev ? 'http://18b10cba.r6.cpolar.top' : 'http://18b10cba.r6.cpolar.top';// 办公室接口 & 测试环境
// const baseUrl = isdev ? 'http://192.168.1.133:8899' : 'https://api.gwkjxb.com';// 办公室接口 & 正式环境 // const baseUrl = isdev ? 'http://192.168.1.133:8899' : 'https://api.gwkjxb.com';// 办公室接口 & 正式环境
// const baseUrl = 'https://api.gwkjxb.com';// 正式环境(由于本地测试后台没有启动,暂时通用正式服) // const baseUrl = 'https://api.gwkjxb.com';// 正式环境(由于本地测试后台没有启动,暂时通用正式服)

@ -12,7 +12,7 @@
if(!store.userInfo?.has_operation) { // if(!store.userInfo?.has_operation) { //
operation_flag.value = true operation_flag.value = true
setTimeout(()=>{ setTimeout(()=>{
console.log(inputDialog.value) // console.log(inputDialog.value)
inputDialog.value.open() inputDialog.value.open()
},0) },0)
} }

@ -6,22 +6,32 @@
// import mySwiper from "@/components/mySwiper.vue" // import mySwiper from "@/components/mySwiper.vue"
import {ref,onMounted,nextTick} from "vue" import {ref,onMounted,nextTick} from "vue"
import {useStore} from '@/store/index.js' import {useStore} from '@/store/index.js'
import api from "@/api/index.js"
const store = useStore() const store = useStore()
onLoad((e) => { onLoad((e) => {
if(!store.userInfo?.has_operation) { // userInfo.value = JSON.parse(store.userInfo)
setTimeout(()=>{ console.log(userInfo.value)
// console.log(inputDialog.value) countDown.value = countDown_init
inputDialog.value.open() // if(!store.userInfo?.has_operation) { //
},0) // setTimeout(()=>{
} // // console.log(inputDialog.value)
// inputDialog.value.open()
// },0)
// }
setTimeout(()=>{
// console.log(inputDialog.value)
inputDialog.value.open()
},0)
}) })
// //
const userInfo = ref(null)
const inputDialog = ref() const inputDialog = ref()
const inputDialog2 = ref() const inputDialog2 = ref()
const inputDialog3 = ref() const inputDialog3 = ref()
const step1 = ref('先测右眼,请遮住左眼') const step1 = ref('先测右眼,请遮住左眼')
const step2 = ref('请遮住右眼') const step2 = ref('请遮住右眼')
const countDown = ref(5) const countDown = ref(null) //
const countDown_init = 3
const scale_ = ref(1) const scale_ = ref(1)
const current_img = ref("") // const current_img = ref("") //
const current_img_index = ref(null) const current_img_index = ref(null)
@ -59,10 +69,10 @@
width:'29px' width:'29px'
}) })
const num = ref(0) const num = ref(0)
const now = ref(1) const now = ref(1); // 1-2-
const vision_info = ref({ const vision_info = ref({
left:4, left:4,
right:4.1 right:4
}) })
// //
function toStart() { // function toStart() { //
@ -93,22 +103,31 @@
} }
function chooseFunc(index) { function chooseFunc(index) {
// //
if(!index){ // if(!index || index!=current_img_index.value){ //
}
else{ //
if(now.value == 1) { //
vision_info.value.right+=0.1
vision_info.value.right = Number(vision_info.value.right.toFixed(1))
}
else{ //
vision_info.value.left+=0.1
vision_info.value.left = Number(vision_info.value.left.toFixed(1))
}
} }
// //
randomFunc() randomFunc()
// //
if(num.value>8) { // if(num.value>8) { //
if(now.value == 2) { // if(now.value == 2) { //
inputDialog3.value.open()
return return
} }
show_size.value.width = '29px' show_size.value.width = '29px'
countDown.value = 5 countDown.value = countDown_init
step1.value = '测左眼,请遮住右眼' step1.value = '测左眼,请遮住右眼'
num.value = 8 num.value = 0
now.value = 2 now.value = 2
toStart() toStart()
} }
@ -117,8 +136,17 @@
num.value++ num.value++
} }
} }
function okFunc() { // async function okFunc() { //
inputDialog3.value.open() // inputDialog3.value.open()
const res = await api.saveVision({
leftEyeVision:vision_info.value.left,
rightEyeVision:vision_info.value.right,
userId:userInfo.value.userId
})
if(res.code == 0) {
uni.navigateBack()
}
} }
</script> </script>
<template> <template>
@ -147,8 +175,10 @@
<view class="pop-box"> <view class="pop-box">
<view class="pb-title">测试须知</view> <view class="pb-title">测试须知</view>
<view class="pb-content"> <view class="pb-content">
<view class="content-text"> <view class="content-text" style="color: gray;">
使用uni-app自带的editor组件该组件支持AppH5微信小程序其他家小程序自身未提供这类解决方案 1.适应室内光纤两分钟左右
2.取坐位或站立正对手机检查者眼部跟手机平行保持手机距离40厘米
3.先测右眼后测左眼测试时请遮挡另一只眼睛
</view> </view>
<view class="okBtn" @tap="toStart"></view> <view class="okBtn" @tap="toStart"></view>
</view> </view>
@ -166,12 +196,16 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<uni-popup ref="inputDialog3" :is-mask-click='true'> <uni-popup ref="inputDialog3" :is-mask-click='false'>
<view class="pop-box"> <view class="pop-box">
<view class="pb-title">测试结束</view> <view class="pb-title">测试结束</view>
<view class="pb-content"> <view class="pb-content">
<view class="content-text"> <view class="content-text">
测试结束当前视力为{{vision_info.left}}(){{vision_info.right}}() 测试结束当前视力为{{vision_info.left}}(){{vision_info.right}}()
<view style="opacity: 0;">
使用uni-app自带的editor组件该组件支持AppH5微信小程序其他家小程序自身未提供这类解决方案
</view>
</view> </view>
<view class="okBtn" @tap="okFunc"></view> <view class="okBtn" @tap="okFunc"></view>
</view> </view>
@ -194,7 +228,7 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
image{ image{
// width: 29px; height: auto;
} }
} }
.ab-action-box{ .ab-action-box{

@ -8,21 +8,57 @@
import api from "@/api/index" import api from "@/api/index"
import custom from "@/utils/index.js" import custom from "@/utils/index.js"
onShow(() => { onShow(() => {
is_login.value = custom.checkLogin() getInfo()
// console.log(is_login.value)
if(is_login.value) {
userinfo.value = uni.getStorageSync('userInfo')
avatar.value = uni.getStorageSync('avatarUrl')
userinfo.value = JSON.parse(userinfo.value)
// console.log(userinfo.value)
}
}) })
// //
const avatar = ref('') const avatar = ref('')
const res_form = ref(null) const res_form = ref(null)
const is_login = ref(null) const is_login = ref(null)
const userinfo = ref(null) const userinfo = ref(null)
// const avatarUrl = ref(null)
const nickname = ref('')
// //
function getInfo(){
is_login.value = custom.checkLogin()
// console.log(is_login.value)
if(is_login.value) {
avatar.value = uni.getStorageSync('avatarUrl')
userinfo.value = JSON.parse(uni.getStorageSync('userInfo'))
}
}
function toLogin() {
uni.navigateTo({
url:"/pages/login/login"
})
}
function toDetail(type) {
let url = ''
switch(type){
case 1:
url= ' '
break;
case 2: //
url= './star'
break;
case 3: //
url= './setting'
break;
case 4: //
url= './feedback'
break;
default:
url= ' '
break;
}
uni.navigateTo({
url
})
}
function toUserInfo() {
uni.navigateTo({
url:"/pages/user/userInfo"
})
}
function getPhoneNumber (e) { function getPhoneNumber (e) {
// tel_code.value = e.detail.code // tel_code.value = e.detail.code
// console.log(e) // console.log(e)
@ -41,14 +77,20 @@
identity:'user', identity:'user',
password:'111' password:'111'
} }
// console.log(':',data) // console.log(':',data);return;
const res = await api.getToken(data) const res = await api.getToken(data)
if(res.code === 200) { if(res.code === 200) {
res_form.value = res.data if(res.data.newUser) { //
res_form.value.access_token = 'Bearer '+res.data.access_token toUserInfo()
let userId = res.data.userId }
uni.setStorageSync('access_token',res_form.value.access_token);// token else{
wx_login(userId) uni.setStorageSync('avatarUrl', res.data.avatar);//avatarUrl
res_form.value = res.data
res_form.value.access_token = 'Bearer '+res.data.access_token
let userId = res.data.userId
uni.setStorageSync('access_token',res_form.value.access_token);// token
wx_login(userId)
}
} }
} }
async function wx_login(userId){ async function wx_login(userId){
@ -63,48 +105,14 @@
}); });
let res2=await api.wx_login({code:res.code},userId); let res2=await api.wx_login({code:res.code},userId);
if(res2.code === 0) { if(res2.code === 0) {
// for(let prop in res_form.value) { uni.setStorageSync('userInfo',JSON.stringify(res_form.value))
// uni.setStorageSync(prop,res_form.value[prop]) // is_login.value = custom.checkLogin()
// } getInfo()
uni.setStorageSync(userInfo,JSON.stringify(res_form.value))
} }
else{ else{
uni.clearStorage(); uni.clearStorage();
} }
} }
function toLogin() {
uni.navigateTo({
url:"/pages/login/login"
})
}
function toDetail(type) {
let url = ''
switch(type){
case 1:
url= ' '
break;
case 2: //
url= './star'
break;
case 3: //
url= './setting'
break;
case 4: //
url= './feedback'
break;
default:
url= ' '
break;
}
uni.navigateTo({
url
})
}
function toUserInfo() {
uni.navigateTo({
url:"/pages/user/userInfo"
})
}
</script> </script>
<template> <template>
<view class="user-box page-box"> <view class="user-box page-box">
@ -115,8 +123,12 @@
</view> </view>
<uni-icons style="position: absolute;right:20rpx;top: 40%;" v-if="is_login" type="forward" color="white" size="20"></uni-icons> <uni-icons style="position: absolute;right:20rpx;top: 40%;" v-if="is_login" type="forward" color="white" size="20"></uni-icons>
</view> </view>
<view class="btn-box" @tap="toLogin" v-if="!is_login"> <!-- <view class="btn-box" @tap="toLogin" v-if="!is_login"> -->
<view class="btn">登录</view> <view class="btn-box" v-if="!is_login">
<!-- <view class="btn">登录</view> -->
<view class="btn-part">
<button class="buy-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"></button>
</view>
</view> </view>
<view class="row-box" v-else> <view class="row-box" v-else>
<view class="rb-card" @tap="toDetail(1)" style="margin-bottom: 10px;"> <view class="rb-card" @tap="toDetail(1)" style="margin-bottom: 10px;">
@ -166,6 +178,17 @@
</view> </view>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.buy-btn{
display: inline-block;
margin-top:1rem;
background-color: #26758d;
color: white;
border-radius: 50rpx;
font-weight: 200;
font-size: 24rpx;
width: 50%;
padding: 10rpx 0;
}
.rbc-content-left-box{ .rbc-content-left-box{
uni-icons{ uni-icons{
margin-right: 20rpx; margin-right: 20rpx;

Loading…
Cancel
Save