/** * Created by Administrator on 2021/4/5. */ define(['jquery', "template", "Tools", "interactApi", "paging"], function ($, template, Tools ) { //数据存储 var module = { data: { //互动交流列表 interactInformationList:'', //搜索结果列表 searchInformationList:'', //页码 pageNum: 1, //页码集合 pageList: [], //每页数量 pageSize: 5, //总页数 pageCount:0 }, }; var tools = new Tools(); module.init = function (page) { //互动交流 tools.doGet(interactList, {deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize,reply:'notnull'}, module.interactInformation,true); //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号) tools.getWebConfig(); }; //新闻资讯数据 module.interactInformation = function (data) { if (data.code == 200) { console.log(data) var content = data.rows; var pageCount = (data.total/module.data.pageSize).toFixed(0); if (pageCount < 1){ pageCount = 1; } console.log(module.data.interactInformationList) if(module.data.interactInformationList == ''){ console.log('aaa') // 初始化 分页器 var page_s1=createPage('.page_s1'); // 设置分页 setPage(page_s1,{ pageTotal: data.total, // 数据总条数 pageSize: module.data.pageSize, // 每页显示条数 pageCurrent: module.data.pageNum, // 当前页 maxBtnNum: 5, // 最多按钮个数 (最少5个) }) $('#page_s1').html('共'+pageCount+'页') } module.data.pageCount = pageCount; module.data.interactInformationList = content; var interactInformationData = template('interactInformationData', module.data); $("#interactInformationContent").html(interactInformationData); } } //新闻资讯数据 module.searchInteractInformation = function (data) { if (data.code == 200) { var content = data.rows; var pageCount = (data.total/module.data.pageSize).toFixed(0); if (pageCount < 1){ pageCount = 1; } console.log(module.data.searchInformationList) if(module.data.searchInformationList == ''){ // 初始化 分页器 var page_s1=createPage('.page_s2'); // 设置分页 setPage(page_s1,{ pageTotal: data.total, // 数据总条数 pageSize: module.data.pageSize, // 每页显示条数 pageCurrent: module.data.pageNum, // 当前页 maxBtnNum: 5, // 最多按钮个数 (最少5个) }) $('#page_s2').html('共'+pageCount+'页') } module.data.pageCount = pageCount; module.data.searchInformationList = content; var searchInformationData = template('searchInformationData', module.data); $("#searchInformationContent").html(searchInformationData); } } goSearch = function () { var searchTitle = $('#searchTitle').val(); var searchContent = $('#searchContent').val(); module.data.searchTitle = searchTitle ; module.data.searchContent = searchContent ; module.data.pageNum = 1 ; document.getElementById('interact').style.display = 'none'; document.getElementById('search').style.display = 'block'; tools.doGet(interactSearch, {deptId:100,title:searchTitle,content:searchContent,pageNum:1,pageSize:module.data.pageSize}, module.searchInteractInformation,true) } turnThePage = function (pageNum) { module.data.pageNum = pageNum ; console.log(pageNum) if (module.data.searchType == 'YES'){ tools.doGet(interactSearch, {deptId:100,title:module.data.searchTitle,content:module.data.searchContent,pageNum:pageNum,pageSize:module.data.pageSize}, module.interactInformation,true) }else{ tools.doGet(interactList, {deptId:100,pageNum:pageNum,pageSize:module.data.pageSize}, module.interactInformation,true); } } goUserInteract = function () { tools.skip('../user/user.html?type=goInteract') } return module; });