From a791248752c5591d11d1a56b0d9dbef6de395cc7 Mon Sep 17 00:00:00 2001 From: xingyy <64720302+Concur-max@users.noreply.github.com> Date: Sat, 8 Feb 2025 16:24:26 +0800 Subject: [PATCH] =?UTF-8?q?refactor(app):=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BB=93=E6=9E=84=E5=92=8C=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除多处 console.log 语句,清理无用代码 - 在消息组件中添加 info 类型配置并实现 info 消息显示功能 - 优化 WebSocket 消息处理逻辑,提高代码可读性 --- app/components/x-message/images/info.png | Bin 0 -> 932 bytes app/components/x-message/message/index.vue | 6 ++++++ app/components/x-message/useMessage.js | 15 ++++++++++++++- app/pages/artDetail/index.vue | 2 +- .../liveRoom/components/SideButton/tangPopup.vue | 1 - app/pages/liveRoom/index.client.vue | 2 +- app/stores-collect-code/live/index.js | 2 +- app/utils/websocket.ts | 4 ++-- 8 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 app/components/x-message/images/info.png diff --git a/app/components/x-message/images/info.png b/app/components/x-message/images/info.png new file mode 100644 index 0000000000000000000000000000000000000000..96a90539d70eb7b7a48f299c93a07dc11b74c1cc GIT binary patch literal 932 zcmV;V16%xwP)Px&UP(kjR9HvVnN3JkQ547jXFfzl&?z-BedQu((V`%zRw=Y-;U)-DaM7YgLXxgh zg1i$%?lKAz+PDxb3R=|O34#iOf`r-?Gm}kf`V>){k9XoeXU3<_I5YRXC*y-zy?6fi zckj99+;h(m6rYy6OJ_XH?O>b+_&9;;0W_uMVho-K=sO6X45CohCIs+3)tPahH z=J`Te1p!-w`W0e4CP2E-v4??qCftY&*FE1&G(Vu2@@Y8rh=A*kQRNU~U@VN!eGnbV zT;t>fY!I_GRq#&|sMAfjj5dSctRc}oCmL6_kGB)hT)C64_6p7l8OE1O+gEZ2peFPu zZo4&~S4?+{x?b!1Er2p0Jd9_1;nsX(7=$is;A8>QspOlDXw?nyKmrK)!52O7JWxqV zGP;++$8-_Udu;abPTCuLYNeiCL)VSzT=cHi+4#DpW)W@Tmw& zn-sVsDgvP_pjhZ6cwQ^&t*;{9HYXZmCZHyCc}ff_ikW5%8V!ruflWYr!N$NySkw)r z0T&~so~^ki!=P~@eh0<{0A2Pb%+at2w9;Ym_pA@z_jbhGvP~j&j06^1UjK8 z^b>&mVHI(Cmc}wV&H(Z>9TEC(OC_wx3H$@M#YDh_m5&pE0Ado5m8mR-E&*a+0G79l zZ3ao!$!@rq!PB9 zx#c{drQDJQYc(o zSm^S=Gg<7}EX(|auVS>&_x@zOpTPZvzLW0_7~K(ZAba)QUl(_ChUMP+kc{QsJj!g8 za&Es_H?s^Jf=BiVoo`^m=(7eyt{^JdVYQ?nCtJYd%iy6*|7Ex6E($OskZzIOw9`ai zL;Ruja#bkxlmuuMlU0zHyyuJg8zRN2x4*=}4~1ZIz5fr@w!;2z%QQv+0000{ const res=await userArtwork({uuid}) if (res.status===0){ detail.value=res.data - console.log('detail.value',detail.value) + } } initData() diff --git a/app/pages/liveRoom/components/SideButton/tangPopup.vue b/app/pages/liveRoom/components/SideButton/tangPopup.vue index cc5ef34..03962b8 100644 --- a/app/pages/liveRoom/components/SideButton/tangPopup.vue +++ b/app/pages/liveRoom/components/SideButton/tangPopup.vue @@ -37,7 +37,6 @@ const close = () => emit('update:show', false); const openShow=(item)=>{ showDetailInfo.value=item showDetail.value=true - } const loadMore = async () => { pageRef.value.page++ diff --git a/app/pages/liveRoom/index.client.vue b/app/pages/liveRoom/index.client.vue index 21c59a6..9d0aa86 100644 --- a/app/pages/liveRoom/index.client.vue +++ b/app/pages/liveRoom/index.client.vue @@ -85,7 +85,7 @@ watch(()=>{ } }) const goBuy=async ()=>{ - console.log('auctionData',auctionData.value) + const res= await artworkBuy({ auctionArtworkUuid:auctionData.value?.artwork?.uuid, buyMoney:String(auctionData.value?.nowAuctionPrice?.nextPrice??0) diff --git a/app/stores-collect-code/live/index.js b/app/stores-collect-code/live/index.js index 49c0884..55000cb 100644 --- a/app/stores-collect-code/live/index.js +++ b/app/stores-collect-code/live/index.js @@ -24,7 +24,7 @@ export const liveStore = createGlobalState(() => { ws.send({ type: 'chat', content: 'Hello!' })*/ // 监听消息 onMessage((data) => { - console.log('收到消息:', data) + auctionData.value = data }) } diff --git a/app/utils/websocket.ts b/app/utils/websocket.ts index 684c043..f6be471 100644 --- a/app/utils/websocket.ts +++ b/app/utils/websocket.ts @@ -33,10 +33,10 @@ export class WebSocketClient { }, onMessage: (callback: (data: any) => void) => { this.socket!.onmessage = (event) => { - console.log('event',event) + try { const data = JSON.parse(event.data) - console.log('data',data) + callback(data) } catch (error) { console.error('解析消息失败:', error)