diff --git a/src/stores/global.ts b/src/stores/global.ts
index c214ff3..f3e78a5 100644
--- a/src/stores/global.ts
+++ b/src/stores/global.ts
@@ -1,6 +1,20 @@
import { defineStore } from 'pinia';
import HomeApi from '@/service/home';
+/** 主页固定注入的「热门短剧」tab(从短剧频道挪过来),不走后端模块 */
+export const HOT_DRAMA_TAB_ID = '-120';
+
+/** 「热门短剧」固定排第二个:没有就插入,本地排序/抽屉拖动挪走了就统一挪回来 */
+const pinHotDrama = (list: Types.Home.HomeTabItem[]) => {
+ const result = list.filter((item) => item.id !== HOT_DRAMA_TAB_ID);
+ const hotDrama = list.find((item) => item.id === HOT_DRAMA_TAB_ID) || {
+ id: HOT_DRAMA_TAB_ID,
+ moduleName: '热门短剧',
+ };
+ result.splice(Math.min(1, result.length), 0, hotDrama as Types.Home.HomeTabItem);
+ return result;
+};
+
export const useGlobalStore = defineStore({
id: 'global',
state: () => {
@@ -327,10 +341,12 @@ export const useGlobalStore = defineStore({
sortedArr.push(item);
}
});
- this.homePageList = sortedArr;
+ this.homePageList = pinHotDrama(sortedArr);
} else {
- this.homePageList = homePage;
+ this.homePageList = pinHotDrama(homePage);
}
+ // 默认选中「热门短剧」
+ this.activeIndex = this.homePageList.findIndex((item) => item.id === HOT_DRAMA_TAB_ID);
}
if (deepWeb) {
const ids = (localStorage.getItem('darkNetPageIds') || '').split(',');
@@ -431,7 +447,7 @@ export const useGlobalStore = defineStore({
switch (elType) {
case 'home':
- this.homePageList = arr;
+ this.homePageList = pinHotDrama(arr);
break;
case 'darkNet':
this.darkNetPageList = arr;
diff --git a/src/views/lldhome/index.vue b/src/views/lldhome/index.vue
index fea74a6..3f40624 100644
--- a/src/views/lldhome/index.vue
+++ b/src/views/lldhome/index.vue
@@ -23,6 +23,8 @@
+
+
@@ -65,11 +67,12 @@ export default {