cultivationApp/pages/poultry/histroyFeed.vue

140 lines
2.6 KiB
Vue

<template>
<view class="content">
<view class="card">
<view class="tit">
<view class="">
编号: 52656
</view>
<view class="">
溯源码: 52656
</view>
</view>
<view class="card-li">
<view class="">
养殖品种: 土豆
</view>
<view class="">
年龄: 的划分等级
</view>
</view>
<view class="card-li">
<view class="">
养殖类型: 20
</view>
<view class="">
体重: 45kg
</view>
</view>
</view>
<view class="card">
<view class="card-li">
<view class="" style="display: flex;align-items: center;">
<u--image src="/static/img/GG.png" style="margin: 0 21rpx;" width="80rpx" height="80rpx"></u--image>
当前养殖状态
</view>
<view class="" style="color: green;">
健康
</view>
</view>
</view>
<view class="">
<view class="">
养殖情况
</view>
<imgCard v-for="(item,index) in imgList" :imgUrl='item' :key="index" @tap='previewImage(index)'></imgCard>
</view>
<view class="up-plant-btn" @click="updateImgFn">
上传新的种植情况
</view>
</view>
</template>
<script setup>
import imgCard from "@/components/imgCard.vue"
import uplodeImg from "@/utils/uplodeImg.js"
import {
animalPicListAPI,
addAnimalPicAPI
} from "@/api/chick.js"
import {
onLoad
} from "@dcloudio/uni-app"
import {
reactive,
ref
} from "vue";
const img = ref("")
const updateImgFn = () => {
uplodeImg().then(res => {
img.value = res.data.image
addAnimalPicAPI({
poultry_id: Number(animal_id.value),
pic: res.data.image
}).then(res => {
imgList.unshift(img.value)
})
})
}
const imgList = reactive([])
const animal_id = ref("")
onLoad((option) => {
animal_id.value = option.id
animalPicListAPI({
poultry_id: option.id
}).then(res => {
res.data.forEach(item => {
imgList.push(item.pic)
})
})
})
const previewImage = (index) => {
uni.previewImage({
urls: imgList,
current: index,
})
}
</script>
<style lang="scss" scoped>
.card {
margin-bottom: 20rpx;
.tit {
display: flex;
justify-content: space-between;
padding-bottom: 20rpx;
border-bottom: 1px solid #EBF1EF;
}
.card-li {
margin-top: 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
}
.up-plant-btn {
width: 371.5rpx;
height: 66.59rpx;
color: #00A15E;
margin: 40rpx auto;
border: 1px solid #00A15E;
font-weight: bold;
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
display: flex;
align-items: center;
justify-content: center;
}
</style>