prod
阿怪 10 months ago
parent eef9377e02
commit e31e6d8fc5

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

@ -9,13 +9,12 @@
import api from "@/api/index.js" import api from "@/api/index.js"
const store = useStore() const store = useStore()
onLoad((e) => { onLoad((e) => {
res_.value = JSON.parse(decodeURIComponent(e.res))
console.log(res_.value)
randomFunc() randomFunc()
}) })
// //
const res = ref([ const res_ = ref(null)
4.1,
4.5
])
const userInfo = ref(null) const userInfo = ref(null)
const bg_imgs = ref([ const bg_imgs = ref([
'/static/result1.jpg', '/static/result1.jpg',
@ -23,9 +22,24 @@
'/static/result3.jpg', '/static/result3.jpg',
]) ])
const bg_index = ref(0) const bg_index = ref(0)
const avatarUrl = ref(null)
const info = ref({left:'',right:''})
const show_ = ref(false)
// //
function randomFunc() { function randomFunc() {
bg_index.value = parseInt((Math.random()*3)) 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> </script>
<template> <template>
@ -36,15 +50,29 @@
<view class="actionBox"> <view class="actionBox">
<view class="img-box"> <view class="img-box">
<image style="width: 100%;" :src="bg_imgs[bg_index]" mode="widthFix"></image> <image style="width: 100%;" :src="bg_imgs[bg_index]" mode="widthFix"></image>
<view class="res-text-row"> <view v-if="show_" class="avatar-box">
<view class="rtr-left">4.5</view> <image :src="avatarUrl" mode="widthFix"></image>
<view class="rtr-right">4.1</view> </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>
</view> </view>
</view> </view>
</template> </template>
<style scoped lang="scss"> <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{ .img-box{
position: relative; position: relative;
.res-text-row{ .res-text-row{
@ -55,6 +83,7 @@
position: absolute; position: absolute;
top: 47%; top: 47%;
font-weight: 900; font-weight: 900;
color:gray;
.rtr-left{ .rtr-left{
margin-left: 20%; margin-left: 20%;
} }

@ -10,7 +10,6 @@
const store = useStore() const store = useStore()
onLoad((e) => { onLoad((e) => {
userInfo.value = JSON.parse(store.userInfo) userInfo.value = JSON.parse(store.userInfo)
console.log(userInfo.value)
countDown.value = countDown_init countDown.value = countDown_init
// if(!store.userInfo?.has_operation) { // // if(!store.userInfo?.has_operation) { //
// setTimeout(()=>{ // setTimeout(()=>{
@ -77,11 +76,11 @@
const is_test = ref(true) const is_test = ref(true)
// //
function toStart() { // function toStart() { //
if(is_test.value) { // if(is_test.value) {
uni.navigateTo({ // uni.navigateTo({
url:'/pages/index/result' // url:'/pages/index/result'
}) // })
} // }
inputDialog.value.close() inputDialog.value.close()
inputDialog2.value.open() inputDialog2.value.open()
let s = setInterval(() => { let s = setInterval(() => {
@ -147,21 +146,22 @@
uni.showLoading({ uni.showLoading({
mask:true mask:true
}) })
const res = await api.saveVision({ const params = {
leftEyeVision:vision_info.value.left+'', leftEyeVision:vision_info.value.left+'',
rightEyeVision:vision_info.value.right+'', rightEyeVision:vision_info.value.right+'',
userId:userInfo.value.userId userId:userInfo.value.userId
}) }
const res = await api.saveVision(params)
uni.hideLoading() uni.hideLoading()
if(res.code == 0) { if(res.code == 0) {
uni.showToast({ uni.showToast({
title:"保存成功", title:"保存成功",
icon:"success", icon:"success",
duration:2000, duration:2000,
success: function (res){ success: function (res1){
// uni.navigateBack() // uni.navigateBack()
uni.navigateTo({ uni.redirectTo({
url:"/pages/index/result?res="+encodeURIComponent(JSON.stringify(res)) url:"/pages/index/result?res="+encodeURIComponent(JSON.stringify(params))
}) })
} }
}) })

@ -7,6 +7,7 @@
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" import api from "@/api/index"
import emptyCard from "@/components/emptyCard.vue"
// //
onLoad(() => { onLoad(() => {
getList() getList()
@ -68,7 +69,7 @@
</view> </view>
<view class="list-box"> <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"> <view class="lb-left">
<image :src="item.cover_img" mode="aspectFill"></image> <image :src="item.cover_img" mode="aspectFill"></image>
</view> </view>
@ -77,6 +78,7 @@
<view class="lb-content text-ellipsis-1 small-text" v-html="item.content"></view> <view class="lb-content text-ellipsis-1 small-text" v-html="item.content"></view>
</view> </view>
</view> </view>
<emptyCard v-else></emptyCard>
</view> </view>
</view> </view>
</template> </template>

Loading…
Cancel
Save