refactor: 移除未使用的依赖并优化代码

- 移除 nuxt-swiper、tinymce 等相关未使用的依赖
- 优化频道关注接口的请求头配置
- 在频道操作中添加登录验证
- 修复样式类名中的语法错误
This commit is contained in:
wangqiao
2025-08-29 21:18:39 +08:00
parent 2c8eda876d
commit 8c265e3a21
5 changed files with 21 additions and 46 deletions

View File

@ -128,7 +128,12 @@ export const getChannelLunTanDetail = (params: { id: string }) => {
* 创建论坛关注 * 创建论坛关注
*/ */
export const createChannelFollow = (params: { channelId: string }) => { export const createChannelFollow = (params: { channelId: string }) => {
return useDollarFetchRequest.post<IResponse<boolean>>('/prod-api/app-api/business/channel-follow/create', params) return useDollarFetchRequest.post<IResponse<boolean>>(`/prod-api/app-api/business/channel-follow/create?channelId=${params.channelId}`, {}, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json'
},
})
} }
/** /**

View File

@ -11,7 +11,7 @@ export default defineNuxtConfig({
debug: process.env.NODE_ENV === 'development', // 开启详细调试日志 debug: process.env.NODE_ENV === 'development', // 开启详细调试日志
ssr: true, 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'], css: ['element-plus/dist/index.css', '~/assets/scss/app.scss'],
vite: { vite: {
css: { css: {

View File

@ -12,20 +12,15 @@
"dependencies": { "dependencies": {
"@nuxtjs/axios": "^5.13.6", "@nuxtjs/axios": "^5.13.6",
"@pinia/nuxt": "^0.11.2", "@pinia/nuxt": "^0.11.2",
"@tinymce/tinymce-vue": "^5.0.0",
"@types/tinymce": "^5.5.0",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12", "@wangeditor/editor-for-vue": "^5.1.12",
"decimal.js": "^10.6.0", "decimal.js": "^10.6.0",
"echarts": "^6.0.0", "echarts": "^6.0.0",
"mqtt": "^5.14.0", "mqtt": "^5.14.0",
"nuxt": "^3.18.1", "nuxt": "^3.18.1",
"nuxt-swiper": "^2.0.1",
"pdfjs-dist": "^5.4.54", "pdfjs-dist": "^5.4.54",
"pinia": "^3.0.3", "pinia": "^3.0.3",
"qrcode.vue": "^3.6.0", "qrcode.vue": "^3.6.0",
"swiper": "^11.2.10",
"tinymce": "^6.2.0",
"vue": "^3.5.18", "vue": "^3.5.18",
"vue-pdf-embed": "^2.1.3", "vue-pdf-embed": "^2.1.3",
"vue-router": "^4.5.1", "vue-router": "^4.5.1",

View File

@ -37,7 +37,7 @@
<div class="stats-item"> <div class="stats-item">
<span class="stats-label">当前有</span> <span class="stats-label">当前有</span>
<span class="stats-value"><i class="el-icon-arrow-up"></i> {{ lunTanRes?.chatUserCount }}人聊天</span> <span class="stats-value"><i class="el-icon-arrow-up"></i> {{ lunTanRes?.chatUserCount }}人聊天</span>
<span class="stats-value ml-[2px] cursor-pointer color-[#1a65ff!]" @click="handleChat">立即加入</span> <span class="stats-value ml-[2px] cursor-pointer !color-[#1a65ff]" @click="handleChat">立即加入</span>
</div> </div>
</div> </div>
@ -76,9 +76,17 @@
}) })
const handleClick = () => { const handleClick = () => {
if (!userStore.token) {
ElMessage.warning('请先登录')
return
}
navigateTo('/channel/create?channelId=' + lunTanRes.value?.channelId) navigateTo('/channel/create?channelId=' + lunTanRes.value?.channelId)
} }
const handleFollow = () => { const handleFollow = () => {
if (!userStore.token) {
ElMessage.warning('请先登录')
return
}
createChannelFollow({ channelId: lunTanRes.value!.channelId }).then((res) => { createChannelFollow({ channelId: lunTanRes.value!.channelId }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
lunTanRes.value!.isFollow = true lunTanRes.value!.isFollow = true
@ -87,6 +95,10 @@
}) })
} }
const handleUnfollow = () => { const handleUnfollow = () => {
if (!userStore.token) {
ElMessage.warning('请先登录')
return
}
deleteChannelFollow({ channelId: lunTanRes.value!.channelId }).then((res) => { deleteChannelFollow({ channelId: lunTanRes.value!.channelId }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
lunTanRes.value!.isFollow = false lunTanRes.value!.isFollow = false

View File

@ -1009,7 +1009,7 @@
which "^5.0.0" which "^5.0.0"
ws "^8.18.3" 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" version "3.18.1"
resolved "https://registry.npmmirror.com/@nuxt/kit/-/kit-3.18.1.tgz" resolved "https://registry.npmmirror.com/@nuxt/kit/-/kit-3.18.1.tgz"
integrity sha512-z6w1Fzv27CIKFlhct05rndkJSfoslplWH5fJ9dtusEvpYScLXp5cATWIbWkte9e9zFSmQTgDQJjNs3geQHE7og== integrity sha512-z6w1Fzv27CIKFlhct05rndkJSfoslplWH5fJ9dtusEvpYScLXp5cATWIbWkte9e9zFSmQTgDQJjNs3geQHE7og==
@ -1739,13 +1739,6 @@
resolved "https://registry.npmmirror.com/@speed-highlight/core/-/core-1.2.7.tgz" resolved "https://registry.npmmirror.com/@speed-highlight/core/-/core-1.2.7.tgz"
integrity sha512-0dxmVj4gxg3Jg879kvFS/msl4s9F3T9UXC1InxgOf7t5NvcPD97u/WTA5vL/IxWHMn7qSxBozqrnnE2wvl1m8g== 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": "@transloadit/prettier-bytes@0.0.7":
version "0.0.7" version "0.0.7"
resolved "https://registry.npmmirror.com/@transloadit/prettier-bytes/-/prettier-bytes-0.0.7.tgz#cdb5399f445fdd606ed833872fa0cabdbc51686b" 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" resolved "https://registry.npmmirror.com/@types/resolve/-/resolve-1.20.2.tgz"
integrity sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q== 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": "@types/triple-beam@^1.3.2":
version "1.3.5" version "1.3.5"
resolved "https://registry.npmmirror.com/@types/triple-beam/-/triple-beam-1.3.5.tgz" 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" debug "^4.3.1"
js-sdsl "4.3.0" 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: nuxt@^3.18.1:
version "3.18.1" version "3.18.1"
resolved "https://registry.npmmirror.com/nuxt/-/nuxt-3.18.1.tgz" resolved "https://registry.npmmirror.com/nuxt/-/nuxt-3.18.1.tgz"
@ -6773,11 +6751,6 @@ svgo@^4.0.0:
picocolors "^1.1.1" picocolors "^1.1.1"
sax "^1.4.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: system-architecture@^0.1.0:
version "0.1.0" version "0.1.0"
resolved "https://registry.npmmirror.com/system-architecture/-/system-architecture-0.1.0.tgz" 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" fdir "^6.4.4"
picomatch "^4.0.2" 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: tmp-promise@^3.0.2:
version "3.0.3" version "3.0.3"
resolved "https://registry.npmmirror.com/tmp-promise/-/tmp-promise-3.0.3.tgz" resolved "https://registry.npmmirror.com/tmp-promise/-/tmp-promise-3.0.3.tgz"