TraceabilityAPP/pages/index/index.vue

250 lines
4.6 KiB
Vue
Raw Normal View History

2023-10-17 11:00:41 +08:00
<template>
<view class="">
<view class="content">
2023-11-22 14:28:54 +08:00
<view class="serch">
2023-11-25 16:18:54 +08:00
<u-search bgColor="white" :show-action="false" margin='0 30rpx' placeholder="搜索你的土地信息"
v-model="fomData.keyword" shape="round"></u-search>
<u-button class="custom-style" @click="search">搜索</u-button>
2023-10-20 18:45:15 +08:00
</view>
2023-11-25 16:18:54 +08:00
<view class="card" v-for="(item,index) in datalist" :key="index" @click="navgo(item)">
<view class="tit card-li">
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-25 16:18:54 +08:00
地址: {{item.town_name}}{{item.village_name}}{{item.group_name}}
2023-11-21 18:54:33 +08:00
</view>
</view>
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-25 16:18:54 +08:00
import {
landlist
} from '@/api/api.js'
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 = () => {
fomData.page_no = 1
getlist()
}
const getlist = () => {
landlist(fomData).then((res) => {
if (res.code == 1) {
datalist.splice(0, datalist.length, ...res.data);
fomData.page_no += fomData.page_no
2023-11-29 18:11:21 +08:00
2023-11-25 16:18:54 +08:00
}
2023-11-29 18:11:21 +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
}
const search = () => {
2023-11-27 18:23:17 +08:00
getlist()
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')
})
</script>
2023-11-22 14:08:24 +08:00
<style lang="scss" >
2023-11-27 18:23:17 +08:00
page {
background-color: #EAF2EF;
}
2023-11-21 18:54:33 +08:00
.content {
2023-11-25 16:18:54 +08:00
position: relative;
2023-11-25 16:18:54 +08:00
2023-11-27 18:23:17 +08:00
padding-top: 180rpx;
2023-11-21 18:54:33 +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 {
width: 100%;
height: 100rpx;
background-color: #EAF2EF;
position: absolute;
position: fixed;
2023-11-25 16:18:54 +08:00
display: flex;
top: 0;
padding-top: 70rpx;
2023-11-25 16:18:54 +08:00
padding-right: 20rpx;
.custom-style {
color: #606266;
2023-11-29 18:11:21 +08:00
width: 140rpx;
2023-11-25 16:18:54 +08:00
border-radius: 30rpx;
margin-top: 10rpx;
margin-right: 20rpx;
}
2023-11-21 18:54:33 +08:00
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;
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;
width: 693.93rpx;
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-10-21 18:02:06 +08:00
2023-11-21 18:54:33 +08:00
.tit {
display: flex;
font-size: 33.29rpx;
font-weight: bold;
2023-11-21 18:54:33 +08:00
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>