register.vue 4.7 KB

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