微信

index.vue 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div class="mainPage">
  3. <div class="mask">
  4. <img :src="logo" class="logo" alt="">
  5. <div class="centerLabel" style="width:100%;">
  6. <div class="box" style="margin:0 auto;">
  7. <div class="title">登录</div>
  8. <div class="mobile">
  9. <i class="iconfont icon-dianhua"></i>
  10. <input type="number" maxlength="11" placeholder="手机号" v-model="postData.phone">
  11. </div>
  12. <div class="sms" style="margin-top:.2rem;">
  13. <i class="iconfont icon-mima"></i>
  14. <input type="number" maxlength="6" placeholder="验证码" v-model="postData.captcha">
  15. <div class="sand" v-if="seconds === 60" @click="sandMsg">发送验证码</div>
  16. <div class="sand" v-else>{{seconds}}后可重发</div>
  17. </div>
  18. </div>
  19. <div class="submit" @click="submit">
  20. <div>通过验证</div>
  21. </div>
  22. </div>
  23. <transition name="slide">
  24. <div class="select" v-if="showCase">
  25. <van-picker
  26. show-toolbar
  27. title="请选择"
  28. value-key='CaseName'
  29. :columns="columns"
  30. @cancel="onCancelC"
  31. @confirm="onConfirmC"
  32. />
  33. </div>
  34. </transition>
  35. <transition name="slide">
  36. <div class="select" v-if="showSales">
  37. <van-picker
  38. show-toolbar
  39. title="请选择"
  40. value-key='UserName'
  41. :columns="columnsS"
  42. @cancel="onCancelS"
  43. @confirm="onConfirmS"
  44. />
  45. </div>
  46. </transition>
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. import logo from '../../../common/icon/logo.png'
  52. import { createNamespacedHelpers } from 'vuex'
  53. const { mapActions: actions } = createNamespacedHelpers('userCenter')
  54. const { mapActions: mapLoginActions } = createNamespacedHelpers('login')
  55. export default {
  56. data () {
  57. return {
  58. logo,
  59. showCase: false,
  60. showSales: false,
  61. seconds: 60,
  62. postData: {
  63. phone: '',
  64. captcha: ''
  65. }
  66. }
  67. },
  68. methods: {
  69. ...actions(['getCaptcha']),
  70. ...mapLoginActions(['submitData']),
  71. sandMsg () {
  72. if (!this.postData.phone) {
  73. this.$toast('请先填写手机号')
  74. return
  75. }
  76. this.getCaptcha(this.postData.phone)
  77. this.runTime()
  78. },
  79. runTime () {
  80. setTimeout(() => {
  81. this.seconds--
  82. if (this.seconds < 60 && this.seconds >= 1) {
  83. this.runTime()
  84. } else if (this.seconds < 1) {
  85. this.seconds = 60
  86. }
  87. }, 1000)
  88. },
  89. submit () {
  90. if (!this.postData.captcha) {
  91. this.$toast('请先获取验证码')
  92. return
  93. }
  94. this.submitData(this.postData).then((res) => {
  95. this.$toast(res)
  96. })
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. @import "page.scss";
  103. </style>