提交 321919d1 作者: 施汉文

🦄 refactor: name单独搜索

上级 8e81fc35
...@@ -4,18 +4,23 @@ ...@@ -4,18 +4,23 @@
placeholder="请输入内容" placeholder="请输入内容"
prefix-icon="el-icon-search" prefix-icon="el-icon-search"
v-model.trim="searchText" v-model.trim="searchText"
@input="debouncedGetVideoList"
> >
</el-input> </el-input>
<el-cascader <el-cascader
class="w-full mt-[8px]" class="w-full mt-[8px]"
v-model="categoryValue" v-model="categoryValue"
:props="{ emitPath: false, expandTrigger: 'click' }" :props="{ emitPath: false, expandTrigger: 'click' }"
:options="categoryList" :options="categoryList"
@change="getVideoList" @change="debouncedGetVideoList"
></el-cascader> ></el-cascader>
<div class="mt-[16px] space-y-[8px] flex-1 overflow-auto pb-[10px]"> <div
class="mt-[16px] space-y-[8px] flex-1 overflow-auto pb-[10px]"
v-loading="loading"
>
<div <div
v-for="item in list" v-for="item in videoList"
:key="item.id" :key="item.id"
class="flex justify-between items-center py-[3px] px-[8px] bottom-[1px] border border-[#E5E7EB] rounded-[4px]" class="flex justify-between items-center py-[3px] px-[8px] bottom-[1px] border border-[#E5E7EB] rounded-[4px]"
> >
...@@ -66,24 +71,27 @@ export default { ...@@ -66,24 +71,27 @@ export default {
categoryValue: {}, categoryValue: {},
categoryList: [], categoryList: [],
videoList: [], videoList: [],
debouncedGetVideoList: null,
loading: false,
}; };
}, },
mounted() { mounted() {
this.getCategoryList(); this.getCategoryList();
// 初始化防抖函数,延迟300ms执行
this.debouncedGetVideoList = debounce(() => {
this.loading = true;
this.getVideoList().finally(() => {
this.loading = false;
});
}, 300);
}, },
computed: { computed: {
...mapState("user", ["userInfo", "weixin_blongs_id"]), ...mapState("user", ["userInfo", "weixin_blongs_id"]),
list() {
return this.videoList.filter((item) =>
item.video_name.includes(this.searchText)
);
},
}, },
methods: { methods: {
...mapMutations("common", ["set_sendSkillMessage"]), ...mapMutations("common", ["set_sendSkillMessage"]),
// 视频分类 // 视频分类
async getCategoryList() { async getCategoryList() {
console.log(this.userInfo);
// return; // return;
const { data } = await teachingVideoCategoryListApi({ const { data } = await teachingVideoCategoryListApi({
weixin_blongs_id: this.weixin_blongs_id, weixin_blongs_id: this.weixin_blongs_id,
...@@ -108,9 +116,11 @@ export default { ...@@ -108,9 +116,11 @@ export default {
return; return;
} }
const { data } = await teachingVideoVideoListApi({ const { data } = await teachingVideoVideoListApi({
weixin_blongs_id: this.categoryValue.weixin_blongs_id, weixin_blongs_id:
this.categoryValue.weixin_blongs_id || this.weixin_blongs_id,
main_game_id: this.categoryValue.main_game_id, main_game_id: this.categoryValue.main_game_id,
video_type: this.categoryValue.id, video_type: this.categoryValue.id,
video_name: this.searchText,
page: 1, page: 1,
page_size: 200, page_size: 200,
}); });
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论