style:新闻
Showing
1 changed file
with
5 additions
and
5 deletions
... | @@ -70,6 +70,11 @@ function NewsData() { | ... | @@ -70,6 +70,11 @@ function NewsData() { |
70 | //数据,这里使用的是Json格式进行传输 | 70 | //数据,这里使用的是Json格式进行传输 |
71 | success: function (result) {//返回数据根据结果进行相应的处理 | 71 | success: function (result) {//返回数据根据结果进行相应的处理 |
72 | if (result.code == 200 && result.data != null) { | 72 | if (result.code == 200 && result.data != null) { |
73 | if(result.data[0].preViewUrl) { | ||
74 | $('.news-img img').attr('src',result.data[0].preViewUrl); | ||
75 | }else { | ||
76 | $('.news-img img').attr('src','./staticImages/news_demo.jpg'); | ||
77 | } | ||
73 | for (var i = 0; i < result.data.length; i++) { | 78 | for (var i = 0; i < result.data.length; i++) { |
74 | if (i == 6) return; | 79 | if (i == 6) return; |
75 | publishTime = CutDate(result.data[i].publishTime); | 80 | publishTime = CutDate(result.data[i].publishTime); |
... | @@ -86,11 +91,6 @@ function NewsData() { | ... | @@ -86,11 +91,6 @@ function NewsData() { |
86 | li += '<span>' + publishTime + '</span></a></li>'; | 91 | li += '<span>' + publishTime + '</span></a></li>'; |
87 | ulNews.append(li); | 92 | ulNews.append(li); |
88 | } | 93 | } |
89 | if(result.data[0].preViewUrl) { | ||
90 | $('.news-img img').attr('src',result.data[0].preViewUrl); | ||
91 | }else { | ||
92 | $('.news-img img').attr('src','./staticImages/news_demo.jpg'); | ||
93 | } | ||
94 | } | 94 | } |
95 | } | 95 | } |
96 | }); | 96 | }); | ... | ... |
-
Please register or sign in to post a comment