student_login.vue 7.2 KB

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