index.vue 4.7 KB

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