185 lines
4.6 KiB
Vue
Raw Normal View History

2024-01-11 18:16:03 +08:00
<template>
2024-02-22 23:01:05 +08:00
<!-- <div style="text-align: center;">伤感情</div>
2024-01-11 18:16:03 +08:00
<el-select v-model="areaCode" class="m-2" @change="changeArea" placeholder="Select" size="large">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-select v-model="townCode" class="m-2" @change="changeTown" placeholder="Select" size="large">
<el-option v-for="item in townOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<button @click="sendFn('back', { name: '泸县' }), townCode = ''">返回首页</button>
<button @click="sendFn('refresh'), townCode = ''">刷新</button>
<button @click="sendFn('choseLand', { landName: item.title,id:item.id })" v-for="item in landList"> {{ item.title }}</button>
<button @click="sendFn('backHome', { name: '泸县' }), townCode = ''">返回首页</button>
<button @click="sendFn('detail', { name: item.title,id:item.id })" v-for="item in landList"> {{ item.title }}</button>
2024-02-22 23:01:05 +08:00
<p>地块</p> -->
2024-02-23 11:51:14 +08:00
<div class="content" v-if="flag">
<div class="plant-li" v-for="item in 10">
究极地块
</div>
2024-02-22 23:01:05 +08:00
</div>
2024-02-23 11:51:14 +08:00
<areaChose v-else></areaChose>
2024-02-22 23:01:05 +08:00
<div class="area" @click="flag = !flag">
<div class="area-top">
<div class="town">江陽區</div>
<div class="town">江陽區</div>
</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 axios from "axios"
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-01-11 18:16:03 +08:00
// 镇列表
const options = [
{
value: '510502',
label: '江阳区',
},
{
value: '510503',
label: '纳溪区',
},
{
value: '510504',
label: '龙马潭区',
},
{
value: '510521',
label: '泸县',
},
{
value: '510522',
label: '合江县 ',
},
{
value: '510524',
label: '叙永县 ',
}, {
value: '510525',
label: '古蔺县 ',
},
]
// 区列表
const townOptions = []
const areaCode = ref('510521')
const townCode = ref("")
const changeArea = (e) => {
townCode.value = ''
getTownList()
options.forEach(item => {
if (item.value == e) {
sendFn('choserArea', { name: item.label, code: item.value })
}
})
}
const changeTown = (e) => {
townOptions.forEach(item => {
if (item.value == e) {
sendFn('choseTown', { name: item.label })
}
})
getLandList()
}
const getTownList = () => {
townOptions.splice(0, 99999999)
axios.get(`https://crmeb-test.shop.lihaink.cn/api/city/get_street?area_code=${areaCode.value}`)
.then(function (res) {
res.data.data.forEach(item => {
townOptions.push({
value: item.code,
label: item.name
})
})
})
}
2024-02-22 23:01:05 +08:00
const landList = ref([])
2024-01-11 18:16:03 +08:00
const getLandList = async () => {
let res = await landListApi({
areaCode: areaCode.value,
streetCode: townCode.value
})
2024-02-22 23:01:05 +08:00
landList.value = res.data.list
2024-01-11 18:16:03 +08:00
}
getTownList()
// 发送消息
const page = ref(1)
const sendFn = (event, data = '') => {
if (data.page) page.value = data.page;
sendMsg({ channel: 'user-3', event, data })
}
</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;
.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
}
2024-02-23 11:51:14 +08:00
2024-01-11 18:16:03 +08:00
</style>