Login.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <script setup>
  2. import { useTemplateRef } from "vue"
  3. const telCodeOpts = ref([
  4. {
  5. label: '+86',
  6. value: '86'
  7. }
  8. ])
  9. const keepLogin=ref(false)
  10. const FORM_RULES = {
  11. telVerifyCode: [{ required: true, message: '请输入验证码' }],
  12. tel:[{ required: true, message: '请输入手机号' }],
  13. imgVerifyCode:[{ required: true, message: '请输入图像验证码' }],
  14. };
  15. const formData = reactive({
  16. tel: '',
  17. telCode: '',
  18. telVerifyCode: '',
  19. imgVerifyCode: '',
  20. })
  21. const formIns=useTemplateRef('formIns')
  22. async function onSubmit(){
  23. const validate=await formIns.value.validate()
  24. if(validate!==true) return
  25. }
  26. </script>
  27. <template>
  28. <div class="login-page">
  29. <img class="bg-img" src="@/assets/imgs/login_bg.png" alt="" />
  30. <div class="flex main-wrap">
  31. <img class="logo-icon" src="@/assets/imgs/logo_login.png" alt="" />
  32. <div class="login-form-wrap">
  33. <div class="en-login-label">Login</div>
  34. <div class="login-label">登录</div>
  35. <div class="login-tips">sign in to continue</div>
  36. <t-form
  37. ref="formIns"
  38. :rules="FORM_RULES"
  39. :data="formData"
  40. :colon="true"
  41. :label-width="0"
  42. @submit="onSubmit"
  43. >
  44. <t-form-item name="tel">
  45. <div class="flex form-item-box">
  46. <t-select v-model="formData.telCode" style="width:80px">
  47. <t-option
  48. v-for="item in telCodeOpts"
  49. :key="item.value"
  50. :label="item.label"
  51. :value="item.value"
  52. />
  53. </t-select>
  54. <t-input class="tel-input" placeholder="请输入手机号" v-model="formData.tel" style="flex:1"></t-input>
  55. </div>
  56. </t-form-item>
  57. <t-form-item name="telVerifyCode">
  58. <div class="flex form-item-box">
  59. <t-input placeholder="请输入验证码" v-model="formData.telVerifyCode" style="flex:1"></t-input>
  60. <span class="get_telcode_btn">获取验证码</span>
  61. </div>
  62. </t-form-item>
  63. <t-form-item name="imgVerifyCode">
  64. <div class="flex form-item-box" style="padding-top:6px;padding-bottom:6px;">
  65. <t-input placeholder="请输入图形验证码" v-model="formData.imgVerifyCode" style="flex:1"></t-input>
  66. <img class="img-code" src="" alt="">
  67. </div>
  68. </t-form-item>
  69. <div>
  70. <t-checkbox v-model="keepLogin">60天内保持登录</t-checkbox>
  71. </div>
  72. <t-button class="submit-btn" block shape="round" type="submit">登录</t-button>
  73. </t-form>
  74. <p class="bottom-tips">共享社区资源,共创市场领先</p>
  75. </div>
  76. </div>
  77. </div>
  78. </template>
  79. <style lang="scss" scoped>
  80. .login-page {
  81. width: 100%;
  82. height: 100%;
  83. position: relative;
  84. background-color: #edf2f7;
  85. .bg-img {
  86. position: absolute;
  87. bottom: 0;
  88. right: 0;
  89. max-width: 100%;
  90. max-height: 100%;
  91. }
  92. .main-wrap {
  93. height: 100%;
  94. padding-top: 67px;
  95. padding-left: 39px;
  96. position: relative;
  97. z-index: 10;
  98. flex-direction: column;
  99. .logo-icon {
  100. width: 374px;
  101. }
  102. .login-form-wrap {
  103. margin-left: 160px;
  104. width: 400px;
  105. flex: 1;
  106. display: flex;
  107. flex-direction: column;
  108. justify-content: center;
  109. .en-login-label {
  110. font-size: 34px;
  111. line-height: 47px;
  112. }
  113. .login-label {
  114. font-size: 54px;
  115. line-height: 75px;
  116. }
  117. .login-tips {
  118. color: #999999;
  119. margin-bottom: 28px;
  120. }
  121. .form-item-box {
  122. border: 1px solid #3d5eff;
  123. padding: 10px 40px 10px 16px;
  124. border-radius: 40px;
  125. width: 100%;
  126. background-color: #fff;
  127. align-items: center;
  128. :deep(.t-input){
  129. border: none;
  130. }
  131. :deep(.t-input--focused){
  132. box-shadow: none;
  133. }
  134. .tel-input{
  135. border-left: 1px solid var(--border-color);
  136. }
  137. .get_telcode_btn{
  138. color: var(--td-brand-color);
  139. cursor: pointer;
  140. display: block;
  141. }
  142. .img-code{
  143. width: 80px;
  144. height: 40px;
  145. }
  146. }
  147. .submit-btn{
  148. background: linear-gradient(90deg, #7C54FF 0%, #4B64F7 100%);
  149. height: 40px;
  150. margin-top: 40px;
  151. border: none;
  152. }
  153. .bottom-tips{
  154. text-align: center;
  155. color: #999999;
  156. font-size: 20px;
  157. margin-top: 60px;
  158. }
  159. }
  160. }
  161. }
  162. </style>