TraceabilityAPP/pages/index/index.vue

440 lines
8.4 KiB
Vue
Raw Normal View History

2023-10-17 11:00:41 +08:00
<template>
<view class="">
2023-12-13 15:57:20 +08:00
<view class="" style="height: var(--status-bar-height);background-color: #35D190;">
2023-11-30 17:51:39 +08:00
2023-12-13 15:57:20 +08:00
</view>
<view class="header">
<u-icon name="plus-circle" color="white" @click="navto('/pages/addLand/addLand')" :size="28"></u-icon>
2023-11-22 14:28:54 +08:00
2023-12-13 15:57:20 +08:00
<Myindex url='/pages/index/index' />
</view>
<view class="content">
<view class="serch">
2023-12-13 15:57:20 +08:00
<u-search bgColor="white" :show-action="false" placeholder="搜索你的土地信息" v-model="fomData.keyword"
shape="round" :clearabled='false' @change="inputval"></u-search>
<view class="ser-text" @click="search">
搜索
2023-11-30 17:51:39 +08:00
</view>
2023-10-20 18:45:15 +08:00
</view>
2023-12-13 15:57:20 +08:00
<view class="tits">
土地信息
</view>
<view class="card" v-for="(item,index) in datalist" :key="index" @click="navgo(item)">
<view class="plant-status" v-if="item.residual_area!=item.total_area"
:style="{backgroundImage:`url(${bgc('yzz')})`}">
已种植
</view>
<view class="plant-status" v-if="item.residual_area==item.total_area"
:style="{backgroundImage:`url(${bgc('wzz')})`}">
未种植
</view>
<view class="card-content">
<u--image v-if="item.pic" :src="item.pic[0]||''" height="150rpx" width="150rpx"
style="margin-right: 20rpx;border-radius: 10rpx;overflow: hidden;"></u--image>
<view style="color:#7B7B7B ;">
<view class="card-tit">
{{item.title}}
</view>
<view class="">
<text style="color: black;">种植面积</text> : {{item.total_area-item.residual_area}}
</view>
<view class="">
<text style="color: black;">土地面积</text>: {{item.total_area}}
</view>
<view class="card-address">
<text style="color: black;white-space: nowrap;">地址</text>: {{item.address}}
</view>
</view>
</view>
2023-11-30 17:51:39 +08:00
2023-12-13 15:57:20 +08:00
<!-- old -->
<!-- <view class="tit card-li" style="margin-top: 50rpx;">
2023-11-21 18:54:33 +08:00
<view class="">
2023-11-25 16:18:54 +08:00
{{item.title}}
2023-10-20 18:45:15 +08:00
</view>
2023-11-25 16:18:54 +08:00
<view class="" style="color: #00A15E;" v-if="item.residual_area!=item.total_area">
已种植
2023-11-21 18:54:33 +08:00
</view>
2023-11-25 16:18:54 +08:00
<view class="" style="color: #00A15E;" v-if="item.residual_area==item.total_area">
未种植
2023-11-21 18:54:33 +08:00
</view>
</view>
2023-11-25 16:18:54 +08:00
<view class="card-li" v-if="item.residual_area!=item.total_area">
<view class="">
2023-11-25 16:18:54 +08:00
种植面积:{{item.total_area-item.residual_area}}
</view>
2023-11-27 18:23:17 +08:00
<view class="">
土地面积:{{item.total_area}}
</view>
2023-11-25 16:18:54 +08:00
</view>
<view class="card-li" v-if="item.residual_area==item.total_area">
<view class="">
未种植面积:{{item.total_area}}
2023-11-21 18:54:33 +08:00
</view>
</view>
<view class="card-li tit">
<view class="" style="font-weight: normal;">
2023-11-30 17:51:39 +08:00
地址: {{item.address}}
2023-11-21 18:54:33 +08:00
</view>
</view>
2023-10-20 18:45:15 +08:00
2023-12-13 15:57:20 +08:00
-->
2023-10-20 18:45:15 +08:00
</view>
2023-11-25 16:18:54 +08:00
<!-- <view class="land" @click="navgo('/pages/addLand/addLand')">
土地
</view> -->
2023-11-27 18:23:17 +08:00
<view class="coneng-detail" v-if="datalist.length==0">
<view class="">
<image src="@/static/img/zw.png" mode="aspectFit"></image>
<view class="">
暂无数据
</view>
</view>
2023-11-27 18:23:17 +08:00
</view>
2023-11-21 18:54:33 +08:00
</view>
2023-10-23 17:57:19 +08:00
2023-10-17 11:00:41 +08:00
</view>
</template>
2023-10-17 16:02:55 +08:00
<script setup>
2023-11-25 16:18:54 +08:00
import {
onLoad,
onShow,
onReachBottom,
onPullDownRefresh
} from "@dcloudio/uni-app"
2023-10-17 16:02:55 +08:00
import {
ref,
2023-10-20 18:45:15 +08:00
reactive,
onMounted
} from "vue"
2023-11-30 17:51:39 +08:00
import Myindex from '@/components/return/index.vue';
import store from "@/store/index.js"
2023-11-25 16:18:54 +08:00
import {
landlist
} from '@/api/api.js'
2023-12-13 15:57:20 +08:00
onLoad(() => {
2023-11-30 17:51:39 +08:00
// console.log(store.state.userInfo)
if (!store.state.userInfo) {
uni.redirectTo({
2023-12-13 15:57:20 +08:00
url: '/pages/Login/login'
2023-11-30 17:51:39 +08:00
})
2023-12-13 15:57:20 +08:00
2023-11-30 17:51:39 +08:00
}
})
2023-11-25 16:18:54 +08:00
onShow(() => {
list()
})
onPullDownRefresh(() => {
list()
2023-11-25 16:18:54 +08:00
uni.stopPullDownRefresh()
})
onReachBottom(() => {
2023-11-25 16:18:54 +08:00
getlist()
})
const datalist = reactive([])
const fomData = reactive({
page_no: 1,
page_size: 15,
keyword: ''
})
2023-10-25 19:55:18 +08:00
2023-10-30 19:09:40 +08:00
// 获取位置
const getPositionFn = () => {
uni.getLocation({
type: 'gcj02',
geocode: true,
isHighAccuracy: true,
2023-11-22 14:28:54 +08:00
success: function(res) {
uni.request({
url: `https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=${res.longitude},${res.latitude}&key=b0c21bc6b220aa882bad8ffb6bce8829&radius=1000&extensions=all`,
success: (res) => {
console.log(res)
}
})
2023-11-22 14:28:54 +08:00
}
});
}
2023-11-25 16:18:54 +08:00
const list = () => {
2023-11-30 17:51:39 +08:00
datalist.splice(0)
2023-11-25 16:18:54 +08:00
fomData.page_no = 1
getlist()
}
const getlist = () => {
landlist(fomData).then((res) => {
if (res.code == 1) {
2023-11-30 17:51:39 +08:00
datalist.push(...res.data)
fomData.page_no = fomData.page_no + 1
2023-11-25 16:18:54 +08:00
}
2023-11-30 17:51:39 +08:00
2023-11-25 16:18:54 +08:00
})
2023-11-21 18:54:33 +08:00
2023-11-25 16:18:54 +08:00
}
2023-12-13 15:57:20 +08:00
//输入监听
2023-12-13 15:57:20 +08:00
const inputval = (e) => {
// console.log(e)
2023-12-13 15:57:20 +08:00
if (e.length == 0) {
list()
}
}
2023-11-25 16:18:54 +08:00
2023-12-13 15:57:20 +08:00
//搜索
2023-11-25 16:18:54 +08:00
const search = () => {
list()
2023-11-25 16:18:54 +08:00
}
2023-12-13 15:57:20 +08:00
const navto = (url) => {
uni.navigateTo({
url
})
}
2023-11-25 16:18:54 +08:00
const navgo = (item) => {
2023-11-21 18:54:33 +08:00
uni.navigateTo({
2023-11-25 16:18:54 +08:00
url: '/pages/landDetail/index?id=' + item.id
2023-11-21 18:54:33 +08:00
})
}
2023-11-22 14:08:24 +08:00
onMounted(() => {
2023-11-25 16:18:54 +08:00
// console.log('22222222')
})
2023-12-13 15:57:20 +08:00
const u = (name) => {
return `/static/main/index/${name}.png`
}
const bgc = (icon) => {
return `/static/main/index/${icon}.png`
}
</script>
2023-11-22 14:08:24 +08:00
2023-11-30 17:51:39 +08:00
<style lang="scss">
2023-11-27 18:23:17 +08:00
page {
background-color: #EAF2EF;
2023-11-30 17:51:39 +08:00
2023-11-27 18:23:17 +08:00
}
2023-12-13 15:57:20 +08:00
.header {
background-color: #34D190;
display: flex;
justify-content: space-between;
padding: 10rpx 0 10rpx 20rpx;
// padding-top: 10rpx;
// padding-left: 20rpx;
// padding-bottom: 20rpx;
}
2023-11-25 16:18:54 +08:00
2023-12-13 15:57:20 +08:00
.tits {
position: relative;
2023-12-13 15:57:20 +08:00
padding-left: 20rpx;
font-weight: bold;
margin-bottom: 20rpx;
}
.tits::before {
content: "";
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
width: 3px;
/* 左边框的宽度 */
height: 30rpx;
background-color: #34D08D;
}
2023-11-25 16:18:54 +08:00
2023-12-13 15:57:20 +08:00
// old
.content {
2023-11-27 18:23:17 +08:00
2023-12-13 15:57:20 +08:00
position: relative;
padding: 0 20rpx;
2023-11-21 18:54:33 +08:00
2023-11-30 17:51:39 +08:00
2023-12-13 15:57:20 +08:00
// padding-top: 100rpx;
2023-11-30 17:51:39 +08:00
2023-12-13 15:57:20 +08:00
.head-img {
// position: absolute;
// display: flex;
// top: 0;
// right: 10rpx;
// margin-top: 20rpx;
2023-11-30 17:51:39 +08:00
}
2023-11-25 16:18:54 +08:00
.land {
width: 100rpx;
height: 100rpx;
line-height: 100rpx;
text-align: center;
background-color: #fff;
border-radius: 50%;
position: absolute;
right: 60rpx;
bottom: 130rpx;
position: fixed;
}
2023-10-20 18:45:15 +08:00
2023-11-21 18:54:33 +08:00
.serch {
2023-11-25 16:18:54 +08:00
2023-12-13 15:57:20 +08:00
// padding-bottom: 20rpx;
position: relative;
color: #35D190;
font-size: 28rpx;
margin-top: 20rpx;
margin-bottom: 20rpx;
.ser-text {
position: absolute;
padding-left: 20rpx;
top: 50%;
transform: translateY(-50%);
right: 40rpx;
2023-11-30 17:51:39 +08:00
2023-11-25 16:18:54 +08:00
}
2023-11-21 18:54:33 +08:00
2023-12-13 15:57:20 +08:00
.ser-text::before {
content: "";
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
width: 2px;
/* 左边框的宽度 */
height: 20rpx;
background-color: #34D08D;
}
// width: 100%;
// height: 100rpx;
// background-color: #EAF2EF;
// position: absolute;
// position: fixed;
// display: flex;
// top: 0;
// // padding-top: calc(70rpx + var(--status-bar-height) + 20rpx);
// padding-right: 20rpx;
// .custom-style {
// color: #606266;
// width: 140rpx;
// border-radius: 30rpx;
// margin-top: 10rpx;
// margin-right: 20rpx;
// }
// z-index: 8888 !important;
2023-10-20 18:45:15 +08:00
}
2023-11-21 18:54:33 +08:00
.border-bgc {
height: 200rpx;
background-color: #34D190;
border-radius: 0 0 40rpx 40rpx;
position: absolute;
width: 750rpx;
2023-11-21 18:54:33 +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;
2023-11-30 17:51:39 +08:00
margin: 300rpx auto;
image {
width: 280rpx;
height: 142rpx;
margin-bottom: 20rpx;
2023-11-27 18:23:17 +08:00
2023-11-21 18:54:33 +08:00
}
2023-11-27 18:23:17 +08:00
}
.card {
position: relative;
2023-12-13 15:57:20 +08:00
margin: auto;
background-color: #fff;
box-sizing: border-box;
border-radius: 21.03rpx 21.03rpx 21.03rpx 21.03rpx;
margin-bottom: 40rpx;
2023-11-21 18:54:33 +08:00
2023-10-17 11:00:41 +08:00
2023-12-13 15:57:20 +08:00
.plant-status {
position: absolute;
width: 109rpx;
height: 99rpx;
background-image: url('/static/main/index/wzz.png');
background-size: 100% 100%;
top: -10rpx;
right: 50rpx;
color: white;
text-align: center;
padding-top: 20rpx;
font-size: 26rpx;
2023-10-21 18:02:06 +08:00
2023-12-13 15:57:20 +08:00
}
2023-11-21 18:54:33 +08:00
2023-12-13 15:57:20 +08:00
.card-content {
display: flex;
2023-11-21 18:54:33 +08:00
2023-12-13 15:57:20 +08:00
.card-tit {
font-weight: bold;
margin-bottom: 10rpx;
color: black;
}
.card-address {
// width: 60vw;
width: 500rpx;
white-space: nowrap;
/* 文字不换行 */
overflow: hidden;
/* 超出部分隐藏 */
text-overflow: ellipsis;
/* 超出部分显示省略号 */
}
.value {
/* 超出部分显示省略号 */
}
2023-11-21 18:54:33 +08:00
}
2023-12-13 15:57:20 +08:00
// .tit {
// display: flex;
// font-size: 33.29rpx;
// font-weight: bold;
// justify-content: space-between;
// }
2023-11-21 18:54:33 +08:00
}
2023-10-21 18:02:06 +08:00
}
2023-11-25 16:18:54 +08:00
</style>