document.write('');
//logo
vue.component('logo-com', {
template: '' +
' \n' +
' \n' +
' \n' +
' \n' +
' \n' +
'
\n' +
' \n' +
' \n' +
' \n' +
' \n' +
' \n' +
' \n' +
' ' +
' ' +
' \n' +
' 搜索\n' +
' ' +
' \n' +
' \n' +
' \n' +
' \n' +
' \n' +
' \n' +
' \n' +
'
\n' +
' \n' +
' ',
data: function () {
return {
topadvbannerrows: [],
navdata: [],
searchkey: '',
}
},
mounted: function () {
this.gettopadvbanner();
this.getnavdata();
},
methods: {
//获取顶部广告
gettopadvbanner: function () {
var app = this;
var url = pageconfig.baseurl + "/api/getarticles?cid=6368&rownumber=0&pagesize=1";
axios.get(url).then(function (results) {
if (results.data && results.data.list && results.data.list.length > 0) {
app.topadvbannerrows = results.data.list;
} else {
app.$message.error(results.data.msg);
}
}).catch(function (error) {
console.log(error);
});
},
//获取数据
getnavdata: function () {
var _this = this;
var url = pageconfig.baseurl + '/api/getsuncolumnlist?cid=5798';
axios.get(url).then(function (result) {
if (result && result.data && result.data.columns && result.data.columns.length > 0) {
_this.navdata = result.data.columns;
_this.$nexttick(function () {
$(".drop-menu-effect>li").each(function (index) {
$(this).hover(function (e) {
$(this).find('ul').slidedown();
$(this).siblings().find('ul').slideup();
}, function (e) {
$(this).find("ul").slideup();
});
})
})
}
}).catch(function (error) {
console.log(error);
});
},
//检索
searcharticle: function () {
var keyword = this.searchkey;
//get请求转码两次,防止中文乱码,服务器端使用decodeuricomponent
keyword = encodeuri(keyword);
keyword = encodeuri(keyword);
if (keyword) {
window.open("./searchcolumn.html?search=" + keyword);
}
},
}
})
//footer
vue.component('footer-com', {
template: '',
data: function () {
},
})
//纯文字
vue.component('hot-news', {
template: '
',
data: function () {
return {
pointdata: []
}
},
created: function () {
this.gethotdata();
},
methods: {
gethotdata: function () {
var _this = this;
var url = pageconfig.baseurl + "/api/getarticles" + "?cid=" + 4829 + "&pagesize=10&containsubcols=1";
axios.get(url).then(function (results) {
if (results.data && results.data.list && results.data.list.length > 0) {
_this.pointdata = results.data;
_this.pointdata.list = _this.processarticles(results.data.list);
}
}).catch(function (error) {
console.log(error);
});
},
processarticles: function (list) {
for (var i in list) {
if (list[i].articletype == 3) {//链接稿件
list.articleurl = list.articleurl;
} else if (list[i].articletype == 4) {//专题稿件
list[i].articleurl = './special.html?cid=' + list[i].linkid;
} else {//其他稿件
list[i].articleurl = './news.html?aid=' + list[i].fileid;
}
}
return list;
},
}
})
//视频
vue.component('video-news', {
template: '',
data: function () {
return {
pointdata: [],
defaultimg: './images/default-bg-image169.png'
}
},
created: function () {
this.gethotdata();
},
methods: {
gethotdata: function () {
var _this = this;
var url = pageconfig.baseurl + "/api/getarticles" + "?cid=" + 4875 + "&pagesize=10&containsubcols=1";
axios.get(url).then(function (results) {
if (results.data && results.data.list && results.data.list.length > 0) {
_this.pointdata = results.data;
_this.pointdata.list = _this.processarticles(results.data.list);
}
}).catch(function (error) {
console.log(error);
});
},
processarticles: function (list) {
for (var i in list) {
if (list[i].articletype == 3) {//链接稿件
list.articleurl = list.articleurl;
} else if (list[i].articletype == 4) {//专题稿件
list[i].articleurl = './special.html?cid=' + list[i].linkid;
} else {//其他稿件
list[i].articleurl = './news.html?aid=' + list[i].fileid;
}
}
return list;
},
}
})
//列表带图
vue.component('images-news', {
template: '',
data: function () {
return {
pointdata: [],
defaultimg: './images/default-bg-image169.png'
}
},
created: function () {
this.gethotdata();
},
methods: {
gethotdata: function () {
var _this = this;
var url = pageconfig.baseurl + "/api/getarticles" + "?cid=" + 4829 + "&pagesize=10&containsubcols=1";
axios.get(url).then(function (results) {
if (results.data && results.data.list && results.data.list.length > 0) {
_this.pointdata = results.data;
_this.pointdata.list = _this.processarticles(results.data.list);
}
}).catch(function (error) {
console.log(error);
});
},
processarticles: function (list) {
for (var i in list) {
if (list[i].articletype == 3) {//链接稿件
list.articleurl = list.articleurl;
} else if (list[i].articletype == 4) {//专题稿件
list[i].articleurl = './special.html?cid=' + list[i].linkid;
} else {//其他稿件
list[i].articleurl = './news.html?aid=' + list[i].fileid;
}
}
return list;
},
}
})
//纯文字带时间
vue.component('special-news', {
template: '\n' +
'
\n' +
'
\n' +
'
\n' +
' - \n' +
' ' +
' \n' +
' {{article.title}}\n' +
' {{article.publishtime?article.publishtime.substring(0,11):\'\'}}' +
'
\n' +
'
\n' +
'
\n' +
'
',
data: function () {
return {
pointdata: []
}
},
created: function () {
this.gethotdata();
},
methods: {
gethotdata: function () {
var _this = this;
var url = pageconfig.baseurl + "/api/getarticles" + "?cid=" + 4864 + "&pagesize=10&containsubcols=1";
axios.get(url).then(function (results) {
if (results.data && results.data.list && results.data.list.length > 0) {
_this.pointdata = results.data;
_this.pointdata.list = _this.processarticles(results.data.list);
}
}).catch(function (error) {
console.log(error);
});
},
processarticles: function (list) {
for (var i in list) {
if (list[i].articletype == 3) {//链接稿件
list.articleurl = list.articleurl;
} else if (list[i].articletype == 4) {//专题稿件
list[i].articleurl = './special.html?cid=' + list[i].linkid;
} else {//其他稿件
list[i].articleurl = './news.html?aid=' + list[i].fileid;
}
}
return list;
},
}
})