feat:版本迭代

This commit is contained in:
jiangrui
2025-02-20 12:00:19 +08:00
parent fd110590af
commit 510fdc48f6
86 changed files with 5045 additions and 1161 deletions

View File

@@ -0,0 +1,50 @@
import { defineStore } from "pinia";
import { doubanApi } from "@/api/douban";
import { HotListItem } from "@/types/douban";
import { ElMessage } from "element-plus";
interface StoreType {
hotList: HotListItem[];
currentParams: CurrentParams;
}
interface CurrentParams {
type: string;
tag?: string;
}
export const useDoubanStore = defineStore("douban", {
state: (): StoreType => ({
hotList: [],
currentParams: {
type: "movie",
tag: "热门",
},
}),
actions: {
async getHotList() {
try {
const params = {
type: this.currentParams.type,
tag: this.currentParams.tag || "热门",
page_limit: "20",
page_start: "0",
};
const result = await doubanApi.getHotList(params);
if (result && result.length > 0) {
this.hotList = result;
} else {
console.log("获取热门列表失败");
ElMessage.warning("获取热门列表失败");
}
} catch (error) {
ElMessage.error(error || "获取热门列表失败");
}
},
setCurrentParams(currentParams: CurrentParams) {
this.currentParams = currentParams;
this.getHotList();
},
},
});