From 8628a6beab87a353d738816efa618b9807d5839c Mon Sep 17 00:00:00 2001 From: aaron <> Date: Sun, 23 Mar 2025 16:42:30 +0800 Subject: [PATCH] update --- src/main.js | 62 ++++++++++++++- src/views/merchant/List.vue | 154 ++++-------------------------------- 2 files changed, 78 insertions(+), 138 deletions(-) diff --git a/src/main.js b/src/main.js index a09e4de..71e8491 100644 --- a/src/main.js +++ b/src/main.js @@ -15,7 +15,37 @@ import { Pagination, Spin, ConfigProvider, - message + message, + Card, + Dropdown, + Checkbox, + Radio, + Switch, + DatePicker, + TimePicker, + InputNumber, + Upload, + Badge, + Avatar, + Drawer, + Divider, + List, + Popover, + Tooltip, + Tag, + Timeline, + Tree, + Alert, + Space, + Row, + Col, + Breadcrumb, + Steps, + Result, + Statistic, + Descriptions, + Empty, + AutoComplete } from 'ant-design-vue' import 'ant-design-vue/dist/antd.css' @@ -35,6 +65,36 @@ const ANT_DESIGN = { app.use(Pagination) app.use(Spin) app.use(ConfigProvider) + app.use(Card) + app.use(Dropdown) + app.use(Checkbox) + app.use(Radio) + app.use(Switch) + app.use(DatePicker) + app.use(TimePicker) + app.use(InputNumber) + app.use(Upload) + app.use(Badge) + app.use(Avatar) + app.use(Drawer) + app.use(Divider) + app.use(List) + app.use(Popover) + app.use(Tooltip) + app.use(Tag) + app.use(Timeline) + app.use(Tree) + app.use(Alert) + app.use(Space) + app.use(Row) + app.use(Col) + app.use(Breadcrumb) + app.use(Steps) + app.use(Result) + app.use(Statistic) + app.use(Descriptions) + app.use(Empty) + app.use(AutoComplete) } } diff --git a/src/views/merchant/List.vue b/src/views/merchant/List.vue index b65cba4..20f347f 100644 --- a/src/views/merchant/List.vue +++ b/src/views/merchant/List.vue @@ -181,26 +181,6 @@ /> - - - - - - - - @@ -345,26 +325,6 @@ /> - - - - - - - - @@ -439,8 +399,6 @@ import PageContainer from '@/components/PageContainer.vue' import { loadAMap, createMap, createAutoComplete, createGeocoder } from '@/utils/amap.js' import request from '@/utils/request' import { PlusOutlined, SearchOutlined, EditOutlined, DownOutlined, GiftOutlined, AccountBookOutlined } from '@ant-design/icons-vue' -import { MdEditor } from 'md-editor-v3' -import 'md-editor-v3/lib/style.css' export default defineComponent({ components: { @@ -452,8 +410,7 @@ export default defineComponent({ GiftOutlined, AccountBookOutlined, AUpload: Upload, - AModal: Modal, - MdEditor + AModal: Modal }, setup() { const loading = ref(false) @@ -462,27 +419,6 @@ export default defineComponent({ const currentMap = ref(null) const currentMarker = ref(null) - // Markdown 编辑器工具栏配置 - const toolbars = [ - 'bold', - 'underline', - 'italic', - 'strikeThrough', - 'title', - 'sub', - 'sup', - 'quote', - 'unorderedList', - 'orderedList', - 'codeRow', - 'code', - 'link', - 'image', - 'table', - 'preview', - 'fullscreen' - ] - const pagination = ref({ current: 1, pageSize: 10, @@ -687,9 +623,7 @@ export default defineComponent({ longitude: null, latitude: null, phone: '', - brand_image_url: '', - product_detail: '', - purchase_note: '', + brand_image_url: '' }) const rules = { @@ -699,9 +633,7 @@ export default defineComponent({ name: [{ required: true, message: '请输入商家名称' }], business_hours: [{ required: true, message: '请输入营业时间' }], address: [{ required: true, message: '请输入详细地址' }], - phone: [{ required: true, message: '请输入联系电话' }], - product_detail: [{ required: false, message: '请输入产品描述' }], - purchase_note: [{ required: false, message: '请输入购买须知' }], + phone: [{ required: true, message: '请输入联系电话' }] } // 获取商家分类 @@ -844,14 +776,7 @@ export default defineComponent({ try { confirmLoading.value = true - // 确保包含产品描述和购买须知字段 - const postData = { - ...formState.value, - product_detail: formState.value.product_detail || '', - purchase_note: formState.value.purchase_note || '' - } - - await request.post('/api/merchant', postData) + await request.post('/api/merchant', formState.value) message.success('添加成功') addModalVisible.value = false fetchData() @@ -875,9 +800,7 @@ export default defineComponent({ longitude: null, latitude: null, phone: '', - brand_image_url: '', - product_detail: '', - purchase_note: '', + brand_image_url: '' } searchAddress.value = '' searchOptions.value = [] @@ -932,9 +855,7 @@ export default defineComponent({ longitude: null, latitude: null, phone: '', - brand_image_url: '', - product_detail: '', - purchase_note: '', + brand_image_url: '' }) const editSearchAddress = ref('') const editMap = ref(null) @@ -947,8 +868,14 @@ export default defineComponent({ editFormState.value = { ...record, user_id: record.user_id, - product_detail: record.product_detail || '', - purchase_note: record.purchase_note || '' + name: record.name, + category_id: record.category_id, + business_hours: record.business_hours, + address: record.address, + longitude: record.longitude, + latitude: record.latitude, + phone: record.phone, + brand_image_url: record.brand_image_url } // 获取分类数据 @@ -1058,12 +985,9 @@ export default defineComponent({ try { editLoading.value = true - // 确保包含 user_id、产品描述和购买须知字段在请求数据中 const updateData = { ...editFormState.value, - user_id: editFormState.value.user_id, - product_detail: editFormState.value.product_detail || '', - purchase_note: editFormState.value.purchase_note || '' + user_id: editFormState.value.user_id } const res = await request.put(`/api/merchant/${currentEditId.value}`, updateData) @@ -1095,9 +1019,7 @@ export default defineComponent({ longitude: null, latitude: null, phone: '', - brand_image_url: '', - product_detail: '', - purchase_note: '', + brand_image_url: '' } editSearchAddress.value = '' userOptions.value = [] @@ -1335,8 +1257,7 @@ export default defineComponent({ shareRateModalVisible, shareRateValue, showShareRateModal, - handleShareRateSubmit, - toolbars + handleShareRateSubmit } } }) @@ -1554,47 +1475,6 @@ export default defineComponent({ width: 100% !important; } -/* Markdown 编辑器样式 */ -:deep(.md-editor) { - height: 300px !important; - margin-bottom: 24px; -} - -:deep(.md-editor-content) { - height: 300px !important; -} - -:deep(.ant-modal-body) { - padding: 24px; -} - -:deep(.md-editor-toolbar) { - border-radius: 2px 2px 0 0 !important; -} - -:deep(.md-editor-input, .md-editor-preview) { - border-radius: 0 0 2px 2px !important; -} - -:deep(.md-editor-preview-wrapper) { - padding: 8px 16px !important; -} - -:deep(.ant-modal .ant-modal-content) { - background: #fff; - box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), - 0 6px 16px 0 rgba(0, 0, 0, 0.08), - 0 9px 28px 8px rgba(0, 0, 0, 0.05); -} - -:deep(.md-editor) { - width: 100% !important; -} - -:deep(.md-editor-input) { - padding: 12px !important; -} - /* 编辑和添加模态框中的内容样式 */ :deep(.ant-modal-body:has(.ant-form)) { padding: 24px;