飞天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.

145 lines
4.1 KiB

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