This commit is contained in:
阿怪 2023-11-28 22:30:40 +08:00
parent eef9377e02
commit e31e6d8fc5
4 changed files with 51 additions and 20 deletions

View File

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

View File

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

View File

@ -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))
})
}
})

View File

@ -7,6 +7,7 @@
import {ref,onMounted,nextTick} from "vue"
import {useStore} from '@/store/index.js'
import api from "@/api/index"
import emptyCard from "@/components/emptyCard.vue"
//
onLoad(() => {
getList()
@ -68,7 +69,7 @@
</view>
<view class="list-box">
<view class="lb-card" v-for="(item,i) in list" @tap="toDetail(item)">
<view v-if="list.length>0" class="lb-card" v-for="(item,i) in list" @tap="toDetail(item)">
<view class="lb-left">
<image :src="item.cover_img" mode="aspectFill"></image>
</view>
@ -77,6 +78,7 @@
<view class="lb-content text-ellipsis-1 small-text" v-html="item.content"></view>
</view>
</view>
<emptyCard v-else></emptyCard>
</view>
</view>
</template>