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

135 lines
5.8 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">
<title>词汇江湖-诗人作品</title>
<link rel="shortcut icon" href="bitbug_favicon.ico" />
<link rel=" stylesheet " href="./assets/css/header.css ">
<link rel="stylesheet " href="./assets/iconfont/iconfont.css ">
<link rel="stylesheet" href="./assets/css/footer.css">
<link rel="stylesheet" href="./assets/css/style.css">
<link rel="stylesheet" href="./assets/css/bootstrap.css">
<link rel="stylesheet" href="./assets/css/footer.css">
<script src="./assets/js/jquery-1.9.1.min.js"></script>
<script src="./assets/js/ajax.js"></script>
<link rel="stylesheet" href="./assets/css/base.css">
<link rel="stylesheet" href="./assets/css/index.css">
<link href="./assets/css/index.boot.css" rel="stylesheet" type="text/css" media="all" />
<link href="./assets/css/index.style.css" rel="stylesheet" type="text/css" media="all" />
<link href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" r~-+el="stylesheet">
</head>
<!-- 头部导航 -->
<body>
<div id="header"></div>
<!-- 诗简介 -->
<div class="poetry " id="submitguciquanbuneirong">
<div class=" d-flex poems " style="margin:0px 10px">
</div>
</div>
<!-- 底部开始 -->
<div id="footer"></div>
<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>';
}
}
})
}
//分享 复制网页链接----------------------------------------------
$('#coin').on('click', function() {
var url = window.location.href;
copyUrl(url);
alert("网页链接复制成功!");
});
function copyUrl(id) {
$("body").after("<input id='copyVal'></input>");
var text = id;
var input = document.getElementById("copyVal");
input.value = text;
input.select();
input.setSelectionRange(0, input.value.length);
document.execCommand("copy");
$("#copyVal").remove();
}
//分享end 复制网页链接----------------------------------------------
//获取搜索数据并展示到页面----------------------------------
var twoText = window.location.href;
var twodata = twoText.split("="); //截取 url中的“=”,获得“=”后面的参数
var username = decodeURI(twodata[1]); //decodeURI解码
console.log(username);
$('#submitguciquanbuneirong').ready(function() {
$.ajax({
url: 'http://127.0.0.1:82/consumer/do/fine/poem/username/' + username + '/',
dataType: "json", //数据格式
type: "get", //请求方式
success: function(data) {
var poemId = data.data.poemId;
var poemName = data.data.poemName;
var poemUser = data.data.poemUser;
var poemInformation = data.data.poemInformation;
var giveLike = data.data.giveLike;
var collection = data.datacollection;
var explain = data.data.explain;
var time = data.data
var b = "";
for (i = 0; i < data.data.length; i++) {
var one = data.data[i].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="./ancient%20poetry.html?ownText=' + data.data[i].poemId + '"><div class="meta-text text-sm-center"><h4 id="title">' + data.data[i].poemName + '</h4>'
b += '<p id="aritle">' + data.data[i].poemUser + '</p>'
b += '<div class="mb-4">'
b += '<p id="poemer">' + poemInformation + '</p></div></div>'
b += '</a>'
b += '</div>';
$(".poems").append(b);
}
},
})
})
//获取搜索数据并展示到页面end----------------------------------
</script>
</body>
</html>