|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- /**
- * Created by Administrator on 2021/4/5.
- */
- define(['jquery', "template", "Tools", "newApi", 'swiper'], function ($, template, Tools ) {
- //数据存储
- var module = {
- data: {
- //焦点图数据
- focusListTop: [],
- newsInformationList:''
- },
- };
- var tools = new Tools();
-
- module.init = function (page) {
- //获取焦点图信息
- tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true);
- //底部友情链接
- tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
- //console.log(getQueryVariable('id'))
- //新闻资讯
- tools.doGet(newDetail + '/'+getQueryVariable('id'), {}, module.NewsInformation,true);
-
- //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
- tools.getWebConfig();
- };
-
- //焦点图数据
- module.focusNewsTop = function (data) {
- if (data.code == 200) {
- module.data.focusListTop = data.data;
- var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
- $("#bannerFocusTopContent").html(bannerFocusDataTop);
-
- new Swiper('#bannerFocusWrapTop', {
- paginationClickable: true,
- autoplay : 4000,
- loop:true
- })
-
- }
- }
- //底部友情链接
- module.bottomFriendsLinks = function (data) {
- if (data.code == 200) {
- var content = data.data;
- //console.log(content)
- module.data.friendsLinksList = content;
- var friendsLinksData = template('friendsLinksData', module.data);
- $("#friendsLinksContent").html(friendsLinksData);
- }
- }
-
- //获取地址栏参数
- function getQueryVariable(variable){
- var query = window.location.search.substring(1);
- var vars = query.split("&");
- for (var i=0;i<vars.length;i++) {
- var pair = vars[i].split("=");
- if(pair[0] == variable){return pair[1];}
- }
- return(false);
- }
-
- //新闻资讯数据
- module.NewsInformation = function (data) {
- //console.log(data)
- if (data.code == 200) {
- var content = data.data;
- $("#newTitle").html(content.title);
- $("#newTime").html(content.newsTime);
- $("#newCome").html(content.createBy);
- $("#newContent").html(content.content);
- }
- }
-
- return module;
- });
|