index.js 687 B

1234567891011121314151617181920212223242526
  1. $(function () {
  2. /*fetchJSON("/api/user/info", {}, "get", function (data) {
  3. if (data.code !== 0) {
  4. window.location.href = "/admin/login.html";
  5. } else {
  6. $("#username").html(data.data.realName);
  7. }
  8. });
  9. */
  10. $("#logout").on("click", function () {
  11. fetchJSON("api/common/logout", {}, "post", function (data) {
  12. sessionStorage.setItem("userId", -1);
  13. window.login = "logout";
  14. window.location.href = "../index.html";
  15. });
  16. });
  17. $("#nav a").click(function () {
  18. $(this)
  19. .addClass("active")
  20. .siblings()
  21. .removeClass("active");
  22. });
  23. });