mkm
/
yanzhiAPP
Template
2
0
Fork 0
yanzhiAPP/pages/landDetail/index.vue

290 lines
5.3 KiB
Vue
Raw Normal View History

2023-11-22 14:08:24 +08:00
<template>
<view class="box">
<view class="content">
2023-11-25 16:18:54 +08:00
<view class="video" @click="navto('/pages/live/live')" >
<!-- <u--image :src="url" width="100%" height="300rpx"></u--image> -->
2023-11-25 16:18:54 +08:00
<u-swiper :list="dataobj.pic"></u-swiper>
2023-11-22 14:08:24 +08:00
</view>
<view class="time">
<u-icon name="clock"></u-icon>
<text>刷新时间: {{getNowTimeFn()}} </text>
</view>
2023-11-25 16:18:54 +08:00
<view class="add-thing" @click="addshowPicke">
新增种植
2023-11-22 14:08:24 +08:00
</view>
2023-11-25 16:18:54 +08:00
<landInfo :info='dataobj'></landInfo>
2023-11-22 14:08:24 +08:00
2023-11-25 16:18:54 +08:00
<view class="" >
2023-11-22 14:08:24 +08:00
<view class="tit" style="font-size: 33.29rpx;margin: 20rpx 0;">
2023-11-25 16:18:54 +08:00
种植信息
2023-11-22 14:08:24 +08:00
</view>
2023-11-25 16:18:54 +08:00
<view class="" v-if="dataList.length>0">
2023-11-22 14:08:24 +08:00
<view class="thing-card" v-for="(item,index) in dataList" :key="index">
<view class="head">
<view class="">
种植
</view>
2023-11-25 16:18:54 +08:00
<view class="" @click="navtoForm(item,i)">
2023-11-22 14:08:24 +08:00
农事查看
</view>
</view>
2023-11-25 16:18:54 +08:00
<view class="card_body">
2023-11-22 14:08:24 +08:00
<view class="left">
2023-11-25 16:18:54 +08:00
<u--image @click="perviewFn(url)" radius='10' :src="item.pic[0]" width="200rpx"
2023-11-22 14:08:24 +08:00
height="200rpx"></u--image>
</view>
<view class="right">
<view class="">
2023-11-25 16:18:54 +08:00
种植种类:{{item.kind}}
2023-11-22 14:08:24 +08:00
</view>
<view class="">
2023-11-25 16:18:54 +08:00
种植品种: {{item.breed}}
2023-11-22 14:08:24 +08:00
</view>
<view class="">
2023-11-25 16:18:54 +08:00
种植面积: {{item.area}}
2023-11-22 14:08:24 +08:00
</view>
<view class="">
2023-11-25 16:18:54 +08:00
参与人员: {{item.user}}
</view>
<view class="">
开始日期: {{item.create_time}}
2023-11-22 14:08:24 +08:00
</view>
</view>
</view>
</view>
2023-11-25 16:18:54 +08:00
</view>
2023-11-22 14:08:24 +08:00
</view>
2023-11-25 16:18:54 +08:00
2023-11-22 14:08:24 +08:00
</view>
2023-11-25 16:18:54 +08:00
2023-11-22 14:08:24 +08:00
</view>
</template>
<script setup>
import landInfo from "@/components/plant/landInfo.vue"
import {
ref,
reactive
} from "vue"
2023-11-25 16:18:54 +08:00
import {
plantlist,
landdetail
} from '@/api/file.js'
import {
onLoad
} from "@dcloudio/uni-app"
const list = reactive([{
id: 1,
url: 'https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg',
},
{
id: 1,
url: 'https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg',
},
{
id: 1,
url: 'https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg',
},
{
id: 1,
url: 'https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg',
2023-11-25 16:18:54 +08:00
},
])
2023-11-25 16:18:54 +08:00
const dataList = reactive([])
const dataList1 = reactive([])
const dataobj = reactive({})
const typeID = ref('')
const columns = reactive([
[{
label: '种植',
route: "/pages/husbandryForm/sow"
2023-11-22 14:08:24 +08:00
}, {
2023-11-25 16:18:54 +08:00
label: '施肥',
route: "/pages/husbandryForm/fertilize"
2023-11-22 14:08:24 +08:00
}, {
2023-11-25 16:18:54 +08:00
label: '除草',
route: "/pages/husbandryForm/weeding"
2023-11-22 14:08:24 +08:00
}, {
2023-11-25 16:18:54 +08:00
label: '灌溉',
route: "/pages/husbandryForm/irrigate"
2023-11-22 14:08:24 +08:00
}, {
2023-11-25 16:18:54 +08:00
label: '除虫',
route: "/pages/husbandryForm/Pest"
2023-11-22 14:08:24 +08:00
}, {
2023-11-25 16:18:54 +08:00
label: '收获',
route: "/pages/husbandryForm/harvest"
}]
]);
onLoad((option) => {
typeID.value = option.id;
getlist();
getlist1();
});
const getlist1 = () => {
landdetail({
land_id: typeID.value
}).then((res) => {
console.log(res);
if (res.code == 1) {
Object.assign(dataobj, res.data);
}
});
};
2023-11-22 14:08:24 +08:00
2023-11-25 16:18:54 +08:00
const getlist = () => {
plantlist({
land_id: typeID.value
}).then((res) => {
2023-11-22 14:08:24 +08:00
2023-11-25 16:18:54 +08:00
if (res.code == 1) {
dataList.splice(0, dataList.length, ...res.data);
}
});
};
//新增种植
const addshowPicke = ()=> {
2023-11-22 14:08:24 +08:00
uni.navigateTo({
2023-11-25 16:18:54 +08:00
url:'/pages/husbandryForm/sow?id='+typeID.value
2023-11-22 14:08:24 +08:00
})
}
2023-11-25 16:18:54 +08:00
//跳转
const navto = (url) => {
2023-11-22 14:08:24 +08:00
uni.navigateTo({
2023-11-25 16:18:54 +08:00
url
2023-11-22 14:08:24 +08:00
})
}
2023-11-25 16:18:54 +08:00
const navtoForm = (item, type) => {
console.log(item)
uni.navigateTo({
url:'/pages/landDetail/tudi?data='+ encodeURIComponent(JSON.stringify(item))
})
// }
}
2023-11-22 14:08:24 +08:00
const getNowTimeFn = () => {
const now = new Date();
const hour = now.getHours();
const minute = now.getMinutes();
const formattedHour = hour < 10 ? '0' + hour : hour;
const formattedMinute = minute < 10 ? '0' + minute : minute;
const currentTime = formattedHour + ':' + formattedMinute;
return currentTime
}
const perviewFn = (url) => {
console.log(url)
uni.previewImage({
urls: [url]
})
}
</script>
<style lang="scss" scoped>
.box {
width: 750rpx;
min-height: 100vh;
background-color: $theme-bg-color;
padding: 0;
.content {
width: 693.93rpx;
margin: auto;
padding-top: 20rpx;
2023-11-22 14:08:24 +08:00
}
// padding: 20rpx;
.time {
display: flex;
font-size: 26.29rpx;
color: #737373;
margin-top: 10rpx;
}
.video {
// margin-top: 10rpx;
}
.add-thing {
width: 266.36rpx;
height: 66.59rpx;
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
border: 1px solid $theme-main-color;
margin: 20rpx auto;
line-height: 66rpx;
text-align: center;
color: $theme-main-color;
}
}
.thing-card {
width: 693.93rpx;
box-sizing: border-box;
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
margin-bottom: 30rpx;
.head {
height: 90rpx;
border-radius: 20rpx 20rpx 0 0;
background-color: $theme-main-color;
display: flex;
justify-content: space-between;
line-height: 90rpx;
color: white;
padding: 0 30rpx;
}
2023-11-25 16:18:54 +08:00
.card_body {
2023-11-22 14:08:24 +08:00
padding: 20rpx;
display: flex;
// justify-content: space-between;
.right {
display: flex;
justify-content: space-between;
flex-direction: column;
margin-left: 40rpx;
}
}
}
</style>