forget.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="content">
  3. <view class="top_bg">
  4. <image class="top_close" src="/static/image/login/close_icon.png" mode="scaleToFill" />
  5. <view class="top_text">
  6. <view>忘记密码</view>
  7. <view class="top_icon"></view>
  8. </view>
  9. </view>
  10. <view class="w pdx-40 main">
  11. <u--input class="h-112" v-model="loginParam.phone" placeholder="请输入手机号码" border="bottom"
  12. clearable></u--input>
  13. <u--input class="h-112 mgt-16" v-model="loginParam.code" placeholder="请输入验证码" border="bottom" clearable>
  14. <template slot="suffix">
  15. <u-code :seconds="seconds" @end="end" @start="start" change-text="xs" ref="uCode"
  16. @change="codeChange"></u-code>
  17. <u-button :disabled="!isShowCode" @tap="getCode" class="code_btn">{{ tips }}</u-button>
  18. </template>
  19. </u--input>
  20. <u--input class="h-112 mgt-16" v-model="loginParam.password" :password="!isViewPassword" placeholder="请输入密码"
  21. border="bottom" clearable>
  22. <template slot="suffix">
  23. <u-icon @click="isViewPassword = !isViewPassword" :name="!isViewPassword ? 'eye-fill' : 'eye-off'"
  24. color="#303030" size="24"></u-icon>
  25. </template>
  26. </u--input>
  27. <u--input class="h-112 mgt-16" v-model="loginParam.confirmPwd" :password="!isViewConfirmPwd"
  28. placeholder="请确认密码" border="bottom" clearable>
  29. <template slot="suffix">
  30. <u-icon @click="isViewConfirmPwd = !isViewConfirmPwd"
  31. :name="!isViewConfirmPwd ? 'eye-fill' : 'eye-off'" color="#303030" size="24"></u-icon>
  32. </template>
  33. </u--input>
  34. <u-button :disabled="!isSubmit" class="login" @tap="submit">提交</u-button>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. isViewPassword: false,
  43. isViewConfirmPwd: false,
  44. isCode: false,//验证码按钮状态
  45. tips: '',// 验证码提示文字
  46. seconds: 60,//验证码秒数
  47. loginParam: {
  48. phone: undefined,
  49. code: undefined,
  50. password: undefined,
  51. confirmPwd: undefined,
  52. },
  53. }
  54. },
  55. computed: {
  56. isShowCode() {
  57. return this.loginParam.phone && !this.isCode
  58. },
  59. isSubmit() {
  60. return this.loginParam.phone && this.loginParam.code &&
  61. this.loginParam.password && this.loginParam.confirmPwd
  62. }
  63. },
  64. watch: {
  65. },
  66. onLoad() {
  67. },
  68. methods: {
  69. codeChange(text) {
  70. this.tips = text;
  71. },
  72. getCode() {
  73. if (this.$refs.uCode.canGetCode) {
  74. // 模拟向后端请求验证码
  75. uni.showLoading({
  76. title: '正在获取验证码'
  77. })
  78. setTimeout(() => {
  79. uni.hideLoading();
  80. // 这里此提示会被this.start()方法中的提示覆盖
  81. uni.$u.toast('验证码已发送');
  82. // 通知验证码组件内部开始倒计时
  83. this.$refs.uCode.start();
  84. }, 2000);
  85. } else {
  86. uni.$u.toast('倒计时结束后再发送');
  87. }
  88. },
  89. end() {
  90. // uni.$u.toast('倒计时结束');
  91. this.isCode = false
  92. },
  93. start() {
  94. // uni.$u.toast('倒计时开始');
  95. this.isCode = true
  96. },
  97. submit() {
  98. console.log('提交参数 :===>>', this.loginParam);
  99. }
  100. }
  101. }
  102. </script>
  103. <style scoped lang="scss">
  104. .content {
  105. width: 100vw;
  106. height: 100vh;
  107. display: flex;
  108. flex-direction: column;
  109. align-items: center;
  110. position: relative;
  111. }
  112. .top_bg {
  113. position: relative;
  114. width: 100vw;
  115. height: 568rpx;
  116. flex-shrink: 0;
  117. background: linear-gradient(to bottom, #ffd8bf, #ffffff);
  118. .top_close {
  119. position: absolute;
  120. top: 128rpx;
  121. left: 40rpx;
  122. width: 48rpx;
  123. height: 48rpx;
  124. }
  125. .top_text {
  126. position: absolute;
  127. top: 224rpx;
  128. left: 64rpx;
  129. display: flex;
  130. color: #070602;
  131. font-family: "MiSans VF";
  132. font-size: 52rpx;
  133. font-style: normal;
  134. font-weight: 600;
  135. line-height: normal;
  136. letter-spacing: 0.66rpx;
  137. text-transform: uppercase;
  138. }
  139. .top_icon {
  140. margin-top: -10rpx;
  141. margin-left: 8rpx;
  142. width: 20rpx;
  143. height: 20rpx;
  144. flex-shrink: 0;
  145. border-radius: 50%;
  146. border: 6rpx solid #4caf50;
  147. background-color: transparent;
  148. }
  149. }
  150. .main {
  151. margin-top: -72rpx;
  152. .login {
  153. margin-top: 240rpx;
  154. height: 96rpx;
  155. width: 100%;
  156. flex-shrink: 0;
  157. border-radius: 64rpx;
  158. background: #FE6505;
  159. color: #ffffff;
  160. text-align: center;
  161. font-family: "MiSans VF";
  162. font-size: 36rpx;
  163. font-style: normal;
  164. font-weight: 500;
  165. }
  166. .code_btn {
  167. padding: 0rpx 24rpx;
  168. height: 60rpx;
  169. border-radius: 32rpx;
  170. font-size: 24rpx;
  171. color: #fff;
  172. font-weight: 400;
  173. background: linear-gradient(0deg, #FE6505 0%, #FE6505 100%), #141111;
  174. }
  175. .code_btn_off {
  176. background: #fe65054d;
  177. }
  178. }
  179. </style>