TraceabilityAPP/pages/landDetail/index.vue

462 lines
9.7 KiB
Vue
Raw Normal View History

2023-11-22 14:08:24 +08:00
<template>
<view class="box">
<view class="content">
2023-11-27 18:23:17 +08:00
2023-12-13 15:57:20 +08:00
<view class="" style="display: flex;justify-content: space-between;">
<view class="tit">
苗情监测数据
</view>
2023-12-14 11:27:14 +08:00
<view class="" style="display: flex;align-items: center;">
2023-12-13 15:57:20 +08:00
<u-icon name="clock" style="margin-right: 10rpx;"></u-icon>
2024-01-02 18:18:57 +08:00
<text style="color: #ACACAC;font-size: 20rpx;">刷新时间: {{getNowTimeFn()}} </text>
2023-12-13 15:57:20 +08:00
</view>
2023-11-22 14:08:24 +08:00
</view>
2023-12-20 23:41:00 +08:00
<view class="video" style="position: relative;">
2023-12-24 20:53:41 +08:00
<u--image src="https://ceshi-worker-task.lihaink.cn/uploads/images/20231223/20231223092144475437017.png"
2024-01-03 19:11:45 +08:00
width="100%" height="500rpx" @click="goLive" v-if="videoUrl"></u--image>
2024-01-02 18:18:57 +08:00
<u--image :src="u('K')" v-else width="100%" height="510rpx"></u--image>
2023-12-20 23:41:00 +08:00
<view class=""
style="width: 100%;height: 100%;background-color: rgba(0, 0, 0, .5);position: absolute;top: 1px;"
@click="goLive" v-if="videoUrl">
<u-icon name="play-circle" size="40" color="white" v-if="videoUrl"
style="position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);"></u-icon>
</view>
2024-01-02 18:18:57 +08:00
</view>
<landInfo :info='dataobj'></landInfo>
2023-12-20 23:41:00 +08:00
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-27 18:23:17 +08:00
<view class="">
2024-01-02 18:18:57 +08:00
<view class="tit">
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-12-13 15:57:20 +08:00
2023-12-14 11:27:14 +08:00
<view class="thing-card" v-for="(item,index) in dataList" :key="index">
2023-12-13 15:57:20 +08:00
<!-- <view class="head">
2023-11-22 14:08:24 +08:00
<view class="">
2023-11-27 18:23:17 +08:00
种植
2023-11-22 14:08:24 +08:00
</view>
2023-11-27 18:23:17 +08:00
<view class="" @click="navtoForm(item,i)">
农事查看
2023-11-22 14:08:24 +08:00
</view>
2023-12-13 15:57:20 +08:00
</view> -->
2023-11-27 18:23:17 +08:00
<view class="card_body">
2023-12-14 11:27:14 +08:00
<view class="left" v-if='item.pic.length>0 && !item.showCode'>
2023-12-07 09:34:25 +08:00
<u--image @click="perviewFn(item.pic)" radius='10' :src="item.pic[0]" width="200rpx"
2023-11-27 18:23:17 +08:00
height="200rpx"></u--image>
2023-11-22 14:08:24 +08:00
</view>
2023-12-14 11:27:14 +08:00
<view class="left" v-else>
<u--image @click="perviewFn1(item.qr_code)" radius='10' :src="item.qr_code"
width="200rpx" height="200rpx"></u--image>
</view>
2023-12-13 15:57:20 +08:00
2024-01-03 19:11:45 +08:00
<u--image @click="navtoForm(item,i)" src="/static/main/index/xyj.png" class="next"
width="38rpx" height="38rpx"></u--image>
2023-12-13 15:57:20 +08:00
2023-12-14 11:27:14 +08:00
<view class="right" style="color: #7B7B7B;" @click="navtoForm(item,i)">
2023-11-27 18:23:17 +08:00
<view class="">
2023-12-13 15:57:20 +08:00
<text style="color: black;">种植种类:</text> {{item.kind}}
2023-11-27 18:23:17 +08:00
</view>
2023-12-13 15:57:20 +08:00
<!-- <view class="">
2023-12-07 09:34:25 +08:00
种植品牌: {{item.breed}}
2023-12-13 15:57:20 +08:00
</view> -->
2023-11-27 18:23:17 +08:00
<view class="">
2023-12-13 15:57:20 +08:00
<text style="color: black;">种植面积:</text> {{item.area}}
2023-11-27 18:23:17 +08:00
</view>
2023-12-13 18:55:18 +08:00
<view class="te">
2024-01-02 18:18:57 +08:00
<text style="color: black;white-space: nowrap;">参与人员:</text> {{item.user}}
2023-11-27 18:23:17 +08:00
</view>
<view class="">
2023-12-13 15:57:20 +08:00
<text style="color: black;">种植日期:</text> {{item.plant_date}}
2023-12-07 09:34:25 +08:00
</view>
2023-12-14 11:27:14 +08:00
<view class="" style="display: flex;justify-content: space-between;">
<view class="te">
<text style="color: black; white-space: nowrap; margin-top: 10rpx;">备注:</text>
{{item.remark}}
</view>
<view class="" v-if="item.status==2">
<view class="code-btn" @click.stop="showCodeFn(index)"
:class="{actBtn:item.showCode}"> 溯源码</view>
<!-- <u--image @click="perviewFn1(item.qr_code)" radius='10' :src="item.qr_code"
width="200rpx" height="200rpx" style="margin-top: 10rpx;"></u--image> -->
</view>
2023-11-27 18:23:17 +08:00
</view>
2023-12-14 11:27:14 +08:00
2023-11-22 14:08:24 +08:00
</view>
</view>
</view>
</view>
2023-11-27 18:23:17 +08:00
<view class="coneng-detail" v-else>
<view class="">
<image src="@/static/img/zw.png" mode="aspectFit"></image>
<view class="">
暂无数据
</view>
</view>
</view>
2023-11-22 14:08:24 +08:00
</view>
</view>
2023-11-27 18:23:17 +08:00
2023-11-22 14:08:24 +08:00
</view>
</template>
<script setup>
import landInfo from "@/components/plant/landInfo.vue"
2024-01-03 19:11:45 +08:00
import {
lindexist,
} from '@/api/api.js'
2023-11-22 14:08:24 +08:00
import {
ref,
reactive
} from "vue"
2023-11-25 16:18:54 +08:00
import {
plantlist,
landdetail
} from '@/api/api.js'
2023-11-25 16:18:54 +08:00
import {
2023-11-27 18:23:17 +08:00
onLoad,
onShow
2023-11-25 16:18:54 +08:00
} from "@dcloudio/uni-app"
2023-12-20 23:41:00 +08:00
const videoUrl = ref('')
const goLive = () => {
uni.navigateTo({
2024-01-03 19:11:45 +08:00
url: `/pages/live/live?url=${videoUrl.value }&user=${userInfo.value.master_phone}&device=${userInfo.value.device_id} `
2023-12-20 23:41:00 +08:00
})
}
const list = reactive([{
id: 1,
2023-12-07 09:34:25 +08:00
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"
}]
]);
2024-01-03 19:11:45 +08:00
const userInfo = ref("")
2023-11-25 16:18:54 +08:00
onLoad((option) => {
typeID.value = option.id;
2024-01-03 19:11:45 +08:00
lindexist({
land_id: option.id
}).then(res => {
userInfo.value = res.data
videoUrl.value = res.data.video_url
console.log(videoUrl.value, 25545)
// console.log(userInfo.value)
})
2023-12-07 09:34:25 +08:00
2023-11-27 18:23:17 +08:00
2023-11-25 16:18:54 +08:00
});
2024-01-03 19:11:45 +08:00
// const goLive = () => {
// }
2023-11-27 18:23:17 +08:00
onShow(() => {
2023-12-07 09:34:25 +08:00
2023-11-27 18:23:17 +08:00
getlist();
getlist1();
})
2023-11-25 16:18:54 +08:00
const getlist1 = () => {
landdetail({
land_id: typeID.value
}).then((res) => {
2023-12-07 09:34:25 +08:00
2023-11-25 16:18:54 +08:00
if (res.code == 1) {
2023-12-20 23:41:00 +08:00
if (res.data.user_id == 23) {
2023-12-24 20:53:41 +08:00
// videoUrl.value =
// 'http://rtsp.lihaink.cn/live/lihai_lot_walnutpi_dev_4.live.mp4?secret=YwDtp2llj80HA19JhMXL4Po99nsMAyNT'
2023-12-20 23:41:00 +08:00
}
console.log(videoUrl.value)
// videoUrl.value=res.data.
2023-11-25 16:18:54 +08:00
Object.assign(dataobj, res.data);
2023-11-27 18:23:17 +08:00
2023-11-25 16:18:54 +08:00
}
});
};
2023-11-22 14:08:24 +08:00
2023-11-27 18:23:17 +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);
2023-12-14 11:27:14 +08:00
dataList.forEach(item => {
item.showCode = false
})
2023-11-25 16:18:54 +08:00
}
});
};
2023-11-27 18:23:17 +08:00
2023-11-25 16:18:54 +08:00
//新增种植
2023-11-27 18:23:17 +08:00
const addshowPicke = () => {
2023-11-22 14:08:24 +08:00
uni.navigateTo({
2023-11-27 18:23:17 +08:00
url: '/pages/husbandryForm/sow?id=' + typeID.value
2023-11-22 14:08:24 +08:00
})
}
2023-11-27 18:23:17 +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) => {
2023-11-27 18:23:17 +08:00
uni.navigateTo({
2023-12-07 09:34:25 +08:00
url: '/pages/landDetail/tudi?data=' + item.id
2023-11-27 18:23:17 +08:00
})
2023-11-25 16:18:54 +08:00
// }
}
2023-11-27 18:23:17 +08:00
2023-11-25 16:18:54 +08:00
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
}
//查看
2023-11-22 14:08:24 +08:00
const perviewFn = (url) => {
2023-12-07 09:34:25 +08:00
uni.previewImage({
urls: url
})
}
const perviewFn1 = (url) => {
2023-11-22 14:08:24 +08:00
uni.previewImage({
urls: [url]
})
}
2023-12-14 11:27:14 +08:00
let img = ''
let codeImg = ''
const showCodeFn = (i) => {
// dataList[i].showCode != dataList[i].showCode
dataList[i].showCode = !dataList[i].showCode
console.log(dataList[i].showCode)
2024-01-02 18:18:57 +08:00
}
const u = (name) => {
return `/static/main/index/${name}.png`
2023-12-14 11:27:14 +08:00
}
2023-11-22 14:08:24 +08:00
</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 {
2024-01-02 18:18:57 +08:00
width: 690rpx;
height: 510rpx;
box-shadow: 1rpx 1rpx 10rpx 1rpx rgba(0, 0, 0, 0.1);
border-radius: 10rpx;
overflow: hidden;
2023-11-22 14:08:24 +08:00
}
.add-thing {
2023-12-13 15:57:20 +08:00
height: 90rpx;
2023-11-22 14:08:24 +08:00
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
margin: 20rpx auto;
2023-12-13 15:57:20 +08:00
line-height: 90rpx;
2023-11-22 14:08:24 +08:00
text-align: center;
2023-12-13 15:57:20 +08:00
color: white;
background-color: $theme-main-color;
2023-11-22 14:08:24 +08:00
}
}
2023-11-27 18:23:17 +08:00
.coneng-detail {
width: 478rpx;
height: 341rpx;
background: #FFFFFF;
border-radius: 6px 6px 6px 6px;
opacity: 1;
font-size: 25rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #737373;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
margin: 70rpx auto;
image {
width: 280rpx;
height: 142rpx;
margin-bottom: 20rpx;
}
}
2023-11-22 14:08:24 +08:00
.thing-card {
width: 693.93rpx;
box-sizing: border-box;
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
margin-bottom: 30rpx;
2023-12-14 11:27:14 +08:00
box-shadow: 1rpx 1rpx 10rpx 1rpx rgba(0, 0, 0, 0.1);
2023-11-22 14:08:24 +08:00
.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;
2023-12-13 15:57:20 +08:00
position: relative;
.next {
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 20rpx;
}
2023-11-22 14:08:24 +08:00
// justify-content: space-between;
.right {
display: flex;
justify-content: space-between;
flex-direction: column;
2024-01-02 18:18:57 +08:00
margin-left: 20rpx;
font-size: 26rpx;
2023-11-22 14:08:24 +08:00
}
}
}
2023-12-13 15:57:20 +08:00
.tit {
position: relative;
padding-left: 20rpx;
font-weight: bold;
2024-01-02 18:18:57 +08:00
font-size: 28rpx;
2023-12-13 15:57:20 +08:00
margin-bottom: 20rpx;
2024-01-02 18:18:57 +08:00
color: #1A1A1A;
2023-12-13 15:57:20 +08:00
}
.tit::before {
content: "";
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
2024-01-02 18:18:57 +08:00
width: 6rpx;
2023-12-13 15:57:20 +08:00
/* 左边框的宽度 */
2024-01-02 18:18:57 +08:00
height: 25rpx;
border-radius: 20rpx;
2023-12-13 15:57:20 +08:00
background-color: #34D08D;
}
2024-01-02 18:18:57 +08:00
2023-12-14 11:27:14 +08:00
.code-btn {
border: 1px solid $theme-main-color;
border-radius: 30rpx;
padding: 3rpx 20rpx;
color: $theme-main-color;
position: absolute;
right: 20rpx;
}
2023-12-13 15:57:20 +08:00
2023-12-14 11:27:14 +08:00
.actBtn {
background: linear-gradient(to right, #FEFFFF 0%, #E8FAF2 100%);
2023-12-13 15:57:20 +08:00
}
2023-11-22 14:08:24 +08:00
</style>