|
@@ -1,51 +1,52 @@
|
|
|
function getajaxTop(params, path) {
|
|
|
- $.ajax({
|
|
|
- type: "get",
|
|
|
- url: path + "/article/getOfficialAccountByPaging",
|
|
|
- async: false,
|
|
|
- data: params,
|
|
|
- success: function (res) {
|
|
|
- var liText = "";
|
|
|
- console.log(res, "first");
|
|
|
- if (res.code === 0 && res.data && res.data.length > 0) {
|
|
|
- if (res.data.length > 7) {
|
|
|
- res.data.splice(7);
|
|
|
- }
|
|
|
- res.data.forEach((item) => {
|
|
|
- liText += `<li><span onclick="openUrl('${item.url}')">${item.title}</span><img src="data:${item.cover}" alt=""></li>`;
|
|
|
- });
|
|
|
- console.log(res.data[0].cover)
|
|
|
- var htmlText = "<img src='data:"+res.data[0].cover+"');' alt='' class='img'>" +
|
|
|
- "</img>" +
|
|
|
- "<ul>" +liText+"</ul>";
|
|
|
- $(".messagetop").html(htmlText);
|
|
|
- }
|
|
|
- },
|
|
|
- error: function (err) {
|
|
|
- console.log(err);
|
|
|
- },
|
|
|
- });
|
|
|
+ $.ajax({
|
|
|
+ type: "get",
|
|
|
+ url: path + "/article/getOfficialAccountByPaging",
|
|
|
+ async: false,
|
|
|
+ data: params,
|
|
|
+ success: function (res) {
|
|
|
+ var liText = "";
|
|
|
+ console.log(res, "first");
|
|
|
+ if (res.code === 0 && res.data && res.data.length > 0) {
|
|
|
+ if (res.data.length > 7) {
|
|
|
+ res.data.splice(7);
|
|
|
+ }
|
|
|
+ res.data.forEach((item) => {
|
|
|
+ liText += `<li><span onclick="openUrl('${item.url}')">${item.title}</span><img src="data:${item.cover}" alt=""></li>`;
|
|
|
+ });
|
|
|
+ console.log(res.data[0].cover)
|
|
|
+ var htmlText = "<img src='data:" + res.data[0].cover + "');' alt='' class='img'>" +
|
|
|
+ "</img>" +
|
|
|
+ "<ul>" + liText + "</ul>";
|
|
|
+ $(".messagetop").html(htmlText);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (err) {
|
|
|
+ console.log(err);
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
+
|
|
|
function changeDate(params, path) {
|
|
|
- $.ajax({
|
|
|
- type: "get",
|
|
|
- url: path + "/article/getNAFBArticleByDate",
|
|
|
- async: false,
|
|
|
- data: params,
|
|
|
- success: function (res) {
|
|
|
- var liText = "";
|
|
|
- console.log(res, "res");
|
|
|
- if (res.code === 0 && res.data && res.data.length > 0) {
|
|
|
- res.data.forEach((item) => {
|
|
|
- liText += `<li><span onclick="openUrl('${item.url}')">${item.title}</span><img src="images/g.png" alt=""></li>`;
|
|
|
- });
|
|
|
- $(".datali").html(liText);
|
|
|
- }
|
|
|
- },
|
|
|
- error: function (err) {
|
|
|
- console.log(err);
|
|
|
- },
|
|
|
- });
|
|
|
+ $.ajax({
|
|
|
+ type: "get",
|
|
|
+ url: path + "/article/getNAFBArticleByDate",
|
|
|
+ async: false,
|
|
|
+ data: params,
|
|
|
+ success: function (res) {
|
|
|
+ var liText = "";
|
|
|
+ console.log(res, "res");
|
|
|
+ if (res.code === 0 && res.data && res.data.length > 0) {
|
|
|
+ res.data.forEach((item) => {
|
|
|
+ liText += `<li><span onclick="openUrl('${item.url}')">${item.title}</span><img src="images/g.png" alt=""></li>`;
|
|
|
+ });
|
|
|
+ $(".datali").html(liText);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (err) {
|
|
|
+ console.log(err);
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
function initPage() {
|
|
@@ -62,10 +63,7 @@ function initPage() {
|
|
|
},
|
|
|
success: function (json) {
|
|
|
if (json.data) {
|
|
|
- var data = json.data;
|
|
|
- topData = data.array;
|
|
|
- ofaData = data.ofa;
|
|
|
- initJrttList(data.jrtt);
|
|
|
+ initOfaList(json.data.ofa);
|
|
|
}
|
|
|
layer.close(loading);
|
|
|
},
|
|
@@ -75,97 +73,131 @@ function initPage() {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function initJrttList(data) {
|
|
|
- $('#jrttList').empty();
|
|
|
- console.log(data)
|
|
|
- var html = '';
|
|
|
- for (var i = 0; i < data.length; i++) {
|
|
|
- html +=
|
|
|
- '<li class="wxInfo" onclick="openDetail()">'
|
|
|
- + '<img src="images/logo-zf.png" alt="" class="logo">'
|
|
|
- + '<div class="name">'
|
|
|
- +'<span>重</span><span>庆</span><span>市</span><span>南</span><span>岸</span><span>区</span><span>人</span>民<span></span>'
|
|
|
- +'<span>政</span><span>府</span>'
|
|
|
- +'</div>'
|
|
|
- +'<img src="images/erweima.png" alt="" class="code">'
|
|
|
- +'</li>'
|
|
|
-
|
|
|
+function regionPage() {
|
|
|
+ $.ajax({
|
|
|
+ type: 'GET',
|
|
|
+ url: PATH + '/article/getRegionAllOfficialAccount',
|
|
|
+ dataType: 'json',
|
|
|
+ data: {
|
|
|
+ 'type': 1,
|
|
|
+ 'official': '重庆市政府网'
|
|
|
+ },
|
|
|
+ success: function (json) {
|
|
|
+ if (json.data) {
|
|
|
+ initOfaList(json.data.ofa);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (e) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
- // '<div class="news-item" data-url="' + data[i].url + '">'
|
|
|
- // + ' <div class="jigou"><span>' + data[i].officialAccount + '</span></div>'
|
|
|
- // + ' <p>' + data[i].title + '</p>'
|
|
|
- // + ' <span class="time">' + data[i].createTime + '</span>'
|
|
|
- // + ' </div>';
|
|
|
+function departments() {
|
|
|
+ $.ajax({
|
|
|
+ type: 'GET',
|
|
|
+ url: PATH + '/article/getRegionAllOfficialAccount',
|
|
|
+ dataType: 'json',
|
|
|
+ data: {
|
|
|
+ 'type': 2,
|
|
|
+ 'official': '中新互联互通项目'
|
|
|
+ },
|
|
|
+ success: function (json) {
|
|
|
+ if (json.data) {
|
|
|
+ initOfaList(json.data.ofa);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (e) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
+function initOfaList(data) {
|
|
|
+ $('#ofaList').empty();
|
|
|
+ var html = '';
|
|
|
+ for (var i = 0; i < data.length; i++) {
|
|
|
+ if (data[i].wType != '微信公众号') {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ var wxName = '';
|
|
|
+ for (var j = 0; j < data[i].wName.length; j++) {
|
|
|
+ wxName += '<span>'
|
|
|
+ + data[i].wName.substr(j, 1)
|
|
|
+ + '</span>'
|
|
|
+ }
|
|
|
+ html += '<li class="wxInfo" onclick="openDetail()">'
|
|
|
+ + '<img src="' + data[i].wxHead + '" alt="" class="logo">'
|
|
|
+ + '<div class="name">'
|
|
|
+ + wxName
|
|
|
+ + '</div>'
|
|
|
+ + '<img src="images/erweima.png" alt="" class="code">'
|
|
|
+ + '</li>';
|
|
|
}
|
|
|
- $('#jrttList').append(html)
|
|
|
- jrttClick();
|
|
|
+ $('#ofaList').append(html);
|
|
|
}
|
|
|
|
|
|
function openUrl(url) {
|
|
|
- window.open(url);
|
|
|
+ window.open(url);
|
|
|
}
|
|
|
+
|
|
|
function getHotData(params, path) {
|
|
|
- var result = []
|
|
|
- $.ajax({
|
|
|
- type: "get",
|
|
|
- url: path + "/article/getOfficialAccountByPaging",
|
|
|
- async: false,
|
|
|
- data: params,
|
|
|
- success: function (res) {
|
|
|
- var liText = "";
|
|
|
- console.log(res, "first");
|
|
|
- if (res.code === 0 && res.data && res.data.length > 0) {
|
|
|
- result = res.data
|
|
|
- }
|
|
|
- },
|
|
|
- error: function (err) {
|
|
|
- console.log(err);
|
|
|
- },
|
|
|
- });
|
|
|
- return result;
|
|
|
+ var result = []
|
|
|
+ $.ajax({
|
|
|
+ type: "get",
|
|
|
+ url: path + "/article/getOfficialAccountByPaging",
|
|
|
+ async: false,
|
|
|
+ data: params,
|
|
|
+ success: function (res) {
|
|
|
+ var liText = "";
|
|
|
+ console.log(res, "first");
|
|
|
+ if (res.code === 0 && res.data && res.data.length > 0) {
|
|
|
+ result = res.data
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (err) {
|
|
|
+ console.log(err);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
function getTabData(params, path) {
|
|
|
- $.ajax({
|
|
|
- type: 'GET',
|
|
|
- url: path + '/article/getAllOfficialAccount',
|
|
|
- dataType: 'json',
|
|
|
- data: params,
|
|
|
- success: function (json) {
|
|
|
- if (json.data) {
|
|
|
- var result = json.data;
|
|
|
- console.log(result)
|
|
|
- regionJrttList(result)
|
|
|
- }
|
|
|
- },
|
|
|
- error: function (e) {
|
|
|
- }
|
|
|
- });
|
|
|
+ $.ajax({
|
|
|
+ type: 'GET',
|
|
|
+ url: path + '/article/getAllOfficialAccount',
|
|
|
+ dataType: 'json',
|
|
|
+ data: params,
|
|
|
+ success: function (json) {
|
|
|
+ if (json.data) {
|
|
|
+ var result = json.data;
|
|
|
+ console.log(result)
|
|
|
+ regionJrttList(result)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (e) {
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
// 今日头条
|
|
|
function regionJrttList(result) {
|
|
|
- var data = result.jrtt
|
|
|
- $('#jrttList').empty();
|
|
|
- var html = '';
|
|
|
- for (var i = 0; i < data.length; i++) {
|
|
|
- // html += '<div class="news-item" onclick="openUrl(\''+ data[i].url +'\')">'
|
|
|
- html += '<div class="news-item" data-url="' + data[i].url + '">'
|
|
|
- + ' <div class="jigou"><span>' + data[i].officialAccount + '</span></div>'
|
|
|
- + ' <p>' + data[i].title + '</p>'
|
|
|
- + ' <span class="time">' + data[i].createTime + '</span>'
|
|
|
- + ' </div>';
|
|
|
- }
|
|
|
- $('#jrttList').append(html)
|
|
|
- $('#jrttList .news-item').click(function () {
|
|
|
- window.open($(this).attr('data-url'))
|
|
|
- })
|
|
|
+ var data = result.jrtt
|
|
|
+ $('#jrttList').empty();
|
|
|
+ var html = '';
|
|
|
+ for (var i = 0; i < data.length; i++) {
|
|
|
+ // html += '<div class="news-item" onclick="openUrl(\''+ data[i].url +'\')">'
|
|
|
+ html += '<div class="news-item" data-url="' + data[i].url + '">'
|
|
|
+ + ' <div class="jigou"><span>' + data[i].officialAccount + '</span></div>'
|
|
|
+ + ' <p>' + data[i].title + '</p>'
|
|
|
+ + ' <span class="time">' + data[i].createTime + '</span>'
|
|
|
+ + ' </div>';
|
|
|
+ }
|
|
|
+ $('#jrttList').append(html)
|
|
|
+ $('#jrttList .news-item').click(function () {
|
|
|
+ window.open($(this).attr('data-url'))
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
var PATH = "https://www.cqna.gov.cn/data";
|
|
|
//初始化数据
|
|
|
// changeDate({ date: $("#time").text().trim() }, PATH);
|
|
@@ -173,6 +205,6 @@ var PATH = "https://www.cqna.gov.cn/data";
|
|
|
|
|
|
|
|
|
$(".messagetop").delegate("li", "click", function () {
|
|
|
- var url = $(this).children("span").attr("clickurl");
|
|
|
- window.location.href(url);
|
|
|
+ var url = $(this).children("span").attr("clickurl");
|
|
|
+ window.location.href(url);
|
|
|
});
|