bindEmail.vue 2.7 KB

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