From 042e0a8e1f676a826dfab1b7599d2abab576cd94 Mon Sep 17 00:00:00 2001 From: qubiaobiao <3294694717@qq.com> Date: Tue, 29 Sep 2026 09:57:48 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20SortableJS=20=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=9C=AC=E5=9C=B0=E4=BE=9D=E8=B5=96=EF=BC=8C=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=85=AC=E7=BD=91=20CDN=20=E8=BF=90=E8=A1=8C=E6=97=B6?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=EF=BC=88R33=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - package.json: 新增 sortablejs@^1.15.0(dependencies) - src/main.js: import Sortable + 挂载 window.Sortable (保留全局挂载形式 => Admin.vue 的 window.Sortable.* 零改动) - index.html: 删除 cdn.jsdelivr.net 的 - +
diff --git a/package-lock.json b/package-lock.json index a08bc55..9f6bdf3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "axios": "^1.6.0", "element-plus": "^2.5.0", "pinia": "^2.1.0", + "sortablejs": "^1.15.0", "spark-md5": "^3.0.2", "vue": "^3.4.0", "vue-router": "^4.3.0" @@ -1680,6 +1681,12 @@ "node": ">=12.17.0" } }, + "node_modules/sortablejs": { + "version": "1.15.0", + "resolved": "https://registry.npmmirror.com/sortablejs/-/sortablejs-1.15.0.tgz", + "integrity": "sha512-bv9qgVMjUMf89wAvM6AxVvS/4MX3sPeN0+agqShejLU5z5GX4C75ow1O2e5k4L6XItUyAK3gH6AxSbXrOM5e8w==", + "license": "MIT" + }, "node_modules/source-map-js": { "version": "1.2.1", "license": "BSD-3-Clause", diff --git a/package.json b/package.json index 2a79154..4d11a37 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "axios": "^1.6.0", "element-plus": "^2.5.0", "pinia": "^2.1.0", + "sortablejs": "^1.15.0", "spark-md5": "^3.0.2", "vue": "^3.4.0", "vue-router": "^4.3.0" diff --git a/src/main.js b/src/main.js index 1314aca..8d99e71 100644 --- a/src/main.js +++ b/src/main.js @@ -8,6 +8,13 @@ import 'element-plus/dist/index.css' // 全局样式(含 Element Plus 主题色变量,防止 getThemeColors 解构 undefined 报错) import './styles/global.css' +// SortableJS:新闻/轮播的拖拽排序依赖 window.Sortable(见 Admin.vue initNewsSortable/initCarouselSortable)。 +// 原先由 index.html 从 cdn.jsdelivr.net 加载,内网/离线环境取不到时会静默失效 +// (Admin.vue 内的 `if (!window.Sortable) return` 守卫不会报错也不提示)。 +// 改为本地依赖并由 Vite 打包进产物,彻底消除对外网 CDN 的运行时依赖。 +import Sortable from 'sortablejs' +window.Sortable = Sortable + import App from './App.vue' import router from './router' // 主动 token 续期(防活跃用户因 token 过期被强制踢回登录页)