bindEmail.vue 2.8 KB

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