|
@@ -0,0 +1,219 @@
|
|
|
+<template>
|
|
|
+ <div class="create-farm">
|
|
|
+ <custom-header name="创建农场"></custom-header
|
|
|
+ ><!-- 地图 -->
|
|
|
+ <div class="map-container" ref="mapContainer"></div>
|
|
|
+ <div class="farm-content">
|
|
|
+ <div class="farm-filter">
|
|
|
+ <el-select
|
|
|
+ v-model="locationVal"
|
|
|
+ filterable
|
|
|
+ remote
|
|
|
+ reserve-keyword
|
|
|
+ placeholder="搜索位置"
|
|
|
+ :remote-method="remoteMethod"
|
|
|
+ :loading="loading"
|
|
|
+ @change="handleSearchRes"
|
|
|
+ popper-class="location-search-popper"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in locationOptions.list"
|
|
|
+ :key="index"
|
|
|
+ :label="item.title"
|
|
|
+ :value="item.point"
|
|
|
+ >
|
|
|
+ <span>{{ item.title }}</span>
|
|
|
+ <span class="sub-title">{{ item.province }}{{ item.city }}{{ item.district }}</span>
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 创建 -->
|
|
|
+ <div class="create-box">
|
|
|
+ <div class="create-title">
|
|
|
+ <img class="title-icon" src="@/assets/img/home/create-icon.png" alt="" />
|
|
|
+ 创建农场
|
|
|
+ </div>
|
|
|
+ <div class="create-content">
|
|
|
+ <div class="create-from">
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import customHeader from "@/components/customHeader.vue";
|
|
|
+import IndexMap from "./map/index.js";
|
|
|
+import { useRoute } from "vue-router";
|
|
|
+import { onMounted, ref, reactive } from "vue";
|
|
|
+const route = useRoute();
|
|
|
+
|
|
|
+const indexMap = new IndexMap();
|
|
|
+const mapContainer = ref(null);
|
|
|
+onMounted(() => {
|
|
|
+ indexMap.initMap("POINT (113.61702297075017 23.584863449735067)", mapContainer.value);
|
|
|
+});
|
|
|
+
|
|
|
+// 搜索
|
|
|
+const MAP_KEY = "CZLBZ-LJICQ-R4A5J-BN62X-YXCRJ-GNBUT";
|
|
|
+
|
|
|
+const locationVal = ref(null);
|
|
|
+const locationOptions = reactive({
|
|
|
+ list: [],
|
|
|
+});
|
|
|
+const loading = ref(false);
|
|
|
+const remoteMethod = async (keyword) => {
|
|
|
+ if (keyword) {
|
|
|
+ locationOptions.list = [];
|
|
|
+ // setTimeout(() => {
|
|
|
+ loading.value = true;
|
|
|
+ const params = {
|
|
|
+ key: MAP_KEY,
|
|
|
+ keyword,
|
|
|
+ location: route.query.userLocation || "113.61702297075017,23.584863449735067",
|
|
|
+ // region: "广东",
|
|
|
+ // region_fix: 1
|
|
|
+ // filter: 'category<>271013',
|
|
|
+ // filter:'category=261400,111100,160000,220000,261400'
|
|
|
+ };
|
|
|
+ await VE_API.old_mini_map.getCtiyList({ word: keyword }).then(({ data }) => {
|
|
|
+ if (data && data.length) {
|
|
|
+ data.forEach((item) => {
|
|
|
+ item.point = item.location.lat + "," + item.location.lng;
|
|
|
+ locationOptions.list.push(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ VE_API.old_mini_map.search(params).then(({ data }) => {
|
|
|
+ loading.value = false;
|
|
|
+ data.forEach((item) => {
|
|
|
+ item.point = item.location.lat + "," + item.location.lng;
|
|
|
+ locationOptions.list.push(item);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // }, 1000);
|
|
|
+ } else {
|
|
|
+ locationOptions.list = [];
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const handleSearchRes = (v) => {
|
|
|
+ console.log("resssss", v);
|
|
|
+ indexMap.setMapPosition([113.32446, 23.10647])
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.create-farm {
|
|
|
+ position: relative;
|
|
|
+ width: 100%;
|
|
|
+ height: 100vh;
|
|
|
+ overflow: hidden;
|
|
|
+ .map-container {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ .farm-content {
|
|
|
+ position: absolute;
|
|
|
+ top: 40px;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: calc(100% - 40px);
|
|
|
+ pointer-events: none;
|
|
|
+ z-index: 2;
|
|
|
+ }
|
|
|
+ .farm-filter {
|
|
|
+ pointer-events: all;
|
|
|
+ margin: 12px;
|
|
|
+ position: relative;
|
|
|
+ background: rgba(0, 0, 0, 0.3);
|
|
|
+ border-radius: 20px;
|
|
|
+ border: 1px solid rgba(255, 255, 255, 0.4);
|
|
|
+ &::before {
|
|
|
+ content: "";
|
|
|
+ position: absolute;
|
|
|
+ left: 12px;
|
|
|
+ top: 9px;
|
|
|
+ width: 14px;
|
|
|
+ height: 14px;
|
|
|
+ background: url("@/assets/img/home/search.png") no-repeat center center / 100% 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::v-deep {
|
|
|
+ .el-select__wrapper {
|
|
|
+ background: none;
|
|
|
+ box-shadow: none;
|
|
|
+ padding-left: 34px;
|
|
|
+ font-size: 12px;
|
|
|
+ .el-select__selected-item,
|
|
|
+ .el-select__placeholder,
|
|
|
+ .el-select__input {
|
|
|
+ color: rgba(255, 255, 255, 0.6);
|
|
|
+ &.is-transparent {
|
|
|
+ color: #ccc;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .el-select {
|
|
|
+ transition: all 0.3s;
|
|
|
+ .el-input.is-focus .el-input__wrapper {
|
|
|
+ box-shadow: none !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .el-input {
|
|
|
+ .el-input__wrapper {
|
|
|
+ background: none;
|
|
|
+ box-shadow: none;
|
|
|
+ padding-left: 18px;
|
|
|
+ font-size: 11px;
|
|
|
+ .el-input__inner {
|
|
|
+ color: rgba(255, 255, 255, 0.6);
|
|
|
+ }
|
|
|
+ &.is-focus {
|
|
|
+ .el-input__inner {
|
|
|
+ color: #ccc;
|
|
|
+ font-size: 11px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .create-box {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 10px;
|
|
|
+ left: 12px;
|
|
|
+ width: calc(100% - 24px);
|
|
|
+ background: #E0F1FE;
|
|
|
+ border-radius: 14px;
|
|
|
+ .create-title {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 12px 6px 12px 12px;
|
|
|
+ .title-icon {
|
|
|
+ width: 18px;
|
|
|
+ padding-right: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+.location-search-popper {
|
|
|
+ .el-select-dropdown__list {
|
|
|
+ max-width: 96vw;
|
|
|
+ overflow-x: auto;
|
|
|
+ }
|
|
|
+ .sub-title {
|
|
|
+ padding-left: 6px;
|
|
|
+ font-size: 12px;
|
|
|
+ color: #ccc;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|