Files
echart/news/index.php
T
2026-05-25 11:01:06 +08:00

190 lines
7.3 KiB
PHP

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>新闻联播 - 实时资讯</title>
<script src="/js/tailwindcss_3.4.17.js"></script>
<script src="/libai/anime.min.js"></script>
<style>
.news-card {
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.news-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.news-content {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease-out;
}
.news-content.expanded {
max-height: 1000px;
transition: max-height 0.5s ease-in;
}
.loading-spinner {
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.fade-in {
opacity: 0;
animation: fadeIn 0.6s ease-out forwards;
}
@keyframes fadeIn {
to { opacity: 1; }
}
.title-font {
font-family: 'Noto Serif SC', serif;
}
.body-font {
font-family: 'Noto Sans SC', sans-serif;
}
</style>
</head>
<body class="bg-gray-50 body-font">
<!-- Header -->
<header class="bg-white shadow-sm border-b border-gray-200 sticky top-0 z-50">
<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center h-16">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 bg-blue-500 rounded-lg flex items-center justify-center">
<svg class="w-5 h-5 text-white" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M2 5a2 2 0 012-2h8a2 2 0 012 2v10a2 2 0 002 2H4a2 2 0 01-2-2V5zm3 1h6v4H5V6zm6 6H5v2h6v-2z" clip-rule="evenodd"/>
</svg>
</div>
<h1 class="text-xl font-bold text-gray-900 title-font">新闻联播-新闻流</h1>
</div>
<div class="text-sm text-gray-500">
实时资讯更新
</div>
</div>
</div>
</header>
<!-- Main Content -->
<main class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<!-- Date Filter -->
<div class="bg-white rounded-lg shadow-sm p-4 mb-6">
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between space-y-3 sm:space-y-0">
<div class="flex items-center space-x-4">
<label class="text-sm font-medium text-gray-700">日期</label>
<input type="date" id="startDate" class="border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent">
<span class="text-gray-500"></span>
<input type="date" id="endDate" class="border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent">
</div>
<button id="refreshBtn" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-md text-sm font-medium transition-colors duration-200">
刷新
</button>
</div>
</div>
<!-- News Container -->
<div id="newsContainer" class="space-y-4">
<!-- News items will be dynamically inserted here -->
</div>
<!-- Loading Indicator -->
<div id="loadingIndicator" class="flex justify-center items-center py-8 hidden">
<div class="flex items-center space-x-3">
<div class="loading-spinner w-6 h-6 border-2 border-blue-500 border-t-transparent rounded-full"></div>
<span class="text-gray-600 text-sm">正在加载更多新闻...</span>
</div>
</div>
<!-- End of Content -->
<div id="endOfContent" class="text-center py-8 text-gray-500 hidden">
<div class="flex flex-col items-center space-y-2">
<svg class="w-12 h-12 text-gray-300" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M3 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 4a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z" clip-rule="evenodd"/>
</svg>
<p class="text-sm">已加载所有新闻</p>
</div>
</div>
</main>
<!-- Footer -->
<footer class="bg-white border-t border-gray-200 mt-16">
<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="text-center text-sm text-gray-500">
<p>&copy; 2025 新闻流应用. 实时获取最新资讯</p>
</div>
<div class="text-center text-sm text-gray-500">
<span style="color: grey; font-size: x-small; ">
<a href="https://beian.miit.gov.cn" target="_blank">浙ICP备18056264号-1</a>
</span>
<span style='color:grey;font-size:small;'>
<?php
ini_set("display_errors", "1");
$mysqli = new mysqli('localhost','myquant','_H(lU1_fF*9baRTp','myquant');
function log_pv(){
#echo "start log";
global $mysqli;
$vpage = addslashes($_SERVER['PHP_SELF']);
$ua = addslashes($_SERVER['HTTP_USER_AGENT']);
$ip = $_SERVER['REMOTE_ADDR'];
$qs = addslashes($_SERVER['QUERY_STRING']);
$vtime = date("Y-m-d H:i:s");
$sql="insert into pv_log(vpage,querystring,remoteip,ua,vtime)
values ('".$vpage."','".$qs."','".$ip."', '".$ua."','".$vtime."')";
$mysqli->query($sql);
}
function pv_counter($user=''){
global $mysqli;
$hits=0; //set default page hits 0;
$page=$_SERVER['PHP_SELF'];
$lmtime=date("Y-m-d H:i:s");
$sql="select hits from pv_counter where page_name='".$page."'";
$result=$mysqli->query($sql);
$rt=$result->fetch_all(MYSQLI_ASSOC);
$n=count($rt);
if($n<1){
$sql = "insert into pv_counter(page_id,Page_name,hits,lm_date,lm_ip,lm_user)
values (null,
'".$page."','1','".$lmtime."',
'".$_SERVER['REMOTE_ADDR']."','".$user."')";
$mysqli->query($sql);
$hits=1;
}
if($n==1){
$hits=$rt[0]['hits'];
$hits++;
$sql="update pv_counter set hits='".$hits."',lm_date='".$lmtime."',
lm_ip='".$_SERVER['REMOTE_ADDR']."',lm_user='".$user."' where page_name='".$page."'";
$mysqli->query($sql);
}
if($n>1){
$display= "<p align='center'>There is error on pv_counter </p>";
return $display;
}
$sql="select sum(hits) hits_all from pv_counter";
$result=$mysqli->query($sql);
$hits_all=$result->fetch_all(MYSQLI_ASSOC);
$display="Page hits: ".$hits." Total: ".$hits_all[0]['hits_all'];
echo $display;
}
log_pv();
pv_counter($user='');
$mysqli->close();
?>
</span>
</div>
</div>
</footer>
<script src="main.js?ver=0.4"></script>
</body>
</html>