header.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="x-ua-compatible" content="IE=edge" >
  6. <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
  7. <title>coderutil出品幸运抽奖系统</title>
  8. <link rel="shortcut icon" href="/favicon.ico" />
  9. <link rel="bookmark" href="/favicon.ico" />
  10. <link rel="stylesheet" href="/css/common/common.css">
  11. <link href="/ref/layui-v2.6.8/layui/css/layui.css" rel="stylesheet" type="text/css" />
  12. <script src="/ref/jquery/jquery-3.4.1.js" type="text/javascript"></script>
  13. <script src="/ref/layui-v2.6.8/layui/layui.js" type="text/javascript"></script>
  14. <script src="/js/common/common.js" type="text/javascript"></script>
  15. <style>
  16. .logo {
  17. position: absolute;
  18. left: 0px;
  19. top: 15px;
  20. height: 30px;
  21. }
  22. .wallet-balance {
  23. position: relative;
  24. float: right;
  25. border: none;
  26. padding: 5px 20px;
  27. margin-right: 100px;
  28. margin-top: 15px;
  29. background-color: transparent;
  30. border-radius: 100px;
  31. font-size: 13px;
  32. color: white;
  33. background-image: linear-gradient(to right, #fab160, #c58a3f);
  34. opacity: 0.8;
  35. }
  36. </style>
  37. <script>
  38. function login() {
  39. location.href = "/auth";
  40. }
  41. </script>
  42. </head>
  43. <body>
  44. <center>
  45. <div style="height: 60px; width: 100%; background-color: white; border-bottom: 1px solid #eae9e9">
  46. <div class="div-1190px">
  47. <img src="/image/icon/logo_title.png" class="logo">
  48. <a class="header-level1-link float-right" id="login-menu" style="margin-right: 0px;">
  49. <button style="padding: 7px 10px; border-radius: 100px; margin-top: 13px; font-size: 12px; border: 1px solid #2b73f6; background-color: transparent; color: #2b73f6"
  50. onclick="login()">登录/注册</button>
  51. </a>
  52. <span class="header-level1-link float-right layui-btn-container" id="login-user" style="float: right; margin-right: 0px; display: none; height: 100%">
  53. <img src="" id="login-user-photo" class="common-login-user down-user-center" style="width: 30px; margin-top: 13px;">
  54. </span>
  55. <button class="wallet-balance">钱包余额:<b><i id="walletBalance">0</i></b> ¥</button>
  56. </div>
  57. </div>
  58. </center>
  59. </body>
  60. <script>
  61. refreshUserInfo();
  62. function refreshUserInfo() {
  63. $.ajax({
  64. url:"/api/user/getCurrentUserInfo",
  65. type:"get",
  66. success:function (data) {
  67. data = eval(data);
  68. if (data.success){
  69. data = data.data;
  70. $("#login-menu").hide();
  71. $("#login-user").show();
  72. $("#login-user-photo").attr("src", data.photo);
  73. var roleCode = data.roleCode;
  74. /***
  75. * 登录用户设置
  76. */
  77. layui.use(['dropdown', 'util', 'layer', 'table'], function() {
  78. var dropdown = layui.dropdown;
  79. //用户
  80. dropdown.render({
  81. elem: '#login-user-photo'
  82. , data: [ {
  83. title: roleCode == 2 ? '后台管理' : ''
  84. , id: roleCode == 2 ? 1 : -1
  85. }, {
  86. title: '退出登录'
  87. , id: 2
  88. }]
  89. , click: function (obj) {
  90. if (obj.id == 1) {
  91. location.href = "/admin/cms";
  92. } else if (obj.id == 2) {
  93. loginOut();
  94. }
  95. }
  96. });
  97. })
  98. }
  99. },error:function () {}
  100. })
  101. }
  102. </script>
  103. </html>