bindPhone.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <mobile-frame :frameStyle="frameStyle" @toPath="toPath">
  3. <view class="main">
  4. <view class="one">
  5. <uni-forms ref="form" :modelValue="form" :rules="rules" label-width="auto">
  6. <uni-forms-item label="手机号" name="phone">
  7. <uni-easyinput type="text" v-model="form.phone" placeholder="请输入您的手机号" />
  8. </uni-forms-item>
  9. <uni-forms-item label="验证码" name="code" class="local">
  10. <uni-easyinput type="text" v-model="form.code" placeholder="验证码图片点击可更改" />
  11. <button class="localicon" type="primary" size="mini">发送验证码</button>
  12. </uni-forms-item>
  13. <uni-forms-item label="手机验证码" name="num" class="local">
  14. <uni-easyinput type="text" v-model="form.num" placeholder="请输入您的手机验证码" />
  15. <button class="localicon" type="primary" size="mini">发送验证码</button>
  16. </uni-forms-item>
  17. </uni-forms>
  18. <view class="btn">
  19. <button type="primary" @click="onSubmit('form')" size="small">立即绑定</button>
  20. </view>
  21. <view class="Tips">提示:为了您的账号安全,请及时绑定手机号</view>
  22. </view>
  23. </view>
  24. </mobile-frame>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. frameStyle: {
  31. useBar: false
  32. },
  33. form: {},
  34. rules: {
  35. phone: {
  36. rules: [{
  37. required: true,
  38. errorMessage: '请输入手机号',
  39. }]
  40. },
  41. code: {
  42. rules: [{
  43. required: true,
  44. errorMessage: '请输入验证码',
  45. }]
  46. },
  47. num: {
  48. rules: [{
  49. required: true,
  50. errorMessage: '请输入手机验证码',
  51. }]
  52. },
  53. },
  54. };
  55. },
  56. onLoad: function(e) {
  57. console.log(e);
  58. },
  59. onShow: function() {},
  60. methods: {
  61. toPath(e) {
  62. if (e && e.route) uni.redirectTo({
  63. url: `/${e.route}`
  64. })
  65. },
  66. // 提交保存
  67. onSubmit() {
  68. const that = this;
  69. let data = that.form;
  70. this.$refs.form.validate().then(async (res) => {
  71. let arr;
  72. console.log(data);
  73. // if (data._id) {
  74. // arr = await that.$api(``, 'POST', data)
  75. // } else {
  76. // arr = await that.$api(``, 'POST', data)
  77. // }
  78. // if (arr.errcode == '0') {
  79. // uni.showToast({
  80. // title: `维护信息成功`,
  81. // icon: 'success',
  82. // duration: 2000
  83. // });
  84. // that.back()
  85. // } else {
  86. // uni.showToast({
  87. // title: arr.errmsg,
  88. // icon: 'error',
  89. // duration: 2000
  90. // })
  91. // }
  92. })
  93. },
  94. }
  95. }
  96. </script>
  97. <style lang="scss">
  98. .main {
  99. display: flex;
  100. flex-direction: column;
  101. width: 100vw;
  102. height: 100vh;
  103. .one {
  104. padding: 2vw;
  105. .uni-input {
  106. border: #f1f1ff 1px solid;
  107. padding: 2vw 2vw;
  108. border-radius: 1vw;
  109. }
  110. .btn {
  111. text-align: center;
  112. button {
  113. margin: 0 2vw 2vw 2vw;
  114. background-color: var(--ff0Color);
  115. color: var(--fffColor);
  116. }
  117. .name {
  118. color: var(--f85Color);
  119. font-size: var(--font14Size);
  120. }
  121. }
  122. .Tips {
  123. font-size: var(--font12Size);
  124. color: var(--f85Color);
  125. }
  126. }
  127. }
  128. .uni-forms-item {
  129. margin-bottom: 6vw !important;
  130. display: flex;
  131. flex-direction: row;
  132. }
  133. .localicon {
  134. position: absolute;
  135. right: 0;
  136. top: 5px;
  137. }
  138. </style>