网站
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

126 wiersze
4.5 KiB

  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. specialPublicityTypeOptions: [],
  14. },
  15. };
  16. var tools = new Tools();
  17. module.init = function (page) {
  18. //新闻列表
  19. tools.doGet(specialPublicityList, {
  20. pageNum:module.data.pageNum12,
  21. translate_dict:"1",
  22. pageSize:10,
  23. bookId: JSON.parse(tools.getCookie('user')).bookId,
  24. deptId: JSON.parse(tools.getCookie('user')).deptId,
  25. }, module.newsList , true);
  26. tools.doGet(webList, {}, module.webList , true);
  27. tools.doGet(webDeptType+"/special_publicity_type", {}, module.deptType,true);
  28. };
  29. //标的物类型
  30. module.deptType = function (data) {
  31. if (data.code == 200) {
  32. var content = data.data ;
  33. module.data.specialPublicityTypeOptions = content;
  34. //新闻详情
  35. tools.doGet(specialPublicityDetail, {
  36. id:getQueryVariable('id'),
  37. bookId: JSON.parse(tools.getCookie('user')).bookId,
  38. deptId: JSON.parse(tools.getCookie('user')).deptId
  39. }, module.newsDetail , true);
  40. }
  41. }
  42. //获取地址栏参数
  43. function getQueryVariable(variable){
  44. var query = window.location.search.substring(1);
  45. var vars = query.split("&");
  46. for (var i=0;i<vars.length;i++) {
  47. var pair = vars[i].split("=");
  48. if(pair[0] == variable){return pair[1];}
  49. }
  50. return(false);
  51. }
  52. module.webList = function (data) {
  53. if (data.code == 200) {
  54. var content = data.data;
  55. module.data.webList = content;
  56. var webData = template('webData', module.data);
  57. $("#webContent").html(webData);
  58. $('#ewm').attr('src', 'static/images/'+content.top.bz);
  59. }
  60. }
  61. module.newsDetail = function (data) {
  62. if (data.code == 200) {
  63. var content = data.data;
  64. content.specialPublicityType = module.selectDictLabel(module.data.specialPublicityTypeOptions,content.specialPublicityType);
  65. $('#openName')[0].innerHTML = content.openName;
  66. $('#openNy')[0].innerHTML = '公示年月:'+content.openAt;
  67. $('#openPic')[0].innerHTML = '公示图片:<br/>';
  68. if (content.openPic){
  69. let arr = content.openPic.split(',');
  70. for (let i = 0;i < arr.length; i++){
  71. $('#openPic')[0].innerHTML += '<img onclick="openDialog(\'/api'+arr[i]+'\')" src="/api'+arr[i]+'" style="width: 200px;height: 150px;margin-right: 10px;">';
  72. }
  73. }
  74. $('#qrcode')[0].innerHTML = '二维码图片:<br/>';
  75. if (content.qrcode){
  76. let arr2 = content.qrcode.split(',');
  77. for (let i = 0;i < arr2.length; i++){
  78. $('#qrcode')[0].innerHTML += '<img onclick="openDialog(\'/api'+arr2[i]+'\')" src="/api'+arr2[i]+'" style="width: 200px;height: 150px;margin-right: 10px;">';
  79. }
  80. }
  81. $('#specialPublicityType')[0].innerHTML = '公示类型:'+(content.specialPublicityType || '');
  82. $('#differCount')[0].innerHTML = '有异议数:'+(content.differCount || '');
  83. $('#agreeCount')[0].innerHTML = '无异议数:'+(content.agreeCount || '');
  84. $('#remark')[0].innerHTML = '备注:'+(content.remark || '');
  85. }
  86. }
  87. openDialog = function (src){
  88. $("#dialogOp").css('display','block');
  89. $('#dialogImg').attr('src', src);
  90. }
  91. closeDia = function (){
  92. $("#dialogOp").css('display','none');
  93. $('#dialogImg').attr('src', '');
  94. }
  95. module.newsList = function (data) {
  96. if (data.code == 200) {
  97. var content = data.rows;
  98. module.data.newList = content;
  99. var newListData = template('newListData', module.data);
  100. $("#newListContent").html(newListData);
  101. }
  102. }
  103. module.selectDictLabel = function (datas, value) {
  104. var actions = [];
  105. Object.keys(datas).some((key) => {
  106. if (datas[key].dictValue == ('' + value)) {
  107. actions.push(datas[key].dictLabel);
  108. return true;
  109. }
  110. })
  111. return actions.join('');
  112. }
  113. return module;
  114. });