index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <view>
  3. <view class="status_bar">
  4. <!-- 这里是状态栏 -->
  5. </view>
  6. <u-image src="../../static/sailun/login_bg.png" mode="widthFix"></u-image>
  7. <view class="content">
  8. <u-card padding="50" :head-border-bottom="false" :show-head="false" :show-foot="false" :border="false" box-shadow="0px 1px 10px rgba(0,0,0,0.2)"
  9. border-radius="20" margin="50rpx">
  10. <view slot="body">
  11. <view style="margin-top: 20rpx;">
  12. <u-field v-model="tel" placeholder="请填写手机号" label-width="50">
  13. <u-icon slot="icon" name="account" size="36" color="#666666"></u-icon>
  14. </u-field>
  15. </view>
  16. <view style="margin-top: 30rpx;">
  17. <u-field v-model="code" placeholder="请填写验证码" label-width="50">
  18. <u-icon slot="icon" name="lock" size="36" color="#666666"></u-icon>
  19. <u-button size="mini" slot="right" type="primary" @click="getCode" shape="circle">{{codeText}}</u-button>
  20. </u-field>
  21. </view>
  22. <u-verification-code ref="uCode" @change="codeChange"></u-verification-code>
  23. <view style="margin-top: 80rpx;">
  24. <u-button type="primary" :ripple="true" ripple-bg-color="#99d4ff" shape="circle" @tap="$u.debounce(submit, 2000,immediate = true)"
  25. :loading="loading">登录</u-button>
  26. </view>
  27. <view style="margin-top: 80rpx;display: flex;justify-content: center;">
  28. <view class="u-flex" @click="inregister">
  29. <view style="color: rgba(0,160,234,0.5)">
  30. 还没有账号?
  31. </view>
  32. <view style="color: #00A0EA">
  33. 立即注册
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </u-card>
  39. </view>
  40. <view class="foot">
  41. <view class="u-flex u-row-center u-col-center">
  42. <u-line color="#0095FF" length="15%" />
  43. <view style="margin: 0 20rpx;color:#0095FF;font-family: Source Han Sans CN;">
  44. 赛轮店管家
  45. </view>
  46. <u-line color="#0095FF" length="15%" />
  47. </view>
  48. </view>
  49. <u-toast ref="uToast" />
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. data() {
  55. return {
  56. tel: '',
  57. code: '',
  58. codeText: '',
  59. pact: false,
  60. loading: false,
  61. }
  62. },
  63. computed: {},
  64. methods: {
  65. submit() {
  66. if (this.$u.test.mobile(this.tel)) {
  67. this.loading = true
  68. setTimeout(() => {
  69. this.$u.route({
  70. url: 'pages/home/index',
  71. type: 'switchTab'
  72. })
  73. this.loading = false
  74. }, 2000)
  75. }
  76. },
  77. inregister() {
  78. this.$u.route({
  79. url: 'pages/login/register',
  80. })
  81. },
  82. codeChange(text) {
  83. this.codeText = text;
  84. },
  85. getCode() {
  86. if (this.$refs.uCode.canGetCode) {
  87. // 模拟向后端请求验证码
  88. uni.showLoading({
  89. title: '正在获取验证码',
  90. })
  91. setTimeout(() => {
  92. uni.hideLoading();
  93. // 通知验证码组件内部开始倒计时
  94. this.$refs.uCode.start();
  95. }, 1000);
  96. } else {
  97. this.$u.toast('倒计时结束后再发送');
  98. }
  99. }
  100. }
  101. };
  102. </script>
  103. <style lang="scss" scoped>
  104. .status_bar {
  105. height: var(--status-bar-height);
  106. width: 100%;
  107. background-color:#0095FF;
  108. }
  109. .content {
  110. position: relative;
  111. top: -350rpx;
  112. }
  113. .foot {
  114. position: fixed;
  115. bottom: 10rpx;
  116. width: 100%;
  117. }
  118. </style>