Notice_Window.cshtml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. @{
  2. Layout = "~/Views/Shared/_MainLayoutPage.cshtml";
  3. }
  4. <!DOCTYPE html>
  5. <head>
  6. <meta charset="utf-8">
  7. <title>layui</title>
  8. <meta name="renderer" content="webkit">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  11. <style>
  12. .message-title {
  13. font-size: 16px;
  14. font-weight: bold;
  15. padding: 1rem 1rem;
  16. width: 805px;
  17. word-wrap: break-word;
  18. }
  19. .message-detail {
  20. font-size: 14px;
  21. padding: 1rem 1rem;
  22. overflow-x:hidden
  23. }
  24. .message-detail p {
  25. width: 805px;
  26. word-wrap: break-word;
  27. }
  28. .message-person {
  29. font-size: 15px;
  30. font-weight: bold;
  31. padding: 0 1rem;
  32. color: #5840a0;
  33. }
  34. #notice div{
  35. overflow-y:auto
  36. }
  37. .messgeconfig{
  38. position:fixed;
  39. bottom:10px;
  40. right:10px;
  41. }
  42. .message-attachment
  43. {
  44. font-size: 15px;
  45. font-weight: bold;
  46. color:royalblue
  47. }
  48. </style>
  49. </head>
  50. <div class="layui-carousel" id="test1" lay-filter="test1" style="background-color:white;" >
  51. <div style="position:fixed;bottom:10px;right:10px;z-index:9999">
  52. </div>
  53. <div carousel-item="" id="notice">
  54. </div>
  55. </div>
  56. <script type="text/javascript">
  57. $(function () {
  58. Getcarousel(function () {
  59. $('.checkconfig').checkbox({
  60. onChange: function (checked) {
  61. var id = $('.layui-this').children('.message-title').attr("id");
  62. $.post("/Notice/SaveNoticeConfig", { NoticeId: id, IsOpen: checked }, function (data) {
  63. if (data == '1') {
  64. } else {
  65. top.ZLPMS.Msg('保存失败');
  66. }
  67. })
  68. }
  69. })
  70. layui.use(['carousel', 'form'], function () {
  71. var carousel = layui.carousel
  72. , form = layui.form;
  73. //常规轮播
  74. carousel.render({
  75. elem: '#test1'
  76. , arrow: 'hover'
  77. , indicator: "none"
  78. , width: "100%"
  79. , autoplay: false
  80. , full: true
  81. });
  82. });
  83. })
  84. })
  85. function Getcarousel(callback) {
  86. var FJID;
  87. $.get('/Notice/GetMessageOnIndex', function (data) {
  88. FJID=data[0].附件ID
  89. var html = "";
  90. for (item in data) {
  91. html = '<div style="background-color:antiquewhite;"><div id="'+data[item].ID+'" class="message-title" >' + data[item].标题 + '</div><div class="message-person" >' + data[item].添加人 + '-' + data[item].发布时间 + '</div><div class="message-detail" ><p>' + data[item].内容 + '</p></div> <div class="message-attachment"><a href="#" onclick="downloadfile(' + data[item].附件ID + ')">下载附件</a></div> <div class="messgeconfig"><input class="easyui-checkbox checkconfig" type="checkbox" label="不再提醒本公告" labelPosition="after" labelWidth="100px" /></div></div>'
  92. $("#notice").append(html);
  93. }
  94. if (FJID == null) {
  95. $(".message-attachment").attr("style", "display:none;")
  96. }
  97. callback();
  98. })
  99. }
  100. //下载附件文件
  101. function downloadfile(id) {
  102. window.open('/Problem/ViewProblemImage?id=' + id);
  103. }
  104. </script>