Commit e569c12a by 姜雷

修改公告获取方式

parent a4f7f715
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta <meta name="viewport"
name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" />
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<title>公告</title> <title>公告</title>
...@@ -19,9 +18,11 @@ ...@@ -19,9 +18,11 @@
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
.loadingText { .loadingText {
padding: 6.66667vw; padding: 6.66667vw;
} }
.Content { .Content {
/* height: 100%; */ /* height: 100%; */
padding: 4.8vw 3.2vw; padding: 4.8vw 3.2vw;
...@@ -29,6 +30,7 @@ ...@@ -29,6 +30,7 @@
/* overflow-y: scroll; /* overflow-y: scroll;
-webkit-overflow-scrolling: touch; */ -webkit-overflow-scrolling: touch; */
} }
.Content .content-title { .Content .content-title {
font-size: 4.53333vw; font-size: 4.53333vw;
color: #1e1e1e; color: #1e1e1e;
...@@ -36,6 +38,7 @@ ...@@ -36,6 +38,7 @@
line-height: 5.33333vw; line-height: 5.33333vw;
word-break: break-all; word-break: break-all;
} }
.Content .content-info { .Content .content-info {
font-size: 3.46667vw; font-size: 3.46667vw;
color: #909090; color: #909090;
...@@ -43,65 +46,70 @@ ...@@ -43,65 +46,70 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.Content .content-info-src { .Content .content-info-src {
flex: 1; flex: 1;
} }
.Content .content-body { .Content .content-body {
font-size: 3.73333vw; font-size: 3.73333vw;
color: #1e1e1e; color: #1e1e1e;
word-break: break-all; word-break: break-all;
} }
</style> </style>
</head> </head>
<body>
<body>
<div id="app"> <div id="app">
<div class="loadingText"> <div class="loadingText">
加载中。。。 加载中。。。
</div> </div>
</div> </div>
</body> </body>
<script> <script>
function getUrlParam(name) { function getUrlParam(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); //构造一个含有目标参数的正则表达式对象 var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数 var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]); if (r != null) return unescape(r[2]);
return null; //返回参数值 return null; //返回参数值
} }
$(function() { $(function () {
var id = getUrlParam('id'); var id = getUrlParam('id');
var token = getUrlParam('token'); var token = getUrlParam('token');
var customerId = getUrlParam('customerId');
$.ajax({ $.ajax({
url: url:
'https://internal-dev-school-main.168cad.top/dcxy/wechat/homepage/campus/itemInfo?itemId=' + 'https://ex-dev-dcxy-home-app.168cad.top/app/home/module/notice/detail?noticeCode=' +
id, id + '&customerId=' + customerId,
headers: { headers: {
token: token, token: token,
}, },
}).done(function(res) { }).done(function (res) {
if (res.code === 1000) { if (res.code === 1000) {
var data = res.data; var data = res.data;
$('#app').html( // $('#app').html(
'<div class="Content">' + // '<div class="Content">' +
'<div class="content-title">' + // '<div class="content-title">' +
data.title + // data.title +
'</div>' + // '</div>' +
'<div class="content-info">' + // '<div class="content-info">' +
'<span class="content-info-src ellipsis">' + // '<span class="content-info-src ellipsis">' +
data.source + // data.source +
'</span>' + // '</span>' +
'<span>' + // '<span>' +
data.updateTime + // data.updateTime +
'</span>' + // '</span>' +
'</div>' + // '</div>' +
'<div class="content-body" ></div>' + // '<div class="content-body" ></div>' +
'</div>', // '</div>',
); // );
$('.content-body').html(data.content); $('#app').html(data.content);
} else { } else {
$('.loadingText').html('获取失败!'); $('.loadingText').html('获取失败!');
} }
}); });
}); });
</script> </script>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment