From 8c265e3a21902c1fd9b9d21869874dd5e410a448 Mon Sep 17 00:00:00 2001 From: wangqiao Date: Fri, 29 Aug 2025 21:18:39 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E6=9C=AA?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E4=BE=9D=E8=B5=96=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 nuxt-swiper、tinymce 等相关未使用的依赖 - 优化频道关注接口的请求头配置 - 在频道操作中添加登录验证 - 修复样式类名中的语法错误 --- api/channel/index.ts | 7 +++- nuxt.config.ts | 2 +- package.json | 5 --- pages/channel/components/ChannelHeader.vue | 14 +++++++- yarn.lock | 39 +--------------------- 5 files changed, 21 insertions(+), 46 deletions(-) diff --git a/api/channel/index.ts b/api/channel/index.ts index f3f5bb7..71acf83 100644 --- a/api/channel/index.ts +++ b/api/channel/index.ts @@ -128,7 +128,12 @@ export const getChannelLunTanDetail = (params: { id: string }) => { * 创建论坛关注 */ export const createChannelFollow = (params: { channelId: string }) => { - return useDollarFetchRequest.post>('/prod-api/app-api/business/channel-follow/create', params) + return useDollarFetchRequest.post>(`/prod-api/app-api/business/channel-follow/create?channelId=${params.channelId}`, {}, { + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + 'Accept': 'application/json' + }, + }) } /** diff --git a/nuxt.config.ts b/nuxt.config.ts index e9eacf6..8dc3047 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -11,7 +11,7 @@ export default defineNuxtConfig({ debug: process.env.NODE_ENV === 'development', // 开启详细调试日志 ssr: true, - modules: ['@unocss/nuxt', '@pinia/nuxt', '@element-plus/nuxt', 'pinia-plugin-persistedstate/nuxt', 'nuxt-swiper'], + modules: ['@unocss/nuxt', '@pinia/nuxt', '@element-plus/nuxt', 'pinia-plugin-persistedstate/nuxt'], css: ['element-plus/dist/index.css', '~/assets/scss/app.scss'], vite: { css: { diff --git a/package.json b/package.json index 1e41d65..26207b6 100644 --- a/package.json +++ b/package.json @@ -12,20 +12,15 @@ "dependencies": { "@nuxtjs/axios": "^5.13.6", "@pinia/nuxt": "^0.11.2", - "@tinymce/tinymce-vue": "^5.0.0", - "@types/tinymce": "^5.5.0", "@wangeditor/editor": "^5.1.23", "@wangeditor/editor-for-vue": "^5.1.12", "decimal.js": "^10.6.0", "echarts": "^6.0.0", "mqtt": "^5.14.0", "nuxt": "^3.18.1", - "nuxt-swiper": "^2.0.1", "pdfjs-dist": "^5.4.54", "pinia": "^3.0.3", "qrcode.vue": "^3.6.0", - "swiper": "^11.2.10", - "tinymce": "^6.2.0", "vue": "^3.5.18", "vue-pdf-embed": "^2.1.3", "vue-router": "^4.5.1", diff --git a/pages/channel/components/ChannelHeader.vue b/pages/channel/components/ChannelHeader.vue index 9eb993c..0a6cd70 100644 --- a/pages/channel/components/ChannelHeader.vue +++ b/pages/channel/components/ChannelHeader.vue @@ -37,7 +37,7 @@
当前有 {{ lunTanRes?.chatUserCount }}人聊天 - 立即加入 + 立即加入
@@ -76,9 +76,17 @@ }) const handleClick = () => { + if (!userStore.token) { + ElMessage.warning('请先登录') + return + } navigateTo('/channel/create?channelId=' + lunTanRes.value?.channelId) } const handleFollow = () => { + if (!userStore.token) { + ElMessage.warning('请先登录') + return + } createChannelFollow({ channelId: lunTanRes.value!.channelId }).then((res) => { if (res.code === 0) { lunTanRes.value!.isFollow = true @@ -87,6 +95,10 @@ }) } const handleUnfollow = () => { + if (!userStore.token) { + ElMessage.warning('请先登录') + return + } deleteChannelFollow({ channelId: lunTanRes.value!.channelId }).then((res) => { if (res.code === 0) { lunTanRes.value!.isFollow = false diff --git a/yarn.lock b/yarn.lock index e72b3ea..12d5f36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1009,7 +1009,7 @@ which "^5.0.0" ws "^8.18.3" -"@nuxt/kit@3.18.1", "@nuxt/kit@^3.12.2", "@nuxt/kit@^3.13.2", "@nuxt/kit@^3.15.4", "@nuxt/kit@^3.17.2", "@nuxt/kit@^3.17.6", "@nuxt/kit@^3.9.0": +"@nuxt/kit@3.18.1", "@nuxt/kit@^3.12.2", "@nuxt/kit@^3.13.2", "@nuxt/kit@^3.15.4", "@nuxt/kit@^3.17.6", "@nuxt/kit@^3.9.0": version "3.18.1" resolved "https://registry.npmmirror.com/@nuxt/kit/-/kit-3.18.1.tgz" integrity sha512-z6w1Fzv27CIKFlhct05rndkJSfoslplWH5fJ9dtusEvpYScLXp5cATWIbWkte9e9zFSmQTgDQJjNs3geQHE7og== @@ -1739,13 +1739,6 @@ resolved "https://registry.npmmirror.com/@speed-highlight/core/-/core-1.2.7.tgz" integrity sha512-0dxmVj4gxg3Jg879kvFS/msl4s9F3T9UXC1InxgOf7t5NvcPD97u/WTA5vL/IxWHMn7qSxBozqrnnE2wvl1m8g== -"@tinymce/tinymce-vue@^5.0.0": - version "5.1.1" - resolved "https://registry.yarnpkg.com/@tinymce/tinymce-vue/-/tinymce-vue-5.1.1.tgz#0879787e07833a4316b2eaf0417c7c6a2abce86b" - integrity sha512-iO57HOWesFOhsaqjA5Ea6sDvQBmJJH3/dq00Uvg7metlct2kLF+ctRgoDsetLt6gmeZ7COPftr814/XzqnJ/dg== - dependencies: - tinymce "^6.0.0 || ^5.5.1" - "@transloadit/prettier-bytes@0.0.7": version "0.0.7" resolved "https://registry.npmmirror.com/@transloadit/prettier-bytes/-/prettier-bytes-0.0.7.tgz#cdb5399f445fdd606ed833872fa0cabdbc51686b" @@ -1825,13 +1818,6 @@ resolved "https://registry.npmmirror.com/@types/resolve/-/resolve-1.20.2.tgz" integrity sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q== -"@types/tinymce@^5.5.0": - version "5.5.0" - resolved "https://registry.npmmirror.com/@types/tinymce/-/tinymce-5.5.0.tgz#b92f376ff97a1a3fef474827e13874786a2fa838" - integrity sha512-fOma8SV34kaHoiigF/RJ7/wbgv2B2DXtP51qTWn5nt2D2ubHFDTl/HKy/QmSgBxkdvpMNW9bng58cMsqgfQrUA== - dependencies: - tinymce "*" - "@types/triple-beam@^1.3.2": version "1.3.5" resolved "https://registry.npmmirror.com/@types/triple-beam/-/triple-beam-1.3.5.tgz" @@ -5339,14 +5325,6 @@ number-allocator@^1.0.14: debug "^4.3.1" js-sdsl "4.3.0" -nuxt-swiper@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/nuxt-swiper/-/nuxt-swiper-2.0.1.tgz#6e05bea474bab8d7e866eaf40554943ce3348177" - integrity sha512-mUAzuGqQHcsqJa1p5y/Hafvurn62o6njHq8DcwQErourkpJpv7z/SnnT0ezXMr7YvDPNg22ayEKGdHkGXXOxMQ== - dependencies: - "@nuxt/kit" "^3.17.2" - swiper "^11.2.6" - nuxt@^3.18.1: version "3.18.1" resolved "https://registry.npmmirror.com/nuxt/-/nuxt-3.18.1.tgz" @@ -6773,11 +6751,6 @@ svgo@^4.0.0: picocolors "^1.1.1" sax "^1.4.1" -swiper@^11.2.10, swiper@^11.2.6: - version "11.2.10" - resolved "https://registry.yarnpkg.com/swiper/-/swiper-11.2.10.tgz#ed0b17286b56f7fe8d4b46ed61e6e0bd8daaccad" - integrity sha512-RMeVUUjTQH+6N3ckimK93oxz6Sn5la4aDlgPzB+rBrG/smPdCTicXyhxa+woIpopz+jewEloiEE3lKo1h9w2YQ== - system-architecture@^0.1.0: version "0.1.0" resolved "https://registry.npmmirror.com/system-architecture/-/system-architecture-0.1.0.tgz" @@ -6854,16 +6827,6 @@ tinyglobby@0.2.14, tinyglobby@^0.2.14: fdir "^6.4.4" picomatch "^4.0.2" -tinymce@*: - version "8.0.2" - resolved "https://registry.npmmirror.com/tinymce/-/tinymce-8.0.2.tgz#babaaa40c154d0832b41332f25f3485b5887a6f2" - integrity sha512-Gkvn5mRcZCAK1EKP7hnk3VBzwqPbqpZU2AN0T08BMtvmY9Sg0C0ZqmMghJCQ3vgo+LWA38pDOPiaM8EW7BZEow== - -"tinymce@^6.0.0 || ^5.5.1", tinymce@^6.2.0: - version "6.8.6" - resolved "https://registry.yarnpkg.com/tinymce/-/tinymce-6.8.6.tgz#799e4f03eeb4399399dfdeb12ba17b3b91887adf" - integrity sha512-++XYEs8lKWvZxDCjrr8Baiw7KiikraZ5JkLMg6EdnUVNKJui0IsrAADj5MsyUeFkcEryfn2jd3p09H7REvewyg== - tmp-promise@^3.0.2: version "3.0.3" resolved "https://registry.npmmirror.com/tmp-promise/-/tmp-promise-3.0.3.tgz"