|
@@ -13,12 +13,16 @@
|
|
|
<view class="bg">
|
|
|
<text class="icon"></text>
|
|
|
<input :password="show" v-model="form.password" placeholder="请输入密码" />
|
|
|
- <view class="label"><view class="icon" :class="{ active: !show }" @click="show = !show"></view></view>
|
|
|
+ <view class="label">
|
|
|
+ <view class="icon" :class="{ active: !show }" @click="show = !show"></view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view class="bg">
|
|
|
<text class="icon"></text>
|
|
|
<input :password="show" v-model="form.rePassword" placeholder="确认密码" />
|
|
|
- <view class="label"><view class="icon" :class="{ active: !show }" @click="show = !show"></view></view>
|
|
|
+ <view class="label">
|
|
|
+ <view class="icon" :class="{ active: !show }" @click="show = !show"></view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view class="xy">
|
|
|
<u-checkbox-group class="checkbox" v-model="form.checked">
|
|
@@ -35,79 +39,110 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- show: true,
|
|
|
- time: 60,
|
|
|
- code: '获取验证码',
|
|
|
- form: {}
|
|
|
- };
|
|
|
- },
|
|
|
- onLoad(option) {
|
|
|
- this.form.type = option.type;
|
|
|
- },
|
|
|
- created() {},
|
|
|
- methods: {
|
|
|
- startCount() {
|
|
|
- setTimeout(() => {
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ show: true,
|
|
|
+ time: 60,
|
|
|
+ code: '获取验证码',
|
|
|
+ form: {}
|
|
|
+ };
|
|
|
+ },
|
|
|
+ onLoad(option) {
|
|
|
+ this.form.type = option.type;
|
|
|
+ },
|
|
|
+ created() {},
|
|
|
+ methods: {
|
|
|
+ startCount() {
|
|
|
+ setTimeout(() => {
|
|
|
+ let time = this.time;
|
|
|
+ if (time == 0) {
|
|
|
+ this.code = '重新获取';
|
|
|
+ this.time = 60;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.time = --time;
|
|
|
+ this.code = time + '后重新获取';
|
|
|
+ this.startCount();
|
|
|
+ }, 1000);
|
|
|
+ },
|
|
|
+ getCode() {
|
|
|
let time = this.time;
|
|
|
- if (time == 0) {
|
|
|
- this.code = '重新获取';
|
|
|
- this.time = 60;
|
|
|
+ if (time > 0 && time < 60) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let phone = this.form.phone;
|
|
|
+ if (!this.$common.isPhone(phone)) {
|
|
|
+ this.$common.toast('请输入正确的手机号');
|
|
|
return;
|
|
|
}
|
|
|
- this.time = --time;
|
|
|
- this.code = time + '后重新获取';
|
|
|
this.startCount();
|
|
|
- }, 1000);
|
|
|
- },
|
|
|
- getCode() {
|
|
|
- let time = this.time;
|
|
|
- if (time > 0 && time < 60) {
|
|
|
- return;
|
|
|
- }
|
|
|
- let phone = this.form.phone;
|
|
|
- if (!this.$common.isPhone(phone)) {
|
|
|
- this.$common.toast('请输入正确的手机号');
|
|
|
- return;
|
|
|
- }
|
|
|
- this.startCount();
|
|
|
- this.$api.getPhoneSmsCode().then(resp => {
|
|
|
- this.$common.toast('已发送');
|
|
|
- });
|
|
|
- },
|
|
|
- submit() {
|
|
|
- let rule = [
|
|
|
- { name: 'phone', checkType: 'phone', errorMsg: '请输入正确的手机号码' },
|
|
|
- { name: 'smsCode', checkType: 'notnull', errorMsg: '请输入验证码' },
|
|
|
- { name: 'password', checkType: 'notnull', errorMsg: '请输入密码' },
|
|
|
- { name: 'rePassword', checkType: 'same', checkRule: this.form.password, errorMsg: '两次输入不一致' },
|
|
|
- { name: 'checked', checkType: 'notnull', errorMsg: '请同意并勾选协议' }
|
|
|
- ];
|
|
|
- if (!this.verify.check(this.form, rule)) {
|
|
|
- uni.showModal({ content: this.verify.error, showCancel: false });
|
|
|
- return false;
|
|
|
- }
|
|
|
- this.$api.doRefister(this.form).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- uni.$u.toast('注册成功');
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/login/login'
|
|
|
+ this.$api.getPhoneSmsCode().then(resp => {
|
|
|
+ this.$common.toast('已发送');
|
|
|
+ });
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ let rule = [{
|
|
|
+ name: 'phone',
|
|
|
+ checkType: 'phone',
|
|
|
+ errorMsg: '请输入正确的手机号码'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'smsCode',
|
|
|
+ checkType: 'notnull',
|
|
|
+ errorMsg: '请输入验证码'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'password',
|
|
|
+ checkType: 'notnull',
|
|
|
+ errorMsg: '请输入密码'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'rePassword',
|
|
|
+ checkType: 'same',
|
|
|
+ checkRule: this.form.password,
|
|
|
+ errorMsg: '两次输入不一致'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'checked',
|
|
|
+ checkType: 'notnull',
|
|
|
+ errorMsg: '请同意并勾选协议'
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ if (!this.verify.check(this.form, rule)) {
|
|
|
+ uni.showModal({
|
|
|
+ content: this.verify.error,
|
|
|
+ showCancel: false
|
|
|
});
|
|
|
+ return false;
|
|
|
}
|
|
|
- });
|
|
|
- },
|
|
|
- toLogin() {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/login/login'
|
|
|
- });
|
|
|
- },
|
|
|
- getAgreement(id) {
|
|
|
- uni.navigateTo({ url: '/pages/login/userAgreement?id=' + id });
|
|
|
+ this.http.request({
|
|
|
+ url: '/sp-admin/app/AppUser/register',
|
|
|
+ data: this.form,
|
|
|
+ contentType: 'application/json; charset=utf-8',
|
|
|
+ method: 'POST',
|
|
|
+ success: resp => {
|
|
|
+ setTimeout(function (){
|
|
|
+ uni.showToast({title: '注册成功'});
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/login/login'
|
|
|
+ });
|
|
|
+ },1000)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ toLogin() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/login/login'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getAgreement(id) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/login/userAgreement?id=' + id
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss"></style>
|
|
|
+<style lang="scss"></style>
|