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

143 lines
4.1 KiB

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