295 lines
5.3 KiB
Vue
295 lines
5.3 KiB
Vue
<template>
|
|
<view class="">
|
|
|
|
<view class="content">
|
|
|
|
<view class="serch">
|
|
<!-- #ifdef APP-PLUS -->
|
|
<view class="head-img" style="top: var(--status-bar-height);">
|
|
<Myindex url='/pages/index/index'/>
|
|
</view>
|
|
|
|
<!-- #endif -->
|
|
<u-search bgColor="white" :show-action="false" margin='0 30rpx' placeholder="搜索你的土地信息"
|
|
v-model="fomData.keyword" shape="round" :clearabled='false' @change="inputval"></u-search>
|
|
|
|
<u-button class="custom-style" @click="search">搜索</u-button>
|
|
|
|
</view>
|
|
|
|
|
|
<view class="card" v-for="(item,index) in datalist" :key="index" @click="navgo(item)"
|
|
style="margin-top: calc(var(--status-bar-height) + 40rpx);">
|
|
<view class="tit card-li">
|
|
<view class="">
|
|
{{item.title}}
|
|
</view>
|
|
<view class="" style="color: #00A15E;" v-if="item.residual_area!=item.total_area">
|
|
已种植
|
|
</view>
|
|
<view class="" style="color: #00A15E;" v-if="item.residual_area==item.total_area">
|
|
未种植
|
|
</view>
|
|
</view>
|
|
<view class="card-li" v-if="item.residual_area!=item.total_area">
|
|
<view class="">
|
|
种植面积:{{item.total_area-item.residual_area}}亩
|
|
</view>
|
|
<view class="">
|
|
土地面积:{{item.total_area}}亩
|
|
</view>
|
|
</view>
|
|
<view class="card-li" v-if="item.residual_area==item.total_area">
|
|
<view class="">
|
|
未种植面积:{{item.total_area}}亩
|
|
</view>
|
|
</view>
|
|
<view class="card-li tit">
|
|
<view class="" style="font-weight: normal;">
|
|
地址: {{item.address}}
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
<!-- <view class="land" @click="navgo('/pages/addLand/addLand')">
|
|
土地
|
|
</view> -->
|
|
|
|
<view class="coneng-detail" v-if="datalist.length==0">
|
|
<view class="">
|
|
<image src="@/static/img/zw.png" mode="aspectFit"></image>
|
|
<view class="">
|
|
暂无数据
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import {
|
|
onLoad,
|
|
onShow,
|
|
onReachBottom,
|
|
onPullDownRefresh
|
|
} from "@dcloudio/uni-app"
|
|
import {
|
|
ref,
|
|
reactive,
|
|
onMounted
|
|
} from "vue"
|
|
import Myindex from '@/components/return/index.vue';
|
|
import store from "@/store/index.js"
|
|
import {
|
|
landlist
|
|
} from '@/api/api.js'
|
|
onLoad(()=>{
|
|
// console.log(store.state.userInfo)
|
|
if (!store.state.userInfo) {
|
|
uni.redirectTo({
|
|
url:'/pages/Login/login'
|
|
})
|
|
|
|
}
|
|
})
|
|
onShow(() => {
|
|
list()
|
|
})
|
|
onPullDownRefresh(() => {
|
|
list()
|
|
uni.stopPullDownRefresh()
|
|
})
|
|
onReachBottom(() => {
|
|
|
|
getlist()
|
|
})
|
|
const datalist = reactive([])
|
|
const fomData = reactive({
|
|
page_no: 1,
|
|
page_size: 15,
|
|
keyword: ''
|
|
})
|
|
|
|
|
|
// 获取位置
|
|
const getPositionFn = () => {
|
|
uni.getLocation({
|
|
type: 'gcj02',
|
|
geocode: true,
|
|
isHighAccuracy: true,
|
|
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)
|
|
}
|
|
})
|
|
}
|
|
});
|
|
}
|
|
const list = () => {
|
|
datalist.splice(0)
|
|
fomData.page_no = 1
|
|
getlist()
|
|
}
|
|
const getlist = () => {
|
|
landlist(fomData).then((res) => {
|
|
if (res.code == 1) {
|
|
datalist.push(...res.data)
|
|
fomData.page_no = fomData.page_no + 1
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
//输入监听
|
|
const inputval= (e) => {
|
|
// console.log(e)
|
|
if(e.length==0){
|
|
list()
|
|
}
|
|
}
|
|
|
|
//搜索
|
|
const search = () => {
|
|
list()
|
|
}
|
|
|
|
|
|
const navgo = (item) => {
|
|
uni.navigateTo({
|
|
url: '/pages/landDetail/index?id=' + item.id
|
|
})
|
|
}
|
|
|
|
onMounted(() => {
|
|
// console.log('22222222')
|
|
})
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
background-color: #EAF2EF;
|
|
|
|
}
|
|
|
|
.content {
|
|
|
|
position: relative;
|
|
|
|
|
|
padding-top: 180rpx;
|
|
|
|
.head-img {
|
|
position: absolute;
|
|
display: flex;
|
|
top: 0;
|
|
right: 10rpx;
|
|
margin-top: 20rpx;
|
|
|
|
|
|
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
|
|
.serch {
|
|
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;
|
|
|
|
}
|
|
|
|
.border-bgc {
|
|
height: 200rpx;
|
|
background-color: #34D190;
|
|
border-radius: 0 0 40rpx 40rpx;
|
|
position: absolute;
|
|
width: 750rpx;
|
|
|
|
}
|
|
|
|
.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;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
.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;
|
|
|
|
|
|
|
|
|
|
.tit {
|
|
display: flex;
|
|
font-size: 33.29rpx;
|
|
font-weight: bold;
|
|
|
|
justify-content: space-between;
|
|
}
|
|
}
|
|
}
|
|
</style> |