|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- /**
- * 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);
-
- //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
- 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;
- }
- 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;
- });
|