index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <el-carousel height="100vh" :pause-on-hover="false">
  3. <el-carousel-item>
  4. <img src="@/assets/images/welcomebg1.png" alt="" />
  5. </el-carousel-item>
  6. <el-carousel-item>
  7. <img src="@/assets/images/welcomebg2.png" alt="" />
  8. </el-carousel-item>
  9. </el-carousel>
  10. <div class="left">
  11. <img src="@/assets/images/welcomelogo.png" alt="" />
  12. </div>
  13. <div class="right">
  14. <div class="title">{{ projectName }}</div>
  15. <div class="title sub-title">欢迎登录</div>
  16. <el-form ref="loginForm" :model="form" :rules="rules" label-width="0" @keyup.enter="login">
  17. <el-row>
  18. <el-col :span="24">
  19. <el-form-item prop="username">
  20. <el-input v-model="form.username" placeholder="请输入用户名">
  21. <template #prefix>
  22. <img src="@/assets/images/user.png" alt="" />
  23. </template>
  24. </el-input>
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="24">
  28. <el-form-item prop="password">
  29. <el-input v-model="form.password" type="password" show-password placeholder="请输入密码">
  30. <template #prefix>
  31. <img src="@/assets/images/pwd.png" alt="" />
  32. </template>
  33. </el-input>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="24">
  37. <el-button class="login-btn" :loading="islogin" @click="login">登录</el-button>
  38. </el-col>
  39. </el-row>
  40. </el-form>
  41. </div>
  42. <!-- 强制修改密码 -->
  43. <update-pwd ref="updatePwd"></update-pwd>
  44. </template>
  45. <script setup>
  46. import { getConfig } from "@/config/config";
  47. import { useUserStore } from "@/store/user";
  48. import CryptoJS from "crypto-js";
  49. import UpdatePwd from "./updatePwd.vue";
  50. const router = useRouter();
  51. const projectName = ref(getConfig("projectName"));
  52. const form = ref({
  53. username: null,
  54. password: null
  55. });
  56. const rules = reactive({
  57. username: [{ required: true, trigger: "blur", message: "用户名不能为空" }],
  58. password: [{ required: true, trigger: "blur", message: "密码不能为空" }]
  59. });
  60. const loginForm = ref();
  61. const updatePwd = ref();
  62. const islogin = ref(false);
  63. const login = () => {
  64. loginForm.value.validate(valid => {
  65. if (valid) {
  66. islogin.value = true;
  67. useUserStore().login(form.value).then(() => {
  68. islogin.value = false;
  69. router.push("/");
  70. }).catch(code => {
  71. islogin.value = false;
  72. if (code === 204) {
  73. form.value.password = null;
  74. updatePwd.value.open();
  75. }
  76. })
  77. } else {
  78. return false;
  79. }
  80. })
  81. }
  82. </script>
  83. <style lang="scss" scoped>
  84. .el-carousel {
  85. position: fixed; //视频定位方式设为固定
  86. right: 0;
  87. bottom: 0; //视频位置
  88. min-width: 100%;
  89. min-height: 100%; //不会因视频尺寸造成页面需要滚动
  90. width: auto;
  91. height: auto; //尺寸保持原视频大小
  92. z-index: -100; //z轴定位,小于0即可
  93. img {
  94. width: 100%;
  95. height: 100%;
  96. }
  97. }
  98. .left {
  99. position: fixed; //视频定位方式设为固定
  100. height: 100%;
  101. min-height: 100%; //不会因视频尺寸造成页面需要滚动
  102. img {
  103. width: 316px;
  104. height: 72px;
  105. margin: 46px 0 0 80px;
  106. }
  107. }
  108. .right {
  109. position: fixed; //视频定位方式设为固定
  110. width: 500px;
  111. right: 0;
  112. min-height: 100%; //不会因视频尺寸造成页面需要滚动
  113. background: rgba(255, 255, 255, 0.68);
  114. border-left: 1px solid #ffffff;
  115. box-shadow: 2px 0px 0px 0px rgba(255, 255, 255, 1) inset;
  116. display: flex;
  117. flex-direction: column;
  118. align-items: center;
  119. .title {
  120. width: 81.6%;
  121. font-family: PingFang SC;
  122. font-size: 36px;
  123. font-weight: 600;
  124. line-height: 28px;
  125. margin: 100px 0 0;
  126. }
  127. .sub-title {
  128. font-size: 28px;
  129. font-weight: 500;
  130. }
  131. .el-form {
  132. width: 81.6%;
  133. margin-top: 40px;
  134. .el-form-item {
  135. margin-bottom: 0;
  136. margin-top: 28px;
  137. .el-input {
  138. --el-component-size: 52px;
  139. --el-input-text-color: #1d2129;
  140. font-size: 16px;
  141. :deep(.el-input__wrapper) {
  142. box-shadow: 0 0;
  143. border-radius: calc(2 * var(--el-border-radius-base));
  144. .el-input__prefix {
  145. padding: 0 calc(25px / 2);
  146. img {
  147. width: 24px;
  148. height: 24px;
  149. }
  150. }
  151. .el-input__inner {
  152. padding-left: 11px;
  153. font-family: PingFang SC;
  154. font-weight: 600;
  155. box-shadow: 0 0 50px #fff inset;
  156. }
  157. }
  158. }
  159. }
  160. .login-btn {
  161. width: 100%;
  162. height: 56px;
  163. margin-top: 72px;
  164. padding: 0;
  165. background: linear-gradient(270.6deg, #165dff 2.71%, #45b1ff 99.81%);
  166. border: none;
  167. border-radius: 8px;
  168. font: 20px PingFang SC;
  169. font-weight: 600;
  170. color: #fff;
  171. }
  172. }
  173. }
  174. </style>