index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. <template>
  2. <div class="app-container">
  3. <div class="title">近期直播</div>
  4. <div class="live-container">
  5. <div class="live-card" v-for="live in displayLives" :key="live.id">
  6. <!-- 直播状态 -->
  7. <div class="status">已结束</div>
  8. <!-- 直播信息 -->
  9. <div class="content">
  10. <img :src="live.image" alt="直播封面" class="cover-image" />
  11. <div class="info">
  12. <h3 class="live-title">{{ live.title }}</h3>
  13. <p class="time">开播时间: {{ live.time }}</p>
  14. </div>
  15. </div>
  16. <!-- 直播数据 -->
  17. <div class="stats">
  18. <div class="stat-item">
  19. <p class="label">直播间浏览量</p>
  20. <p class="value">{{ live.views }}</p>
  21. </div>
  22. <div class="stat-item">
  23. <p class="label">直播间访客数</p>
  24. <p class="value">{{ live.visitors }}</p>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. <!-- 直播趋势统计 -->
  30. <div class="trend-section">
  31. <div class="trend-header">
  32. <h3>直播趋势</h3>
  33. <div class="filter-container">
  34. <!-- 时间范围选择(下拉框) -->
  35. <span class="filter-label">时间筛选:</span>
  36. <el-select v-model="selectedTimeRange" placeholder="选择时间范围" @change="changeTimeRange" style="width: 180px">
  37. <el-option label="自然天" value="day"></el-option>
  38. <el-option label="自然周" value="week"></el-option>
  39. <el-option label="自然月" value="month"></el-option>
  40. </el-select>
  41. <!-- 日期选择器 -->
  42. <!-- 选择日期 -->
  43. <el-date-picker
  44. v-model="selectedDate"
  45. :type="datePickerType"
  46. :format="selectedTimeRange === 'week' ? weekRange : dateFormat"
  47. :value-format="valueFormat"
  48. placeholder="选择日期"
  49. style="width: 280px"
  50. @change="changeDate"
  51. ></el-date-picker>
  52. </div>
  53. </div>
  54. <div class="trend-cards">
  55. <div
  56. class="trend-card"
  57. v-for="item in trendData"
  58. :key="item.id"
  59. :class="{ 'active': selectedMetric.id === item.id }"
  60. @click="changeMetric(item)"
  61. >
  62. <div class="trend-header">
  63. <p class="trend-title">{{ item.title }}</p>
  64. <el-tooltip class="item" effect="dark" :content="item.tip" placement="top">
  65. <i class="el-icon-info"></i>
  66. </el-tooltip>
  67. </div>
  68. <p class="trend-value">{{ item.value }}</p>
  69. <p class="trend-change" :class="{ 'up': computedChange(item) > 0, 'down': computedChange(item) < 0 }">
  70. {{ changeLabel }} {{ computedChange(item) }}%
  71. </p>
  72. </div>
  73. </div>
  74. <!-- 直播趋势折线图 -->
  75. <div id="liveChart" class="chart"></div>
  76. </div>
  77. <div class="top10-section">
  78. <h3>直播TOP10排行榜</h3>
  79. <div class="ranking-container">
  80. <!-- 红榜 -->
  81. <div class="ranking-section red-rank">
  82. <span class="rank-title">红榜</span>
  83. <div class="rank-filters">
  84. <button
  85. v-for="item in redRankTypes"
  86. :key="item.value"
  87. :class="{ active: selectedRank === item.value }"
  88. @click="selectRank(item.value)"
  89. >
  90. {{ item.label }}
  91. </button>
  92. </div>
  93. </div>
  94. <!-- 黑榜 -->
  95. <div class="ranking-section black-rank">
  96. <div class="rank-filters">
  97. <button
  98. v-for="item in blackRankTypes"
  99. :key="item.value"
  100. :class="{ active: selectedRank === item.value }"
  101. @click="selectRank(item.value)"
  102. >
  103. {{ item.label }}
  104. </button>
  105. </div>
  106. <span class="rank-title">黑榜</span>
  107. </div>
  108. </div>
  109. <el-table :data="top10List" border style="width: 100%">
  110. <el-table-column prop="rank" label="排名" width="80"></el-table-column>
  111. <el-table-column prop="name" label="直播名称">
  112. <template #default="scope">
  113. <div class="live-name">
  114. <img :src="scope.row.cover" class="live-cover" alt="封面">
  115. <span class="live-title">{{ scope.row.name }}</span>
  116. </div>
  117. </template>
  118. </el-table-column>
  119. <el-table-column prop="pv" label="直播间浏览量(PV)"></el-table-column>
  120. <el-table-column prop="uv" label="直播间访客数(UV)"></el-table-column>
  121. <el-table-column prop="watchPV" label="累计观看人次(PV)"></el-table-column>
  122. <el-table-column prop="watchUV" label="累计观看人数(UV)"></el-table-column>
  123. <el-table-column prop="avgTime" label="人均观看时长"></el-table-column>
  124. <el-table-column prop="maxOnline" label="最高在线人数"></el-table-column>
  125. </el-table>
  126. </div>
  127. </div>
  128. </template>
  129. <script>
  130. import * as echarts from "echarts";
  131. import { listLive, getLive, delLive, addLive, updateLive, exportLive } from "@/api/live/live";
  132. import Editor from '@/components/Editor/wang';
  133. import articleDetails from "@/views/components/his/doctorArticleDetails.vue";
  134. export default {
  135. name: "Live",
  136. components: { Editor },
  137. data() {
  138. return {
  139. top10List: [
  140. {
  141. rank: 1,
  142. name: "御君方年末会员福利专场!",
  143. cover:"https://cos.his.cdwjyyh.com/fs/20250304/710ea5b1896749b58438b76baf881d05.jpeg",
  144. pv: 88332,
  145. uv: 32674,
  146. watchPV: 41866,
  147. watchUV: 24714,
  148. avgTime: "00:13:12",
  149. maxOnline: 4317,
  150. },
  151. {
  152. rank: 2,
  153. name: "立秋养生大作战",
  154. cover:"https://cos.his.cdwjyyh.com/fs/20250304/710ea5b1896749b58438b76baf881d05.jpeg",
  155. pv: 55092,
  156. uv: 15066,
  157. watchPV: 33522,
  158. watchUV: 12343,
  159. avgTime: "01:18:30",
  160. maxOnline: 3160,
  161. },
  162. {
  163. rank: 3,
  164. name: "寒露养生大挑战:防寒防燥防疾病",
  165. cover:"https://cos.his.cdwjyyh.com/fs/20250304/710ea5b1896749b58438b76baf881d05.jpeg",
  166. pv: 36044,
  167. uv: 12205,
  168. watchPV: 26056,
  169. watchUV: 11086,
  170. avgTime: "01:16:08",
  171. maxOnline: 3232,
  172. },
  173. ],
  174. selectedRank: 'highFlow',
  175. redRankTypes: [
  176. { label: '高流量', value: 'highFlow' },
  177. { label: '高观看', value: 'highView' },
  178. { label: '高时长', value: 'highTime' },
  179. ],
  180. blackRankTypes: [
  181. { label: '低时长', value: 'lowTime' },
  182. { label: '低观看', value: 'lowView' },
  183. { label: '低流量', value: 'lowFlow' },
  184. ],
  185. chart: null,
  186. selectedTimeRange: "day", // 默认选中“自然天”
  187. datePickerType: "date", // 默认 date 类型
  188. trendData: [], // 直播趋势数据
  189. weekRange: "", // 存储选择周的时间范围
  190. selectedMetric: {}, // 选中的指标
  191. selectedDate: new Date().toISOString().split("T")[0], // 默认今天
  192. selectedMetric: "views", // 默认选中浏览量
  193. lives: [
  194. {
  195. id: 1,
  196. image: "https://cos.his.cdwjyyh.com/fs/20250117/d9e3b268e3834a2497e0bb1f900eac90.jpg",
  197. title: "李悦的直播",
  198. time: "2024-10-10 15:00:00",
  199. views: 352821,
  200. visitors: 14505,
  201. },
  202. {
  203. id: 2,
  204. image: "https://cos.his.cdwjyyh.com/fs/20250117/d9e3b268e3834a2497e0bb1f900eac90.jpg",
  205. title: "小付的直播",
  206. time: "2024-10-12 18:00:00",
  207. views: 284210,
  208. visitors: 10234,
  209. },
  210. {
  211. id: 3,
  212. image: "https://cos.his.cdwjyyh.com/fs/20250117/d9e3b268e3834a2497e0bb1f900eac90.jpg",
  213. title: "生活妙招分享",
  214. time: "2024-11-05 20:00:00",
  215. views: 182401,
  216. visitors: 8734,
  217. },
  218. {
  219. id: 4,
  220. image: "https://cos.his.cdwjyyh.com/fs/20250117/d9e3b268e3834a2497e0bb1f900eac90.jpg",
  221. title: "家庭健康指南",
  222. time: "2024-12-01 14:00:00",
  223. views: 254321,
  224. visitors: 12345,
  225. },
  226. {
  227. id: 5,
  228. image: "https://cos.his.cdwjyyh.com/fs/20250117/d9e3b268e3834a2497e0bb1f900eac90.jpg",
  229. title: "额外的直播",
  230. time: "2024-12-15 19:00:00",
  231. views: 100000,
  232. visitors: 5000,
  233. }
  234. ],
  235. trendData: [
  236. {
  237. id: "views",
  238. title: "直播间浏览量",
  239. tip: "直播间总浏览量",
  240. value: 352421,
  241. dailyChange:1,
  242. weeklyChange:2,
  243. monthlyChange:3,
  244. change: 5.2,
  245. dates: ["02-02", "02-04", "02-06", "02-08", "02-10"],
  246. data: [10, 20, 15, 25, 30],
  247. },
  248. {
  249. id: "visitors",
  250. title: "直播间访客数",
  251. tip: "直播间访客数",
  252. value: 14505,
  253. dailyChange:1,
  254. weeklyChange:2,
  255. monthlyChange:3,
  256. change: 5.2,
  257. dates: ["02-02", "02-04", "02-06", "02-08", "02-10"],
  258. data: [5, 8, 6, 10, 12],
  259. },
  260. {
  261. id: "streams",
  262. title: "创建直播数",
  263. tip: "每日直播场次",
  264. value: 20,
  265. dailyChange:1,
  266. weeklyChange:2,
  267. monthlyChange:3,
  268. change: 5.2,
  269. dates: ["02-02", "02-04", "02-06", "02-08", "02-10"],
  270. data: [1, 2, 1, 3, 2],
  271. },
  272. {
  273. id: "pv",
  274. title: "累计观看人次(PV)",
  275. tip: "累计观看人次",
  276. value: 5000,
  277. dailyChange:1,
  278. weeklyChange:2,
  279. monthlyChange:3,
  280. change: 5.2,
  281. dates: ["02-02", "02-04", "02-06", "02-08", "02-10"],
  282. data: [0, 0, 1, 0, 0],
  283. },
  284. {
  285. id: "uv",
  286. title: "累计观看人数(UV)",
  287. tip: "累计观看人数",
  288. value: 3000,
  289. dailyChange:1,
  290. weeklyChange:2,
  291. monthlyChange:3,
  292. change: 5.2,
  293. dates: ["02-02", "02-04", "02-06", "02-08", "02-10"],
  294. data: [0, 0, 0, 1, 0],
  295. },
  296. ],
  297. selectedMetric: {}, // 选中的卡片数据
  298. chart: null, // ECharts 实例
  299. };
  300. },
  301. computed: {
  302. changeLabel() {
  303. switch (this.selectedTimeRange) {
  304. case 'day': return '比前一天';
  305. case 'week': return '比上周';
  306. case 'month': return '比上月';
  307. default: return '变化';
  308. }
  309. },
  310. displayLives() {
  311. return this.lives.slice(0, 4); // 最多只显示前 4 条数据
  312. },
  313. /*datePickerType() {
  314. return this.selectedTimeRange === "day"
  315. ? "date"
  316. : this.selectedTimeRange === "week"
  317. ? "week"
  318. : "month";
  319. },*/
  320. dateFormat() {
  321. return this.selectedTimeRange === "day"
  322. ? "yyyy-MM-dd"
  323. : this.selectedTimeRange === "week"
  324. ? "yyyy-MM-dd 至 yyyy-MM-dd"
  325. : "yyyy-MM";
  326. },
  327. valueFormat() {
  328. return this.selectedTimeRange === "day"
  329. ? "yyyy-MM-dd"
  330. : this.selectedTimeRange === "week"
  331. ? "yyyy-MM-dd"
  332. : "yyyy-MM";
  333. },
  334. },
  335. created() {
  336. //this.getList();
  337. },
  338. mounted() {
  339. this.selectedMetric = this.trendData[0]; // 默认选中第一个
  340. this.initChart(); // 初始化折线图
  341. },
  342. methods: {
  343. changeDate(value) {
  344. if (this.selectedTimeRange === "week" && value) {
  345. /*console.log("🟢 监听到 selectedWeek 变化:", newVal);*/
  346. this.weekRange = this.getWeekRange(value);
  347. } else {
  348. this.weekRange = "";
  349. }
  350. console.log("选择的时间:", value, "筛选方式:", this.selectedTimeRange);
  351. },
  352. getWeekRange(selectedWeek) {
  353. console.log("🔹 selectedWeek 输入值:", selectedWeek); // 检查传入值
  354. let date = new Date(selectedWeek);
  355. if (isNaN(date.getTime())) {
  356. console.error("Invalid Date:", selectedWeek);
  357. return "日期错误";
  358. }
  359. let dayOfWeek = date.getDay(); // 0(星期天)- 6(星期六)
  360. // 计算周一
  361. let startDate = new Date(date); // 创建一个新的 Date 实例
  362. startDate.setDate(date.getDate() - dayOfWeek + (dayOfWeek === 0 ? -6 : 1));
  363. // 计算周日(确保 `endDate` 是新实例)
  364. let endDate = new Date(startDate.getTime()); // 复制 `startDate`
  365. endDate.setDate(startDate.getDate() + 6);
  366. console.log("周一:", this.formatDate(startDate));
  367. console.log("周日:", this.formatDate(endDate));
  368. return `${this.formatDate(startDate)} 至 ${this.formatDate(endDate)}`;
  369. },
  370. formatDate(date) {
  371. const year = date.getFullYear();
  372. const month = String(date.getMonth() + 1).padStart(2, "0");
  373. const day = String(date.getDate()).padStart(2, "0");
  374. return `${year}-${month}-${day}`;
  375. },
  376. computedChange(item) {
  377. switch (this.selectedTimeRange) {
  378. case 'day': return item.dailyChange;
  379. case 'week': return item.weeklyChange;
  380. case 'month': return item.monthlyChange;
  381. default: return 0;
  382. }
  383. },
  384. selectRank(type) {
  385. this.selectedRank = type;
  386. console.log(`选中的排行方式: ${type}`);
  387. },
  388. selectRank(type) {
  389. this.selectedRank = type; // 只允许一个按钮被选中
  390. console.log(`选中的排行方式: ${type}`);
  391. },
  392. fetchRankingData() {
  393. // 这里根据 `selectedRedRank` 和 `selectedBlackRank` 来请求不同的排行榜数据
  394. console.log(`获取排行榜数据: 红榜-${this.selectedRedRank}, 黑榜-${this.selectedBlackRank}`);
  395. },
  396. // 切换时间范围
  397. changeTimeRange() {
  398. // 根据选中的时间范围修改 datePicker 类型
  399. if (this.selectedTimeRange === "day") {
  400. this.datePickerType = "date";
  401. } else if (this.selectedTimeRange === "month") {
  402. this.datePickerType = "month";
  403. } else if (this.selectedTimeRange === "week") {
  404. this.datePickerType = "week";
  405. }
  406. this.selectedDate = null; // 重置已选日期
  407. },
  408. // 切换时间(但目前只是选日期,没有请求后端)
  409. /*changeDate() {
  410. console.log("选择日期:", this.selectedDate);
  411. // 这里可以做后端请求:this.fetchTrendData();
  412. },*/
  413. // 获取直播趋势数据
  414. async fetchTrendData() {
  415. try {
  416. const response = await axios.get("/api/trend-data", { params: { date: this.selectedDate } });
  417. this.trendData = response.data;
  418. // 默认选择第一个指标
  419. if (this.trendData.length > 0) {
  420. this.changeMetric(this.trendData[0]);
  421. }
  422. } catch (error) {
  423. console.error("获取直播数据失败:", error);
  424. }
  425. },
  426. // 切换日期时更新数据
  427. updateTrendData() {
  428. console.log(`更新 ${this.selectedDate} 的直播数据`);
  429. // 这里可以加接口请求,获取新的数据
  430. this.updateChart();
  431. },
  432. // 切换指标
  433. changeMetric(metric) {
  434. this.selectedMetric = metric;
  435. this.updateChart();
  436. },
  437. updateTrendData() {
  438. console.log("选择的时间:", this.selectedDate);
  439. this.trendData = this.trendData.map(item => ({
  440. ...item,
  441. value: Math.floor(Math.random() * 50),
  442. change: (Math.random() * 10 - 5).toFixed(2)
  443. }));
  444. this.updateChart();
  445. },
  446. initChart() {
  447. let chartDom = document.getElementById("liveChart");
  448. if (!chartDom) return;
  449. this.chart = echarts.init(chartDom);
  450. this.updateChart();
  451. },
  452. // 更新折线图
  453. updateChart() {
  454. if (!this.chart) return;
  455. let options = {
  456. tooltip: { trigger: "axis", backgroundColor: "rgba(0, 0, 0, 0.7)", textStyle: { color: "#fff" } },
  457. grid: { left: "5%", right: "5%", bottom: "10%", top: "10%", containLabel: true },
  458. xAxis: { type: "category", data: this.selectedMetric.dates || [], axisLine: { lineStyle: { color: "#ddd" } } },
  459. yAxis: { type: "value", splitLine: { lineStyle: { type: "dashed", color: "#ddd" } } },
  460. series: [
  461. {
  462. name: this.selectedMetric.title,
  463. data: this.selectedMetric.data || [],
  464. type: "line",
  465. smooth: true,
  466. symbol: "circle",
  467. symbolSize: 8,
  468. itemStyle: { color: "#007BFF", borderColor: "#fff", borderWidth: 2 },
  469. lineStyle: { width: 3, color: "#007BFF" },
  470. areaStyle: {
  471. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  472. { offset: 0, color: "rgba(0, 123, 255, 0.5)" },
  473. { offset: 1, color: "rgba(0, 123, 255, 0)" },
  474. ]),
  475. },
  476. emphasis: {
  477. focus: "series",
  478. label: { show: true, formatter: "{c}", fontSize: 14, color: "#333", backgroundColor: "#fff", padding: [4, 6] },
  479. },
  480. animationDuration: 1200,
  481. animationEasing: "quadraticOut",
  482. },
  483. ],
  484. };
  485. this.chart.setOption(options);
  486. },
  487. changeMetric(metric) {
  488. this.selectedMetric = metric;
  489. this.updateChart();
  490. },
  491. }
  492. };
  493. </script>
  494. <style scoped>
  495. .app-container {
  496. padding: 20px;
  497. }
  498. .title {
  499. font-size: 18px;
  500. font-weight: bold;
  501. margin-bottom: 10px;
  502. }
  503. .live-container {
  504. display: flex;
  505. gap: 15px; /* 控制卡片之间的间距 */
  506. overflow-x: auto; /* 允许横向滚动 */
  507. padding-bottom: 10px;
  508. }
  509. /* 卡片样式 */
  510. .live-card {
  511. width: 380px;
  512. height: 225px;
  513. background: rgb(250,250,250);
  514. border-radius: 10px;
  515. padding: 15px;
  516. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  517. display: flex;
  518. flex-direction: column;
  519. align-items: flex-start;
  520. }
  521. /* 直播状态 */
  522. .status {
  523. background: #d3d3d3;
  524. color: #333;
  525. font-size: 14px;
  526. padding: 4px 8px;
  527. border-radius: 5px;
  528. display: inline-block;
  529. }
  530. /* 直播信息部分 */
  531. .content {
  532. background: rgb(250,250,250);
  533. display: flex;
  534. gap: 10px;
  535. align-items: center;
  536. width: 90%;
  537. margin-top: 0px;
  538. }
  539. /* 直播封面图片 */
  540. .cover-image {
  541. width: 70px;
  542. height: 70px;
  543. border-radius: 10px;
  544. object-fit: cover;
  545. }
  546. /* 直播文本信息 */
  547. .info {
  548. flex: 1;
  549. }
  550. .live-title {
  551. font-size: 16px;
  552. font-weight: bold;
  553. white-space: nowrap;
  554. overflow: hidden;
  555. text-overflow: ellipsis;
  556. max-width: 250px; /* 防止标题过长 */
  557. }
  558. .time {
  559. font-size: 14px;
  560. color: #666;
  561. }
  562. /* 直播数据部分 */
  563. .stats {
  564. display: flex;
  565. justify-content: space-between;
  566. width: 100%;
  567. flex-shrink: 0;
  568. margin-top: -40px;
  569. }
  570. .stat-item {
  571. text-align: center;
  572. flex: 1;
  573. }
  574. .label {
  575. font-size: 14px;
  576. color: #888;
  577. }
  578. .value {
  579. font-size: 18px;
  580. font-weight: bold;
  581. color: #333;
  582. }
  583. /* 直播趋势 */
  584. .trend-section {
  585. margin-top: 30px;
  586. }
  587. .trend-header {
  588. display: flex;
  589. justify-content: space-between;
  590. align-items: center;
  591. }
  592. .trend-cards {
  593. display: flex;
  594. gap: 15px;
  595. }
  596. .trend-card {
  597. width: 280px;
  598. hight: 100px;
  599. border: 1px solid #ddd;
  600. border-radius: 8px;
  601. padding: 16px;
  602. transition: all 0.3s;
  603. position: relative;
  604. }
  605. .trend-card.active {
  606. border-color: #007bff; /* 选中时边框变蓝 */
  607. box-shadow: 0px 0px 10px rgba(0, 123, 255, 0.3);
  608. }
  609. .trend-card.active::after {
  610. content: "✔";
  611. position: absolute;
  612. bottom: 8px;
  613. right: 8px;
  614. color: white;
  615. background: #007bff;
  616. border-radius: 50%;
  617. width: 20px;
  618. height: 20px;
  619. display: flex;
  620. justify-content: center;
  621. align-items: center;
  622. font-size: 14px;
  623. font-weight: bold;
  624. }
  625. .trend-value {
  626. font-size: 24px;
  627. font-weight: bold;
  628. }
  629. /* 折线图 */
  630. .chart {
  631. width: 100%;
  632. height: 300px;
  633. margin-top: 20px;
  634. }
  635. .top10-section {
  636. margin-top: 20px;
  637. background: #fff;
  638. padding: 16px;
  639. border-radius: 8px;
  640. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  641. }
  642. .live-name {
  643. display: flex;
  644. align-items: center;
  645. }
  646. .live-cover {
  647. width: 80px; /* 直播封面宽度 */
  648. height: 45px; /* 直播封面高度 */
  649. border-radius: 4px;
  650. margin-right: 10px;
  651. object-fit: cover;
  652. }
  653. .live-title {
  654. font-size: 14px;
  655. color: #333;
  656. white-space: nowrap;
  657. overflow: hidden;
  658. text-overflow: ellipsis;
  659. }
  660. .ranking-tabs {
  661. display: flex;
  662. justify-content: space-between;
  663. align-items: center;
  664. padding: 10px 20px;
  665. }
  666. .ranking-container {
  667. display: flex;
  668. justify-content: space-between;
  669. align-items: center;
  670. margin: 10px 0;
  671. border-radius: 8px;
  672. overflow: hidden;
  673. }
  674. .ranking-section {
  675. display: flex;
  676. align-items: center;
  677. width: 50%;
  678. padding: 10px 15px;
  679. }
  680. .red-rank {
  681. background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
  682. justify-content: flex-start;
  683. }
  684. .black-rank {
  685. background: linear-gradient(90deg, #4a4a4a, #6b6b6b);
  686. justify-content: flex-end;
  687. }
  688. .rank-title {
  689. font-size: 18px;
  690. font-weight: bold;
  691. color: white;
  692. margin: 0 15px;
  693. }
  694. .rank-filters {
  695. display: flex;
  696. }
  697. button {
  698. background: rgba(255, 255, 255, 0.2);
  699. border: 1px solid rgba(255, 255, 255, 0.5);
  700. color: white;
  701. font-size: 14px;
  702. padding: 5px 12px;
  703. margin: 0 5px;
  704. border-radius: 15px;
  705. cursor: pointer;
  706. transition: all 0.3s ease;
  707. }
  708. button.active {
  709. background: white;
  710. color: #ff4d4f;
  711. }
  712. .filter-container {
  713. display: flex;
  714. align-items: center;
  715. gap: 8px; /* 控制两个组件的间距 */
  716. }
  717. .filter-label {
  718. font-weight: bold;
  719. white-space: nowrap; /* 防止换行 */
  720. }
  721. </style>