index.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <!DOCTYPE html>
  2. <head>
  3. <meta charset="utf-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="keywords" content="">
  7. <meta name="description" content="">
  8. <title text="主页"></title>
  9. <link rel="stylesheet" href="component/pear/css/pear.css">
  10. <link rel="stylesheet" href="admin/css/load.css"/>
  11. <link rel="stylesheet" href="admin/css/admin.css"/>
  12. </head>
  13. <!-- 结 构 代 码 -->
  14. <body class="layui-layout-body pear-admin">
  15. <!-- 布 局 框 架 -->
  16. <div class="layui-layout layui-layout-admin">
  17. <div class="layui-header">
  18. <!-- 顶 部 左 侧 功 能 -->
  19. <ul class="layui-nav layui-layout-left">
  20. <li class="collaspe layui-nav-item"><a href="#" class="layui-icon layui-icon-shrink-right"></a></li>
  21. <li class="refresh layui-nav-item"><a href="#" class="layui-icon layui-icon-refresh-1" title="刷新页面" loading=600></a></li>
  22. </ul>
  23. <!-- 顶 部 右 侧 菜 单 -->
  24. <div id="control" class="layui-layout-control"></div>
  25. <ul class="layui-nav layui-layout-right">
  26. <li class="layui-nav-item layui-hide-xs"><a href="#" class="fullScreen layui-icon layui-icon-screen-full"></a></li>
  27. <li class="layui-nav-item layui-hide-xs"><a href="http://www.baidu.com" class="layui-icon layui-icon-website"></a></li>
  28. <li class="layui-nav-item">
  29. <!-- 头 像 -->
  30. <a href="javascript:;">
  31. <img src="admin/images/head.jpg" class="layui-nav-img">
  32. </a>
  33. <!-- 功 能 菜 单 -->
  34. <dl class="layui-nav-child">
  35. <dd style="cursor: pointer;">
  36. <a user-menu-url="view/system/user/userInfo.html" user-menu-id="9999" user-menu-title="基本资料">基本资料</a>
  37. </dd>
  38. <dd>
  39. <a href="javascript:void(0);" class="logout">注销登录</a>
  40. </dd>
  41. </dl>
  42. </li>
  43. <li class="layui-nav-item setting"><a href="#" class="layui-icon layui-icon-more-vertical"></a></li>
  44. </ul>
  45. </div>
  46. <!-- 侧 边 区 域 -->
  47. <div class="layui-side layui-bg-black">
  48. <!-- 顶 部 图 标 -->
  49. <div class="layui-logo">
  50. <img class="logo">
  51. <span class="title"></span>
  52. </div>
  53. <!-- 侧 边 菜 单 -->
  54. <div class="layui-side-scroll">
  55. <div id="sideMenu"></div>
  56. </div>
  57. </div>
  58. <div class="layui-body">
  59. <div id="content"></div>
  60. </div>
  61. </div>
  62. <!-- 遮 盖 层 -->
  63. <div class="pear-cover"></div>
  64. <!-- 加 载 动 画-->
  65. <div class="loader-main">
  66. <div class="loader"></div>
  67. </div>
  68. <!-- 移 动 端 便 捷 操 作 -->
  69. <div class="pear-collasped-pe collaspe">
  70. <a class="layui-icon layui-icon-shrink-right" href="#"></a>
  71. </div>
  72. <!-- 依 赖 脚 本 -->
  73. <script src="component/layui/layui.js"></script>
  74. <script src="component/pear/pear.js"></script>
  75. <script src="component/js/jquery.min.js"></script>
  76. <script>
  77. layui.use(['jquery', 'admin', 'layer', 'request'], function () {
  78. var $ = layui.jquery,
  79. layer = layui.layer,
  80. admin = layui.admin,
  81. request = layui.request;
  82. // 获取用户信息,用户名、昵称、头像等
  83. request.http({
  84. url: "/system/user/v1/userInfo",
  85. dataType: 'json',
  86. success: function (result) {
  87. $(".layui-nav-img").attr("src", (result.data.avatar ? request.getAdminServerUrl() + result.data.avatar : "admin/images/head.jpg"));
  88. $(".layui-nav-img").parent().append(result.data.realName);
  89. }
  90. });
  91. admin.render();
  92. $("body").on("click", ".logout", function() {
  93. var loading = layer.load(2, {shade: [0.3, '#333']});
  94. request.http({
  95. type: 'post',
  96. url: '/logout',
  97. dataType: 'json',
  98. success: function (result) {
  99. layer.close(loading);
  100. if (result.success) {
  101. layui.data('user', null); // 清空本地存储
  102. layer.msg("注销成功", {icon: 1, time: 1200}, function() {
  103. location.href = "/";
  104. });
  105. }
  106. }
  107. });
  108. })
  109. })
  110. </script>
  111. </body>
  112. </html>