|
@@ -2,82 +2,14 @@ const test9 = (function() {
|
|
|
|
|
|
|
|
|
|
|
|
- // 最新动态数据
|
|
|
- const officialAccount = {
|
|
|
- init() {
|
|
|
- this.getData();
|
|
|
- },
|
|
|
-
|
|
|
- getData() {
|
|
|
- $.ajax({
|
|
|
- /** url,data参数,
|
|
|
- * type请求类型,响应体结果,超时时间
|
|
|
- * 成功的回调,失败回调 */
|
|
|
- url: baseURL + '/getHotNews_Top10',
|
|
|
- data: {
|
|
|
- dateType: 0
|
|
|
- },
|
|
|
- type: 'POST',
|
|
|
- dataType: 'JSON',
|
|
|
- contentType: 'application/x-www-form-urlencoded',
|
|
|
- success: function(data) {
|
|
|
- if (data.success != 'true') return
|
|
|
- const {
|
|
|
- obj: dataArr
|
|
|
- } = data;
|
|
|
- if (dataArr.length == 0) {
|
|
|
- return
|
|
|
- }
|
|
|
- console.log(dataArr, '热门文章排行');
|
|
|
- // This.createRankingPopularArticles(dataArr);
|
|
|
- },
|
|
|
- error: function() {
|
|
|
- console.log('超时了');
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- createRankingPopularArticles(dataArr) {
|
|
|
- let html = '';
|
|
|
- let newDataArr = dataArr.filter((item) => {
|
|
|
- return item.titlepic != '' && item.summary != '';
|
|
|
- })
|
|
|
- newDataArr.forEach((d, i) => {
|
|
|
- html += `
|
|
|
- <div class="news" >
|
|
|
- <img src="${imgURL + d.titlepic}" class="imgx"></img>
|
|
|
- <!-- 排名 -->
|
|
|
- <div class="ranking">
|
|
|
- <span>${(i + 1 + '').padStart(2, "0")}</span>
|
|
|
- </div>
|
|
|
- <p class="title">${d.title}</p>
|
|
|
- <p class="news_cont">${d.summary}</p>
|
|
|
- </div>
|
|
|
- `
|
|
|
- })
|
|
|
- // 暂无数据隐藏
|
|
|
- $('.column3 .rmwzph .no_data').css('display', 'none')
|
|
|
- $('.column3 .rmwzph .inner').html('').append(html);
|
|
|
- // 实际的高度
|
|
|
- const actualHeight = parseInt($('.column3 .rmwzph').get(0).clientHeight) - parseInt($('.column3 .panel_title').get(0).clientHeight);
|
|
|
- // 显示的高度
|
|
|
- const showHeight = parseInt($('.column3 .inner').get(0).clientHeight);
|
|
|
- if (showHeight > actualHeight) {
|
|
|
- // setAnimation($('.column3 .rmwzph .inner'), 'news', 70)
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
// 热门文章排行
|
|
|
const RankingOfPopularArticles = {
|
|
|
init() {
|
|
|
- const This = this;
|
|
|
$.ajax({
|
|
|
/** url,data参数,
|
|
|
* type请求类型,响应体结果,超时时间
|
|
|
* 成功的回调,失败回调 */
|
|
|
- url: baseURL + '/getHotNews_Top10',
|
|
|
+ url: ZQURL + '/getHotNews_Top10',
|
|
|
data: {
|
|
|
dateType: 0
|
|
|
},
|
|
@@ -85,18 +17,23 @@ const test9 = (function() {
|
|
|
dataType: 'JSON',
|
|
|
contentType: 'application/x-www-form-urlencoded',
|
|
|
success: function(data) {
|
|
|
+ console.log(data, '热门文章排行');
|
|
|
+
|
|
|
if (data.success != 'true') return
|
|
|
const {
|
|
|
obj: dataArr
|
|
|
} = data;
|
|
|
if (dataArr.length == 0) {
|
|
|
+ $('.test9 .box9 .content').html('暂无数据');
|
|
|
+ $('.test9 .box9 .content').css({
|
|
|
+ 'color':'#fff'
|
|
|
+ })
|
|
|
return
|
|
|
}
|
|
|
- console.log(dataArr, '热门文章排行');
|
|
|
- This.createRankingPopularArticles(dataArr);
|
|
|
+ // This.createRankingPopularArticles(dataArr);
|
|
|
},
|
|
|
error: function() {
|
|
|
- console.log('超时了');
|
|
|
+ console.log('热门文章排行超时了');
|
|
|
},
|
|
|
});
|
|
|
},
|
|
@@ -142,7 +79,7 @@ const test9 = (function() {
|
|
|
eventClick('.test9');
|
|
|
|
|
|
|
|
|
- officialAccount.init()
|
|
|
+ RankingOfPopularArticles.init()
|
|
|
|
|
|
}
|
|
|
|