123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <template>
- <mobile-frame :frameStyle="frameStyle" @toPath="toPath">
- <view class="main">
- <view class="one">
- <uni-forms ref="form" :modelValue="form" :rules="rules" label-width="auto">
- <uni-forms-item label="电子邮箱" name="email" class="local">
- <uni-easyinput type="text" v-model="form.email" placeholder="请输入电子邮箱" />
- <button class="localicon" type="primary" size="mini">发送验证码</button>
- </uni-forms-item>
- <uni-forms-item label="邮箱验证码" name="num">
- <uni-easyinput type="text" v-model="form.num" placeholder="请输入邮箱验证码" />
- </uni-forms-item>
- </uni-forms>
- <view class="btn">
- <button type="primary" @click="onSubmit('form')" size="small">立即绑定</button>
- </view>
- </view>
- </view>
- </mobile-frame>
- </template>
- <script>
- export default {
- data() {
- return {
- frameStyle: {
- useBar: false
- },
- form: {},
- rules: {
- email: {
- rules: [{
- required: true,
- errorMessage: '请输入邮箱',
- }]
- },
- num: {
- rules: [{
- required: true,
- errorMessage: '请输入邮箱验证码',
- }]
- },
- },
- };
- },
- onLoad: function(e) {
- console.log(e);
- },
- onShow: function() {},
- methods: {
- toPath(e) {
- if (e && e.route) uni.redirectTo({
- url: `/${e.route}`
- })
- },
- // 提交保存
- onSubmit() {
- const that = this;
- let data = that.form;
- data = {
- ...data,
- }
- console.log(data);
- // this.$refs.form.validate().then(async (res) => {
- // let arr;
- // if (data._id) {
- // arr = await that.$api(``, 'POST', data)
- // } else {
- // arr = await that.$api(``, 'POST', data)
- // }
- // if (arr.errcode == '0') {
- // uni.showToast({
- // title: `维护信息成功`,
- // icon: 'success',
- // duration: 2000
- // });
- // that.back()
- // } else {
- // uni.showToast({
- // title: arr.errmsg,
- // icon: 'error',
- // duration: 2000
- // })
- // }
- // })
- },
- }
- }
- </script>
- <style lang="scss">
- .main {
- display: flex;
- flex-direction: column;
- width: 100vw;
- height: 100vh;
- .one {
- padding: 2vw;
- .uni-input {
- border: #f1f1ff 1px solid;
- padding: 2vw 2vw;
- border-radius: 1vw;
- }
- .btn {
- text-align: center;
- button {
- margin: 0 2vw 2vw 2vw;
- background-color: var(--ff0Color);
- color: var(--fffColor);
- }
- .name {
- color: var(--f85Color);
- font-size: var(--font14Size);
- }
- }
- }
- }
- .uni-forms-item {
- margin-bottom: 6vw !important;
- display: flex;
- flex-direction: row;
- }
- .uni-forms-item:first-child {
- .uni-easyinput__content {
- width: 50vw;
- }
- }
- .localicon {
- position: absolute;
- right: 0;
- top: 5px;
- }
- </style>
|