index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <a-row
  3. style="width: 100vw; height: 100vh, overflow: hidden"
  4. justify="center"
  5. >
  6. <a-col :span="16" style="height: 100vh;" >
  7. <img
  8. style="width: 100%; height: 100%; object-fit: cover"
  9. :src='staticImg.loginBg'
  10. alt=""
  11. />
  12. </a-col>
  13. <a-col
  14. :span="8"
  15. style="display: flex; justify-content: center;align-items: center"
  16. >
  17. <a-row :gutter="[8, 8]" >
  18. <a-col class="app-name" :span="24" style="display: flex;justify-content: center;">
  19. 蛟龙云联
  20. </a-col>
  21. <a-col :span="24" >
  22. <a-form
  23. name="basic"
  24. :label-col="{ span: 8 }"
  25. :wrapper-col="{ span: 16 }"
  26. autocomplete="off"
  27. >
  28. <a-form-item
  29. label="账号"
  30. name="userAccount"
  31. :rules="[{ required: true, message: '请填写账号' }]"
  32. >
  33. <a-input style="width: 328px;height: 42px;" v-model:value="state.userAccount" />
  34. </a-form-item>
  35. <a-form-item
  36. label="密码"
  37. name="password"
  38. :rules="[{ required: true, message: '请输入密码' }]"
  39. >
  40. <a-input-password style="width: 328px;height: 42px;" v-model:value="state.password" />
  41. </a-form-item>
  42. </a-form>
  43. </a-col>
  44. <a-col :span="24" style="display: flex;justify-content: center;">
  45. <a-button @click="login" style="width: 200px;" type="primary" >登录</a-button>
  46. </a-col>
  47. </a-row>
  48. </a-col>
  49. </a-row>
  50. </template>
  51. <script lang='ts' setup >
  52. import { useUserStore } from '@/store/index'
  53. import { onUnmounted, reactive } from 'vue'
  54. import { useStaticImg } from '@/utils/static'
  55. // const { redirct_url } = useRoute().query
  56. const userStore = useUserStore()
  57. const staticImg = useStaticImg()
  58. window.addEventListener('keypress', event => {
  59. if (event.key === 'Enter') login()
  60. })
  61. const state = reactive({
  62. userAccount: '',
  63. password: ''
  64. })
  65. const login = () => {
  66. userStore.login(state)
  67. }
  68. onUnmounted(() => {
  69. window.removeEventListener('keypress', () => {})
  70. })
  71. </script>
  72. <style lang='less' scoped >
  73. .app-name {
  74. font: 40px 'Italiana', sans-serif;
  75. text-transform: lowercase;
  76. text-align: center;
  77. }
  78. </style>