飞天AI数字人展会页面
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 lines
4.2 KiB

11 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. var ajaxUrl = 'http://192.168.99.86:3001'
  2. $(function () {
  3. console.log(localStorage.getItem("userName"))
  4. if(localStorage.getItem("userName")){
  5. $(".header-login p").html(localStorage.getItem("userName"))
  6. $(".header-login").removeClass('login-user').addClass('login-active')
  7. }else{
  8. $(".header-login").removeClass('login-active').addClass('login-user')
  9. }
  10. //登录
  11. $('.login-user').on('click', function () {
  12. layer.open({
  13. type: 1,
  14. skin: 'layui-layer-login', //样式类名
  15. title: false,
  16. anim: 2,
  17. shade: 0.8,
  18. shadeClose: false, //开启遮罩关闭
  19. content: $('#form-layer'),
  20. cancel: function(index, layero){
  21. // layer.close(index);
  22. // alert("你点击了右上角的X");
  23. }
  24. });
  25. })
  26. // 登录提交
  27. $('.login-submit').on('click', function (event) {
  28. event.preventDefault();
  29. var username = $('input[type="text"]').val();
  30. var password = $('input[type="password"]').val();
  31. if (username === '' || password === '') {
  32. layer.msg('账号和密码不能为空!', {
  33. offset: 50,
  34. anim: 6
  35. });
  36. return;
  37. }
  38. // 检查账号是否为 "admin" 且密码是否为 "83560792"
  39. if (username !== 'admin' || password !== '83560792') {
  40. layer.msg('账号或密码错误!', {
  41. offset: 50,
  42. anim: 6
  43. });
  44. return;
  45. }
  46. layer.msg('登录成功', {
  47. offset: 50,
  48. anim: 0
  49. });
  50. setTimeout(()=>{
  51. localStorage.setItem('userName',username)
  52. window.location.reload();
  53. layer.closeAll();
  54. },1000)
  55. })
  56. // 查看用户信息
  57. $('.login-active').on('click', function () {
  58. layer.open({
  59. type: 1,
  60. skin: 'layui-layer-login', //样式类名
  61. title: false,
  62. anim: 2,
  63. shade: 0.8,
  64. shadeClose: false, //开启遮罩关闭
  65. content: $('#user-layer')
  66. });
  67. })
  68. // 切换账号
  69. $(".change-accout-btn").on('click', function () {
  70. layer.closeAll();
  71. localStorage.removeItem('userName')
  72. layer.open({
  73. type: 1,
  74. skin: 'layui-layer-login', //样式类名
  75. title: false,
  76. anim: 2,
  77. shade: 0.8,
  78. shadeClose: false, //开启遮罩关闭
  79. content: $('#form-layer'),
  80. cancel: function(index, layero){
  81. // layer.close(index);
  82. window.location.reload();
  83. }
  84. });
  85. })
  86. // 退出程序
  87. $(".doubleExit").dblclick(function(){
  88. if (confirm("确定退出?")) {
  89. console.log("确定");
  90. } else {
  91. console.log("取消");
  92. }
  93. });
  94. // 首页样式操作
  95. $('.list-left li').hover(
  96. function() {
  97. $(this).removeClass('animate__backInLeft').addClass('animate__headShake');
  98. },
  99. function() {
  100. $(this).removeClass('animate__headShake')
  101. }
  102. );
  103. $('.list-right li').hover(
  104. function() {
  105. $(this).removeClass('animate__backInRight').addClass('animate__headShake');
  106. },
  107. function() {
  108. $(this).removeClass('animate__headShake')
  109. }
  110. );
  111. // 首页菜单点击操作
  112. $('.index-list li').on('click', function () {
  113. const _this = $(this)
  114. $('.ai-human').css('animation-duration', '0.2s').addClass('animate__animated animate__flash')
  115. setTimeout(function () {
  116. $('.list-left li').removeClass('animate__backInLeft').addClass('animate__animated animate__backOutLeft')
  117. $('.list-right li').removeClass('animate__backInRight').addClass('animate__animated animate__backOutRight')
  118. setTimeout(function(){
  119. const href = _this.find('a').attr('id');
  120. if (href === 'page1') {
  121. window.location.href = 'page1.html';
  122. } else if (href === 'page2') {
  123. window.location.href = 'page2.html';
  124. } else if (href === 'page3') {
  125. window.location.href = 'page3.html';
  126. } else if (href === 'page4') {
  127. window.location.href = 'page4.html';
  128. } else if (href === 'page5') {
  129. window.location.href = 'page5.html';
  130. } else if (href === 'aiChat') {
  131. window.location.href = 'ai_chat.html';
  132. }
  133. return false;
  134. },1000)
  135. }, 300)
  136. })
  137. })