login.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <route lang="json5">
  2. {
  3. style: {
  4. navigationStyle: 'custom',
  5. navigationBarTitleText: '登录',
  6. },
  7. }
  8. </route>
  9. <template>
  10. <view class="login-container">
  11. <view class="login-box">
  12. <view class="login_title">
  13. <view class="title-en">Hello!</view>
  14. <view class="title-en">欢迎登录橙宝日志</view>
  15. </view>
  16. <!-- 输入框-->
  17. <view class="input-wrapper">
  18. <!-- 账号 -->
  19. <view class="country-code">
  20. <view class="country-phone">
  21. <image style="width: 24px; height: 24px" src="/src/static/icon/phone.svg"></image>
  22. <view class="login-text">手机号</view>
  23. </view>
  24. <view class="phone-input">
  25. <view>+86</view>
  26. <view>
  27. <input v-model="account" type="text" placeholder="请输入手机号" />
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 验证码 -->
  32. <view class="country-password">
  33. <view class="country-phone">
  34. <image
  35. style="width: 24px; height: 24px"
  36. src="/src/static/icon/Verification.svg"
  37. ></image>
  38. <view class="login-text">验证码</view>
  39. </view>
  40. <view class="phone-input">
  41. <view class="verification-input">
  42. <input v-model="verification" type="text" placeholder="请输入验证码" />
  43. </view>
  44. <image
  45. style="width: 1px; height: 16px; background: red"
  46. src="/src/static/icon/textBor.svg"
  47. ></image>
  48. <view class="send-btn" :disabled="isCountingDown" @click="sendVerificationCode">
  49. {{ buttonText }}
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <wd-button @click="loginBtn" class="login-button">登录</wd-button>
  55. </view>
  56. </view>
  57. </template>
  58. <script setup>
  59. import { ref } from 'vue'
  60. const account = ref('') // 账号
  61. const verification = ref('') // 验证码
  62. const countdown = ref(0)
  63. const isCountingDown = ref(false)
  64. const buttonText = computed(() => {
  65. return isCountingDown.value ? `${countdown.value}秒后重新发送` : '发送验证码'
  66. })
  67. // 点击登录
  68. const loginBtn = () => {
  69. console.log(account.value, verification.value)
  70. console.log(2222)
  71. }
  72. // 发生验证码
  73. const sendVerificationCode = () => {
  74. if (isCountingDown.value) return
  75. countdown.value = 60
  76. isCountingDown.value = true
  77. const timer = setInterval(() => {
  78. countdown.value--
  79. if (countdown.value <= 0) {
  80. clearInterval(timer)
  81. isCountingDown.value = false
  82. }
  83. }, 1000)
  84. }
  85. </script>
  86. <style scoped lang="scss">
  87. .login-container {
  88. display: flex;
  89. justify-content: center;
  90. min-height: 100vh;
  91. background: linear-gradient(to bottom, #c4eee6, #fff);
  92. }
  93. .login-box {
  94. width: 90%;
  95. font-size: 1rem;
  96. }
  97. .login_title {
  98. width: 100%;
  99. height: 4.5rem;
  100. margin: 6.25rem 0 1.25rem 0;
  101. }
  102. .title-en {
  103. margin: 0 0 0.5rem 0;
  104. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  105. font-size: 1.5rem;
  106. font-weight: 600;
  107. color: #333333;
  108. }
  109. .input-wrapper {
  110. position: relative;
  111. width: 100%;
  112. height: 11.25rem;
  113. margin: 0.625rem 0 1.25rem 0;
  114. }
  115. .country-code {
  116. width: 100%;
  117. height: 5rem;
  118. padding: 1rem 0;
  119. }
  120. .phone-input {
  121. display: flex;
  122. gap: 1rem;
  123. align-items: center;
  124. height: 3.5rem;
  125. border-bottom: 0.03125rem solid var(--Gray-Gray3, #e7e7e7);
  126. }
  127. .country-phone {
  128. display: flex;
  129. align-items: center;
  130. }
  131. .login-text {
  132. margin-left: 0.625rem;
  133. }
  134. .phone-input input {
  135. flex: 1;
  136. padding: 0 1rem;
  137. font-size: 0.875rem;
  138. }
  139. .verification-input {
  140. width: 27.75rem;
  141. }
  142. .send-btn {
  143. width: 13.75rem;
  144. overflow: hidden;
  145. font-size: 0.875rem;
  146. color: #f88842;
  147. text-overflow: ellipsis;
  148. white-space: nowrap;
  149. background: transparent;
  150. }
  151. .login-button {
  152. width: 100%;
  153. height: 3rem;
  154. margin: 5rem 0 1.25rem 0;
  155. font-size: 1rem;
  156. color: white;
  157. background: #f88842 !important;
  158. border-radius: 0.5rem;
  159. }
  160. </style>