网站
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

71 regels
2.5 KiB

  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "interactApi", "paging"], function ($, template, Tools ) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //互动交流列表
  9. interactInformationList:'',
  10. //页码
  11. pageNum: 1,
  12. //页码集合
  13. pageList: [],
  14. //每页数量
  15. pageSize: 5,
  16. //总页数
  17. pageCount:0
  18. },
  19. };
  20. var tools = new Tools();
  21. module.init = function (page) {
  22. //互动交流
  23. tools.doGet(interactList, {deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.interactInformation,true);
  24. };
  25. //新闻资讯数据
  26. module.interactInformation = function (data) {
  27. if (data.code == 200) {
  28. console.log(data)
  29. var content = data.rows;
  30. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  31. if (pageCount < 1){
  32. pageCount = 1;
  33. }
  34. if(module.data.interactInformationList == ''){
  35. // 初始化 分页器
  36. var page_s1=createPage('.page_s1');
  37. // 设置分页
  38. setPage(page_s1,{
  39. pageTotal: data.total, // 数据总条数
  40. pageSize: module.data.pageSize, // 每页显示条数
  41. pageCurrent: 1, // 当前页
  42. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  43. })
  44. $('#page_s1').html('共'+pageCount+'页')
  45. }
  46. module.data.pageCount = pageCount;
  47. module.data.interactInformationList = content;
  48. var interactInformationData = template('interactInformationData', module.data);
  49. $("#interactInformationContent").html(interactInformationData);
  50. }
  51. }
  52. goSearch = function () {
  53. var searchTitle = $('#searchTitle').val();
  54. var searchContent = $('#searchContent').val();
  55. console.log(searchContent)
  56. console.log(searchTitle)
  57. tools.doGet(interactSearch, {deptId:100,title:searchTitle,content:searchContent,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.interactInformation,true)
  58. }
  59. turnThePage = function (pageNum) {
  60. module.data.pageNum = pageNum ;
  61. tools.doGet(interactList, {deptId:100,pageNum:pageNum,pageSize:module.data.pageSize}, module.interactInformation,true);
  62. }
  63. return module;
  64. });