cultivationApp/pages/feedIng/histroyFeed.vue

148 lines
3.1 KiB
Vue
Raw Normal View History

2023-10-21 18:02:06 +08:00
<template>
<view class="content">
2023-10-27 18:38:25 +08:00
<!-- <view class="card">
2023-10-21 18:02:06 +08:00
<view class="tit">
2023-10-27 18:38:25 +08:00
2023-10-21 18:02:06 +08:00
<view class="">
2023-10-27 18:38:25 +08:00
溯源码: {{animal_detail.animal_code}}
2023-10-21 18:02:06 +08:00
</view>
</view>
<view class="card-li">
<view class="">
2023-10-27 18:38:25 +08:00
养殖品种: {{animal_detail.animal_kind}}
2023-10-21 18:02:06 +08:00
</view>
<view class="">
2023-10-27 18:38:25 +08:00
年龄: {{animal_detail.animal_age}}
2023-10-21 18:02:06 +08:00
</view>
</view>
<view class="card-li">
<view class="">
2023-10-27 18:38:25 +08:00
养殖类型: {{animal_detail.animal_breed}}
2023-10-21 18:02:06 +08:00
</view>
<view class="">
2023-10-27 18:38:25 +08:00
体重:{{animal_detail.animal_weight}}
2023-10-21 18:02:06 +08:00
</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>
2023-10-27 18:38:25 +08:00
<view class="" style="color: #00A15E;" v-if='animal_detail.animal_status==1'>
2023-10-21 18:02:06 +08:00
健康
</view>
2023-10-27 18:38:25 +08:00
<view class="" style="color: #FFD736;" v-if='animal_detail.animal_status==2'>
怀孕中
</view>
<view class="" style="color: #3274F9;" v-if='animal_detail.animal_status==4'>
可出栏
</view>
<view class="" style="color: #F84221;" v-if='animal_detail.animal_status==3'>
生病隔离中
</view>
2023-10-21 18:02:06 +08:00
</view>
2023-10-27 18:38:25 +08:00
</view> -->
<detailCard :id='animal_id'></detailCard>
2023-10-21 18:02:06 +08:00
<view class="">
<view class="">
养殖情况
</view>
2023-10-26 20:18:04 +08:00
<imgCard v-for="(item,index) in imgList" :imgUrl='item' :key="index" @tap='previewImage(index)'></imgCard>
2023-10-21 18:02:06 +08:00
</view>
2023-10-23 17:57:19 +08:00
<view class="up-plant-btn" @click="updateImgFn">
2023-10-21 18:02:06 +08:00
上传新的种植情况
</view>
</view>
</template>
<script setup>
import imgCard from "@/components/imgCard.vue"
2023-10-25 19:55:18 +08:00
import uplodeImg from "@/utils/uplodeImg.js"
import {
animalPicListAPI,
2023-10-27 18:38:25 +08:00
addAnimalPicAPI,
animalInfoAPI
2023-10-25 19:55:18 +08:00
} from "@/api/animal.js"
import {
onLoad
} from "@dcloudio/uni-app"
import {
reactive,
ref
} from "vue";
2023-10-27 18:38:25 +08:00
import detailCard from "@/components/animal/detailCard.vue"
2023-10-26 20:18:04 +08:00
const img = ref("")
2023-10-23 17:57:19 +08:00
const updateImgFn = () => {
2023-10-25 19:55:18 +08:00
uplodeImg().then(res => {
2023-10-26 20:18:04 +08:00
img.value = res.data.image
2023-10-25 19:55:18 +08:00
addAnimalPicAPI({
animal_id: Number(animal_id.value),
pic: res.data.image
}).then(res => {
2023-10-26 20:18:04 +08:00
imgList.unshift(img.value)
2023-10-25 19:55:18 +08:00
})
2023-10-23 17:57:19 +08:00
})
}
2023-10-25 19:55:18 +08:00
const imgList = reactive([])
const animal_id = ref("")
onLoad((option) => {
animal_id.value = option.id
animalPicListAPI({
animal_id: option.id
}).then(res => {
res.data.forEach(item => {
2023-10-26 20:18:04 +08:00
imgList.push(item.pic)
2023-10-25 19:55:18 +08:00
})
})
})
2023-10-26 20:18:04 +08:00
const previewImage = (index) => {
uni.previewImage({
urls: imgList,
current: index,
})
}
2023-10-21 18:02:06 +08:00
</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>