125 lines
2.9 KiB
Vue
Raw Normal View History

2024-01-11 18:16:03 +08:00
<template>
2024-02-23 11:51:14 +08:00
<div class="content" v-if="flag">
2024-02-23 23:49:36 +08:00
<div class="plant-li" v-for="item in landList" :key="item.id" @click="handClick(item)">
{{ item.title }}
2024-02-23 11:51:14 +08:00
</div>
2024-02-22 23:01:05 +08:00
</div>
2024-02-23 23:49:36 +08:00
<areaChose v-else channel="user-plant" @handTown="handTown" @handArea="handArea"></areaChose>
2024-02-22 23:01:05 +08:00
<div class="area" @click="flag = !flag">
<div class="area-top">
2024-02-23 23:49:36 +08:00
<div class="town">{{ area }}</div>
<div class="town">{{ town }}</div>
2024-02-22 23:01:05 +08:00
</div>
<div class="area-bottom"></div>
</div>
2024-01-11 18:16:03 +08:00
</template>
<script setup scoped>
import { ref, reactive } from "vue"
import { sendMsg } from "@/api.js"
import { landListApi } from "@/api.js"
2024-02-23 11:51:14 +08:00
import areaChose from "../components/areaChose.vue"
2024-01-11 18:16:03 +08:00
2024-02-23 11:51:14 +08:00
const flag = ref(true)
2024-02-23 23:49:36 +08:00
const town = ref("")
const area = ref("泸县")
let areaCode = 0
2024-01-11 18:16:03 +08:00
2024-02-23 23:49:36 +08:00
const handTown = (e) => {
town.value = e.name
getLandList(areaCode ,e.code)
2024-01-11 18:16:03 +08:00
}
2024-02-23 23:49:36 +08:00
const handArea = (e) => {
area.value = e.name
areaCode=e.code
town.value = ''
getLandList(e.code)
2024-01-11 18:16:03 +08:00
}
2024-02-23 23:49:36 +08:00
const landList=ref([])
const getLandList = async (areaCode=510521,streetCode='') => {
2024-01-11 18:16:03 +08:00
let res = await landListApi({
2024-02-23 23:49:36 +08:00
areaCode,
streetCode,
2024-01-11 18:16:03 +08:00
})
2024-02-23 23:49:36 +08:00
landList.value=res.data.list
console.log(landList.value)
}
getLandList()
const handClick=(item)=>{
let data={
id:item.id,
landName:item.title,
areaCode:item.county_code,
townCode:item.town_code,
town_name:item.town_name
}
sendMsg({ channel: 'user-plant', event:'choseLand', data })
// sendFn('choseLand', {id:item.id,landName:item.title,townCode:item.town_code} )
2024-01-11 18:16:03 +08:00
}
// 发送消息
const sendFn = (event, data = '') => {
if (data.page) page.value = data.page;
2024-02-23 23:49:36 +08:00
sendMsg({ channel: 'user-plant', event, data })
2024-01-11 18:16:03 +08:00
}
</script>
<style lang="scss" scoped>
2024-02-23 11:51:14 +08:00
.content {
height: 500px;
width: 90vw;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
justify-content: center;
overflow-y: auto;
2024-02-23 23:49:36 +08:00
2024-02-23 11:51:14 +08:00
.plant-li {
width: 165.9px;
height: 190.48px;
background-image: url('/static/img/plantScreen/A.png');
text-align: center;
line-height: 190.48px;
color: white;
}
2024-02-22 23:01:05 +08:00
}
.area {
position: absolute;
font-size: 20px;
color: white;
bottom: 0px;
left: 50%;
transform: translateX(-50%);
width: 558px;
.area-top {
display: flex;
justify-content: space-around;
.town {
background-image: url('/static/img/tradeScreen/areaA.png');
background-size: 100% 100%;
width: 160.12px;
height: 30.94px;
text-align: center;
line-height: 10px;
}
}
}
.area-bottom {
background-image: url('/static/img/tradeScreen/areaB.png');
width: 558px;
height: 57px;
background-size: 100% 100%;
transform: translateY(-20px);
2024-01-11 18:16:03 +08:00
}
</style>