From aec3825a3b1d8aed48efcd504fbdc93b3c9bdb86 Mon Sep 17 00:00:00 2001 From: xingyy <64720302+Concur-max@users.noreply.github.com> Date: Sat, 8 Feb 2025 10:06:21 +0800 Subject: [PATCH] =?UTF-8?q?feat(component):=20=E4=BC=98=E5=8C=96=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=BB=84=E4=BB=B6=E5=B9=B6=E6=B7=BB=E5=8A=A0=E6=96=B0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 重构 x-message 组件,支持更多自定义选项 - 添加 artDetail 页面用于展示艺术品详情 - 修改 liveRoom 页面,接入新的消息提示功能- 优化 profile 页面布局,增加去支付按钮 - 调整 home 页面,集成新的消息系统 - 修改 websocket 插件,支持携带 token 认证 --- app/api/goods/index.js | 8 ++ app/components/x-message/index.vue | 65 ++++++++++++-- app/components/x-message/message/index.vue | 81 +++++++++++++++--- app/components/x-message/useMessage.js | 44 +++++++--- app/pages/artDetail/index.vue | 27 ++++++ app/pages/home/index.vue | 1 + .../liveRoom/components/Broadcast/index.vue | 8 +- .../liveRoom/components/SideButton/index.vue | 2 +- app/pages/liveRoom/index.client.vue | 6 +- app/pages/profile/index.vue | 31 +++++-- app/plugins/websocket.ts | 7 +- app/static/images/zd5530@2x.png | Bin 0 -> 20216 bytes app/stores/goods/index.js | 4 +- app/stores/live/index.js | 48 ++++++++--- 14 files changed, 268 insertions(+), 64 deletions(-) create mode 100644 app/pages/artDetail/index.vue create mode 100644 app/static/images/zd5530@2x.png diff --git a/app/api/goods/index.js b/app/api/goods/index.js index 99c537d..9760a4d 100644 --- a/app/api/goods/index.js +++ b/app/api/goods/index.js @@ -30,3 +30,11 @@ export async function userArtworks(data) { data }) } +export async function userArtwork(data) { + + return await request( { + url:'/api/v1/m/user/artwork', + method: 'POST', + data + }) +} \ No newline at end of file diff --git a/app/components/x-message/index.vue b/app/components/x-message/index.vue index cd38213..0073f47 100644 --- a/app/components/x-message/index.vue +++ b/app/components/x-message/index.vue @@ -1,21 +1,65 @@ @@ -26,9 +70,12 @@ defineExpose({ showMessage }) > diff --git a/app/components/x-message/message/index.vue b/app/components/x-message/message/index.vue index 2b7b9fa..c28f333 100644 --- a/app/components/x-message/message/index.vue +++ b/app/components/x-message/message/index.vue @@ -7,13 +7,36 @@ import warning from '../images/warning.png' const props = defineProps({ type: { type: String, - default: 'success', - validator: value => ['success', 'error', 'warning'].includes(value), + default: 'success' }, - text: { + message: { type: String, - default: '', + default: '' }, + title: { + type: Object, + default: () => ({ + text: '', + color: '', + align: 'left' + }) + }, + subTitle: { + type: Object, + default: () => ({ + text: '', + color: '', + align: 'left' + }) + }, + showIcon: { + type: Boolean, + default: true + }, + customStyle: { + type: Object, + default: () => ({}) + } }) const typeConfig = { @@ -24,34 +47,64 @@ const typeConfig = { }, error: { imgSrc: error, - borderColor: '#F3CBD3', - bgColor: '#FBEEF1', + borderColor: '#FFD4D4', + bgColor: '#FFF0F0', }, warning: { imgSrc: warning, - borderColor: '#FAE0B5', - bgColor: '#FEF7ED', - }, + borderColor: '#FFE2BA', + bgColor: '#FFF7EC', + } } diff --git a/app/components/x-message/useMessage.js b/app/components/x-message/useMessage.js index 10eed19..da23492 100644 --- a/app/components/x-message/useMessage.js +++ b/app/components/x-message/useMessage.js @@ -2,22 +2,46 @@ import { createApp, nextTick } from 'vue' import MessagePopup from './index.vue' const message = { - success(text, duration = 2000) { + success(options, duration = 2000) { if (process.client) { - this.show({ type: 'success', message: text, duration }) + if (typeof options === 'string') { + this.show({ type: 'success', message: options, duration }) + } else { + this.show({ + type: 'success', + ...options, + duration + }) + } } }, - error(text, duration = 2000) { + error(options, duration = 2000) { if (process.client) { - this.show({ type: 'error', message: text, duration }) + if (typeof options === 'string') { + this.show({ type: 'error', message: options, duration }) + } else { + this.show({ + type: 'error', + ...options, + duration + }) + } } }, - warning(text, duration = 2000) { + warning(options, duration = 2000) { if (process.client) { - this.show({ type: 'warning', message: text, duration }) + if (typeof options === 'string') { + this.show({ type: 'warning', message: options, duration }) + } else { + this.show({ + type: 'warning', + ...options, + duration + }) + } } }, - show({ type = 'success', message, duration = 2000 }) { + show(options) { if (!process.client) return const container = document.createElement('div') @@ -32,11 +56,7 @@ const message = { const instance = app.mount(container) nextTick(() => { - instance.showMessage?.({ - type, - message, - duration - }) + instance.showMessage?.(options) }) } } diff --git a/app/pages/artDetail/index.vue b/app/pages/artDetail/index.vue new file mode 100644 index 0000000..266f7fd --- /dev/null +++ b/app/pages/artDetail/index.vue @@ -0,0 +1,27 @@ + + + + + \ No newline at end of file diff --git a/app/pages/home/index.vue b/app/pages/home/index.vue index 117ba2e..aa35bef 100644 --- a/app/pages/home/index.vue +++ b/app/pages/home/index.vue @@ -3,6 +3,7 @@ import liveRoom from '@/pages/liveRoom/index.client.vue'; import {goodStore} from "@/stores/goods/index.js"; import ItemList from './components/ItemList/index.vue' import Cescribe from './components/Cescribe/index.vue' +import {message} from '@/components/x-message/useMessage.js' const {fullLive,getAuctionDetail,auctionDetail} = goodStore(); const changeLive = () => { fullLive.value = true; diff --git a/app/pages/liveRoom/components/Broadcast/index.vue b/app/pages/liveRoom/components/Broadcast/index.vue index 0b8e46b..7c04913 100644 --- a/app/pages/liveRoom/components/Broadcast/index.vue +++ b/app/pages/liveRoom/components/Broadcast/index.vue @@ -65,10 +65,10 @@ onUnmounted(() => {