You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
3.4 KiB

  1. <template>
  2. <view class="main">
  3. <view :style="{height:iSMT+'px'}"></view>
  4. <view class="tab">
  5. <view class="tab-item" :class="{active: activeTab === 'email'}" @click="activeTab = 'email'">邮箱</view>
  6. <view class="tab-item" :class="{active: activeTab === 'phone'}" @click="activeTab = 'phone'">手机号</view>
  7. </view>
  8. <view class="switch-tab">
  9. <view class="input-list" v-if="activeTab === 'email'">
  10. <image src="/static/my/changeEmail.png" mode="aspectFit"></image>
  11. <input type="text" placeholder="请输入邮箱" class="input" />
  12. <button class="code-btn" :class="{disabled: gettingCode}" @click="getCode" :disabled="gettingCode">
  13. {{ gettingCode ? `重新发送 ${time}s` : '获取验证码' }}
  14. </button>
  15. </view>
  16. <view class="input-list" v-else>
  17. <image src="/static/my/changeBindPhone.png" mode="aspectFit"></image>
  18. <input type="number" placeholder="请输入手机号" class="input" />
  19. <button class="code-btn" :class="{disabled: gettingCode}" @click="getCode" :disabled="gettingCode">
  20. {{ gettingCode ? `重新发送 ${time}s` : '获取验证码' }}
  21. </button>
  22. </view>
  23. <view class="input-list">
  24. <image src="/static/my/verification.png" mode="aspectFit"></image>
  25. <input type="text" placeholder="请输入验证码" class="input" />
  26. </view>
  27. </view>
  28. <view class="btn-area">
  29. <button class="next-btn" @click="goToPwdNext">下一步</button>
  30. </view>
  31. </view>
  32. </template>
  33. <script setup>
  34. import {
  35. ref,
  36. onMounted
  37. } from 'vue'
  38. const iSMT = ref(0)
  39. const activeTab = ref('email')
  40. const gettingCode = ref(false)
  41. const time = ref(60)
  42. const getCode = () => {
  43. if (gettingCode.value) return
  44. gettingCode.value = true
  45. time.value = 60
  46. const timer = setInterval(() => {
  47. time.value--
  48. if (time.value <= 0) {
  49. clearInterval(timer)
  50. gettingCode.value = false
  51. time.value = 60
  52. }
  53. }, 1000)
  54. }
  55. const goToPwdNext = () =>{
  56. uni.navigateTo({
  57. url:'../setting/nextPwd'
  58. })
  59. }
  60. onMounted(() => {
  61. // 获取状态栏高度
  62. iSMT.value = uni.getSystemInfoSync().statusBarHeight;
  63. })
  64. </script>
  65. <style>
  66. .tab {
  67. display: flex;
  68. height: 8vh;
  69. background-color: #fff;
  70. border-bottom: 1rpx solid #eee;
  71. }
  72. .tab-item {
  73. flex: 1;
  74. display: flex;
  75. justify-content: center;
  76. align-items: center;
  77. font-size: 32rpx;
  78. position: relative;
  79. }
  80. .tab-item.active {
  81. color: #000;
  82. font-weight: bold;
  83. }
  84. .tab-item.active::after {
  85. content: '';
  86. position: absolute;
  87. bottom: 0;
  88. left: 50%;
  89. transform: translateX(-50%);
  90. width: 40rpx;
  91. height: 6rpx;
  92. background-color: #000;/* ????? */
  93. }
  94. .switch-tab {
  95. background-color: #fff;
  96. padding: 0 60rpx;
  97. }
  98. .input-list {
  99. display: flex;
  100. align-items: center;
  101. justify-content: center;
  102. height: 7vh;
  103. border-bottom: 1rpx solid #eee;
  104. }
  105. .input-list image {
  106. width: 40rpx;
  107. height: 40rpx;
  108. margin-right: 20rpx;
  109. }
  110. .input {
  111. flex: 1;
  112. height: 14vh;
  113. font-size: 28rpx;
  114. }
  115. .code-btn {
  116. width: 200rpx;
  117. height: 60rpx;
  118. font-size: 24rpx;
  119. border-radius: 10rpx;
  120. background-color: #eee;
  121. color: #666;
  122. display: flex;
  123. align-items: center;
  124. justify-content: center;
  125. }
  126. .code-btn.disabled {
  127. background-color: #ccc;
  128. color: #999;
  129. }
  130. .btn-area{
  131. height:8vh;
  132. background-color: white;
  133. padding-top: 120rpx;
  134. }
  135. .next-btn {
  136. width: 610rpx;
  137. height: 85rpx;
  138. background-color: #000;
  139. color: #fff;
  140. font-size: 30rpx;
  141. border-radius: 40rpx;
  142. display: flex;
  143. align-items: center;
  144. justify-content: center;
  145. }
  146. </style>