Преглед на файлове

🎨 修改地图与首页显示细节问题

快乐的梦鱼 преди 6 дни
родител
ревизия
01793d51e6
променени са 4 файла, в които са добавени 35 реда и са изтрити 20 реда
  1. 7 0
      src/components/content/ImageGrid.vue
  2. 10 6
      src/components/dynamicf/Map/AddressSercher.vue
  3. 1 0
      src/pages/forms/form.vue
  4. 17 14
      src/pages/inheritor.vue

+ 7 - 0
src/components/content/ImageGrid.vue

@@ -21,11 +21,18 @@
         @click="()=>emit('itemClick', v)"
       />
     </slot>
+    <slot name="empty" v-if="!data || data.length === 0">
+      <div class="w-100 text-center">
+        <ExclamationCircleOutlined />
+        <div>暂无数据</div>
+      </div>
+    </slot>
   </div>
 </template>
 
 <script setup lang="ts">
 import type { PropType } from 'vue';
+import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
 
 defineProps({	
   rowCount : {

+ 10 - 6
src/components/dynamicf/Map/AddressSercher.vue

@@ -51,11 +51,13 @@ async function searchAddress() {
     const data = await response.json();
     
     if (data.status === '1' && data.pois && data.pois.length > 0) {
+      console.log('搜索到的地址:', data.pois);
+      
       addressList.value = data.pois.map((item: any) => ({
         name: item.name,
         lng: parseFloat(item.location.split(',')[0]),
         lat: parseFloat(item.location.split(',')[1]),
-        address: item.address || item.name
+        address: item.address ? `${item.cityname}${item.adname}${item.address} ${item.name}` : item.name
       }));
     } else {
       addressList.value = [];
@@ -71,11 +73,9 @@ async function searchAddress() {
 // 选择地址
 function handleSelectAddress(address: any) {
   // 更新输入值
-  inputValue.value = address.name;
+  inputValue.value = address.address;
   // 关闭下拉列表
   openList.value = false;
-
-  emit('update:modelValue', address.name);
   
   // 发送详细地址信息
   emit('choosedAddress', {
@@ -86,6 +86,10 @@ function handleSelectAddress(address: any) {
   });
 }
 
+watch(inputValue, (newValue) => {
+  emit('update:modelValue', newValue ?? '');
+})
+
 // 处理输入变化
 function handleInputChange(value: string) {
   inputValue.value = value;
@@ -100,8 +104,8 @@ function handleSearch() {
 // 定义select组件的选项
 const selectOptions = computed<SelectProps['options']>(() => {
   return addressList.value.map(item => ({
-    label: `${item.name} (${item.address})`,
-    value: item.name,
+    label: item.name,
+    value: item.address,
     data: item
   }));
 });

+ 1 - 0
src/pages/forms/form.vue

@@ -208,6 +208,7 @@ async function handleSubmitBase() {
       onOk() {
         router.back();
       },
+      onCancel() {}
     });
   } catch (error) {
     Modal.error({

+ 17 - 14
src/pages/inheritor.vue

@@ -28,8 +28,8 @@
                 <a-descriptions-item label="批次"><ShowValueOrNull :value="ichData.content.value.batchText" /></a-descriptions-item>
                 <a-descriptions-item label="区域"><ShowValueOrNull :value="ichData.content.value.regionText" /></a-descriptions-item>
                 <a-descriptions-item label="保护单位"><ShowValueOrNull :value="ichData.content.value.unit" /></a-descriptions-item>
-                <a-descriptions-item v-if="ichData.content.value.image" label="图片">
-                  <a-image :src="ichData.content.value.image" style="max-width:300px;" />
+                <a-descriptions-item label="非遗项目相关图片">
+                  <ImageGrid :data="ichData.content.value.images" />
                 </a-descriptions-item>
                 <a-descriptions-item v-if="ichData.content.value.video" label="视频">
                   <video controls :src="ichData.content.value.video" style="max-width:300px;" />
@@ -52,8 +52,11 @@
               </a-alert>
               <a-descriptions class="mt-3" title="传承人信息" v-if="inheritorData.content.value" bordered :column="{ xs: 1, sm: 1, md: 1, lg: 2 }">
                 <a-descriptions-item label="名字"><ShowValueOrNull :value="inheritorData.content.value.title" /></a-descriptions-item>
-                <a-descriptions-item v-if="inheritorData.content.value.image" label="头像">
-                  <a-avatar :src="inheritorData.content.value.image" size="large" />
+                <a-descriptions-item label="传承人照片">
+                  <ImageGrid :data="inheritorData.content.value.images" />
+                </a-descriptions-item> 
+                <a-descriptions-item v-if="inheritorData.content.value.video" label="传承人相关视频">
+                  <video controls :src="inheritorData.content.value.video" style="max-width:300px;" />
                 </a-descriptions-item>
                 <a-descriptions-item label="传承人等级"><ShowValueOrNull :value="inheritorData.content.value.levelText" /></a-descriptions-item>
                 <a-descriptions-item label="传承人批次"><ShowValueOrNull :value="inheritorData.content.value.batchText" /></a-descriptions-item>
@@ -88,6 +91,16 @@
                 <a-descriptions-item v-if="seminarData.content.value.latitude && seminarData.content.value.longitude" label="地图">
                   <SimplePointedMap :longitude="seminarData.content.value.longitude" :latitude="seminarData.content.value.latitude" :zoom="15" height="300px"  />
                 </a-descriptions-item>
+
+                <a-descriptions-item v-if="seminarData.content.value.image" label="图片">
+                  <a-image :src="seminarData.content.value.image" style="max-width:300px;" />
+                </a-descriptions-item>
+                <a-descriptions-item v-if="seminarData.content.value.video" label="视频">
+                  <video controls :src="seminarData.content.value.video" style="max-width:300px;" />
+                </a-descriptions-item>
+                <a-descriptions-item v-if="seminarData.content.value.audio" label="音频">
+                  <audio controls :src="seminarData.content.value.audio" style="max-width:300px;" />
+                </a-descriptions-item>
                 <a-descriptions-item label="地址"><ShowValueOrNull :value="seminarData.content.value.address" /></a-descriptions-item>
                 <a-descriptions-item label="批次"><ShowValueOrNull :value="seminarData.content.value.batchText" /></a-descriptions-item>
                 <a-descriptions-item label="级别"><ShowValueOrNull :value="seminarData.content.value.levelText" /></a-descriptions-item>
@@ -101,16 +114,6 @@
                 <a-descriptions-item v-if="seminarData.content.value.latitude && seminarData.content.value.longitude" label="地图">
                   <SimplePointedMap :longitude="seminarData.content.value.longitude" :latitude="seminarData.content.value.latitude" :zoom="15" height="300px"  />
                 </a-descriptions-item>
-
-                <a-descriptions-item v-if="seminarData.content.value.image" label="图片">
-                  <a-image :src="seminarData.content.value.image" style="max-width:300px;" />
-                </a-descriptions-item>
-                <a-descriptions-item v-if="seminarData.content.value.video" label="视频">
-                  <video controls :src="seminarData.content.value.video" style="max-width:300px;" />
-                </a-descriptions-item>
-                <a-descriptions-item v-if="seminarData.content.value.audio" label="音频">
-                  <audio controls :src="seminarData.content.value.audio" style="max-width:300px;" />
-                </a-descriptions-item>
               </a-descriptions>
             </EmptyToRecord>
           </a-tab-pane>