test.html 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <html lang="en">
  2. <head>
  3. <meta charset="UTF-8">
  4. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <link rel="stylesheet" href="https://iot.usky.cn/YtIoT/view/efireAnalysis/layui/css/layui.css" />
  7. <title>Document</title>
  8. <style>
  9. .layui-layer-title {
  10. background: #081A32 !important;
  11. color: #fff !important;
  12. border-bottom: 1px solid #1E9FFF !important;
  13. }
  14. .layui-layer {
  15. background: #072442 !important;
  16. color: #fff;
  17. }
  18. .layui-layer-ico {
  19. border-radius: 50%;
  20. }
  21. .layui-layer-btn .layui-layer-btn0 {
  22. font-size: 0.2rem;
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <script src="https://iot.usky.cn/YtIoT/view/efireAnalysis/layui/layui.js"></script>
  28. <script src="js/jquery.js"></script>
  29. <script>
  30. $(document).ready(function() {
  31. getReportState({
  32. "queryJson": '{"V_LOGINNAME": "admin"}'
  33. });
  34. });
  35. function getReportState(params = {}) {
  36. $.ajax({
  37. type: "POST",
  38. url: "https://iot.usky.cn/YtIoT/iot/userstate/getUserStateList",
  39. data: params,
  40. success: function(data) {
  41. var result = eval('(' + data + ')');
  42. var getState = result.RESULT[0].STATE
  43. console.log('getState')
  44. console.log(getState);
  45. if (getState != 3 && result.success) {
  46. layui.use('layer', function() {
  47. var layer = layui.layer;
  48. layer.open({
  49. icon: 7,
  50. title: '提示信息',
  51. closeBtn: false,
  52. btn: ['确定', '取消'],
  53. content: '您有报告未读,请查看!',
  54. yes: function(index, layero) { //yes对应第一个按钮“确定”
  55. if (getState == 0) {
  56. window.location.href = "../waterIndex.html";
  57. } else if (getState == 1) {
  58. window.location.href = "../waterIndex.html";
  59. } else if (getState == 2) {
  60. window.location.href = "../eleFireIndex.html";
  61. }
  62. },
  63. btn2: function(index, layero) { //该操作对应的是“取消”按钮
  64. layer.close(index)
  65. return false;
  66. },
  67. });
  68. });
  69. }
  70. },
  71. error: function() {
  72. console.log("发生错误")
  73. // alert("发生错误");
  74. },
  75. complete: function() {
  76. // console.log("ajax请求完事,最终操作在这里完成")
  77. }
  78. });
  79. }
  80. </script>
  81. </body>
  82. </html>