index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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-divider color="#0095FF" border-color="#0095FF" bg-color="#F4F4F4" fontSize="30">赛轮店管家</u-divider>
  43. </view>
  44. </view>
  45. <u-toast ref="uToast" />
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. tel: '',
  53. code: '',
  54. codeText: '',
  55. pact: false,
  56. loading: false,
  57. }
  58. },
  59. computed: {},
  60. methods: {
  61. submit() {
  62. if (this.$u.test.mobile(this.tel)) {
  63. this.loading = true
  64. setTimeout(() => {
  65. this.$u.route({
  66. url: 'pages/home/index',
  67. type: 'switchTab'
  68. })
  69. this.loading = false
  70. }, 2000)
  71. }
  72. },
  73. inregister() {
  74. this.$u.route({
  75. url: 'pages/login/register',
  76. })
  77. },
  78. codeChange(text) {
  79. this.codeText = text;
  80. },
  81. getCode() {
  82. if (this.$refs.uCode.canGetCode) {
  83. // 模拟向后端请求验证码
  84. uni.showLoading({
  85. title: '正在获取验证码',
  86. })
  87. setTimeout(() => {
  88. uni.hideLoading();
  89. // 通知验证码组件内部开始倒计时
  90. this.$refs.uCode.start();
  91. }, 1000);
  92. } else {
  93. this.$u.toast('倒计时结束后再发送');
  94. }
  95. }
  96. }
  97. };
  98. </script>
  99. <style lang="scss" scoped>
  100. .status_bar {
  101. height: var(--status-bar-height);
  102. width: 100%;
  103. background-color:#0095FF;
  104. }
  105. .content {
  106. position: relative;
  107. top: -350rpx;
  108. }
  109. .foot {
  110. position: fixed;
  111. bottom: 10rpx;
  112. width: 100%;
  113. }
  114. </style>