99 @onSearch =" onSearch"
1010 :now_site_title =" form.now_site_title"
1111 >
12- <template #default >
13- <!-- 默认default 插槽的内容放这里 -->
14- <div class =" current-time" >
15- <span >{{ currentDateTime }}</span >
16- </div >
17- </template >
12+ <!-- 默认插槽的内容放这里 -->
13+ <div class =" current-time" >
14+ <span >{{ currentDateTime }}</span >
15+ </div >
1816 </Breadcrumb >
1917
2018 <!-- 内容区域 -->
2119 <a-layout-content class =" content" >
22- <div >
23- <h1 >点播</h1 >
24- <p >这是点播页面的内容。</p >
25- <ul v-if =" form.sites.length > 0" >
26- <li v-for =" site in form.sites" :key =" site.key" >{{ site.name }}</li >
27- </ul >
28- <p v-else >没有站点信息。</p >
29- </div >
20+ <VideoList :classList =" form.classList" />
3021 </a-layout-content >
3122
3223 <SourceDialog
4536import { ref , reactive , onMounted , onBeforeUnmount } from " vue" ;
4637import SourceDialog from " ../components/SourceDialog.vue" ;
4738import Breadcrumb from " ../components/Breadcrumb.vue" ;
39+ import VideoList from " ../components/VideoList.vue" ;
4840import req from " @/utils/req" ;
4941import { useSiteStore } from " @/stores/siteStore" ;
5042
@@ -57,7 +49,10 @@ const form = reactive({
5749 now_site: {},
5850 visible: false ,
5951 form_title: " " ,
52+ classList: {},
53+ videoList: {},
6054});
55+
6156const timer = ref (null );
6257const getData = async () => {
6358 try {
@@ -121,7 +116,6 @@ const refreshPage = () => {
121116const minimize = () => {};
122117const maximize = () => {};
123118const closeWindow = () => {};
124- const onSearch = (value ) => console .log (" 搜索内容:" , value);
125119
126120const handleChangeRule = (site ) => (form .new_site = site);
127121
@@ -134,11 +128,28 @@ const handleConfirmClear = () => {
134128};
135129
136130const handleConfirmChange = (site ) => {
137- console .log (" 确认换源" );
138131 form .now_site = site;
139132 setCurrentSite (site);
140133 form .now_site_title = site .name ;
141134 form .visible = false ;
135+ getClassList (site); // 获取分类列表
136+ };
137+ // 获取分类列表
138+ const getClassList = async (site ) => {
139+ console .log (site, " 确认换源" );
140+
141+ let response;
142+ if (req .defaults .baseURL === " " ) {
143+ response = await req .get (" /mock/data.json" );
144+ form .classList = response .home ;
145+ } else {
146+ response = await req .get (" /home" );
147+ form .classList = response;
148+ }
149+ console .log (form .classList );
150+ };
151+ const onSearch = (value ) => {
152+ console .log (" 搜索内容:" , value);
142153};
143154
144155const handleOpenForm = () => {
@@ -151,6 +162,7 @@ const handleOpenForm = () => {
151162onMounted (() => {
152163 getData (); // 页面加载时获取数据
153164 getNowSite (); // 获取储存的当前源
165+ getClassList (form .now_site );
154166 startClock (); // 启动时钟
155167});
156168
0 commit comments