login.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view style="position: relative;">
  3. <view class="bg"></view>
  4. <view class="bg1"></view>
  5. <view class="back" @click="$back">
  6. <u-icon name="arrow-left" size="50" color="#919191"></u-icon>
  7. </view>
  8. <view class="content">
  9. <view class="top">
  10. <view class="logo">
  11. <image src="@/static/icon/logo.png" mode=""></image>
  12. </view>
  13. <view class="title">
  14. <text>欢迎进入联兑通</text>
  15. <text>输入手机号快捷登录</text>
  16. </view>
  17. </view>
  18. <view style="width: 76%;margin-top: 80rpx;">
  19. <u-form >
  20. <u-form-item :rightIconStyle="{color: '#888', fontSize: '32rpx'}" label-position="top" label="手机号" prop="phone" label-width="150">
  21. <view style="border-bottom: 1rpx solid #DDDDDD;">
  22. <u-input :border="false" placeholder="请输入手机号" v-model="phone" type="number"></u-input>
  23. </view>
  24. </u-form-item>
  25. <u-form-item label-position="top" label="验证码" prop="code" label-width="150">
  26. <view class="flex" style="border-bottom: 1rpx solid #DDDDDD;">
  27. <u-input style="width: 100%;" :border="false" placeholder="请输入验证码" v-model="code" type="text"></u-input>
  28. <u-button shape="circle" slot="right" :custom-style="customStyle" size="mini" @click="getCode">{{codeTips}}</u-button>
  29. </view>
  30. </u-form-item>
  31. </u-form>
  32. </view>
  33. <view style="width: 86%;margin-top: 80rpx;">
  34. <view @click="login" class="btn cu-btn round" style="width:100%;height: 90rpx;font-size: 34rpx;">
  35. 立即登录
  36. </view>
  37. <view class="center" style="margin-top: 100rpx;">
  38. <text style="color: #949494;">登录即代表已阅读并同意</text>
  39. <text style="color: #0000ff;">《软件服务协议》</text>
  40. </view>
  41. </view>
  42. </view>
  43. <u-verification-code seconds="60" ref="uCode" @change="codeChange"></u-verification-code>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. data() {
  49. return {
  50. customStyle:{
  51. 'backgroundColor':'#d18c42',
  52. 'color':'#ffffff'
  53. },
  54. codeTips: '',
  55. phone:'',
  56. code:'',
  57. }
  58. },
  59. methods: {
  60. login(){
  61. uni.reLaunch({
  62. url:"/pages/index/index"
  63. })
  64. },
  65. codeChange(text) {
  66. this.codeTips = text;
  67. },
  68. // 获取验证码
  69. getCode() {
  70. if(this.$refs.uCode.canGetCode) {
  71. // 模拟向后端请求验证码
  72. uni.showLoading({
  73. title: '正在获取验证码',
  74. mask: true
  75. })
  76. setTimeout(() => {
  77. uni.hideLoading();
  78. // 这里此提示会被this.start()方法中的提示覆盖
  79. this.$u.toast('验证码已发送');
  80. // 通知验证码组件内部开始倒计时
  81. this.$refs.uCode.start();
  82. }, 2000);
  83. } else {
  84. this.$u.toast('倒计时结束后再发送');
  85. }
  86. },
  87. }
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. $color:#d18c42;
  92. page{
  93. background-color: #FFFFFF;
  94. }
  95. .btn{
  96. background-color: $color;
  97. color:#FFFFFF;
  98. }
  99. .bg{
  100. z-index: 99;
  101. height: 440rpx;
  102. width: 440rpx;
  103. position: absolute;
  104. right: -240rpx;
  105. top: -240rpx;
  106. background-color: #d18c42;
  107. border-radius: 50%;
  108. box-shadow: 0rpx 0rpx 50rpx #c5803b;
  109. }
  110. .bg1{
  111. height: 500rpx;
  112. width: 500rpx;
  113. position: absolute;
  114. right: -240rpx;
  115. top: -240rpx;
  116. background-color: #d18c42;
  117. border-radius: 50%;
  118. box-shadow: #c6813b;
  119. }
  120. .back{
  121. position: absolute;
  122. top: var(--status-bar-height);
  123. left: 20rpx;
  124. padding-top: var(--status-bar-height);
  125. }
  126. .content{
  127. height: 90vh;
  128. display: flex;
  129. flex-direction: column;
  130. justify-content: center;
  131. align-items: center;
  132. .top{
  133. display: flex;
  134. .logo{
  135. background-color: $color;
  136. width: 130rpx;
  137. height: 130rpx;
  138. border-radius: 30rpx;
  139. display: flex;
  140. justify-content: center;
  141. align-items: center;
  142. margin-right: 20rpx;
  143. image{
  144. width: 90rpx;
  145. height: 90rpx;
  146. }
  147. }
  148. .title{
  149. margin-right: 20rpx;
  150. display: flex;
  151. flex-direction: column;
  152. justify-content: center;
  153. align-items: flex-start;
  154. text-align: left;
  155. text:first-child{
  156. font-weight: 800;
  157. font-size: 50rpx;
  158. color: #000;
  159. margin-bottom: 20rpx;
  160. }
  161. text:last-child{
  162. font-size: 28rpx;
  163. color: #7f7f7f;
  164. }
  165. }
  166. }
  167. }
  168. </style>