/** * Created by Administrator on 2021/4/5. */ define(['jquery', "template", "Tools", "interactApi", "paging"], function ($, template, Tools ) { //数据存储 var module = { data: { //互动交流列表 interactInformationList:'', //页码 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}, module.interactInformation,true); }; //新闻资讯数据 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; } if(module.data.interactInformationList == ''){ // 初始化 分页器 var page_s1=createPage('.page_s1'); // 设置分页 setPage(page_s1,{ pageTotal: data.total, // 数据总条数 pageSize: module.data.pageSize, // 每页显示条数 pageCurrent: 1, // 当前页 maxBtnNum: 5, // 最多按钮个数 (最少5个) }) $('#page_s1').html('共'+pageCount+'页') } module.data.pageCount = pageCount; module.data.interactInformationList = content; var interactInformationData = template('interactInformationData', module.data); $("#interactInformationContent").html(interactInformationData); } } goSearch = function () { var searchTitle = $('#searchTitle').val(); var searchContent = $('#searchContent').val(); console.log(searchContent) console.log(searchTitle) tools.doGet(interactSearch, {deptId:100,title:searchTitle,content:searchContent,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.interactInformation,true) } turnThePage = function (pageNum) { module.data.pageNum = pageNum ; tools.doGet(interactList, {deptId:100,pageNum:pageNum,pageSize:module.data.pageSize}, module.interactInformation,true); } return module; });