cultivationApp/pages/index/index.vue

210 lines
3.9 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>
</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-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/file.js'
onShow(() => {
console.log(11)
list()
})
onPullDownRefresh(() => {
console.log(11)
uni.stopPullDownRefresh()
})
onReachBottom(() => {
console.log(11)
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-22 14:28:54 +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 = () => {
console.log('111111')
}
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-21 18:54:33 +08:00
.content {
2023-11-25 16:18:54 +08:00
min-height: 100vh;
position: relative;
2023-11-25 16:18:54 +08:00
background-color: #EAF2EF;
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;
width: 120rpx;
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
}
2023-11-21 18:54:33 +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>