student_login.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div class="student-login-page">
  3. <div class="page-head">
  4. <img class="head-icon" src="@/assets/images/login/login-return.png" @click="router.go(-1)" alt="404">
  5. </div>
  6. <div class="page-content">
  7. <div class="content-background">
  8. <div class="content-left">
  9. <div class="content-form">
  10. <p>新基础生涯</p>
  11. <p>欢迎访问新基础生涯唤醒一体机</p>
  12. <div class="form-box">
  13. <p>学生登录</p>
  14. <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
  15. <el-form-item prop="username">
  16. <el-input
  17. v-model="loginForm.username"
  18. type="text"
  19. size="large"
  20. auto-complete="off"
  21. placeholder="身份证号"
  22. class="form-box-input1"
  23. >
  24. <template #prefix>
  25. <svg-icon icon-class="user_login" class="el-input__icon input-icon"/>
  26. </template>
  27. </el-input>
  28. </el-form-item>
  29. <el-form-item prop="password">
  30. <el-input
  31. v-model="loginForm.password"
  32. type="password"
  33. size="large"
  34. auto-complete="off"
  35. placeholder="密码"
  36. show-password
  37. class="form-box-input1"
  38. @keyup.enter="handleLogin"
  39. >
  40. <template #prefix>
  41. <svg-icon icon-class="password_login" class="el-input__icon input-icon"/>
  42. </template>
  43. </el-input>
  44. </el-form-item>
  45. <p class="form-box-text">首次登录请联系班主任获取账号密码</p>
  46. <el-form-item style="width:100%;">
  47. <div style="display: flex;flex-direction: column;width: 100%">
  48. <el-button
  49. :loading="loading"
  50. size="large"
  51. type="primary"
  52. class="form-box-btn1"
  53. @click.prevent="handleLogin"
  54. >
  55. <span v-if="!loading">登 录</span>
  56. <span v-else>登 录 中...</span>
  57. </el-button>
  58. <p class="form-box-text1" @click="forgetPass">
  59. 忘记密码?
  60. </p>
  61. </div>
  62. </el-form-item>
  63. </el-form>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </template>
  71. <script setup>
  72. import {login} from '@/api/login'
  73. import useUserStore from '@/store/modules/user'
  74. import { setToken } from '@/utils/auth'
  75. const userStore = useUserStore()
  76. const {proxy} = getCurrentInstance()
  77. const router = useRouter()
  78. const route = useRoute()
  79. const params = route.query
  80. const loading = ref(false)
  81. const loginForm = ref({
  82. username: "",
  83. password: "",
  84. loginType: "1",
  85. rememberMe: false,
  86. code: "",
  87. uuid: ""
  88. })
  89. const loginRules = {
  90. username: [{required: true, trigger: "blur", message: "请输入您的身份证号"}],
  91. password: [{required: true, trigger: "blur", message: "请输入您的密码"}],
  92. }
  93. function handleLogin() {
  94. proxy.$refs.loginRef.validate(valid => {
  95. if (valid) {
  96. loading.value = true
  97. // 调用action的登录方法
  98. loginForm.value.loginType = "1"
  99. login(loginForm.value.username, loginForm.value.password, null, null, loginForm.value.loginType)
  100. .then(resp => {
  101. setToken(resp.data.access_token)
  102. router.push({
  103. path: params.modulePath
  104. })
  105. console.log("11",resp)
  106. })
  107. }
  108. })
  109. }
  110. function forgetPass() {
  111. router.push({
  112. path : '/xjc-integratedmachine/login/student_forgetpass',
  113. query:{
  114. modulePath : params.modulePath
  115. }
  116. })
  117. }
  118. function jumpReturn(path) {
  119. router.push({
  120. path: path,
  121. query : {
  122. modulePath : params.modulePath
  123. }
  124. })
  125. }
  126. </script>
  127. <style scoped lang="scss">
  128. *{
  129. margin: 0;
  130. padding: 0;
  131. }
  132. .student-login-page{
  133. background: url('@/assets/images/login/login-page-background.png') no-repeat;
  134. background-size: 1920px 1080px;
  135. z-index:10;
  136. width: 100%;
  137. height: 1080px;
  138. .page-head{
  139. position: absolute;
  140. top: 0;
  141. left: 0;
  142. width:100%;
  143. height: 123px;
  144. background: #FFFFFF;
  145. display: flex;
  146. align-items: center;
  147. .head-icon{
  148. width: 74px;
  149. height: 74px;
  150. margin-left: 74px;
  151. }
  152. }
  153. .page-content{
  154. //background: #ECF2F6;
  155. width: 100%;
  156. position: absolute;
  157. top: 123px;
  158. bottom: 0;
  159. .content-left{
  160. width: 600px;
  161. margin-left: 237px;
  162. margin-top: 70px;
  163. .content-form{
  164. display: flex;
  165. flex-direction:column;
  166. align-items:center;
  167. p:nth-child(1){
  168. font-weight: bold;
  169. font-size: 48px;
  170. color: #414141;
  171. }
  172. p:nth-child(2){
  173. font-weight: 300;
  174. font-size: 36px;
  175. color: #414141;
  176. margin-top: 42px;
  177. }
  178. .form-box{
  179. width: 490px;
  180. margin-top: 29px;
  181. background: #FFFFFF;
  182. display: flex;
  183. flex-direction: column;
  184. align-items: center;
  185. p:nth-child(1){
  186. font-weight: 400;
  187. font-size: 36px;
  188. color: #666666;
  189. margin-top: 24px;
  190. }
  191. .form-box-input1{
  192. width: 445px;
  193. height: 65px;
  194. background: #F5F9FA;
  195. border-radius: 5px 5px 5px 5px;
  196. margin-top: 20px;
  197. ::v-deep .el-input__wrapper{
  198. background: #F5F9FA;
  199. box-shadow: none;
  200. }
  201. }
  202. .form-box-text{
  203. font-weight: 400;
  204. font-size: 16px;
  205. color: #979797;
  206. margin-top: 6px;
  207. text-align: center;
  208. }
  209. .form-box-text1{
  210. font-weight: 400;
  211. font-size: 16px;
  212. color: #5956E9;
  213. margin:9px auto 32px;
  214. text-align: center;
  215. }
  216. .form-box-btn1{
  217. width: 255px;
  218. height: 65px;
  219. background-color: #5956E9;
  220. border-radius: 33px 33px 33px 33px;
  221. margin:16px auto 9px;
  222. font-weight: 500;
  223. font-size: 18px;
  224. color: #FFFFFF;
  225. }
  226. .form-box-btn2{
  227. width: 150px;
  228. height: 57px;
  229. background: #87B8FF;
  230. border-radius: 10px 10px 10px 10px;
  231. font-size: 16px;
  232. color: #FFFFFF;
  233. }
  234. }
  235. }
  236. }
  237. }
  238. }
  239. </style>