Просмотр исходного кода

feat: 完善模型管理和展馆管理功能

wangfumin 6 месяцев назад
Родитель
Сommit
b396e54fa1

+ 7 - 0
eslint.config.js

@@ -11,6 +11,13 @@ export default antfu({
     'vue/block-order': 'off',
     '@typescript-eslint/no-this-alias': 'off',
     'prefer-promise-reject-errors': 'off',
+    'unused-imports/no-unused-vars': [
+      'error',
+      {
+        varsIgnorePattern: '^_',
+        argsIgnorePattern: '^_',
+      },
+    ],
   },
   languageOptions: {
     globals: {

+ 24 - 18
src/components/common/WangEditor.vue

@@ -3,27 +3,27 @@
     <Toolbar
       style="border-bottom: 1px solid #ccc"
       :editor="editorRef"
-      :defaultConfig="toolbarConfig"
+      :default-config="toolbarConfig"
       :mode="mode"
     />
     <Editor
-      style="height: 500px; overflow-y: hidden;"
       v-model="valueHtml"
-      :defaultConfig="editorConfig"
+      style="height: 500px; overflow-y: hidden;"
+      :default-config="editorConfig"
       :mode="mode"
-      @onCreated="handleCreated"
-      @onChange="handleChange"
-      @onDestroyed="handleDestroyed"
-      @onFocus="handleFocus"
-      @onBlur="handleBlur"
+      @on-created="handleCreated"
+      @on-change="handleChange"
+      @on-destroyed="handleDestroyed"
+      @on-focus="handleFocus"
+      @on-blur="handleBlur"
     />
   </div>
 </template>
 
 <script setup>
-import '@wangeditor/editor/dist/css/style.css'
 import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
 import { onBeforeUnmount, ref, shallowRef, watch } from 'vue'
+import '@wangeditor/editor/dist/css/style.css'
 
 defineOptions({ name: 'WangEditor' })
 
@@ -81,7 +81,7 @@ watch(
       valueHtml.value = newVal
     }
   },
-  { immediate: true }
+  { immediate: true },
 )
 
 // 监听编辑器内容变化
@@ -89,13 +89,14 @@ watch(
   valueHtml,
   (newVal) => {
     emit('update:modelValue', newVal)
-  }
+  },
 )
 
 // 组件销毁时,也及时销毁编辑器
 onBeforeUnmount(() => {
   const editor = editorRef.value
-  if (editor == null) return
+  if (editor == null)
+    return
 
   editor.destroy()
 })
@@ -125,35 +126,40 @@ function handleBlur(editor) {
 // 获取编辑器内容
 function getHtml() {
   const editor = editorRef.value
-  if (editor == null) return ''
+  if (editor == null)
+    return ''
   return editor.getHtml()
 }
 
 // 获取编辑器纯文本内容
 function getText() {
   const editor = editorRef.value
-  if (editor == null) return ''
+  if (editor == null)
+    return ''
   return editor.getText()
 }
 
 // 设置编辑器内容
 function setHtml(html) {
   const editor = editorRef.value
-  if (editor == null) return
+  if (editor == null)
+    return
   editor.setHtml(html)
 }
 
 // 插入文本
 function insertText(text) {
   const editor = editorRef.value
-  if (editor == null) return
+  if (editor == null)
+    return
   editor.insertText(text)
 }
 
 // 清空内容
 function clear() {
   const editor = editorRef.value
-  if (editor == null) return
+  if (editor == null)
+    return
   editor.clear()
 }
 
@@ -170,4 +176,4 @@ defineExpose({
 
 <style scoped>
 /* 可以添加自定义样式 */
-</style>
+</style>

+ 1 - 1
src/layouts/full/sidebar/index.vue

@@ -4,5 +4,5 @@
 </template>
 
 <script setup>
-import { SideLogo, SideMenu } from '@/layouts/components'
+import { SideMenu } from '@/layouts/components'
 </script>

+ 1 - 1
src/layouts/normal/sidebar/index.vue

@@ -4,5 +4,5 @@
 </template>
 
 <script setup>
-import { SideLogo, SideMenu } from '@/layouts/components'
+import { SideMenu } from '@/layouts/components'
 </script>

+ 1 - 1
src/layouts/simple/sidebar/index.vue

@@ -8,7 +8,7 @@
 </template>
 
 <script setup>
-import { MenuCollapse, SideLogo, SideMenu, UserAvatar } from '@/layouts/components'
+import { MenuCollapse, SideMenu, UserAvatar } from '@/layouts/components'
 import { useAppStore } from '@/store'
 
 const appStore = useAppStore()

+ 1 - 0
src/router/index.js

@@ -9,6 +9,7 @@
 import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
 import { basicRoutes } from './basic-routes'
 import { setupRouterGuards } from './guards'
+
 console.log(import.meta.env, 77777)
 export const router = createRouter({
   history:

+ 42 - 35
src/utils/ossUpload.js

@@ -3,19 +3,20 @@
  * 提供统一的OSS上传功能
  */
 
-import { ref, readonly } from 'vue'
 import { request } from '@/utils'
+import { readonly, ref } from 'vue'
 
 /**
  * 获取OSS配置信息
  * @param {number} fileNum - 配置类型,默认为1
- * @returns {Promise<Object>} OSS配置信息
+ * @returns {Promise<object>} OSS配置信息
  */
 export async function getOssConfig(fileNum = 1) {
   try {
     const response = await request.get('/file/oss/info', { params: { fileNum } })
     return response.data?.[0] || null
-  } catch (error) {
+  }
+  catch (error) {
     console.error('获取OSS配置失败:', error)
     window.$message?.error('获取OSS配置失败')
     throw new Error('获取OSS配置失败')
@@ -31,14 +32,15 @@ export async function getOssConfig(fileNum = 1) {
 export async function uploadFileToOss(actionUrl, file) {
   const formData = new FormData()
   formData.append('file', file)
-  
+
   try {
     const response = await fetch(actionUrl, {
       method: 'PUT',
       body: file,
     })
     return response
-  } catch (error) {
+  }
+  catch (error) {
     console.error('文件上传失败:', error)
     throw new Error('文件上传失败')
   }
@@ -47,54 +49,55 @@ export async function uploadFileToOss(actionUrl, file) {
 /**
  * OSS上传Hook
  * 提供完整的OSS上传功能,包括配置获取、文件上传、状态管理
- * @returns {Object} 上传相关的方法和状态
+ * @returns {object} 上传相关的方法和状态
  */
 export function useOssUpload() {
   const ossConfig = ref(null)
   const uploading = ref(false)
-  
+
   /**
    * 初始化OSS配置
    */
   const initOssConfig = async () => {
     try {
       ossConfig.value = await getOssConfig()
-    } catch (error) {
+    }
+    catch (error) {
       $message.error('获取OSS配置失败')
       throw error
     }
     return ossConfig.value
   }
-  
+
   /**
    * 上传文件
    * @param {File} file - 要上传的文件
-   * @param {Object} options - 上传选项
+   * @param {object} options - 上传选项
    * @param {Function} options.onSuccess - 成功回调
    * @param {Function} options.onError - 失败回调
    * @param {Function} options.onProgress - 进度回调(可选)
-   * @returns {Promise<Object>} 上传结果
+   * @returns {Promise<object>} 上传结果
    */
   const uploadFile = async (file, options = {}) => {
     const { onSuccess, onError, onProgress } = options
-    
+
     if (uploading.value) {
       window.$message?.warning('正在上传中,请稍候')
       return
     }
-    
+
     try {
       uploading.value = true
-      
+
       // 确保OSS配置已加载
       const config = await initOssConfig()
       if (!config) {
         throw new Error('OSS配置未获取')
       }
-      
+
       // 上传文件
       const response = await uploadFileToOss(config.actionUrl, file)
-      
+
       if (response.ok) {
         // 构建文件URL信息
         const result = {
@@ -102,25 +105,28 @@ export function useOssUpload() {
           localUrl: URL.createObjectURL(file),
           fileName: config.fileName,
           dir: config.dir,
-          fullUrl: config.dir + config.fileName
+          fullUrl: config.dir + config.fileName,
         }
-        
+
         onSuccess?.(result)
         window.$message?.success('上传成功')
         return result
-      } else {
+      }
+      else {
         throw new Error('上传失败')
       }
-    } catch (error) {
+    }
+    catch (error) {
       console.error('上传失败:', error)
       onError?.(error)
       window.$message?.error('上传失败,请重试')
       throw error
-    } finally {
+    }
+    finally {
       uploading.value = false
     }
   }
-  
+
   /**
    * 验证文件类型
    * @param {File} file - 要验证的文件
@@ -134,56 +140,57 @@ export function useOssUpload() {
       }
       return file.type === acceptTypes
     }
-    
+
     if (Array.isArray(acceptTypes)) {
-      return acceptTypes.some(type => {
+      return acceptTypes.some((type) => {
         if (type.endsWith('/*')) {
           return file.type.startsWith(type.slice(0, -1))
         }
         return file.type === type
       })
     }
-    
+
     return true
   }
-  
+
   /**
    * 处理NUpload组件的上传
-   * @param {Object} uploadOptions - NUpload的上传参数
+   * @param {object} uploadOptions - NUpload的上传参数
    * @param {string|Array} acceptTypes - 允许的文件类型
    * @returns {Promise<void>}
    */
   const handleNUpload = async ({ file, onFinish, onError }, acceptTypes = 'image/*') => {
     // 文件类型验证
     if (!validateFile(file.file, acceptTypes)) {
-      const errorMsg = Array.isArray(acceptTypes) 
+      const errorMsg = Array.isArray(acceptTypes)
         ? `只能上传 ${acceptTypes.join(', ')} 类型的文件`
-        : acceptTypes === 'image/*' 
+        : acceptTypes === 'image/*'
           ? '只能上传图片文件'
           : `只能上传 ${acceptTypes} 类型的文件`
       window.$message?.error(errorMsg)
       onError?.()
       return
     }
-    
+
     try {
       const result = await uploadFile(file.file, {
         onSuccess: () => onFinish?.(),
-        onError: () => onError?.()
+        onError: () => onError?.(),
       })
       return result
-    } catch (error) {
+    }
+    catch (error) {
       onError?.()
       throw error
     }
   }
-  
+
   return {
     ossConfig: readonly(ossConfig),
     uploading: readonly(uploading),
     initOssConfig,
     uploadFile,
     validateFile,
-    handleNUpload
+    handleNUpload,
   }
-}
+}

+ 1 - 2
src/views/kzhanManage/ArtistMgt/index.vue

@@ -84,8 +84,7 @@
 <script setup>
 import { MeCrud, MeModal, MeQueryItem } from '@/components'
 import { useCrud } from '@/composables'
-import { withPermission } from '@/directives'
-import { NButton, NCard, NImage } from 'naive-ui'
+import { NButton, NImage } from 'naive-ui'
 import api from './api'
 
 defineOptions({ name: 'OnlineExhibition' })

+ 2 - 4
src/views/kzhanManage/CarouselImageMgt/index.vue

@@ -148,11 +148,9 @@
 </template>
 
 <script setup>
-import { MeCrud, MeModal, MeQueryItem } from '@/components'
+import { MeCrud, MeModal } from '@/components'
 import { useCrud } from '@/composables'
-import { withPermission } from '@/directives'
-import { formatDateTime } from '@/utils'
-import { NButton, NImage, NInputNumber, NSelect, NText, NUpload, NUploadDragger } from 'naive-ui'
+import { NButton, NImage, NSelect, NText, NUpload, NUploadDragger } from 'naive-ui'
 import api from './api'
 
 defineOptions({ name: 'CarouselImageMgt' })

+ 75 - 63
src/views/kzhanManage/GalleryMgt/components/addAndEditGallery.vue

@@ -20,7 +20,7 @@
       >
         <n-input v-model:value="formData.name" placeholder="请输入展馆名称" />
       </n-form-item>
-      
+
       <n-form-item
         label="英文名称"
         path="enName"
@@ -92,7 +92,7 @@
           />
         </n-form-item>
       </div>
-      
+
       <n-form-item
         label="相关展会"
         path="exhibitionList"
@@ -100,13 +100,12 @@
         <div style="width:100%;">
           <NSelect
             v-model:value="formData.exhibitionList"
-            multiple
-            filterable
+
             placeholder="搜索展会"
             :options="exhibitionOptions"
             :loading="exhibitionLoading"
-            clearable
-            remote
+
+            clearable filterable remote multiple
             :clear-filter-after-select="false"
             @search="handleExhibitionSearch"
           />
@@ -127,12 +126,12 @@
               :loading="addressLoading"
               :remote="true"
               :clear-filter-after-select="false"
+              class="w-full"
               @search="handleAddressSearch"
               @update:value="handleAddressSelect"
-              class="w-full"
             />
           </div>
-          <div id="mapContainer" class="h-300px mt-10 w-full border border-gray-300 rounded" />
+          <div id="mapContainer" class="mt-10 h-300px w-full border border-gray-300 rounded" />
         </div>
       </n-form-item>
 
@@ -144,7 +143,7 @@
           <WangEditor
             ref="editorRef"
             v-model="formData.description"
-            :height="'300px'"
+            height="300px"
             placeholder="请输入展馆详情描述..."
             :toolbar-config="toolbarConfig"
             :editor-config="editorConfig"
@@ -173,10 +172,10 @@
 </template>
 
 <script setup>
-import { onMounted, watch } from 'vue'
 import { WangEditor } from '@/components'
-import { NButton, NImage, NSelect, NTag, NText, NTimePicker, NUpload, NUploadDragger } from 'naive-ui'
 import { request } from '@/utils'
+import { NButton, NImage, NSelect, NText, NTimePicker, NUpload, NUploadDragger } from 'naive-ui'
+import { onMounted, watch } from 'vue'
 import api from '../api'
 
 defineOptions({ name: 'AddAndEditGallery' })
@@ -231,7 +230,7 @@ const toolbarConfig = {
     'tableHeader',
     'tableFullWidth',
     'todo', // 待办
-  ]
+  ],
 }
 
 // 编辑器配置 - 配置图片和视频上传
@@ -243,23 +242,25 @@ const editorConfig = {
         try {
           const formData = new FormData()
           formData.append('file', file)
-          
+
           const response = await request.post('/file/upload', formData, {
             headers: {
-              'Content-Type': 'multipart/form-data'
-            }
+              'Content-Type': 'multipart/form-data',
+            },
           })
           console.log(response)
           if (response.data) {
             // 插入图片到编辑器
             insertFn(response.data, file.name, response.data)
             $message.success('图片上传成功')
-          } else {
+          }
+          else {
             throw new Error('上传响应格式错误')
           }
-        } catch (error) {
+        }
+        catch (error) {
           console.error('图片上传失败', error)
-          $message.error('图片上传失败:' + (error.message || '未知错误'))
+          $message.error(`图片上传失败:${error.message || '未知错误'}`)
         }
       },
       // 上传错误的回调函数
@@ -286,23 +287,25 @@ const editorConfig = {
         try {
           const formData = new FormData()
           formData.append('file', file)
-          
+
           const response = await request.post('/file/upload', formData, {
             headers: {
-              'Content-Type': 'multipart/form-data'
-            }
+              'Content-Type': 'multipart/form-data',
+            },
           })
           console.log(response)
           if (response.data) {
             // 插入视频到编辑器
             insertFn(response.data)
             $message.success('视频上传成功')
-          } else {
+          }
+          else {
             throw new Error('上传响应格式错误')
           }
-        } catch (error) {
+        }
+        catch (error) {
           console.error('视频上传失败', error)
-          $message.error('视频上传失败:' + (error.message || '未知错误'))
+          $message.error(`视频上传失败:${error.message || '未知错误'}`)
         }
       },
       // 上传错误的回调函数
@@ -322,8 +325,8 @@ const editorConfig = {
       maxFileSize: 50 * 1024 * 1024, // 50M
       // 限制文件类型
       allowedFileTypes: ['video/*'],
-    }
-  }
+    },
+  },
 }
 
 // 表单验证规则
@@ -374,7 +377,7 @@ function handleAddressSearch(query) {
 // 调用腾讯位置服务suggestion API
 function searchAddressSuggestions(keyword) {
   addressLoading.value = true
-  
+
   try {
     // 使用JSONP方式调用腾讯地图WebService API进行地址建议搜索
     const callbackName = `jsonp_callback_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
@@ -394,15 +397,18 @@ function searchAddressSuggestions(keyword) {
             value: item.title + (item.address ? ` - ${item.address}` : ''),
             location: item.location,
             id: item.id,
-            category: item.category
+            category: item.category,
           }))
-        } else {
+        }
+        else {
           addressOptions.value = []
         }
-      } catch (error) {
+      }
+      catch (error) {
         console.error('地址搜索处理失败:', error)
         addressOptions.value = []
-      } finally {
+      }
+      finally {
         addressLoading.value = false
         // 清理:移除script标签和回调函数
         document.head.removeChild(script)
@@ -422,7 +428,8 @@ function searchAddressSuggestions(keyword) {
 
     // 添加script标签到head中开始请求
     document.head.appendChild(script)
-  } catch (error) {
+  }
+  catch (error) {
     console.error('地址搜索失败:', error)
     addressLoading.value = false
     addressOptions.value = []
@@ -438,7 +445,7 @@ function handleAddressSelect(value) {
       // 触发地图更新
       emit('search-location', {
         address: value,
-        location: selectedOption.location
+        location: selectedOption.location,
       })
     }
   }
@@ -448,7 +455,6 @@ watch(() => props.editExhibitionList, (newValue) => {
   if (newValue && Array.isArray(newValue) && newValue.length > 0) {
     // 根据ID从exhibitionOptions中找到对应的展会信息
     editExhibitionHuixian.value = newValue
-    
   }
 }, { immediate: true })
 // 监听地址变化,在编辑模式下自动搜索和定位
@@ -458,7 +464,7 @@ watch(() => props.formData.address, (newAddress) => {
     setTimeout(() => {
       // 直接触发地址搜索和定位
       emit('search-location', {
-        address: newAddress
+        address: newAddress,
       })
     }, 1000)
   }
@@ -470,7 +476,8 @@ watch(() => props.formData.exhibitionList, (newExhibitionList) => {
     // 根据ID从exhibitionOptions中找到对应的展会信息
     const exhibitions = []
     selectedExhibitions.value = newExhibitionList
-  } else {
+  }
+  else {
     selectedExhibitions.value = []
   }
 }, { immediate: true, deep: true })
@@ -487,7 +494,7 @@ async function handleConfirm() {
       try {
         // 获取富文本内容
         const description = getEditorContent()
-        
+
         // 构建开放时间字符串
         let openTime = ''
         if (props.formData.startTime && props.formData.endTime) {
@@ -496,54 +503,57 @@ async function handleConfirm() {
           const endTimeStr = new Date(props.formData.endTime).toLocaleTimeString('zh-CN', { hour12: false })
           openTime = `${startTimeStr} - ${endTimeStr}`
         }
-        
+
         // 获取图片URL(从imgList中获取)
         let imageUrl = props.formData.imageUrl || ''
         let logoUrl = props.formData.logoUrl || ''
-        
+
         if (props.imgList.cover && props.imgList.cover.length > 0) {
           imageUrl = props.imgList.cover[0].remoteUrl
         }
         if (props.imgList.logo && props.imgList.logo.length > 0) {
           logoUrl = props.imgList.logo[0].remoteUrl
         }
-        
+
         // 构建请求参数
         const requestData = {
           address: props.formData.address || '',
           description: description || '',
           enName: props.formData.enName || '',
           exhibitionList: props.formData.exhibitionList || [],
-          imageUrl: imageUrl,
-          logoUrl: logoUrl,
+          imageUrl,
+          logoUrl,
           name: props.formData.name || '',
-          openTime: openTime,
-          remark: props.formData.remark || ''
+          openTime,
+          remark: props.formData.remark || '',
         }
         console.log(requestData, 'requestData')
         // $message.loading('保存中...')
-        
+
         // 根据编辑状态调用不同接口
         let response
         if (props.isEdit) {
           // 编辑模式:添加ID参数并调用更新接口
           requestData.id = props.formData.id
           response = await api.update(requestData)
-        } else {
+        }
+        else {
           // 新增模式:调用新增接口
           response = await api.create(requestData)
         }
-        
+
         if (response.code === 0) {
           $message.success(props.isEdit ? '更新成功' : '新增成功')
           // 添加小延迟确保消息显示后再触发父组件处理
           setTimeout(() => {
             emit('confirm')
           }, 100)
-        } else {
+        }
+        else {
           $message.error(response.message || (props.isEdit ? '更新失败' : '新增失败'))
         }
-      } catch (error) {
+      }
+      catch (error) {
         console.error(props.isEdit ? '更新失败:' : '新增失败:', error)
         $message.error(props.isEdit ? '更新失败,请重试' : '新增失败,请重试')
       }
@@ -566,48 +576,51 @@ function handleExhibitionSearch(query) {
 // 搜索展会
 async function searchExhibitions(name = '') {
   exhibitionLoading.value = true
-  
+
   try {
     const params = {
       pageNo: 1,
       pageSize: name ? 100 : 20, // 有搜索条件时加载100条,否则加载20条
-      online: 1
+      online: 1,
     }
-    
+
     if (name) {
       params.name = name
     }
-    
+
     const response = await api.getExhibitionList(params)
-    
+
     if (response.code === 0 && response.data?.pageData) {
       // 过滤掉已选中的展会
-      const filteredData = response.data.pageData.filter(item => 
-        !selectedExhibitions.value.some(selected => selected.id === item.id)
+      const filteredData = response.data.pageData.filter(item =>
+        !selectedExhibitions.value.some(selected => selected.id === item.id),
       )
       props.exhibitionOptions.splice(0, props.exhibitionOptions.length, ...filteredData.map(item => ({
         label: item.name,
         value: item.id,
-        ...item
+        ...item,
       })))
-    } else {
+    }
+    else {
       props.exhibitionOptions.splice(0, props.exhibitionOptions.length)
     }
-  } catch (error) {
+  }
+  catch (error) {
     console.error('展会搜索失败:', error)
     props.exhibitionOptions.splice(0, props.exhibitionOptions.length)
-  } finally {
+  }
+  finally {
     exhibitionLoading.value = false
   }
 }
 
 // 处理展会选择
 function handleExhibitionSelect(value) {
-  console.log(value,'value')
+  console.log(value, 'value')
   if (value) {
     const selectedOption = props.exhibitionOptions.find(option => option.value === value[value.length - 1])
     if (selectedOption && !selectedExhibitions.value.some(item => item.id === [value.length - 1])) {
-      console.log(selectedOption,'selectedOption')
+      console.log(selectedOption, 'selectedOption')
       editExhibitionHuixian.value.push(selectedOption)
       // 更新formData.exhibitionList
       props.formData.exhibitionList = editExhibitionHuixian.value.map(item => item.id)
@@ -641,4 +654,3 @@ defineExpose({
   setEditorContent,
 })
 </script>
-

+ 21 - 21
src/views/kzhanManage/GalleryMgt/index.vue

@@ -35,7 +35,7 @@
         :form-data="modalForm"
         :img-list="imgList"
         :exhibition-options="exhibitionOptions"
-        :editExhibitionList="editExhibitionList"
+        :edit-exhibition-list="editExhibitionList"
         @cancel="handleCancel"
         @confirm="handleConfirm"
         @upload="handleUpload"
@@ -48,9 +48,7 @@
 <script setup>
 import { MeCrud, MeQueryItem } from '@/components'
 import { useCrud } from '@/composables'
-import { withPermission } from '@/directives'
-import { formatDateTime } from '@/utils'
-import { NButton, NImage, NSelect, NSwitch, NTag, NText, NTimePicker, NUpload, NUploadDragger } from 'naive-ui'
+import { NButton, NImage } from 'naive-ui'
 import api from './api'
 import AddAndEditGallery from './components/addAndEditGallery.vue'
 
@@ -263,10 +261,10 @@ async function handleOpen(options) {
       if (detailResponse.code === 0 && detailResponse.data) {
         const detailData = detailResponse.data
         editExhibitionList.value = detailData.exhibitionList
-        
+
         // 将详情中的展会添加到exhibitionOptions中(如果不存在的话)
         if (detailData.exhibitionList && Array.isArray(detailData.exhibitionList)) {
-          detailData.exhibitionList.forEach(exhibition => {
+          detailData.exhibitionList.forEach((exhibition) => {
             // 检查是否已存在于exhibitionOptions中
             const exists = exhibitionOptions.value.some(option => option.value === exhibition.id)
             // if (!exists) {
@@ -279,7 +277,7 @@ async function handleOpen(options) {
             // }
           })
         }
-        
+
         Object.assign(modalForm.value, detailData)
         modalForm.value.exhibitionList = (detailData.exhibitionList || []).map(item => item.id) // 将展会ID数组赋值给exhibitionList
         // 解析openTime为startTime和endTime
@@ -288,11 +286,11 @@ async function handleOpen(options) {
           if (timeRange.length === 2) {
             const today = new Date()
             const todayStr = today.toISOString().split('T')[0] // 获取今天的日期字符串 YYYY-MM-DD
-            
+
             // 将时间字符串转换为今天的完整时间戳
             const startDateTime = new Date(`${todayStr}T${timeRange[0]}`)
             const endDateTime = new Date(`${todayStr}T${timeRange[1]}`)
-            
+
             modalForm.value.startTime = startDateTime.getTime()
             modalForm.value.endTime = endDateTime.getTime()
           }
@@ -323,10 +321,11 @@ async function handleOpen(options) {
           }
           imgList.logo.push(logoImgObj)
         }
-      } else {
+      }
+      else {
         // 如果详情接口失败,使用列表数据作为备选
         Object.assign(modalForm.value, options.row)
-        
+
         // 回显封面图
         if (options.row.imageUrl) {
           const fullImageUrl = options.row.imageUrl.startsWith('http')
@@ -424,18 +423,19 @@ async function getExhibitionList() {
       name: '',
       pageNo: 1,
       pageSize: 20, // 获取所有展会数据
-      online: '', //不传值表示获取全部
+      online: '', // 不传值表示获取全部
     }
-    
+
     const response = await api.getExhibitionList(params)
-    
+
     if (response.code === 0 && response.data && response.data.pageData) {
       exhibitionOptions.value = response.data.pageData.map(item => ({
         label: item.name,
         value: item.id,
-        ...item
+        ...item,
       }))
-    } else {
+    }
+    else {
       exhibitionOptions.value = []
       console.warn('获取展会列表响应格式异常:', response)
     }
@@ -519,8 +519,6 @@ async function handleUpload({ file, onFinish, onError }, type) {
   }
 }
 
-
-
 // 初始化腾讯地图
 function initMap() {
   if (typeof TMap === 'undefined') {
@@ -548,7 +546,8 @@ function initMap() {
     if (map) {
       try {
         map.destroy()
-      } catch (error) {
+      }
+      catch (error) {
         console.warn('销毁旧地图实例失败:', error)
       }
       map = null
@@ -596,7 +595,7 @@ function searchLocation(locationData) {
     // 如果传入了位置数据(来自自动完成选择),直接使用
     if (locationData && locationData.location) {
       const { address, location } = locationData
-      
+
       if (location.lat && location.lng) {
         const latLng = new TMap.LatLng(location.lat, location.lng)
 
@@ -616,7 +615,8 @@ function searchLocation(locationData) {
         }
 
         $message.success('地址定位成功')
-      } else {
+      }
+      else {
         $message.warning('位置信息无效')
       }
       return

+ 2 - 2
src/views/kzhanManage/LogoMgt/index.vue

@@ -16,7 +16,7 @@
         >
           <NUploadDragger class="upload-dragger">
             <div class="upload-content">
-              <i class="i-mdi:cloud-upload upload-icon" />
+              <i class="upload-icon i-mdi:cloud-upload" />
               <p class="upload-text">
                 点击上传,或将图片拖到此处
               </p>
@@ -34,7 +34,7 @@
 </template>
 
 <script setup>
-import { NImage, NUpload, NUploadDragger, useMessage } from 'naive-ui'
+import { NImage, NUpload, NUploadDragger } from 'naive-ui'
 import { onMounted, reactive, ref } from 'vue'
 import api from './api'
 

+ 60 - 59
src/views/kzhanManage/OfflineExhibitionNewsMgt/components/addAndEditOffline.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="add-edit-offline bg-card rounded-lg p-6 shadow-lg">
+  <div class="bg-card add-edit-offline rounded-lg p-6 shadow-lg">
     <div class="mb-6">
       <h2 class="text-xl text-gray-800 font-semibold">
         {{ isEdit ? '编辑线下展会' : '新增线下展会' }}
@@ -25,14 +25,14 @@
       >
         <n-input v-model:value="formData.name" placeholder="请输入展会名称" />
       </n-form-item>
-      
+
       <n-form-item
         label="展览日期"
         path="dateRange"
       >
-        <n-date-picker v-model:value="formData.dateRange" type="daterange" clearable placeholder="请选择展览日期" />
+        <NDatePicker v-model:value="formData.dateRange" type="daterange" clearable placeholder="请选择展览日期" />
       </n-form-item>
-      
+
       <n-form-item
         label="展馆"
         path="pavilionId"
@@ -43,7 +43,7 @@
           trigger: ['change', 'blur'],
         }"
       >
-        <n-select
+        <NSelect
           v-model:value="formData.pavilionId"
           :options="pavilionOptions"
           :loading="pavilionLoading"
@@ -88,8 +88,6 @@
         </div>
       </n-form-item>
 
-
-
       <n-form-item
         label="展会状态"
         path="statusText"
@@ -101,9 +99,7 @@
       >
         <n-input v-model:value="formData.statusText" placeholder="请输入展会状态" />
       </n-form-item>
-      
 
-      
       <n-form-item label="置顶" path="setTop">
         <NSwitch v-model:value="formData.setTop">
           <template #checked>
@@ -114,7 +110,7 @@
           </template>
         </NSwitch>
       </n-form-item>
-      
+
       <n-form-item label="热门" path="hot">
         <NSwitch v-model:value="formData.hot">
           <template #checked>
@@ -125,14 +121,12 @@
           </template>
         </NSwitch>
       </n-form-item>
-      
 
-      
       <n-form-item
         label="相关艺术家"
         path="artistId"
       >
-        <n-select
+        <NSelect
           v-model:value="formData.artistId"
           :options="artistOptions"
           :loading="artistLoading"
@@ -166,12 +160,12 @@
               :loading="addressLoading"
               :remote="true"
               :clear-filter-after-select="false"
+              class="w-full"
               @search="handleAddressSearch"
               @update:value="handleAddressSelect"
-              class="w-full"
             />
           </div>
-          <div id="mapContainer" class="h-300px mt-10 w-full border border-gray-300 rounded" />
+          <div id="mapContainer" class="mt-10 h-300px w-full border border-gray-300 rounded" />
         </div>
       </n-form-item>
 
@@ -183,15 +177,13 @@
           <WangEditor
             ref="editorRef"
             v-model="formData.description"
-            :height="'300px'"
+            height="300px"
             placeholder="请输入展会详情描述..."
             :toolbar-config="toolbarConfig"
             :editor-config="editorConfig"
           />
         </div>
       </n-form-item>
-      
-
     </n-form>
 
     <!-- 操作按钮 -->
@@ -207,12 +199,10 @@
 </template>
 
 <script setup>
-import { onMounted, watch } from 'vue'
 import { WangEditor } from '@/components'
-import { NButton, NImage, NSelect, NSwitch, NText, NTimePicker, NUpload, NUploadDragger, NDatePicker, NRadio, NRadioGroup, NInputNumber } from 'naive-ui'
 import { request } from '@/utils'
-import pavilionApi from '../../GalleryMgt/api'
-import artistApi from '../../ArtistMgt/api'
+import { NButton, NDatePicker, NImage, NSelect, NSwitch, NText, NUpload, NUploadDragger } from 'naive-ui'
+import { watch } from 'vue'
 import api from '../api'
 
 defineOptions({ name: 'AddAndEditOffline' })
@@ -232,7 +222,7 @@ const props = defineProps({
   },
   modalAction: {
     type: String,
-    default: 'add'
+    default: 'add',
   },
   pavilionOptions: {
     type: Array,
@@ -270,7 +260,7 @@ const toolbarConfig = {
     'tableHeader',
     'tableFullWidth',
     'todo', // 待办
-  ]
+  ],
 }
 
 // 编辑器配置 - 配置图片和视频上传
@@ -282,23 +272,25 @@ const editorConfig = {
         try {
           const formData = new FormData()
           formData.append('file', file)
-          
+
           const response = await request.post('/file/upload', formData, {
             headers: {
-              'Content-Type': 'multipart/form-data'
-            }
+              'Content-Type': 'multipart/form-data',
+            },
           })
           console.log(response)
           if (response.data) {
             // 插入图片到编辑器
             insertFn(response.data, file.name, response.data)
             $message.success('图片上传成功')
-          } else {
+          }
+          else {
             throw new Error('上传响应格式错误')
           }
-        } catch (error) {
+        }
+        catch (error) {
           console.error('图片上传失败', error)
-          $message.error('图片上传失败:' + (error.message || '未知错误'))
+          $message.error(`图片上传失败:${error.message || '未知错误'}`)
         }
       },
       // 上传错误的回调函数
@@ -325,23 +317,25 @@ const editorConfig = {
         try {
           const formData = new FormData()
           formData.append('file', file)
-          
+
           const response = await request.post('/file/upload', formData, {
             headers: {
-              'Content-Type': 'multipart/form-data'
-            }
+              'Content-Type': 'multipart/form-data',
+            },
           })
           console.log(response)
           if (response.data) {
             // 插入视频到编辑器
             insertFn(response.data)
             $message.success('视频上传成功')
-          } else {
+          }
+          else {
             throw new Error('上传响应格式错误')
           }
-        } catch (error) {
+        }
+        catch (error) {
           console.error('视频上传失败', error)
-          $message.error('视频上传失败:' + (error.message || '未知错误'))
+          $message.error(`视频上传失败:${error.message || '未知错误'}`)
         }
       },
       // 上传错误的回调函数
@@ -361,8 +355,8 @@ const editorConfig = {
       maxFileSize: 50 * 1024 * 1024, // 50M
       // 限制文件类型
       allowedFileTypes: ['video/*'],
-    }
-  }
+    },
+  },
 }
 
 // 上传前验证
@@ -399,7 +393,7 @@ function handleAddressSearch(query) {
 // 调用腾讯位置服务suggestion API
 function searchAddressSuggestions(keyword) {
   addressLoading.value = true
-  
+
   try {
     // 使用JSONP方式调用腾讯地图WebService API进行地址建议搜索
     const callbackName = `jsonp_callback_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
@@ -424,15 +418,18 @@ function searchAddressSuggestions(keyword) {
             district: item.district,
             adcode: item.adcode,
             id: item.id,
-            category: item.category
+            category: item.category,
           }))
-        } else {
+        }
+        else {
           addressOptions.value = []
         }
-      } catch (error) {
+      }
+      catch (error) {
         console.error('地址搜索处理失败:', error)
         addressOptions.value = []
-      } finally {
+      }
+      finally {
         addressLoading.value = false
         // 清理:移除script标签和回调函数
         document.head.removeChild(script)
@@ -452,7 +449,8 @@ function searchAddressSuggestions(keyword) {
 
     // 添加script标签到head中开始请求
     document.head.appendChild(script)
-  } catch (error) {
+  }
+  catch (error) {
     console.error('地址搜索失败:', error)
     addressLoading.value = false
     addressOptions.value = []
@@ -474,7 +472,7 @@ function handleAddressSelect(value) {
         district: selectedOption.district,
         adcode: selectedOption.adcode,
         id: selectedOption.id,
-        category: selectedOption.category
+        category: selectedOption.category,
       })
     }
   }
@@ -500,7 +498,7 @@ watch(() => props.formData.address, (newAddress) => {
         address: newAddress,
         latitude: props.formData.latitude,
         longitude: props.formData.longitude,
-        city: props.formData.city
+        city: props.formData.city,
       })
     }, 1000)
   }
@@ -518,7 +516,7 @@ async function handleConfirm() {
       try {
         // 获取富文本内容
         const description = getEditorContent()
-        
+
         // 格式化展览日期
         let openTime = ''
         if (props.formData.dateRange && props.formData.dateRange.length === 2) {
@@ -533,55 +531,58 @@ async function handleConfirm() {
           }
           openTime = `${formatDate(startDate)} - ${formatDate(endDate)}`
         }
-        
+
         // 获取图片URL(从imgList中获取)
         let imageUrl = props.formData.coverImageUrl || ''
         if (props.imgList.cover && props.imgList.cover.length > 0) {
           imageUrl = props.imgList.cover[0].remoteUrl || props.imgList.cover[0].url
         }
-        
+
         // 构建请求参数
         const requestData = {
           address: props.formData.address || '',
           artistIdList: Array.isArray(props.formData.artistId) ? props.formData.artistId : (props.formData.artistId ? [props.formData.artistId] : []),
           city: props.formData.city || '',
           description: description || '',
-          imageUrl: imageUrl,
+          imageUrl,
           latitude: props.formData.latitude || 0,
           longitude: props.formData.longitude || 0,
           name: props.formData.name || '',
           online: 0,
-          openTime: openTime,
+          openTime,
           openTimeDetail: props.formData.openTimeDetail || '',
           pavilionId: props.formData.pavilionId || 0,
           hot: props.formData.hot ? 1 : 0,
           setTop: props.formData.setTop ? 'A' : 'I',
-          statusText: props.formData.statusText || ''
+          statusText: props.formData.statusText || '',
         }
-        
+
         console.log(requestData, 'requestData')
-        
+
         // 根据编辑状态调用不同接口
         let response
         if (props.isEdit) {
           // 编辑模式:添加ID参数并调用更新接口
           requestData.id = props.formData.id
           response = await api.update(requestData)
-        } else {
+        }
+        else {
           // 新增模式:调用新增接口
           response = await api.create(requestData)
         }
-        
+
         if (response.code === 0) {
           $message.success(props.isEdit ? '更新成功' : '新增成功')
           // 添加小延迟确保消息显示后再触发父组件处理
           setTimeout(() => {
             emit('confirm')
           }, 100)
-        } else {
+        }
+        else {
           $message.error(response.message || (props.isEdit ? '更新失败' : '新增失败'))
         }
-      } catch (error) {
+      }
+      catch (error) {
         console.error(props.isEdit ? '更新失败:' : '新增失败:', error)
         $message.error(props.isEdit ? '更新失败,请重试' : '新增失败,请重试')
       }
@@ -615,4 +616,4 @@ defineExpose({
   max-width: 1200px;
   margin: 0 auto;
 }
-</style>
+</style>

+ 118 - 105
src/views/kzhanManage/OfflineExhibitionNewsMgt/index.vue

@@ -26,35 +26,33 @@
     </MeCrud>
 
     <AddAndEditOffline
-        v-if="showAddEditForm"
-        ref="addEditRef"
-        :is-edit="modalAction === 'edit'"
-        :form-data="modalForm"
-        :img-list="imgList"
-        :modal-action="modalAction"
-        :pavilion-options="pavilionOptions"
-        :artist-options="artistOptions"
-        @cancel="handleFormCancel"
-        @confirm="handleComponentConfirm"
-        @upload="handleUpload"
-        @search-location="handleAddressSelect"
-        @pavilion-search="handlePavilionSearch"
-        @artist-search="handleArtistSearch"
-      />
+      v-if="showAddEditForm"
+      ref="addEditRef"
+      :is-edit="modalAction === 'edit'"
+      :form-data="modalForm"
+      :img-list="imgList"
+      :modal-action="modalAction"
+      :pavilion-options="pavilionOptions"
+      :artist-options="artistOptions"
+      @cancel="handleFormCancel"
+      @confirm="handleComponentConfirm"
+      @upload="handleUpload"
+      @search-location="handleAddressSelect"
+      @pavilion-search="handlePavilionSearch"
+      @artist-search="handleArtistSearch"
+    />
   </CommonPage>
 </template>
 
 <script setup>
-import { MeCrud, MeModal, MeQueryItem } from '@/components'
+import { MeCrud, MeQueryItem } from '@/components'
 import { useCrud } from '@/composables'
-import { withPermission } from '@/directives'
-import { formatDateTime, request } from '@/utils'
-import { NButton, NImage, NSwitch, NTag, NSelect, NUpload, NUploadDragger, NText, NRadio, NRadioGroup, NInputNumber, NDatePicker, NTimePicker } from 'naive-ui'
-import WangEditor from '@/components/common/WangEditor.vue'
-import AddAndEditOffline from './components/addAndEditOffline.vue'
-import api from './api'
-import pavilionApi from '../GalleryMgt/api'
+import { request } from '@/utils'
+import { NButton, NImage } from 'naive-ui'
 import artistApi from '../ArtistMgt/api'
+import pavilionApi from '../GalleryMgt/api'
+import api from './api'
+import AddAndEditOffline from './components/addAndEditOffline.vue'
 
 defineOptions({ name: 'OnlineExhibition' })
 
@@ -86,12 +84,12 @@ const addressLoading = ref(false)
 // 图片上传相关状态
 const imgList = ref({
   cover: [],
-  share: []
+  share: [],
 })
 
 // 防抖搜索展馆
 let searchTimer = null
-const handlePavilionSearch = (query) => {
+function handlePavilionSearch(query) {
   if (searchTimer) {
     clearTimeout(searchTimer)
   }
@@ -102,7 +100,7 @@ const handlePavilionSearch = (query) => {
 
 // 防抖搜索艺术家
 let artistSearchTimer = null
-const handleArtistSearch = (query) => {
+function handleArtistSearch(query) {
   if (artistSearchTimer) {
     clearTimeout(artistSearchTimer)
   }
@@ -113,7 +111,7 @@ const handleArtistSearch = (query) => {
 
 // 防抖搜索地址
 let addressSearchTimer = null
-const handleAddressSearch = (query) => {
+function handleAddressSearch(query) {
   if (addressSearchTimer) {
     clearTimeout(addressSearchTimer)
   }
@@ -123,12 +121,12 @@ const handleAddressSearch = (query) => {
 }
 
 // 加载展馆选项
-const loadPavilionOptions = async (name = '') => {
+async function loadPavilionOptions(name = '') {
   pavilionLoading.value = true
   try {
     const params = {
       pageSize: 20,
-      pageNo: 1
+      pageNo: 1,
     }
     if (name) {
       params.name = name,
@@ -136,21 +134,23 @@ const loadPavilionOptions = async (name = '') => {
     }
     const { data } = await pavilionApi.read(params)
     pavilionOptions.value = data.pageData || []
-  } catch (error) {
+  }
+  catch (error) {
     console.error('加载展馆列表失败:', error)
     pavilionOptions.value = []
-  } finally {
+  }
+  finally {
     pavilionLoading.value = false
   }
 }
 
 // 加载艺术家选项
-const loadArtistOptions = async (name = '') => {
+async function loadArtistOptions(name = '') {
   artistLoading.value = true
   try {
     const params = {
       pageSize: 20,
-      pageNo: 1
+      pageNo: 1,
     }
     if (name) {
       params.name = name
@@ -158,10 +158,12 @@ const loadArtistOptions = async (name = '') => {
     }
     const { data } = await artistApi.read(params)
     artistOptions.value = data.pageData || []
-  } catch (error) {
+  }
+  catch (error) {
     console.error('加载艺术家列表失败:', error)
     artistOptions.value = []
-  } finally {
+  }
+  finally {
     artistLoading.value = false
   }
 }
@@ -176,7 +178,7 @@ function initMap() {
     console.error('腾讯地图SDK未加载')
     return
   }
-  
+
   // 等待DOM完全渲染后再初始化地图
   setTimeout(() => {
     const mapContainer = document.getElementById('mapContainer')
@@ -197,7 +199,8 @@ function initMap() {
     if (map) {
       try {
         map.destroy()
-      } catch (error) {
+      }
+      catch (error) {
         console.warn('销毁旧地图实例失败:', error)
       }
       map = null
@@ -236,12 +239,13 @@ function initMap() {
 
 // 在地图上标记位置
 function markLocationOnMap(location, address, locationData) {
-  if (!map || !location) return
-  
+  if (!map || !location)
+    return
+
   try {
     // 更新标记位置
     const position = new TMap.LatLng(location.lat, location.lng)
-    
+
     // 更新地图中心和缩放级别
     if (map) {
       map.setCenter(position)
@@ -253,51 +257,55 @@ function markLocationOnMap(location, address, locationData) {
       marker.updateGeometries([{
         id: 'marker1',
         styleId: 'marker',
-        position: position,
+        position,
       }])
     }
-    
+
     // 存储经纬度信息到modalForm
     modalForm.value.latitude = location.lat
     modalForm.value.longitude = location.lng
     modalForm.value.city = locationData.city
-    
+
     console.log('地图标记成功:', { lat: location.lat, lng: location.lng, city: modalForm.value.city })
-  } catch (error) {
+  }
+  catch (error) {
     console.error('地图标记失败:', error)
   }
 }
 
 // 处理地址选择 - 地图定位逻辑
-const handleAddressSelect = (locationData) => {
+function handleAddressSelect(locationData) {
   console.log('选择的地址:', locationData)
-  
+
   if (locationData.location) {
     // 在地图上标记位置
     markLocationOnMap(locationData.location, locationData.address, locationData)
-  } else if (locationData.address) {
+  }
+  else if (locationData.address) {
     // 检查是否有传递过来的经纬度信息(编辑模式回显)
     if (locationData.latitude && locationData.longitude) {
       // 使用传递过来的经纬度进行地图定位
       const savedLocation = {
         lat: locationData.latitude,
-        lng: locationData.longitude
+        lng: locationData.longitude,
       }
       markLocationOnMap(savedLocation, locationData.address, {
         city: locationData.city,
-        address: locationData.address
+        address: locationData.address,
       })
-    } else if (modalForm.value.latitude && modalForm.value.longitude) {
+    }
+    else if (modalForm.value.latitude && modalForm.value.longitude) {
       // 使用表单中已保存的经纬度进行地图定位
       const savedLocation = {
         lat: modalForm.value.latitude,
-        lng: modalForm.value.longitude
+        lng: modalForm.value.longitude,
       }
       markLocationOnMap(savedLocation, locationData.address, {
         city: modalForm.value.city,
-        address: locationData.address
+        address: locationData.address,
       })
-    } else {
+    }
+    else {
       // 如果没有坐标,可以进行地址解析
       console.log('需要进行地址解析:', locationData.address)
     }
@@ -328,7 +336,7 @@ function loadTencentMapSDK() {
       resolve()
       return
     }
-    
+
     // 创建script标签加载SDK
     const script = document.createElement('script')
     script.src = 'https://map.qq.com/api/gljs?v=1.exp&key=YCABZ-AFPRX-VD54O-TL3VN-TL7A3-KPBQJ'
@@ -359,35 +367,38 @@ async function handleUpload(options, type) {
   try {
     const formData = new FormData()
     formData.append('file', file.file)
-    
+
     const response = await request.post('/file/upload', formData, {
       headers: {
-        'Content-Type': 'multipart/form-data'
-      }
+        'Content-Type': 'multipart/form-data',
+      },
     })
-    
+
     if (response.data) {
       // 更新对应类型的图片列表
       imgList.value[type] = [{
         url: response.data,
-        remoteUrl: response.data
+        remoteUrl: response.data,
       }]
-      
+
       // 更新表单数据
       if (type === 'cover') {
         modalForm.value.coverImageUrl = response.data
-      } else if (type === 'share') {
+      }
+      else if (type === 'share') {
         modalForm.value.shareImageUrl = response.data
       }
-      
+
       $message.success('图片上传成功')
       options.onFinish()
-    } else {
+    }
+    else {
       throw new Error('上传响应格式错误')
     }
-  } catch (error) {
+  }
+  catch (error) {
     console.error('图片上传失败', error)
-    $message.error('图片上传失败:' + (error.message || '未知错误'))
+    $message.error(`图片上传失败:${error.message || '未知错误'}`)
     options.onError()
   }
 }
@@ -398,7 +409,7 @@ onMounted(async () => {
   loadPavilionOptions()
   // 初始加载艺术家选项
   loadArtistOptions()
-  
+
   // 加载腾讯地图SDK并初始化地图
   try {
     await loadTencentMapSDK()
@@ -406,7 +417,8 @@ onMounted(async () => {
     // setTimeout(() => {
     //   initMap()
     // }, 500)
-  } catch (error) {
+  }
+  catch (error) {
     console.error('地图SDK加载失败:', error)
   }
 })
@@ -421,9 +433,9 @@ const {
   handleSave,
 } = useCrud({
   name: '线上展会',
-  initForm: { 
-    display: true, 
-    setTop: false, 
+  initForm: {
+    display: true,
+    setTop: false,
     isBomb: false,
     hot: false,
     dateRange: null,
@@ -437,7 +449,7 @@ const {
     shareImageUrl: '',
     latitude: 0,
     longitude: 0,
-    city: ''
+    city: '',
   },
   doCreate: (formData) => {
     // 格式化展览日期
@@ -447,7 +459,7 @@ const {
       const endDate = new Date(formData.dateRange[1]).toISOString().split('T')[0]
       openTime = `${startDate} - ${endDate}`
     }
-    
+
     const apiData = {
       address: formData.address || '',
       artistIdList: Array.isArray(formData.artistId) ? formData.artistId : (formData.artistId ? [formData.artistId] : []),
@@ -458,12 +470,12 @@ const {
       longitude: formData.longitude || 0,
       name: formData.name || '',
       online: 0,
-      openTime: openTime,
+      openTime,
       openTimeDetail: formData.openTimeDetail || '',
       pavilionId: formData.pavilionId || 0,
       setHot: formData.hot ? 1 : 0,
       setTop: formData.setTop ? 'A' : 'I',
-      statusText: formData.statusText || ''
+      statusText: formData.statusText || '',
     }
     return api.create(apiData)
   },
@@ -476,7 +488,7 @@ const {
       const endDate = new Date(formData.dateRange[1]).toISOString().split('T')[0]
       openTime = `${startDate} - ${endDate}`
     }
-    
+
     const apiData = {
       id: formData.id,
       address: formData.address || '',
@@ -488,12 +500,12 @@ const {
       longitude: formData.longitude || 0,
       name: formData.name || '',
       online: 0,
-      openTime: openTime,
+      openTime,
       openTimeDetail: formData.openTimeDetail || '',
       pavilionId: formData.pavilionId || 0,
       setHot: formData.hot ? 1 : 0,
       setTop: formData.setTop ? 'A' : 'I',
-      statusText: formData.statusText || ''
+      statusText: formData.statusText || '',
     }
     return api.update(apiData)
   },
@@ -504,8 +516,8 @@ const {
 function handleAdd() {
   // 重置表单数据
   Object.assign(modalForm, {
-    display: true, 
-    setTop: false, 
+    display: true,
+    setTop: false,
     isBomb: false,
     hot: false,
     dateRange: null,
@@ -521,25 +533,25 @@ function handleAdd() {
     pavilionId: null,
     latitude: 0,
     longitude: 0,
-    city: ''
+    city: '',
   })
-  
+
   // 设置为新增模式
   modalAction.value = 'add'
-  
+
   // 清空图片列表
   imgList.value = {
     cover: [],
-    share: []
+    share: [],
   }
-  
+
   // 重新加载选项
   loadPavilionOptions()
   loadArtistOptions()
-  
+
   // 切换到表单视图
   showAddEditForm.value = true
-  
+
   // 延迟初始化地图,确保DOM已渲染
   setTimeout(() => {
     initMap()
@@ -565,21 +577,21 @@ async function handleOpen(options) {
   // 重新加载选项
   loadPavilionOptions()
   loadArtistOptions()
-  
+
   // 切换到表单视图
   showAddEditForm.value = true
-  
+
   // 延迟初始化地图,确保弹窗DOM已渲染
   setTimeout(() => {
     initMap()
   }, 800)
-  
+
   // 清空图片列表
   imgList.value = {
     cover: [],
-    share: []
+    share: [],
   }
-  
+
   // 如果是编辑模式,调用接口获取展会详情
   if (options.action === 'edit' && options.row && options.row.id) {
     try {
@@ -589,10 +601,10 @@ async function handleOpen(options) {
         if (detailData.imageUrl) {
           imgList.value.cover = [{
             url: detailData.imageUrl,
-            remoteUrl: detailData.imageUrl
+            remoteUrl: detailData.imageUrl,
           }]
         }
-        
+
         // 如果详情中有pavilion信息,将其合并到展馆选项列表中
         let pavilionId = ''
         if (detailData.pavilion) {
@@ -602,11 +614,11 @@ async function handleOpen(options) {
           }
           pavilionId = detailData.pavilion.id
         }
-        
+
         // 如果详情中有artistList信息,将其合并到艺术家选项列表中
         let artistId = []
         if (detailData.artistList && Array.isArray(detailData.artistList)) {
-          detailData.artistList.forEach(artist => {
+          detailData.artistList.forEach((artist) => {
             const existingArtist = artistOptions.value.find(a => a.id === artist.id)
             if (!existingArtist) {
               artistOptions.value.unshift(artist)
@@ -614,7 +626,7 @@ async function handleOpen(options) {
           })
           artistId = detailData.artistList.map(artist => artist.id)
         }
-        
+
         // 处理日期范围回显
         let dateRange = null
         if (detailData.openTime && typeof detailData.openTime === 'string') {
@@ -627,18 +639,18 @@ async function handleOpen(options) {
             }
           }
         }
-        
+
         // 更新options中的row数据为接口返回的完整数据
         options.row = {
           ...options.row,
           id: detailData.id,
           name: detailData.name || '',
-          dateRange: dateRange,
+          dateRange,
           startTime: detailData.startTime || null,
           endTime: detailData.endTime || null,
           statusText: detailData.statusText || '',
-          pavilionId: pavilionId,
-          artistId: artistId,
+          pavilionId,
+          artistId,
           address: detailData.address || '',
           description: detailData.description || '',
           coverImageUrl: detailData.imageUrl || '',
@@ -649,15 +661,16 @@ async function handleOpen(options) {
           hot: detailData.hot === 1,
           latitude: detailData.latitude || 0,
           longitude: detailData.longitude || 0,
-          city: detailData.city || ''
+          city: detailData.city || '',
         }
       }
-    } catch (error) {
+    }
+    catch (error) {
       console.error('获取展会详情失败:', error)
       $message.error('获取展会详情失败')
     }
   }
-  
+
   // 调用原始的handleOpen方法
   originalHandleOpen(options)
 }
@@ -694,7 +707,7 @@ const columns = [
   {
     title: '展会状态',
     key: 'statusText',
-    width: 100
+    width: 100,
   },
   {
     title: '展览时间',
@@ -758,7 +771,7 @@ const columns = [
 async function handleOnline(row) {
   row.onlineLoading = true
   try {
-    await api.update({ id: row.id})
+    await api.update({ id: row.id })
     row.onlineLoading = false
     $message.success('操作成功')
     $table.value?.handleSearch()

+ 84 - 76
src/views/kzhanManage/OnlineExhibition/index.vue

@@ -44,7 +44,7 @@
         >
           <n-input v-model:value="modalForm.name" placeholder="请输入展会名称" />
         </n-form-item>
-        
+
         <n-form-item
           label="场景连接"
           path="sceneUrl"
@@ -56,7 +56,7 @@
         >
           <n-input v-model:value="modalForm.sceneUrl" placeholder="请输入场景连接" />
         </n-form-item>
-        
+
         <n-form-item
           label="展馆"
           path="pavilionId"
@@ -67,7 +67,7 @@
             trigger: ['change', 'blur'],
           }"
         >
-          <n-select
+          <NSelect
             v-model:value="modalForm.pavilionId"
             :options="pavilionOptions"
             :loading="pavilionLoading"
@@ -130,12 +130,16 @@
         </n-form-item>
 
         <n-form-item label="状态" path="display">
-          <n-radio-group v-model:value="modalForm.display">
-            <n-radio :value="true">上架</n-radio>
-            <n-radio :value="false">下架</n-radio>
-          </n-radio-group>
+          <NRadioGroup v-model:value="modalForm.display">
+            <NRadio :value="true">
+              上架
+            </NRadio>
+            <NRadio :value="false">
+              下架
+            </NRadio>
+          </NRadioGroup>
         </n-form-item>
-        
+
         <n-form-item label="置顶" path="setTop">
           <NSwitch v-model:value="modalForm.setTop">
             <template #checked>
@@ -156,9 +160,9 @@
             </template>
           </NSwitch>
         </n-form-item>
-        
+
         <n-form-item label="排序" path="sort">
-          <n-input-number v-model:value="modalForm.sort" placeholder="请输入排序" :min="0" />
+          <NInputNumber v-model:value="modalForm.sort" placeholder="请输入排序" :min="0" />
         </n-form-item>
       </n-form>
     </MeModal>
@@ -168,11 +172,9 @@
 <script setup>
 import { MeCrud, MeModal, MeQueryItem } from '@/components'
 import { useCrud } from '@/composables'
-import { withPermission } from '@/directives'
-import { formatDateTime, request } from '@/utils'
-import { NButton, NImage, NSwitch, NTag, NSelect, NUpload, NUploadDragger, NText, NRadio, NRadioGroup, NInputNumber } from 'naive-ui'
-import api from './api'
+import { NButton, NImage, NInputNumber, NRadio, NRadioGroup, NSelect, NSwitch, NTag, NText, NUpload, NUploadDragger } from 'naive-ui'
 import pavilionApi from '../GalleryMgt/api'
+import api from './api'
 
 defineOptions({ name: 'OnlineExhibition' })
 
@@ -187,12 +189,12 @@ const pavilionLoading = ref(false)
 // 图片上传相关状态
 const imgList = ref({
   cover: [],
-  share: []
+  share: [],
 })
 
 // 防抖搜索展馆
 let searchTimer = null
-const handlePavilionSearch = (query) => {
+function handlePavilionSearch(query) {
   if (searchTimer) {
     clearTimeout(searchTimer)
   }
@@ -202,12 +204,12 @@ const handlePavilionSearch = (query) => {
 }
 
 // 加载展馆选项
-const loadPavilionOptions = async (name = '') => {
+async function loadPavilionOptions(name = '') {
   pavilionLoading.value = true
   try {
     const params = {
       pageSize: 20,
-      pageNo: 1
+      pageNo: 1,
     }
     if (name) {
       params.name = name,
@@ -215,10 +217,12 @@ const loadPavilionOptions = async (name = '') => {
     }
     const { data } = await pavilionApi.read(params)
     pavilionOptions.value = data.pageData || []
-  } catch (error) {
+  }
+  catch (error) {
     console.error('加载展馆列表失败:', error)
     pavilionOptions.value = []
-  } finally {
+  }
+  finally {
     pavilionLoading.value = false
   }
 }
@@ -241,41 +245,44 @@ async function handleUpload(options, type) {
     if (!ossInfoResponse.data || !ossInfoResponse.data.length) {
       throw new Error('获取OSS配置失败')
     }
-    
+
     const ossInfo = ossInfoResponse.data[0]
     const { actionUrl, fileName } = ossInfo
-    
+
     // 2. 上传文件到OSS
     const uploadResponse = await api.uploadToOss(actionUrl, file.file)
-    
+
     if (uploadResponse.ok) {
-       // 3. 构建文件URL
-       const dir = ossInfo.dir
-       const fileName = ossInfo.fileName
-       const remoteUrl = dir + fileName
-       const localUrl = URL.createObjectURL(file.file)
-       
-       // 更新对应类型的图片列表
-       imgList.value[type] = [{
-         url: localUrl,
-         remoteUrl: remoteUrl
-       }]
-       
-       // 更新表单数据
-       if (type === 'cover') {
-         modalForm.value.coverImageUrl = remoteUrl
-       } else if (type === 'share') {
-         modalForm.value.shareImageUrl = remoteUrl
-       }
-      
+      // 3. 构建文件URL
+      const dir = ossInfo.dir
+      const fileName = ossInfo.fileName
+      const remoteUrl = dir + fileName
+      const localUrl = URL.createObjectURL(file.file)
+
+      // 更新对应类型的图片列表
+      imgList.value[type] = [{
+        url: localUrl,
+        remoteUrl,
+      }]
+
+      // 更新表单数据
+      if (type === 'cover') {
+        modalForm.value.coverImageUrl = remoteUrl
+      }
+      else if (type === 'share') {
+        modalForm.value.shareImageUrl = remoteUrl
+      }
+
       $message.success('图片上传成功')
       options.onFinish()
-    } else {
+    }
+    else {
       throw new Error('OSS上传失败')
     }
-  } catch (error) {
+  }
+  catch (error) {
     console.error('图片上传失败', error)
-    $message.error('图片上传失败:' + (error.message || '未知错误'))
+    $message.error(`图片上传失败:${error.message || '未知错误'}`)
     options.onError()
   }
 }
@@ -297,28 +304,28 @@ const {
   handleSave,
 } = useCrud({
   name: '线上展会',
-  initForm: { 
-    display: true, 
-    setTop: false, 
+  initForm: {
+    display: true,
+    setTop: false,
     isBomb: false,
     sort: 0,
     sceneUrl: '',
     coverImageUrl: '',
-    shareImageUrl: ''
+    shareImageUrl: '',
   },
   doCreate: (formData) => {
     const apiData = {
       display: formData.display ? 1 : 0,
-      fee: "",
-      imageUrl: formData.coverImageUrl || "",
+      fee: '',
+      imageUrl: formData.coverImageUrl || '',
       isBomb: formData.isBomb ? 1 : 0,
-      name: formData.name || "",
+      name: formData.name || '',
       online: 1,
       pavilionId: formData.pavilionId || 0,
-      relayUrl: formData.shareImageUrl || "",
-      sceneLink: formData.sceneUrl || "",
-      setTop: formData.setTop ? "A" : "I",
-      sort: formData.sort || 0
+      relayUrl: formData.shareImageUrl || '',
+      sceneLink: formData.sceneUrl || '',
+      setTop: formData.setTop ? 'A' : 'I',
+      sort: formData.sort || 0,
     }
     return api.create(apiData)
   },
@@ -327,16 +334,16 @@ const {
     const apiData = {
       id: formData.id,
       display: formData.display ? 1 : 0,
-      fee: "",
-      imageUrl: formData.coverImageUrl || "",
+      fee: '',
+      imageUrl: formData.coverImageUrl || '',
       isBomb: formData.isBomb ? 1 : 0,
-      name: formData.name || "",
+      name: formData.name || '',
       online: 1,
       pavilionId: formData.pavilionId || 0,
-      relayUrl: formData.shareImageUrl || "",
-      sceneLink: formData.sceneUrl || "",
-      setTop: formData.setTop ? "A" : "I",
-      sort: formData.sort || 0
+      relayUrl: formData.shareImageUrl || '',
+      sceneLink: formData.sceneUrl || '',
+      setTop: formData.setTop ? 'A' : 'I',
+      sort: formData.sort || 0,
     }
     return api.update(apiData)
   },
@@ -347,13 +354,13 @@ const {
 async function handleOpen(options) {
   // 重新加载展馆选项
   loadPavilionOptions()
-  
+
   // 清空图片列表
   imgList.value = {
     cover: [],
-    share: []
+    share: [],
   }
-  
+
   // 如果是编辑模式,调用接口获取展会详情
   if (options.action === 'edit' && options.row && options.row.id) {
     try {
@@ -365,20 +372,20 @@ async function handleOpen(options) {
             url: detailData.imageUrl.startsWith('http')
               ? detailData.imageUrl
               : `${import.meta.env.VITE_COS_BASE_URL}/${detailData.imageUrl}`,
-            remoteUrl: detailData.imageUrl
+            remoteUrl: detailData.imageUrl,
           }]
         }
-        
+
         // 回显转发图
         if (detailData.relayUrl) {
           imgList.value.share = [{
             url: detailData.relayUrl.startsWith('http')
               ? detailData.relayUrl
               : `${import.meta.env.VITE_COS_BASE_URL}/${detailData.relayUrl}`,
-            remoteUrl: detailData.relayUrl
+            remoteUrl: detailData.relayUrl,
           }]
         }
-        
+
         // 如果详情中有pavilion信息,将其合并到展馆选项列表中
         let pavilionId = ''
         if (detailData.pavilion) {
@@ -388,28 +395,29 @@ async function handleOpen(options) {
           }
           pavilionId = detailData.pavilion.id
         }
-        
+
         // 更新options中的row数据为接口返回的完整数据
         options.row = {
           ...options.row,
           id: detailData.id,
           name: detailData.name || '',
           sceneUrl: detailData.sceneLink || '',
-          pavilionId: pavilionId,
+          pavilionId,
           coverImageUrl: detailData.imageUrl || '',
           shareImageUrl: detailData.relayUrl || '',
           display: detailData.display === 1,
           setTop: detailData.setTop === 'I',
           isBomb: detailData.isBomb === 1,
-          sort: detailData.sort || 0
+          sort: detailData.sort || 0,
         }
       }
-    } catch (error) {
+    }
+    catch (error) {
       console.error('获取展会详情失败:', error)
       $message.error('获取展会详情失败')
     }
   }
-  
+
   // 调用原始的handleOpen方法
   originalHandleOpen(options)
 }
@@ -502,7 +510,7 @@ const columns = [
 async function handleOnline(row) {
   row.onlineLoading = true
   try {
-    await api.update({ id: row.id})
+    await api.update({ id: row.id })
     row.onlineLoading = false
     $message.success('操作成功')
     $table.value?.handleSearch()

+ 1 - 1
src/views/kzhanManage/OrderMgt/api.js

@@ -9,7 +9,7 @@ export default {
       orderTimeEnd: params.orderTimeEnd || '',
       paymentStatus: params.paymentStatus !== undefined ? params.paymentStatus : 0,
       searchText: params.searchText || '',
-      searchType: params.searchType || ''
+      searchType: params.searchType || '',
     }
     return request.get('/order/page', { params: requestParams })
   },

+ 7 - 8
src/views/kzhanManage/OrderMgt/index.vue

@@ -41,7 +41,7 @@
 <script setup>
 import { MeCrud, MeQueryItem } from '@/components'
 import { formatDateTime } from '@/utils'
-import { NButton, NTag, NAvatar } from 'naive-ui'
+import { NAvatar, NTag } from 'naive-ui'
 import api from './api'
 
 defineOptions({ name: 'OrderManagement' })
@@ -55,15 +55,13 @@ const queryItems = ref({
   searchText: '',
   searchType: '',
   orderTimeStart: '',
-  orderTimeEnd: ''
+  orderTimeEnd: '',
 })
 
 onMounted(() => {
   $table.value?.handleSearch()
 })
 
-
-
 const columns = [
   {
     title: 'ID',
@@ -84,7 +82,7 @@ const columns = [
       const statusMap = {
         0: { text: '未支付', type: 'warning' },
         1: { text: '已支付', type: 'success' },
-        2: { text: '已取消', type: 'error' }
+        2: { text: '已取消', type: 'error' },
       }
       const status = statusMap[paymentStatus] || { text: '未知', type: 'default' }
       return h(
@@ -130,9 +128,9 @@ const columns = [
         h(NAvatar, {
           size: 'small',
           src: avatarUrl || '/src/assets/images/avatar.jpg',
-          fallbackSrc: '/src/assets/images/avatar.jpg'
+          fallbackSrc: '/src/assets/images/avatar.jpg',
         }),
-        h('span', nickName || '微信用户')
+        h('span', nickName || '微信用户'),
       ])
     },
   },
@@ -143,7 +141,8 @@ watch(range, (newRange) => {
   if (newRange && newRange.length === 2) {
     queryItems.value.orderTimeStart = new Date(newRange[0]).toISOString().split('T')[0]
     queryItems.value.orderTimeEnd = new Date(newRange[1]).toISOString().split('T')[0]
-  } else {
+  }
+  else {
     queryItems.value.orderTimeStart = ''
     queryItems.value.orderTimeEnd = ''
   }

+ 1 - 1
src/views/modelManage/api.js

@@ -9,7 +9,7 @@ export default {
       uploadTimeStart: params.uploadTimeStart || '',
       uploadTimeEnd: params.uploadTimeEnd || '',
       pageNo: params.pageNo || 1,
-      pageSize: params.pageSize || 10
+      pageSize: params.pageSize || 10,
     }
     return request.get('/antique/page', { params: queryParams })
   },

+ 55 - 58
src/views/modelManage/index.vue

@@ -16,7 +16,7 @@
         />
       </MeQueryItem>
       <MeQueryItem label="上传日期" :label-width="70">
-        <n-date-picker
+        <NDatePicker
           v-model:value="range"
           type="daterange"
           clearable
@@ -46,7 +46,7 @@
         >
           <n-input v-model:value="modalForm.name" placeholder="请输入文物名称" />
         </n-form-item>
-        
+
         <n-form-item label="文物图片" path="coverImgUrl">
           <div class="flex items-start gap-4">
             <NUpload
@@ -72,39 +72,39 @@
         </n-form-item>
 
         <n-form-item label="审核状态" path="audit">
-          <n-select
+          <NSelect
             v-model:value="modalForm.audit"
             :options="[
               { label: '待审核', value: 0 },
               { label: '通过', value: 1 },
-              { label: '不通过', value: 2 }
+              { label: '不通过', value: 2 },
             ]"
             placeholder="请选择审核状态"
           />
         </n-form-item>
 
         <n-form-item label="是否热门" path="hot">
-          <n-switch 
-            v-model:value="modalForm.hot" 
-            :checked-value="1" 
+          <NSwitch
+            v-model:value="modalForm.hot"
+            :checked-value="1"
             :unchecked-value="0"
-            checked-text="是" 
+            checked-text="是"
             unchecked-text="否"
           />
         </n-form-item>
 
         <n-form-item label="显示状态" path="display">
-          <n-switch 
-            v-model:value="modalForm.display" 
-            :checked-value="1" 
+          <NSwitch
+            v-model:value="modalForm.display"
+            :checked-value="1"
             :unchecked-value="0"
-            checked-text="显示" 
+            checked-text="显示"
             unchecked-text="隐藏"
           />
         </n-form-item>
-        
+
         <n-form-item label="排序" path="sort">
-          <n-input-number v-model:value="modalForm.sort" placeholder="请输入排序" :min="0" />
+          <NInputNumber v-model:value="modalForm.sort" placeholder="请输入排序" :min="0" />
         </n-form-item>
       </n-form>
     </MeModal>
@@ -114,9 +114,8 @@
 <script setup>
 import { MeCrud, MeModal, MeQueryItem } from '@/components'
 import { useCrud } from '@/composables'
-import { withPermission } from '@/directives'
 import { formatDateTime, useOssUpload } from '@/utils'
-import { NButton, NImage, NSwitch, NTag, NSelect, NUpload, NUploadDragger, NText, NRadio, NRadioGroup, NInputNumber, NDatePicker, NAvatar } from 'naive-ui'
+import { NButton, NDatePicker, NImage, NInputNumber, NSelect, NSwitch, NTag, NText, NUpload, NUploadDragger } from 'naive-ui'
 import api from './api'
 
 defineOptions({ name: 'AntiqueManage' })
@@ -125,7 +124,7 @@ const $table = ref(null)
 /** QueryBar筛选参数(可选) */
 const queryItems = ref({
   uploadTimeStart: '',
-  uploadTimeEnd: ''
+  uploadTimeEnd: '',
 })
 
 // 日期范围选择
@@ -133,7 +132,7 @@ const range = ref(null)
 
 // 图片列表状态
 const imgList = ref({
-  cover: []
+  cover: [],
 })
 
 // 使用OSS上传Hook
@@ -145,10 +144,11 @@ watch(range, (newRange) => {
     // 使用本地时间格式化日期,避免时区问题
     const startDate = new Date(newRange[0])
     const endDate = new Date(newRange[1])
-    
+
     queryItems.value.uploadTimeStart = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-${String(startDate.getDate()).padStart(2, '0')}`
     queryItems.value.uploadTimeEnd = `${endDate.getFullYear()}-${String(endDate.getMonth() + 1).padStart(2, '0')}-${String(endDate.getDate()).padStart(2, '0')}`
-  } else {
+  }
+  else {
     queryItems.value.uploadTimeStart = ''
     queryItems.value.uploadTimeEnd = ''
   }
@@ -167,7 +167,7 @@ function onBeforeUpload({ file }) {
 async function handleUpload(uploadOptions) {
   try {
     const result = await handleNUpload(uploadOptions, 'image/*')
-    
+
     if (result) {
       // 更新图片列表
       imgList.value.cover.splice(0, imgList.value.cover.length)
@@ -177,17 +177,16 @@ async function handleUpload(uploadOptions) {
         url: result.localUrl,
         remoteUrl: result.remoteUrl,
       })
-      
+
       // 更新表单数据
       modalForm.value.coverImgUrl = result.remoteUrl
     }
-  } catch (error) {
+  }
+  catch (error) {
     console.error('上传失败:', error)
   }
 }
 
-
-
 onMounted(() => {
   $table.value?.handleSearch()
 })
@@ -207,16 +206,17 @@ function handleAudit(row) {
           audit: 1,
           description: row.description || '',
           display: row.display || 0,
-          name: row.name || ''
+          name: row.name || '',
         }
         await api.update(auditData)
         $message.success('审核通过成功')
         $table.value?.handleSearch()
-      } catch (error) {
+      }
+      catch (error) {
         $message.error('审核失败')
         console.error('审核失败:', error)
       }
-    }
+    },
   })
 }
 
@@ -231,13 +231,13 @@ const {
   handleSave,
 } = useCrud({
   name: '文物',
-  initForm: { 
+  initForm: {
     name: '',
     coverImgUrl: '',
     audit: 0,
     hot: 0,
     display: 1,
-    sort: 0
+    sort: 0,
   },
   doCreate: api.create,
   doDelete: api.delete,
@@ -247,21 +247,21 @@ const {
 
 // 重写handleOpen以处理图片回显
 async function handleOpen(options) {
-  const {action, title, row} = options
-  
+  const { action, title, row } = options
+
   // 初始化OSS配置
   await initOssConfig()
-  
+
   // 重置图片列表
   imgList.value.cover = []
-  
+
   // 如果是编辑模式,调用API获取详细数据
   if (action === 'edit' && row && row.id) {
     try {
       const response = await api.getById(row.id)
       if (response.data) {
         const data = response.data
-        
+
         // 更新表单数据
         Object.assign(modalForm.value, {
           name: data.name || '',
@@ -269,33 +269,32 @@ async function handleOpen(options) {
           audit: data.audit || 0,
           hot: data.hot || 0,
           display: data.display || 1,
-          sort: data.sort || 0
+          sort: data.sort || 0,
         })
-        
+
         // 回显图片
         if (data.coverImgUrl) {
           // 处理图片URL,如果不是完整URL则添加基础路径
-          const imageUrl = data.coverImgUrl.startsWith('http') 
-            ? data.coverImgUrl 
+          const imageUrl = data.coverImgUrl.startsWith('http')
+            ? data.coverImgUrl
             : `${import.meta.env.VITE_COS_BASE_URL}/${data.coverImgUrl}`
           imgList.value.cover = [{
             url: imageUrl,
-            remoteUrl: data.coverImgUrl
+            remoteUrl: data.coverImgUrl,
           }]
         }
       }
-    } catch (error) {
+    }
+    catch (error) {
       console.error('获取文物详情失败:', error)
       $message.error('获取文物详情失败')
     }
   }
-  
+
   // 调用原始的handleOpen
   originalHandleOpen(options)
 }
 
-
-
 const columns = [
   {
     title: 'ID',
@@ -332,13 +331,13 @@ const columns = [
       const statusMap = {
         0: { text: '待审核', type: 'warning' },
         1: { text: '通过', type: 'success' },
-        2: { text: '不通过', type: 'error' }
+        2: { text: '不通过', type: 'error' },
       }
       const status = statusMap[audit] || { text: '未知', type: 'default' }
       return h(
         NTag,
         { type: status.type },
-        { default: () => status.text }
+        { default: () => status.text },
       )
     },
   },
@@ -350,7 +349,7 @@ const columns = [
       return h(
         NTag,
         { type: hot === 1 ? 'success' : 'default' },
-        { default: () => hot === 1 ? '是' : '否' }
+        { default: () => hot === 1 ? '是' : '否' },
       )
     },
   },
@@ -362,7 +361,7 @@ const columns = [
       return h(
         NTag,
         { type: display === 1 ? 'success' : 'warning' },
-        { default: () => display === 1 ? '显示' : '隐藏' }
+        { default: () => display === 1 ? '显示' : '隐藏' },
       )
     },
   },
@@ -388,7 +387,7 @@ const columns = [
     hideInExcel: true,
     render(row) {
       const buttons = []
-      
+
       // 只有当audit不等于1时才显示审核按钮
       if (row.audit !== 1) {
         buttons.push(
@@ -403,10 +402,10 @@ const columns = [
               default: () => '审核',
               icon: () => h('i', { class: 'i-material-symbols:check-circle-outline text-14' }),
             },
-          )
+          ),
         )
       }
-      
+
       // 编辑按钮
       buttons.push(
         h(
@@ -415,15 +414,15 @@ const columns = [
             size: 'small',
             type: 'primary',
             style: 'margin-left: 8px;',
-            onClick: () => handleOpen({ action: 'edit', title: '编辑文物', row}),
+            onClick: () => handleOpen({ action: 'edit', title: '编辑文物', row }),
           },
           {
             default: () => '编辑',
             icon: () => h('i', { class: 'i-material-symbols:edit-outline text-14' }),
           },
-        )
+        ),
       )
-      
+
       // 删除按钮
       buttons.push(
         h(
@@ -438,13 +437,11 @@ const columns = [
             default: () => '删除',
             icon: () => h('i', { class: 'i-material-symbols:delete-outline text-14' }),
           },
-        )
+        ),
       )
-      
+
       return buttons
     },
   },
 ]
-
-
 </script>

+ 0 - 1
src/views/pms/user/components/UserAddOrEdit.vue

@@ -102,7 +102,6 @@
 <script setup>
 import { MeModal } from '@/components'
 import { useForm, useModal } from '@/composables'
-import api from '../api.js'
 
 defineOptions({ name: 'UserAddOrEdit' })
 const emit = defineEmits(['refresh'])