Nenhuma Descrição

seeNewsDetails.js 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /**
  2. * 查看公告详情
  3. * */
  4. $(function() {
  5. var n_id = helper.request.queryString("edit_id");
  6. if(n_id){
  7. getDetails(n_id); //公告详情信息
  8. }
  9. });
  10. //获取详情
  11. function getDetails(ids) {
  12. $.getJSON(huayi.config.callcenter_url + "messageapi/api/News/getdetails", {
  13. id: ids,
  14. }, function(data) {
  15. if(data.state == "success") {
  16. $('#project_detail_title').html(data.data.title); //标题
  17. $('#project_detail_category').html(data.data.typename); //公告类型
  18. $('#news_level').text(formatterLevel(data.data.level).stateName);//紧急程度
  19. $('#news_level').addClass(formatterLevel(data.data.level).stateClass);
  20. $('#pro_location').html(data.data.provincename + (data.data.cityname == null ? '' : data.data.cityname)); //所在地
  21. $('#pro_title').html(data.data.projectname); //所属项目
  22. $('#pro_sort').html(data.data.sort); //排序编号
  23. $('#createtime').html(data.data.createtime); //创建时间
  24. //logo
  25. if(data.data.headimg) {
  26. $('#project_img').attr('src', data.data.headimg);
  27. } else {
  28. $('#project_img').attr('src', '');
  29. }
  30. $('#project_detail_content').html(helper.filter.content(decodeURIComponent(data.data.content))); //项目内容
  31. //项目图纸
  32. var EnclosureList = data.data.files;
  33. if(EnclosureList && EnclosureList.length > 0) {
  34. var $list = $("#fileList");
  35. $.each(EnclosureList, function(i, v) {
  36. if(v.filesmallurl) {
  37. //原来的图片
  38. var $li = $(
  39. '<li><span class="img_mask"><a href="' + v.fileurl + '" download="filename" title="点击下载"><i class="glyphicon glyphicon-download-alt" aria-hidden="true"></i></a></span>' +
  40. '<img layer-src="' + v.fileurl + '" src="' + v.filesmallurl + '" title="图片" alt="' + v.filename + '"/>' +
  41. '<span class="file_name">' + v.filename + '</span>' +
  42. '</li>'
  43. );
  44. $list.append($li);
  45. } else {
  46. var $liFile = $(
  47. '<li><span class="img_mask"><a href="' + v.fileurl + '" download="filename" title="点击下载"><i class="glyphicon glyphicon-download-alt" aria-hidden="true"></i></a></span>' +
  48. '<div class="noThumb" title="文件"><i class="glyphicon glyphicon-paperclip"></i><p>无法预览</p></div>' +
  49. '<span class="file_name">' + v.filename + '</span>' +
  50. '</li>'
  51. );
  52. $list.append($liFile);
  53. }
  54. });
  55. layer.photos({
  56. photos: '#fileList',
  57. anim: 5, //0-6的选择,指定弹出图片动画类型,默认随机(请注意,3.0之前的版本用shift参数)
  58. title: '查看图片',
  59. move: '.layui-layer-title',
  60. shadeClose: false,
  61. closeBtn: 1,
  62. area: ['80%', '90%'],
  63. tab: function(pic, layero) {
  64. $('.layui-layer-content').on("mousewheel", function(e, d) {
  65. helper.methods.zoomImg($('#layui-layer-photos').find('img[alt="' + pic.alt + '"]'), d);
  66. $('#layui-layer-photos').find('img[alt="' + pic.alt + '"]').dragging({
  67. move: "both", //拖动方向,x y both
  68. randomPosition: false //初始位置是否随机
  69. });
  70. return false;
  71. });
  72. helper.methods.initLayerPhotos('#layui-layer-photos', pic, layero);
  73. },
  74. });
  75. } else {
  76. $("#fileList").html('<p>暂无内容。。。</p>');
  77. }
  78. }
  79. });
  80. }
  81. //格式化紧急程度
  82. function formatterLevel(val) {
  83. //1 非常紧急,2 紧急,3 较急, 4 一般
  84. var stateClass, stateName;
  85. switch(val) {
  86. case 1:
  87. stateClass = 'state_audit_termination';
  88. stateName = '非常紧急';
  89. break;
  90. case 2:
  91. stateClass = 'state_audit_refuse';
  92. stateName = '紧急';
  93. break;
  94. case 3:
  95. stateClass = 'state_audit_wait';
  96. stateName = '较急';
  97. break;
  98. case 4:
  99. stateClass = 'state_audit_done';
  100. stateName = '一般';
  101. break;
  102. default:
  103. stateClass = 'text-block';
  104. stateName = '-';
  105. break;
  106. }
  107. return {
  108. "stateClass": stateClass,
  109. "stateName": stateName
  110. }
  111. }