layout.js 885 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. 
  2. //登出
  3. function signout() {
  4. var url = '/mes/api/staff/signout';
  5. $.get(url, { t: new Date().getMilliseconds() }, function (res) {
  6. if (res != '1') {
  7. alert(res);
  8. } else {
  9. window.location.href = '../login/login.html';
  10. }
  11. }, 'text');
  12. }
  13. //提取cookie
  14. window.onload = function () {
  15. var realname = getCookieValue('realname');
  16. this.document.querySelector('#realname').outerHTML = decodeURI(realname);
  17. }
  18. //根据key获取cookie值
  19. function getCookieValue(key) {
  20. var cookie = document.cookie;
  21. if (cookie == null || cookie == undefined)
  22. return undefined;
  23. var array = cookie.split(';');
  24. for (var i = 0; i < array.length; i++) {
  25. if (array[i].indexOf(key) > 0) {
  26. return array[i].split('=')[1];
  27. }
  28. }
  29. return undefined;
  30. }
  31. //加载菜单
  32. function loadMenus() {
  33. }