poem_front/xia.html
ZHANG ZENGXUAN d0dd647fac feat: INIT
2025-05-19 21:59:43 +08:00

244 lines
7.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0" maximum-scale=1 , user-scalable=0”>
<title>词汇江湖-夏</title>
<link rel="shortcut icon" href="bitbug_favicon.ico" />
<!-- 引入所需要的css -->
<!-- 引入页面所需要的css -->
<link rel="stylesheet" href="./assets/css/style.css">
<link rel="stylesheet" href="./assets/css/header.css">
<link rel="stylesheet" href="./assets/css/footer.css">
<link rel="stylesheet" href="./assets/css/main.css">
<link rel="stylesheet" href="./assets/css/base.css">
<link rel="stylesheet" href="./assets/css/bootstrap.css">
<link rel="stylesheet" href="./assets/css/pagination.css">
<link rel="stylesheet" href="./assets/css/index.style.css">
<link rel="stylesheet" href="./assets/iconfont/iconfont.css">
<!-- 引入所需要的js文件 -->
<script src="./assets/js/jquery-3.4.1.min.js"></script>
<script src="./assets/js/pagination.js"></script>
<script src="./assets/js/ajax.js"></script>
<!-- 引入所需要的js文件 -->
<!-- 头部导航所需要的css -->
<style>
body {
background: url(./assets/images/bg5.png);
background-size: 100% 100%;
background-repeat: no-repeat;
}
</style>
</head>
<body>
<div id="header"></div>
<div class="season-wrap">
<div class="season">
<div class="season-title"> 夏季</div>
<div style="font-size: 15px;text-align: center;border-bottom:5px dashed #e8e8e8">有关夏的词</div>
<ul class="season-list poems">
</ul>
<div id="pagination" name="pagination" style="margin: 10px auto;text-align: center;"></div>
</div>
<div class="season">
<div style="font-size: 15px;text-align: center;border-bottom:5px dashed #e8e8e8">有关夏的诗</div>
<ul class="season-list dynastys">
</ul>
<div id="dynastyPaging" name="dynastyPaging" style="margin: 10px auto;text-align: center;"></div>
</div>
</div>
<!-- 底部 end-->
<div id="footer"></div>
</body>
<script>
$(function() {
$('#header').load('./common/header.html');
$('#footer').load('./common/footer.html');
})
// 用户权限判断
window.onload= function(){
var userId = window.sessionStorage.getItem('userId');
var username = window.sessionStorage.getItem("username");
var userToken = window.sessionStorage.getItem("yq_token");
$.ajax({
url: 'http://127.0.0.1:81/consumer/user/fineById/' + userId + '/', //请求url
undefined,
type: "get",
headers: {
undefined,
"token": userToken //此处放置请求到的用户token
},
success: function(data) {
if (data.code == 200) {
document.getElementById("denglu").innerHTML = '<div style="display:flex;"><a href="./user"><img src=http://cdn.shuguangwl.com/2022/04/01/9d62eaa7c11f2.png style="width:20px;height:20px;">' + data.data.username + '</a><a href="./user/logout.html"><img src=http://cdn.shuguangwl.com/2022/04/10/60fc777f1b526.png style="width:20px;height:20px;">退出登录</a><div>';
}
}
})
}
$(document).ready(() => {
getPoemPage();
getdynastyPage();
});
let poemPagingEl = pagination("#pagination", () => {
getPoemPage(poemPagingEl.currentPage);
});
function getPoemPage(index = 1) {
// for (i = 0; i < 3; i++) {
$.ajax({
url: `http://127.0.0.1:88/consumer/do/fine/poem/type/2/${index}/6`,
type: 'GET',
data: 'data',
success: data => {
if (data && !data.data) return;
const res = data.data;
poemPagingEl.init();
if(res.total%6!=0&&res.total%6<6){
var z=1;
}
else{
var z=0;
}
poemPagingEl.total = z+Math.round(res.total/ res.size);
poemPagingEl.fetchHistory();
if ($(".poems")[0].children.length) $(".poems").empty();
res.rows.forEach(item => {
var one = item.poemInformation;
var input = one.replace(/\。/g, '。<br/>');
one = input.replace(/\/g, '<br/>');
input = one.replace(/\ /g, '<br/>');
one = input.replace(/\,/g, '<br/>');
input = one.replace(/\ /g, '<br/>')
one = input.replace(/\!/g, '!<br/>');
var result = one.replace(/\./g, '。<br/>');
var poemInformation = result;
b = `<div class=" col-md-6 col-sm-12 single-trainer"><a href="./poetry.html?ownText=${item.poemId}"><div class="meta-text text-sm-center"><h4 id="title">${item.poemName}</h4>`
b += `<p id="aritle">${item.poemUser}</p>`
b += `<div class="mb-4">`
b += `<p id="poemer">${poemInformation}</p></div></div>`
b += `</a>`
b += `</div>`;
$(".poems").append(b);
});
}
});
// }
}
let dynastyPagingEl = pagination("#dynastyPaging", () => {
getdynastyPage(dynastyPagingEl.currentPage);
});
// 诗
function getdynastyPage(index = 1) {
// for (i = 0; i < 3; i++) {
$.ajax({
url: `http://127.0.0.1:88/consumer/do/fine/dynasty/type/2/${index}/6`,
type: 'GET',
data: 'data',
success: data => {
if (data && !data.data) return;
const res = data.data;
dynastyPagingEl.init();
if(res.total%6!=0 && res.total%6< 6){
var z=1;
}
else{
var z=0;
}
dynastyPagingEl.total = z+Math.round(res.total/ res.size);
dynastyPagingEl.fetchHistory();
if ($(".dynastys")[0].children.length) $(".dynastys").empty();
res.rows.forEach(item => {
var one = item.dynastyInformation;
var input = one.replace(/\。/g, '。<br/>');
one = input.replace(/\/g, '<br/>');
input = one.replace(/\ /g, '<br/>');
one = input.replace(/\,/g, '<br/>');
input = one.replace(/\? /g, '<br/>');
one = input.replace(/\,/g, '<br/>');
input = one.replace(/\ /g, '<br/>')
one = input.replace(/\!/g, '!<br/>');
var result = one.replace(/\./g, '。<br/>');
var dynastyInformation = result;
b = `<div class=" col-md-6 col-sm-12 single-trainer"><a href="./ancient%20poetry.html?ownText=${item.dynastyId}"><div class="meta-text text-sm-center"><h4 id="title">${item.dynastyName}</h4>`
b += `<p id="aritle">${item.dynastyUser}</p>`
b += `<div class="mb-4">`
b += `<p id="poemer">${dynastyInformation}</p></div></div>`
b += `</a>`
b += `</div>`;
$(".dynastys").append(b);
});
}
});
// }
}
</script>
</html>