11<template >
2- <!-- 内容上方面包屑-->
3- <a-breadcrumb :style =" { margin: '16px 0' }" >
4- <a-breadcrumb-item >Video</a-breadcrumb-item >
5-
6- <div class =" header-left" >
7- <a-button type =" outline" status =" success" shape =" round" @click =" handleOpenForm" >
8- <template #icon >
9- <icon-apps />
10- </template >
11- <template #default >{{ form.now_site_title }}</template >
12- </a-button >
13-
14- <a-button type =" outline" status =" success" shape =" round" @click =" refreshPage" >
15- <template #icon >
16- <icon-refresh />
17- </template >
18- <template #default >重载源</template >
19- </a-button >
20- </div >
21-
22- <!-- 中间搜索框 -->
23- <div class =" header-center" >
24- <a-input-search
25- placeholder =" 搜索视频"
26- enter-button
27- @search =" onSearch"
28- style =" width : 300px ;"
29- />
30- </div >
31-
32- <!-- 右侧控制按钮 -->
33- <div class =" header-right" >
34- <a-button type =" outline" status =" success" shape =" round" @click =" minimize" >
35- <template #icon >
36- <icon-bug />
37- </template >
38- <template #default >调试</template >
39- </a-button >
40-
41- <a-button type =" outline" status =" success" shape =" round" @click =" maximize" >
42- <template #icon >
43- <icon-settings />
44- </template >
45- <template #default >设置</template >
46- </a-button >
47- <a-button type =" outline" status =" success" shape =" round" @click =" closeWindow" >
48- <template #icon >
49- <icon-user />
50- </template >
51- <template #default >用户设置</template >
52- </a-button >
53-
54- <!-- 当前时间显示 -->
2+ <Breadcrumb
3+ :navigation_title =" '点播'"
4+ @handleOpenForm =" handleOpenForm"
5+ @refreshPage =" refreshPage"
6+ @minimize =" minimize"
7+ @maximize =" maximize"
8+ @closeWindow =" closeWindow"
9+ @onSearch =" onSearch"
10+ :now_site_title =" form.now_site_title"
11+ >
12+ <template v-slot :default >
13+ <!-- 默认default 插槽的内容放这里 -->
5514 <div class =" current-time" >
5615 <span >{{ currentDateTime }}</span >
5716 </div >
58- </div >
59- </a-breadcrumb >
17+ </template >
18+ </Breadcrumb >
6019
6120 <!-- 内容区域 -->
6221 <a-layout-content class =" content" >
7130 </a-layout-content >
7231
7332 <SourceDialog
74- :visible =" form.visible"
75- :title =" form.form_title"
76- :sites =" form.sites"
77- :currentSiteKey =" form.now_site.key"
78- @update:visible =" val => form.visible = val"
79- @confirm-clear =" handleConfirmClear"
80- @confirm-change =" handleConfirmChange"
81- @change-rule =" handleChangeRule"
33+ :visible =" form.visible"
34+ :title =" form.form_title"
35+ :sites =" form.sites"
36+ :currentSiteKey =" form.now_site.key"
37+ @update:visible =" ( val) => ( form.visible = val) "
38+ @confirm-clear =" handleConfirmClear"
39+ @confirm-change =" handleConfirmChange"
40+ @change-rule =" handleChangeRule"
8241 />
8342</template >
8443
8544<script setup>
86- import { ref , reactive , onMounted , onBeforeUnmount } from ' vue' ;
87- import SourceDialog from ' ../components/SourceDialog.vue' ;
88- import req from ' @/utils/req' ;
89- import { useSiteStore } from ' @/stores/siteStore' ;
45+ import { ref , reactive , onMounted , onBeforeUnmount } from " vue" ;
46+ import SourceDialog from " ../components/SourceDialog.vue" ;
47+ import Breadcrumb from " ../components/Breadcrumb.vue" ;
48+ import req from " @/utils/req" ;
49+ import { useSiteStore } from " @/stores/siteStore" ;
9050
9151const { nowSite , setCurrentSite } = useSiteStore ();
9252
93- const currentDateTime = ref (' ' );
53+ const currentDateTime = ref (" " );
9454const form = reactive ({
9555 sites: [],
96- now_site_title: ' hipy影视' ,
56+ now_site_title: " hipy影视" ,
9757 now_site: {},
9858 visible: false ,
99- form_title: ' ' ,
59+ form_title: " " ,
10060});
10161const timer = ref (null );
10262const getData = async () => {
10363 try {
10464 let response;
105- if (req .defaults .baseURL === ' ' ) {
106- response = await req .get (' /mock/data.json' );
65+ if (req .defaults .baseURL === " " ) {
66+ response = await req .get (" /mock/data.json" );
10767 response = response .config ;
108- }else {
109- response = await req .get (' /config' ); // 假设这个请求返回 sites 数组
68+ } else {
69+ response = await req .get (" /config" ); // 假设这个请求返回 sites 数组
11070 }
11171 form .sites = response .sites ; // 给 form.sites 赋值
11272 } catch (error) {
113- console .error (' 请求数据失败:' , error);
73+ console .error (" 请求数据失败:" , error);
11474 }
11575};
11676
@@ -119,29 +79,32 @@ const getNowSite = () => {
11979 form .now_site = nowSite;
12080 form .now_site_title = nowSite .name ;
12181 }
122- }
82+ };
12383
12484const checkNowSite = () => {
125- form .new_site = form .now_site
85+ form .new_site = form .now_site ;
12686 if (! form .new_site .key && form .sites .length > 0 ) {
127- form .new_site = form .sites [0 ]
128- } else if (form .new_site .key && ! form .sites .map (i => i .key ).includes (form .new_site .key )) {
129- form .new_site = form .sites [0 ]
87+ form .new_site = form .sites [0 ];
88+ } else if (
89+ form .new_site .key &&
90+ ! form .sites .map ((i ) => i .key ).includes (form .new_site .key )
91+ ) {
92+ form .new_site = form .sites [0 ];
13093 }
131- }
94+ };
13295
13396const formatDate = (date ) => {
13497 const options = {
135- weekday: ' long' , // 星期几
136- year: ' numeric' ,
137- month: ' numeric' ,
138- day: ' numeric' ,
139- hour: ' 2-digit' ,
140- minute: ' 2-digit' ,
141- second: ' 2-digit' ,
98+ weekday: " long" , // 星期几
99+ year: " numeric" ,
100+ month: " numeric" ,
101+ day: " numeric" ,
102+ hour: " 2-digit" ,
103+ minute: " 2-digit" ,
104+ second: " 2-digit" ,
142105 hour12: true , // 12小时制
143106 };
144- return date .toLocaleString (' zh-CN' , options);
107+ return date .toLocaleString (" zh-CN" , options);
145108};
146109
147110// 启动定时器
@@ -158,9 +121,9 @@ const refreshPage = () => {
158121const minimize = () => {};
159122const maximize = () => {};
160123const closeWindow = () => {};
161- const onSearch = (value ) => console .log (' 搜索内容:' , value);
124+ const onSearch = (value ) => console .log (" 搜索内容:" , value);
162125
163- const handleChangeRule = (site ) => form .new_site = site;
126+ const handleChangeRule = (site ) => ( form .new_site = site) ;
164127
165128const handleConfirmClear = () => {
166129 form .now_site = form .new_site ;
@@ -171,7 +134,7 @@ const handleConfirmClear = () => {
171134};
172135
173136const handleConfirmChange = (site ) => {
174- console .log (' 确认换源' );
137+ console .log (" 确认换源" );
175138 form .now_site = site;
176139 setCurrentSite (site);
177140 form .now_site_title = site .name ;
@@ -191,7 +154,6 @@ onMounted(() => {
191154 startClock (); // 启动时钟
192155});
193156
194-
195157// 清理定时器
196158onBeforeUnmount (() => {
197159 if (timer .value ) {
0 commit comments