网站
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

discussionsDetail_03.js 3.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools"], function ($, template, Tools) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //服务器地址
  9. serverApi:'',
  10. //焦点图数据
  11. focusList: [],
  12. communicateList: [],
  13. },
  14. };
  15. var tools = new Tools();
  16. module.init = function (page) {
  17. //新闻详情
  18. tools.doGet(majorEventPublicDetail, {
  19. id:getQueryVariable('id'),
  20. bookId: JSON.parse(tools.getCookie('user')).bookId,
  21. deptId: JSON.parse(tools.getCookie('user')).deptId
  22. }, module.newsDetail , true);
  23. //新闻列表
  24. tools.doGet(majorEventPublicList, {
  25. pageNum:1,
  26. pageSize:10,
  27. orderByColumn: 'openNy',
  28. isAsc: 'desc',
  29. bookId: JSON.parse(tools.getCookie('user')).bookId,
  30. deptId: JSON.parse(tools.getCookie('user')).deptId
  31. }, module.newsList , true);
  32. tools.doGet(webList, {}, module.webList , true);
  33. };
  34. //获取地址栏参数
  35. function getQueryVariable(variable){
  36. var query = window.location.search.substring(1);
  37. var vars = query.split("&");
  38. for (var i=0;i<vars.length;i++) {
  39. var pair = vars[i].split("=");
  40. if(pair[0] == variable){return pair[1];}
  41. }
  42. return(false);
  43. }
  44. module.webList = function (data) {
  45. if (data.code == 200) {
  46. var content = data.data;
  47. module.data.webList = content;
  48. var webData = template('webData', module.data);
  49. $("#webContent").html(webData);
  50. }
  51. }
  52. module.newsDetail = function (data) {
  53. if (data.code == 200) {
  54. var content = data.data;
  55. $('#openName')[0].innerHTML = content.openName;
  56. $('#openNy')[0].innerHTML = '公开年月:'+content.openNy;
  57. $('#openPic')[0].innerHTML = '公开图片:<br/>';
  58. if (content.openPic){
  59. let arr = content.openPic.split(',');
  60. for (let i = 0;i < arr.length; i++){
  61. $('#openPic')[0].innerHTML += '<img src="/api'+arr[i]+'" style="width: 200px;height: 150px;margin-right: 10px;">';
  62. }
  63. }
  64. $('#openFile')[0].innerHTML = '附件:<br/>';
  65. if (content.openFile){
  66. let arr2 = content.openFile.split(',');
  67. for (let i = 0;i < arr2.length; i++){
  68. $('#openFile')[0].innerHTML += '<a href="/api'+arr2[i]+'">';
  69. }
  70. }
  71. $('#content')[0].innerHTML = '内容:'+content.content;
  72. $('#remark')[0].innerHTML = '备注:'+content.remark;
  73. }
  74. }
  75. module.newsList = function (data) {
  76. if (data.code == 200) {
  77. var content = data.rows;
  78. module.data.newList = content;
  79. var newListData = template('newListData', module.data);
  80. $("#newListContent").html(newListData);
  81. }
  82. }
  83. return module;
  84. });