screen.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>数智大屏 - 舆情分析系统</title>
  7. <script src="https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js"></script>
  8. <script src="https://cdn.jsdelivr.net/npm/echarts-gl@2.0.9/dist/echarts-gl.min.js"></script>
  9. <script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>
  10. <style>
  11. * {
  12. margin: 0;
  13. padding: 0;
  14. box-sizing: border-box;
  15. }
  16. body {
  17. background-color: #0b1325;
  18. color: #fff;
  19. font-family: 'Microsoft YaHei', sans-serif;
  20. overflow: hidden;
  21. width: 100vw;
  22. height: 100vh;
  23. background-image: radial-gradient(circle at center, #1a2a4a 0%, #0b1325 100%);
  24. }
  25. /* Header */
  26. .header {
  27. height: 80px;
  28. width: 100%;
  29. background: url('https://lib.baomitu.com/echarts/4.9.0/echarts.min.js'); /* Placeholder for header bg if needed */
  30. background-size: 100% 100%;
  31. display: flex;
  32. justify-content: center;
  33. align-items: center;
  34. position: relative;
  35. border-bottom: 2px solid #2c4270;
  36. box-shadow: 0 0 20px rgba(44, 66, 112, 0.5);
  37. }
  38. .header h1 {
  39. font-size: 32px;
  40. letter-spacing: 5px;
  41. text-shadow: 0 0 10px #00eaff;
  42. background: linear-gradient(to bottom, #fff, #84d8ff);
  43. -webkit-background-clip: text;
  44. -webkit-text-fill-color: transparent;
  45. }
  46. .time-display {
  47. position: absolute;
  48. right: 30px;
  49. font-size: 18px;
  50. color: #84d8ff;
  51. }
  52. /* Layout */
  53. .main-container {
  54. display: flex;
  55. height: calc(100vh - 80px);
  56. padding: 20px;
  57. gap: 20px;
  58. }
  59. .column {
  60. display: flex;
  61. flex-direction: column;
  62. gap: 20px;
  63. }
  64. .left-col { flex: 3; }
  65. .center-col { flex: 5; position: relative; }
  66. .right-col { flex: 3; }
  67. /* Card/Panel */
  68. .panel {
  69. background: rgba(18, 32, 60, 0.6);
  70. border: 1px solid #2c4270;
  71. border-radius: 4px;
  72. padding: 15px;
  73. flex: 1;
  74. display: flex;
  75. flex-direction: column;
  76. position: relative;
  77. box-shadow: inset 0 0 20px rgba(0, 150, 255, 0.1);
  78. }
  79. .panel::before {
  80. content: '';
  81. position: absolute;
  82. top: -1px; left: -1px;
  83. width: 10px; height: 10px;
  84. border-top: 2px solid #00eaff;
  85. border-left: 2px solid #00eaff;
  86. }
  87. .panel::after {
  88. content: '';
  89. position: absolute;
  90. bottom: -1px; right: -1px;
  91. width: 10px; height: 10px;
  92. border-bottom: 2px solid #00eaff;
  93. border-right: 2px solid #00eaff;
  94. }
  95. .panel-title {
  96. font-size: 18px;
  97. color: #00eaff;
  98. margin-bottom: 15px;
  99. padding-left: 10px;
  100. border-left: 4px solid #00eaff;
  101. }
  102. .chart-container {
  103. flex: 1;
  104. width: 100%;
  105. height: 100%;
  106. min-height: 200px;
  107. }
  108. /* Center Content */
  109. .stats-row {
  110. display: flex;
  111. justify-content: space-around;
  112. margin-bottom: 20px;
  113. }
  114. .stat-item {
  115. text-align: center;
  116. background: rgba(0, 78, 146, 0.3);
  117. padding: 15px 25px;
  118. border-radius: 8px;
  119. border: 1px solid #00eaff;
  120. }
  121. .stat-value {
  122. font-size: 36px;
  123. font-weight: bold;
  124. color: #ffeb3b;
  125. text-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
  126. }
  127. .stat-label {
  128. color: #fff;
  129. font-size: 16px;
  130. margin-top: 5px;
  131. }
  132. .earth-container {
  133. flex: 1;
  134. width: 100%;
  135. border: 1px solid rgba(0, 234, 255, 0.2);
  136. border-radius: 50%; /* Optional */
  137. background: radial-gradient(circle, rgba(0,0,0,0) 0%, rgba(0,10,30,0.5) 100%);
  138. }
  139. /* List Style */
  140. .news-list {
  141. overflow-y: hidden;
  142. flex: 1;
  143. }
  144. .news-item {
  145. display: flex;
  146. justify-content: space-between;
  147. padding: 10px;
  148. border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  149. color: #ccc;
  150. font-size: 14px;
  151. transition: all 0.3s;
  152. }
  153. .news-item:hover {
  154. background: rgba(0, 234, 255, 0.1);
  155. color: #fff;
  156. }
  157. .news-title {
  158. white-space: nowrap;
  159. overflow: hidden;
  160. text-overflow: ellipsis;
  161. max-width: 70%;
  162. }
  163. .news-time {
  164. color: #00eaff;
  165. }
  166. </style>
  167. </head>
  168. <body>
  169. <div class="header">
  170. <h1>数智舆情大数据可视化平台</h1>
  171. <div class="time-display" id="clock"></div>
  172. </div>
  173. <div class="main-container">
  174. <!-- Left Column -->
  175. <div class="column left-col">
  176. <div class="panel">
  177. <div class="panel-title">数据来源分布</div>
  178. <div id="chart-source" class="chart-container"></div>
  179. </div>
  180. <div class="panel">
  181. <div class="panel-title">舆情趋势分析 (近7天)</div>
  182. <div id="chart-trend" class="chart-container"></div>
  183. </div>
  184. <div class="panel">
  185. <div class="panel-title">热词云图</div>
  186. <div id="chart-words" class="chart-container"></div>
  187. </div>
  188. </div>
  189. <!-- Center Column -->
  190. <div class="column center-col">
  191. <div class="stats-row">
  192. <div class="stat-item">
  193. <div class="stat-value" id="val-total">0</div>
  194. <div class="stat-label">总数据量</div>
  195. </div>
  196. <div class="stat-item">
  197. <div class="stat-value" id="val-today">0</div>
  198. <div class="stat-label">今日新增</div>
  199. </div>
  200. <div class="stat-item">
  201. <div class="stat-value" id="val-ai">0</div>
  202. <div class="stat-label">AI智库</div>
  203. </div>
  204. <div class="stat-item">
  205. <div class="stat-value" id="val-tasks">0</div>
  206. <div class="stat-label">活跃任务</div>
  207. </div>
  208. </div>
  209. <div id="earth-chart" class="chart-container" style="height: 100%;"></div>
  210. </div>
  211. <!-- Right Column -->
  212. <div class="column right-col">
  213. <div class="panel">
  214. <div class="panel-title">采集任务状态</div>
  215. <div id="chart-tasks" class="chart-container"></div>
  216. </div>
  217. <div class="panel" style="flex: 2;">
  218. <div class="panel-title">实时舆情动态</div>
  219. <div class="news-list" id="news-list">
  220. <!-- Dynamic Content -->
  221. </div>
  222. </div>
  223. </div>
  224. </div>
  225. <script>
  226. // Clock
  227. setInterval(() => {
  228. const now = new Date();
  229. document.getElementById('clock').innerText = now.toLocaleString();
  230. }, 1000);
  231. // Init Charts
  232. const chartSource = echarts.init(document.getElementById('chart-source'));
  233. const chartTrend = echarts.init(document.getElementById('chart-trend'));
  234. const chartWords = echarts.init(document.getElementById('chart-words'));
  235. const chartTasks = echarts.init(document.getElementById('chart-tasks'));
  236. const chartEarth = echarts.init(document.getElementById('earth-chart'));
  237. // Resize
  238. window.addEventListener('resize', () => {
  239. chartSource.resize();
  240. chartTrend.resize();
  241. chartWords.resize();
  242. chartTasks.resize();
  243. chartEarth.resize();
  244. });
  245. // Fetch Data
  246. function loadData() {
  247. $.get('/api/screen/data', function(res) {
  248. updateStats(res.stats);
  249. updateSourceChart(res.charts.source_pie);
  250. updateTrendChart(res.charts.daily_trend);
  251. updateTaskChart(res.charts.task_bar);
  252. updateWordCloud(res.charts.keywords); // Using simple bar/scatter for now or specialized wordcloud if imported
  253. updateNewsList(res.news_list);
  254. });
  255. }
  256. function updateStats(stats) {
  257. animateValue('val-total', stats.total_articles);
  258. animateValue('val-today', stats.today_articles);
  259. animateValue('val-tasks', stats.active_tasks);
  260. }
  261. function animateValue(id, end) {
  262. const obj = document.getElementById(id);
  263. const start = parseInt(obj.innerText);
  264. if (start === end) return;
  265. let current = start;
  266. const step = Math.ceil((end - start) / 20) || 1;
  267. const timer = setInterval(() => {
  268. current += step;
  269. if ((step > 0 && current >= end) || (step < 0 && current <= end)) {
  270. current = end;
  271. clearInterval(timer);
  272. }
  273. obj.innerText = current;
  274. }, 50);
  275. }
  276. function updateSourceChart(data) {
  277. const option = {
  278. tooltip: { trigger: 'item' },
  279. legend: { top: '5%', left: 'center', textStyle: { color: '#fff' } },
  280. series: [{
  281. name: '来源',
  282. type: 'pie',
  283. radius: ['40%', '70%'],
  284. avoidLabelOverlap: false,
  285. itemStyle: {
  286. borderRadius: 10,
  287. borderColor: '#fff',
  288. borderWidth: 2
  289. },
  290. label: { show: false, position: 'center' },
  291. emphasis: {
  292. label: { show: true, fontSize: 20, fontWeight: 'bold', color: '#fff' }
  293. },
  294. labelLine: { show: false },
  295. data: data
  296. }]
  297. };
  298. chartSource.setOption(option);
  299. }
  300. function updateTrendChart(data) {
  301. const option = {
  302. tooltip: { trigger: 'axis' },
  303. xAxis: {
  304. type: 'category',
  305. data: data.dates,
  306. axisLine: { lineStyle: { color: '#fff' } }
  307. },
  308. yAxis: {
  309. type: 'value',
  310. axisLine: { lineStyle: { color: '#fff' } },
  311. splitLine: { lineStyle: { color: 'rgba(255,255,255,0.1)' } }
  312. },
  313. series: [{
  314. data: data.values,
  315. type: 'line',
  316. smooth: true,
  317. areaStyle: {
  318. opacity: 0.5,
  319. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  320. { offset: 0, color: 'rgb(0, 221, 255)' },
  321. { offset: 1, color: 'rgb(77, 119, 255)' }
  322. ])
  323. },
  324. itemStyle: { color: '#00eaff' }
  325. }]
  326. };
  327. chartTrend.setOption(option);
  328. }
  329. function updateTaskChart(data) {
  330. const option = {
  331. tooltip: { trigger: 'axis' },
  332. xAxis: {
  333. type: 'category',
  334. data: data.labels,
  335. axisLabel: { color: '#fff' }
  336. },
  337. yAxis: {
  338. type: 'value',
  339. axisLabel: { color: '#fff' },
  340. splitLine: { lineStyle: { color: 'rgba(255,255,255,0.1)' } }
  341. },
  342. series: [{
  343. data: data.values,
  344. type: 'bar',
  345. itemStyle: {
  346. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  347. { offset: 0, color: '#83bff6' },
  348. { offset: 0.5, color: '#188df0' },
  349. { offset: 1, color: '#188df0' }
  350. ])
  351. }
  352. }]
  353. };
  354. chartTasks.setOption(option);
  355. }
  356. function updateWordCloud(data) {
  357. // Using a bubble chart simulation for words since we didn't import wordcloud extension
  358. const option = {
  359. tooltip: { show: true },
  360. series: [{
  361. type: 'graph',
  362. layout: 'force',
  363. force: { repulsion: 100 },
  364. data: data.map(item => ({
  365. name: item.name,
  366. value: item.value,
  367. symbolSize: item.value / 2,
  368. draggable: true,
  369. itemStyle: { color: 'rgb(' + [
  370. Math.round(Math.random() * 160),
  371. Math.round(Math.random() * 160),
  372. Math.round(Math.random() * 160)
  373. ].join(',') + ')' }
  374. })),
  375. label: { show: true, color: '#fff' }
  376. }]
  377. };
  378. chartWords.setOption(option);
  379. }
  380. function updateNewsList(list) {
  381. const container = $('#news-list');
  382. container.empty();
  383. list.forEach(item => {
  384. const html = `
  385. <div class="news-item">
  386. <span class="news-title" title="${item.title}">[${item.source}] ${item.title}</span>
  387. <span class="news-time">${item.time}</span>
  388. </div>
  389. `;
  390. container.append(html);
  391. });
  392. }
  393. // 3D Earth Config
  394. function initEarth() {
  395. const option = {
  396. globe: {
  397. baseTexture: '/assets/earth.jpg',
  398. heightTexture: '/assets/bathymetry.jpg',
  399. displacementScale: 0.1,
  400. shading: 'lambert',
  401. environment: '/assets/starfield.jpg',
  402. light: {
  403. ambient: { intensity: 0.4 },
  404. main: { intensity: 0.4 }
  405. },
  406. viewControl: {
  407. autoRotate: true,
  408. autoRotateSpeed: 5, // Simulating rotation
  409. distance: 150
  410. }
  411. },
  412. series: []
  413. };
  414. chartEarth.setOption(option);
  415. }
  416. // Initialize
  417. initEarth();
  418. loadData();
  419. setInterval(loadData, 30000); // Refresh every 30s
  420. </script>
  421. </body>
  422. </html>