|
|
|
@ -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%;
|
|
|
|
|
}
|
|
|
|
|