From 37571ac2b42614593dbbe5a56378236fa0a8beac Mon Sep 17 00:00:00 2001 From: aaron <> Date: Wed, 8 Jan 2025 16:49:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E5=B0=8F=E5=8C=BA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=BF=90=E8=90=A5=E7=8A=B6=E6=80=81=E7=9A=84=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/community.js | 9 ++ src/utils/amap.js | 42 +++--- src/views/community/BuildingList.vue | 58 +++++++ src/views/community/CommunityList.vue | 208 ++++++++++++++++++++++++-- 4 files changed, 283 insertions(+), 34 deletions(-) diff --git a/src/api/community.js b/src/api/community.js index a735afa..7c3899b 100644 --- a/src/api/community.js +++ b/src/api/community.js @@ -34,4 +34,13 @@ export function createBuilding(data) { method: 'post', data }) +} + +// 更新小区状态 +export function updateCommunityStatus(id, status) { + return request({ + url: `/api/community/${id}`, + method: 'put', + data: { status } + }) } \ No newline at end of file diff --git a/src/utils/amap.js b/src/utils/amap.js index 4bd40f2..365a36a 100644 --- a/src/utils/amap.js +++ b/src/utils/amap.js @@ -1,37 +1,33 @@ export function initAMap() { return new Promise((resolve, reject) => { if (window.AMap) { - // 如果已经加载过,直接加载插件 - window.AMap.plugin(['AMap.PlaceSearch', 'AMap.AutoComplete'], () => { - resolve(window.AMap); - }); - return; + resolve(window.AMap) + return } - // 加载高德地图脚本 - const script = document.createElement('script'); - script.type = 'text/javascript'; - script.async = true; - script.src = `https://webapi.amap.com/maps?v=2.0&key=fd47f3d4f54b675693c7d59dcd2a6c5f&plugin=AMap.PlaceSearch,AMap.AutoComplete&callback=initAMapCallback`; + const script = document.createElement('script') + script.type = 'text/javascript' + script.async = true + script.src = `https://webapi.amap.com/maps?v=2.0&key=fd47f3d4f54b675693c7d59dcd2a6c5f&plugin=AMap.PlaceSearch,AMap.AutoComplete,AMap.Geocoder&callback=initAMapCallback` - // 创建回调函数 window.initAMapCallback = () => { - resolve(window.AMap); - }; + resolve(window.AMap) + } - script.onerror = () => { - reject(new Error('加载地图失败')); - }; - - document.head.appendChild(script); - }); + script.onerror = reject + document.head.appendChild(script) + }) } -// 添加地图工具函数 +// 创建地图实例 export function createMap(container, options = {}) { + const defaultOptions = { + zoom: 15, + viewMode: '2D' + } + return new window.AMap.Map(container, { - zoom: 13, - viewMode: '2D', + ...defaultOptions, ...options - }); + }) } \ No newline at end of file diff --git a/src/views/community/BuildingList.vue b/src/views/community/BuildingList.vue index 6f1d7bd..cdd97f0 100644 --- a/src/views/community/BuildingList.vue +++ b/src/views/community/BuildingList.vue @@ -68,6 +68,7 @@ :rules="rules" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }" + class="building-form" > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before { + color: #ff4d4f; + font-size: 14px; + margin-right: 4px; + } +} + +:deep(.ant-input), +:deep(.ant-select) { + height: 40px; +} + +:deep(.ant-select-selector) { + height: 40px !important; + padding: 4px 11px !important; + + .ant-select-selection-search-input { + height: 38px !important; + } + + .ant-select-selection-item { + line-height: 38px !important; + } +} + +:deep(.ant-input::placeholder), +:deep(.ant-select-selection-placeholder) { + color: #bfbfbf; +} + +:deep(.ant-modal-body) { + padding: 0; +} + +:deep(.ant-modal-footer) { + border-top: 1px solid #f0f0f0; + padding: 16px 24px; +} \ No newline at end of file diff --git a/src/views/community/CommunityList.vue b/src/views/community/CommunityList.vue index a708926..475efdb 100644 --- a/src/views/community/CommunityList.vue +++ b/src/views/community/CommunityList.vue @@ -16,9 +16,18 @@ >