home.php 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. require_once 'conn.php';
  3. checkLogin();
  4. ?>
  5. <!DOCTYPE html>
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9. <title>管理区域</title>
  10. <link rel="stylesheet" href="css/common.css" type="text/css" />
  11. <link rel="stylesheet" href="css/alert.css" type="text/css" />
  12. <script src="system/js/jquery-1.7.2.min.js"></script>
  13. <script src="js/js.js"></script>
  14. </head>
  15. <body class="clear">
  16. <?php require_once 'panel.php'; ?>
  17. <div id="man_zone">
  18. <div class="searchForm homeSearch">
  19. <form method="post" action="/searchResult.php" accept-charset="UTF-8">
  20. <input class="keywords" id="keyword" name="keywords" placeholder="请输入联系人 / 电话 / 邮箱 / 微信 / WhatsApp.." >
  21. <input class="searchSubmit" type="submit" value="客户检索">
  22. </form>
  23. </div>
  24. </div>
  25. <?php
  26. $sql = "SELECT cs_code, em_user, cs_claimdate FROM customer
  27. LEFT JOIN employee ON customer.cs_belong = employee.id
  28. WHERE customer.id IN (
  29. SELECT cs_id FROM claimRecord
  30. WHERE isread = 0 AND originalEmp = ?
  31. )";
  32. $stmt = $conn->prepare($sql);
  33. $stmt->bind_param("s", $_SESSION['employee_name']);
  34. $stmt->execute();
  35. $result = $stmt->get_result();
  36. if ($result->num_rows > 0) {
  37. ?>
  38. <div class="modal" id="modal">
  39. <div class="modal-wraper">
  40. <div class="modal-content">
  41. <div class="popup-title">距离上次登录之后,以下客户已经被认领</div>
  42. <div class="popup-content">
  43. <ul>
  44. <?php while ($row = $result->fetch_assoc()) { ?>
  45. <li>
  46. <span class="prominent"><?= textUncode($row['cs_code']) ?></span> 被
  47. <span class="prominent"><?= textUncode($row['em_user']) ?></span> 于
  48. <span><?= textUncode($row['cs_claimdate']) ?></span> 认领
  49. </li>
  50. <?php } ?>
  51. </ul>
  52. </div>
  53. <div class="close" onclick="closePopup()">已读</div>
  54. </div>
  55. </div>
  56. </div>
  57. <?php
  58. }
  59. // Update claim records
  60. $update_sql = "UPDATE claimRecord SET isread = 1
  61. WHERE originalEmp = ? AND isread = 0";
  62. $update_stmt = $conn->prepare($update_sql);
  63. $update_stmt->bind_param("s", $_SESSION['employee_name']);
  64. $update_stmt->execute();
  65. $stmt->close();
  66. $update_stmt->close();
  67. ?>
  68. <script>
  69. // 检查是否首次登陆或是否过期
  70. const em = localStorage.getItem('em');
  71. const currentTime = new Date().getTime();
  72. const expirationTime = 24 * 60 * 60 * 1000; // 24小时的有效时间
  73. console.log(em);
  74. if (!em || em !== 'em<?= $_SESSION["employee_id"] ?>') {
  75. // 如果是首次登陆或已过期,显示弹窗
  76. $("#modal").addClass("active");
  77. setTimeout(function() {
  78. $("#modal").find(".modal-content").addClass("active");
  79. }, 0);
  80. // 存储当前时间戳
  81. localStorage.setItem('em', 'em<?= $_SESSION["employee_id"] ?>');
  82. }
  83. // 关闭弹窗的函数
  84. function closePopup() {
  85. $("#modal").removeClass("active");
  86. }
  87. </script>
  88. </body>
  89. </html>