login.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <view class="content">
  3. <view class="login-top">
  4. <img src="../static/images/login/login-bj-sj.png">
  5. <text>
  6. {{systemName}}
  7. </text>
  8. </view>
  9. <view class="text-area">
  10. <input type="text" v-model="username" placeholder="Username" class="input-item" />
  11. <input type="password" v-model="password" placeholder="Password" class="input-item" />
  12. <button @click="handleLogin">Login</button>
  13. </view>
  14. </view>
  15. </template>
  16. <script setup>
  17. import {
  18. getAppConfig,
  19. login,
  20. kaoshiList
  21. } from '@/api/login.js'
  22. import {
  23. ref
  24. } from 'vue';
  25. let systemName = ref('麦塔考试')
  26. let username = ref('')
  27. let password = ref('')
  28. //let loginLogoImg = ref('../static/images/login/login-bj-sj.png')
  29. const changePassword = ()=>{
  30. }
  31. const handleLogin = () => {
  32. console.log('Username:', username.value);
  33. console.log('Password:', password.value);
  34. let req = {
  35. //lli.encode()
  36. password: 'sVXqow3/+jG5kIDVGqoezXoK/Pceal1cf/kiojvUdvSU0qTjm5ikUz9CHcsu05I9whRxeep/TDVAcNl2dEqAgSUr5Ufq1FDdHr5Pn/HA5LfoZV+n5j82RE93cwcrCJw6/MwW3ZWgISzvG5qN8t9IzkRX2qMB/7SJxnh3NzoaxX4=',
  37. userName: 'root'
  38. }
  39. login(req).then(res => {
  40. let obj = JSON.stringify(res.data)
  41. console.log(obj)
  42. uni.setStorage({
  43. key: 'Mta-Auth',
  44. data: obj // 假设 this.userInputValue 是用户输入的数据
  45. });
  46. setTimeout(() => {
  47. let req = {
  48. 'page': 1,
  49. 'size': 4,
  50. 'status': 1,
  51. }
  52. kaoshiList(req).then(res => {
  53. console.log(res)
  54. })
  55. }, 5000)
  56. })
  57. }
  58. </script>
  59. <style lang="scss" scoped>
  60. .content {
  61. display: flex;
  62. .login-top {
  63. height: 270px;
  64. background-size: cover;
  65. background-image: url("../static/images/login/login-bj-sj.png");
  66. // logo
  67. img {
  68. width: 133px;
  69. max-height: 50px;
  70. margin-top: 78px;
  71. }
  72. }
  73. }
  74. .text-area {
  75. display: flex;
  76. justify-content: center;
  77. .input-item {
  78. margin-bottom: 20rpx;
  79. height: 40rpx;
  80. line-height: 40rpx;
  81. padding: 0 10rpx;
  82. border: 1px solid #ccc;
  83. border-radius: 4rpx;
  84. }
  85. button {
  86. margin-top: 20rpx;
  87. padding: 10rpx 20rpx;
  88. background-color: #409EFF;
  89. color: #fff;
  90. border-radius: 4rpx;
  91. }
  92. }
  93. </style>