TraceabilityAPP/pages/allPlant/index.vue

187 lines
3.7 KiB
Vue
Raw Normal View History

2023-10-21 18:02:06 +08:00
<template>
<view class="content">
2023-10-26 19:02:26 +08:00
<!-- <view class="card">
2023-10-21 18:02:06 +08:00
<view class="tit">
<view class="">
1号土地
</view>
<view class="">
溯源码: 12302
</view>
</view>
<view class="card-li">
<view class="">
当前种植: 土豆
</view>
<view class="">
种植品牌: 的划分等级
</view>
</view>
<view class="card-li">
<view class="">
土地面积: 20
</view>
<view class="">
种子品牌: 的划分等级
</view>
</view>
<view class="card-li">
<view class="">
预计产量: 20
</view>
<view class="">
已出售: 的划分等级
</view>
</view>
<view class="card-li">
<view class="">
播种时间: 2020.12.01
</view>
</view>
2023-10-26 19:02:26 +08:00
</view> -->
<landInfo :land_id='land_id'></landInfo>
2023-10-21 18:02:06 +08:00
2023-10-26 19:02:26 +08:00
<!-- <view class="status">
2023-10-21 18:02:06 +08:00
<view class="" style="margin-bottom: 30rpx;">
今日种植状态
</view>
2023-10-25 19:55:18 +08:00
<imgCard text="地址"
imgUrl='http://ceshi-suyuan.lihaink.cn/uploads/20231025/3048b734cff7d9adfb00aaf6ab7290e5.jpeg'>
</imgCard>
2023-10-21 18:02:06 +08:00
</view>
<view class="status">
<view class="" style="margin-bottom: 30rpx;">
播种图片
</view>
2023-10-25 19:55:18 +08:00
<imgCard text="地址"
imgUrl='http://ceshi-suyuan.lihaink.cn/uploads/20231025/3048b734cff7d9adfb00aaf6ab7290e5.jpeg'>
</imgCard>
2023-10-26 19:02:26 +08:00
</view> -->
2023-10-21 18:02:06 +08:00
<view class="status">
<view class="" style="margin-bottom: 30rpx;">
生长情况
</view>
2023-10-26 19:02:26 +08:00
<imgCard text="地址" :imgUrl="item" v-for="(item,index) in imgList" :key="index" @tap='previewImage(index)'>
</imgCard>
2023-10-21 18:02:06 +08:00
</view>
2023-10-26 19:02:26 +08:00
<view class="up-btn" @click="updateImgFn">
2023-10-21 18:02:06 +08:00
上传新的种植情况
</view>
</view>
</template>
2023-10-25 19:55:18 +08:00
<script setup>
2023-10-26 19:02:26 +08:00
import landInfo from "@/components/plant/landInfo.vue"
2023-10-25 19:55:18 +08:00
import imgCard from "@/components/imgCard.vue"
import {
2023-10-26 19:02:26 +08:00
landCropPicListAPI,
addLandCropPicAPI
2023-10-25 19:55:18 +08:00
} from "@/api/plant.js"
import {
onLoad
} from "@dcloudio/uni-app"
import {
ref,
reactive
} from "vue"
2023-10-26 19:02:26 +08:00
import uplodeImg from "@/utils/uplodeImg.js"
2023-10-25 19:55:18 +08:00
const imgList = reactive([])
2023-10-26 19:02:26 +08:00
const crop_id = ref(0)
const land_id = ref(0)
2023-10-25 19:55:18 +08:00
onLoad((options) => {
2023-10-26 19:02:26 +08:00
crop_id.value = options.crop_id
land_id.value = options.land_id
2023-10-25 19:55:18 +08:00
landCropPicListAPI({
crop_id: options.crop_id
}).then(res => {
res.data.forEach(item => {
2023-10-26 19:02:26 +08:00
imgList.push(item.pic)
2023-10-25 19:55:18 +08:00
})
})
})
2023-10-26 19:02:26 +08:00
const updateImgFn = () => {
let image = ""
uplodeImg().then(res => {
image = res.data.image
addLandCropPicAPI({
crop_id: crop_id.value,
pic: image
}).then(res2 => {
imgList.unshift(image)
})
})
}
const previewImage = (index) => {
uni.previewImage({
urls: imgList,
current: index,
})
}
2023-10-21 18:02:06 +08:00
</script>
<style lang="scss" scoped>
.content {
padding: 20rpx;
background-color: #F4F4F4;
min-height: 100vh;
.card {
.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;
}
}
.status {
margin-bottom: 40rpx;
}
.head-img {
border-radius: 21.03rpx 21.03rpx 21.03rpx 21.03rpx;
margin: 20rpx auto;
position: relative;
.poisition {
opacity: 0.7;
position: absolute;
width: 360.26rpx;
height: 71rpx;
background-color: #FFFFFF;
left: 20rpx;
bottom: 36rpx;
border-radius: 21.03rpx 21.03rpx 21.03rpx 21.03rpx;
display: flex;
align-items: center;
font-size: 29.79rpx;
padding-left: 20rpx;
}
}
}
.up-btn {
width: 371.5rpx;
height: 66.59rpx;
border: 1px solid #00A15E;
color: #00A15E;
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
text-align: center;
line-height: 66rpx;
margin: 40rpx auto;
}
</style>