login.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view class="mobile-login-page">
  3. <view class="login-top">
  4. <img class="login-logo" src="../static/images/login/login-logo-sj.png">
  5. <text class="login-text">
  6. {{systemName}}
  7. </text>
  8. </view>
  9. <view class="login-body">
  10. <view class="input-container">
  11. <uni-icons type="auth" size="30" class="input-icon"></uni-icons>
  12. <input type="text" v-model="username" placeholder="请输入用户名" class="input-item-1" />
  13. </view>
  14. <view class="input-container">
  15. <uni-icons type="locked" size="30" class="input-icon"></uni-icons>
  16. <input type="password" v-model="password" placeholder="请输入密码" class="input-item-1" />
  17. </view>
  18. <view class="login-change">
  19. <checkbox-group>
  20. <label class="checkbox-zhanghao">
  21. <checkbox value="cb" color="#0550e5" checked="true" />记住此账号
  22. </label>
  23. </checkbox-group>
  24. <text class="checkbox-zhanghao">
  25. 忘记密码?
  26. </text>
  27. </view>
  28. <button class="login-btn" @click="handleLogin">登录</button>
  29. </view>
  30. </view>
  31. </template>
  32. <script setup>
  33. import {
  34. getAppConfig,
  35. login,
  36. kaoshiList
  37. } from '@/api/login.js'
  38. import {
  39. ref
  40. } from 'vue';
  41. let systemName = ref('麦塔考试系统')
  42. let username = ref('')
  43. let password = ref('')
  44. //let loginLogoImg = ref('../static/images/login/login-bj-sj.png')
  45. const changePassword = () => {
  46. }
  47. const handleLogin = () => {
  48. console.log('Username:', username.value);
  49. console.log('Password:', password.value);
  50. let req = {
  51. //lli.encode()
  52. password: 'sVXqow3/+jG5kIDVGqoezXoK/Pceal1cf/kiojvUdvSU0qTjm5ikUz9CHcsu05I9whRxeep/TDVAcNl2dEqAgSUr5Ufq1FDdHr5Pn/HA5LfoZV+n5j82RE93cwcrCJw6/MwW3ZWgISzvG5qN8t9IzkRX2qMB/7SJxnh3NzoaxX4=',
  53. userName: 'root'
  54. }
  55. login(req).then(res => {
  56. let obj = JSON.stringify(res.data)
  57. console.log(obj)
  58. uni.setStorage({
  59. key: 'Mta-Auth',
  60. data: obj // 假设 this.userInputValue 是用户输入的数据
  61. });
  62. uni.switchTab({
  63. url: '/pages/index/index'
  64. });
  65. // setTimeout(() => {
  66. // let req = {
  67. // 'page': 1,
  68. // 'size': 4,
  69. // 'status': 1,
  70. // }
  71. // kaoshiList(req).then(res => {
  72. // console.log(res)
  73. // })
  74. // }, 5000)
  75. })
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .mobile-login-page {
  80. width: 100%;
  81. height: 100%;
  82. background: #FFF;
  83. text-align: center;
  84. position: absolute;
  85. overflow: auto;
  86. .login-top {
  87. height: 540rpx;
  88. background-size: cover;
  89. background-image: url("../static/images/login/login-bj-sj.png");
  90. // logo
  91. }
  92. .login-logo {
  93. width: 266rpx;
  94. max-height: 100rpx;
  95. margin-top: 156rpx;
  96. }
  97. .login-text {
  98. display: block;
  99. font-size: 64rpx;
  100. color: #FFF;
  101. margin: 24rpx 0 0;
  102. font-weight: 700
  103. }
  104. // 登录区域
  105. .login-body {
  106. width: 100%;
  107. padding: 0 60px;
  108. box-sizing: border-box;
  109. margin: 140rpx auto 0;
  110. .input-container {
  111. display: flex;
  112. align-items: center;
  113. /* 垂直对齐 */
  114. position: relative;
  115. height: 100rpx;
  116. border-radius: 50rpx;
  117. background-color: #F7F7F7;
  118. padding: 0;
  119. margin-bottom: 40rpx;
  120. }
  121. .input-icon {
  122. margin-left: 20rpx;
  123. /* 图标和输入框之间的间距 */
  124. color: #999;
  125. }
  126. }
  127. // 输入框
  128. .login-btn {
  129. width: 100%;
  130. height: 100rpx;
  131. margin-top: 60rpx;
  132. font-size: 36rpx;
  133. letter-spacing: 7.2rpx;
  134. background: linear-gradient(0deg, #436aff 0%, #234ff7 100%);
  135. border-radius: 50rpx;
  136. border: 0;
  137. color: #F7F7F7;
  138. line-height: 100rpx;
  139. }
  140. .login-change {
  141. display: flex;
  142. justify-content: space-between;
  143. align-items: center;
  144. .checkbox-zhanghao {
  145. font-size: 24rpx;
  146. color: #565656;
  147. }
  148. }
  149. }
  150. </style>