You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.6 KiB
Vue

11 months ago
<script setup>
// 引入依赖
import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue'
import { onLoad,onPullDownRefresh,onReachBottom } from "@dcloudio/uni-app"
import emptyCard from "@/components/emptyCard.vue"
import {ref,onMounted,nextTick,watch} from "vue"
import api from '@/api/index.js'
import util from "@/utils/index.js"
import {useStore} from '@/store/index.js'
// import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
const store = useStore()
// 生命周期
onLoad((e) => {
if(store.userInfo){
let user_info = JSON.parse(store.userInfo)
queryParams.value.userId = user_info.userId
}
getList()
})
onPullDownRefresh(()=> { // 下拉刷新
init()
getList()
})
onReachBottom(() => { // 上滑触底
queryParams.value.page++
getList()
})
// 变量
const list = ref([])
const queryParams = ref({
page:1,
pageSize:10,
userId:0
})
// 函数
function init(){
list.value = []
queryParams.value.page = 1
queryParams.value.pageSize = 10
}
async function getList() {
const res = await api.getVisionList(queryParams.value)
if(res.code === 0) {
if(res.data.list && res.data.list.length > 0) {
list.value.push(...res.data.list)
}
else{
queryParams.value.page--
}
}
else{
uni.showToast({
title:"获取失败",
icon:"error",
duration:2000
})
}
}
</script>
<template>
<view class="visinoListBox page-box">
<view class="vl-item-box" v-if="list.length > 0">
<view class="vl-item" v-for="(item,i) in list">
<view class="vl-title">{{util.timestampToDate(item.CreatedAt)}}</view>
<view class="vl-row-box">
<view class="vl-row">
<view class="vlr-left">右眼</view>
<view class="vlr-left">{{item.rightEyeVision}}</view>
</view>
<view class="vl-row">
<view class="vlr-left">左眼</view>
<view class="vlr-left">{{item.leftEyeVision}}</view>
</view>
</view>
</view>
</view>
<emptyCard v-else></emptyCard>
</view>
</template>
<style scoped lang="scss">
.visinoListBox{
.vl-item-box{
padding: 20rpx;
.vl-item{
.vl-title{
border-left: 4rpx solid red;
}
.vl-row-box{
.vl-row{
display: flex;
align-items: center;
.vlr-left{
}
.vlr-right{
margin-left: 20rpx;
}
}
}
}
}
}
</style>