index.vue 2.9 KB

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