11.28
This commit is contained in:
@@ -9,13 +9,12 @@
|
||||
import api from "@/api/index.js"
|
||||
const store = useStore()
|
||||
onLoad((e) => {
|
||||
res_.value = JSON.parse(decodeURIComponent(e.res))
|
||||
console.log(res_.value)
|
||||
randomFunc()
|
||||
})
|
||||
// 变量
|
||||
const res = ref([
|
||||
4.1,
|
||||
4.5
|
||||
])
|
||||
const res_ = ref(null)
|
||||
const userInfo = ref(null)
|
||||
const bg_imgs = ref([
|
||||
'/static/result1.jpg',
|
||||
@@ -23,9 +22,24 @@
|
||||
'/static/result3.jpg',
|
||||
])
|
||||
const bg_index = ref(0)
|
||||
const avatarUrl = ref(null)
|
||||
const info = ref({left:'',right:''})
|
||||
const show_ = ref(false)
|
||||
// 函数
|
||||
function randomFunc() {
|
||||
bg_index.value = parseInt((Math.random()*3))
|
||||
uni.getImageInfo({
|
||||
src:bg_imgs.value[bg_index.value],
|
||||
success:function(res) {
|
||||
avatarUrl.value = uni.getStorageSync('avatarUrl')
|
||||
info.value.left = res_.value.leftEyeVision
|
||||
info.value.right = res_.value.rightEyeVision
|
||||
show_.value = true
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
@@ -36,15 +50,29 @@
|
||||
<view class="actionBox">
|
||||
<view class="img-box">
|
||||
<image style="width: 100%;" :src="bg_imgs[bg_index]" mode="widthFix"></image>
|
||||
<view class="res-text-row">
|
||||
<view class="rtr-left">4.5</view>
|
||||
<view class="rtr-right">4.1</view>
|
||||
<view v-if="show_" class="avatar-box">
|
||||
<image :src="avatarUrl" mode="widthFix"></image>
|
||||
</view>
|
||||
<view v-if="show_" class="res-text-row">
|
||||
<view class="rtr-left">{{info.left}}</view>
|
||||
<view class="rtr-right">{{info.right}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.avatar-box{
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top:280rpx;
|
||||
image{
|
||||
width: 260rpx;
|
||||
margin: 0px auto;
|
||||
display: block;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.img-box{
|
||||
position: relative;
|
||||
.res-text-row{
|
||||
@@ -55,6 +83,7 @@
|
||||
position: absolute;
|
||||
top: 47%;
|
||||
font-weight: 900;
|
||||
color:gray;
|
||||
.rtr-left{
|
||||
margin-left: 20%;
|
||||
}
|
||||
|
@@ -10,7 +10,6 @@
|
||||
const store = useStore()
|
||||
onLoad((e) => {
|
||||
userInfo.value = JSON.parse(store.userInfo)
|
||||
console.log(userInfo.value)
|
||||
countDown.value = countDown_init
|
||||
// if(!store.userInfo?.has_operation) { // 未填写手术信息
|
||||
// setTimeout(()=>{
|
||||
@@ -77,11 +76,11 @@
|
||||
const is_test = ref(true)
|
||||
// 函数
|
||||
function toStart() { // 开始测试
|
||||
if(is_test.value) {
|
||||
uni.navigateTo({
|
||||
url:'/pages/index/result'
|
||||
})
|
||||
}
|
||||
// if(is_test.value) {
|
||||
// uni.navigateTo({
|
||||
// url:'/pages/index/result'
|
||||
// })
|
||||
// }
|
||||
inputDialog.value.close()
|
||||
inputDialog2.value.open()
|
||||
let s = setInterval(() => {
|
||||
@@ -147,21 +146,22 @@
|
||||
uni.showLoading({
|
||||
mask:true
|
||||
})
|
||||
const res = await api.saveVision({
|
||||
const params = {
|
||||
leftEyeVision:vision_info.value.left+'',
|
||||
rightEyeVision:vision_info.value.right+'',
|
||||
userId:userInfo.value.userId
|
||||
})
|
||||
}
|
||||
const res = await api.saveVision(params)
|
||||
uni.hideLoading()
|
||||
if(res.code == 0) {
|
||||
uni.showToast({
|
||||
title:"保存成功",
|
||||
icon:"success",
|
||||
duration:2000,
|
||||
success: function (res){
|
||||
success: function (res1){
|
||||
// uni.navigateBack()
|
||||
uni.navigateTo({
|
||||
url:"/pages/index/result?res="+encodeURIComponent(JSON.stringify(res))
|
||||
uni.redirectTo({
|
||||
url:"/pages/index/result?res="+encodeURIComponent(JSON.stringify(params))
|
||||
})
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user