农燊高科官方网站
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

interact.js 2.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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: 1,
  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. turnThePage = function (pageNum) {
  53. module.data.pageNum = pageNum ;
  54. tools.doGet(interactList, {deptId:100,pageNum:pageNum,pageSize:module.data.pageSize}, module.interactInformation,true);
  55. }
  56. return module;
  57. });