login.uvue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <cl-page>
  3. <Back />
  4. <img src="/static/home/1.jpg" alt="" class="w-full h-full object-cover">
  5. <view class="title">
  6. 少儿物理启蒙
  7. </view>
  8. <view class="group">
  9. <cl-image src="/static/home/8.png" width="150px" height="150px" mode="heightFix" />
  10. <view class="w-[40vw]">
  11. <cl-tabs v-model="val" :list="list" :form="formData"></cl-tabs>
  12. <cl-form v-model="formData" :pt="{ className: 'mt-1' }">
  13. <view v-if="val === 'quickly_login'">
  14. <phone :form="formData" />
  15. </view>
  16. <view v-else>
  17. 密码登录
  18. </view>
  19. <cl-button :pt="{ className: '!h-[45px] !rounded-full w-[200px] mx-auto' }" :loading="loading" @tap="toLogin">
  20. 登录
  21. </cl-button>
  22. </cl-form>
  23. </view>
  24. </view>
  25. </cl-page>
  26. </template>
  27. <script lang="ts" setup>
  28. import Back from '@/components/back.uvue'
  29. import type { LoginForm } from "./components/types";
  30. import phone from './components/phone.uvue';
  31. import { ref } from 'vue'
  32. import type { ClTabsItem } from "@/uni_modules/cool-ui";
  33. import type { user } from '@/.cool';
  34. const val = ref('quickly_login')
  35. const list: ClTabsItem[] = [
  36. {
  37. label: '验证码登录',
  38. value: 'quickly_login'
  39. },
  40. {
  41. label: '密码登录',
  42. value: 'password'
  43. },
  44. ]
  45. const formData = ref<LoginForm>({
  46. username: '17812345678',
  47. password: '',
  48. randomStr: 0,
  49. grant_type: 'password',
  50. scope: 'server',
  51. loginType: 1,
  52. code: ''
  53. })
  54. const loading = ref(false)
  55. function toLogin() {
  56. // loading.value = true
  57. console.log(formData.value);
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. .title {
  62. position: absolute;
  63. top: 6%;
  64. left: 50%;
  65. transform: translateX(-50%);
  66. //设置字间距
  67. letter-spacing: 0.1em;
  68. @apply text-white text-5xl font-bold;
  69. }
  70. .group {
  71. @apply absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-white px-4 py-2 rounded-xl;
  72. display: flex;
  73. align-items: center;
  74. flex-direction: row;
  75. height: 60vh;
  76. }
  77. </style>