index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <div class="login-container">
  3. <el-row class="window-login">
  4. <el-col :span="9">
  5. <div id="u35">
  6. <div id="u37">
  7. <div id="u39">
  8. <div id="u39_text" class="text ">
  9. <span></span>
  10. </div>
  11. </div>
  12. <div id="u38">
  13. <div id="u38_text" class="text">
  14. <p style="font-size:20px;line-height:normal;">
  15. <span style="font-family:'FZXBSJW--GB1-0', 'FZXiaoBiaoSong-B05S', sans-serif;font-weight:400;">
  16. 牵引供电维护管理信息化系统
  17. </span>
  18. </p>
  19. <p style="font-size:14px;line-height:24px;margin-top: 5px">
  20. <span style="font-family:'Helvetica', sans-serif;font-weight:400;">
  21. Information System Platform
  22. </span>
  23. </p>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. </el-col>
  29. <el-col :span="15">
  30. <el-form
  31. ref="loginForm"
  32. :model="loginForm"
  33. :rules="loginRules"
  34. class="login-form"
  35. auto-complete="on"
  36. label-position="left"
  37. >
  38. <div class="title-container" style="margin-top:45px;margin-bottom: 80px">
  39. <h2 class="title">用户登录 <span style="font-size: 15px">USER LOGIN</span></h2>
  40. </div>
  41. <el-form-item prop="username">
  42. <el-input
  43. ref="username"
  44. v-model="loginForm.username"
  45. placeholder="请输入用户名"
  46. name="username"
  47. prefix-icon="el-icon-s-check"
  48. type="text"
  49. tabindex="1"
  50. auto-complete="on"
  51. size="medium"
  52. />
  53. </el-form-item>
  54. <el-form-item prop="password" style="position: relative">
  55. <el-input
  56. :key="passwordType"
  57. ref="password"
  58. v-model="loginForm.password"
  59. :type="passwordType"
  60. placeholder="请输入密码"
  61. name="password"
  62. prefix-icon="el-icon-lock"
  63. tabindex="2"
  64. auto-complete="on"
  65. />
  66. <span class="show-pwd" style="position: absolute;right: 12px;top: 8px;" @click="showPwd">
  67. <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
  68. </span>
  69. </el-form-item>
  70. <el-form-item >
  71. <el-input
  72. ref="code"
  73. v-model="loginForm.code"
  74. style="width: 70%;vertical-align:middle"
  75. placeholder="请输入验证码"
  76. prefix-icon="el-icon-lock"
  77. tabindex="2"
  78. auto-complete="on"
  79. @keyup.enter.native="handleLogin"
  80. />
  81. <img :src="imgSrc" alt="" style="margin-left:5%;width: 25%;height: 45px;vertical-align:middle;" @click="captchaImage">
  82. </el-form-item>
  83. <el-form-item>
  84. <el-tooltip class="item" effect="dark" content="请联系管理员重置密码" placement="top">
  85. <el-button type="text" style="float: right;padding:0">忘记密码?</el-button>
  86. </el-tooltip>
  87. </el-form-item>
  88. <el-button
  89. type="primary"
  90. style="width:100%;margin-bottom:30px;"
  91. @click.native.prevent="handleLogin"
  92. ><h2 style="margin: 5px;color: white">登 录</h2>
  93. </el-button>
  94. </el-form>
  95. </el-col>
  96. </el-row>
  97. </div>
  98. </template>
  99. <script>
  100. import { captchaImage } from '@/api/user'
  101. export default {
  102. name: 'Login',
  103. data() {
  104. return {
  105. loginForm: {
  106. username: 'railway',
  107. password: 'admin123',
  108. code: '',
  109. uuid: ''
  110. },
  111. loginRules: {
  112. username: [{ required: true, trigger: 'blur', message: '请输入用户名' }],
  113. password: [{ required: true, trigger: 'blur', message: '请输入密码' }],
  114. code: [{ required: true, trigger: 'blur', message: '请输入验证码' }]
  115. },
  116. loading: false,
  117. passwordType: 'password',
  118. redirect: undefined,
  119. imgSrc: ''
  120. }
  121. },
  122. watch: {
  123. $route: {
  124. handler: function(route) {
  125. this.redirect = route.query && route.query.redirect
  126. },
  127. immediate: true
  128. }
  129. },
  130. created() {
  131. this.captchaImage()
  132. },
  133. methods: {
  134. captchaImage() {
  135. captchaImage({ type: 'math' }).then(res => {
  136. const url = window.URL.createObjectURL(res)
  137. this.imgSrc = url
  138. })
  139. },
  140. showPwd() {
  141. if (this.passwordType === 'password') {
  142. this.passwordType = ''
  143. } else {
  144. this.passwordType = 'password'
  145. }
  146. this.$nextTick(() => {
  147. this.$refs.password.focus()
  148. })
  149. },
  150. handleLogin() {
  151. this.$refs.loginForm.validate(valid => {
  152. if (valid) {
  153. this.loading = true
  154. this.$store.dispatch('user/login', this.loginForm).then(() => {
  155. this.$router.push({ path: this.redirect || '/' })
  156. this.loading = false
  157. }).catch(() => {
  158. this.loading = false
  159. })
  160. } else {
  161. console.log('error submit!!')
  162. return false
  163. }
  164. })
  165. }
  166. }
  167. }
  168. </script>
  169. <style lang="scss">
  170. .login-container {
  171. .el-form {
  172. width: 90%;
  173. margin: 0 auto;
  174. .el-input__inner{
  175. height: 50px;
  176. }
  177. }
  178. }
  179. </style>
  180. <style lang="css" scoped>
  181. .login-container {
  182. min-height: 100%;
  183. width: 100%;
  184. overflow: hidden;
  185. }
  186. .window-login {
  187. overflow: hidden;
  188. border-radius: 15px;
  189. margin: 0 auto;
  190. margin-top: 9%;
  191. width: 800px;
  192. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)
  193. }
  194. #u35 {
  195. width: 100%;
  196. height: 540px;
  197. font-family: '微软雅黑', sans-serif;
  198. font-weight: 400;
  199. font-style: normal;
  200. background-image: url(https://axure-file.lanhuapp.com/83ee941a-8080-4603-ab36-dc56ce561371__b332944a16cd91abd30b3a70f019b96f.svg);
  201. }
  202. #u37 {
  203. width: 100%;
  204. height: 100%;
  205. background-image: url(https://axure-file.lanhuapp.com/83ee941a-8080-4603-ab36-dc56ce561371__3da133640c87c7921faf320a11a3196b.svg);
  206. background-position: left top;
  207. background-repeat: no-repeat;
  208. background-attachment: scroll;
  209. background-size: 1440px 712px;
  210. background-origin: border-box;
  211. border: none;
  212. }
  213. #u38 {
  214. height: 60px;
  215. color: #FFFFFF;
  216. }
  217. #u38 p {
  218. margin: 0;
  219. }
  220. #u38 .text {
  221. text-align: center;
  222. padding: 2px 2px 2px 2px;
  223. box-sizing: border-box;
  224. width: 100%;
  225. }
  226. #u38_text {
  227. word-wrap: break-word;
  228. text-transform: none;
  229. }
  230. #u39 {
  231. position: relative;
  232. margin: 0 auto;
  233. width: 50px;
  234. height: 100px;
  235. display: flex;
  236. font-family: 'Font Awesome 5 Pro Solid', 'Font Awesome 5 Pro Regular', 'Font Awesome 5 Pro', sans-serif;
  237. font-weight: 900;
  238. font-style: normal;
  239. font-size: 72px;
  240. color: #FFFFFF;
  241. }
  242. #u39 .text {
  243. position: absolute;
  244. align-self: center;
  245. padding: 0;
  246. box-sizing: border-box;
  247. width: 100%;
  248. }
  249. #u39_text {
  250. word-wrap: break-word;
  251. text-transform: none;
  252. }
  253. </style>