| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <template>
-
- <view class="page-box">
-
- <uni-forms :modelValue="postForm" ref="postForm" :rules="rules" :label-width="80">
-
- <sms-box v-model="postForm" ref="smsBox" :type="2"></sms-box>
-
- <uni-forms-item name="newPassword" label="新的密码" required>
- <uni-easyinput type="text" v-model="postForm.newPassword" placeholder="输入新密码" />
- </uni-forms-item>
-
-
- </uni-forms>
-
- <view>
- <button type="primary" @tap="handleReset">重设密码</button>
- </view>
-
- <view class="login-opt">
- <a @tap="$navs.toReg">立即注册</a>
- <a @tap="$navs.toLogin">已有账号?</a>
- </view>
-
- </view>
-
- </template>
- <script>
- import { resetPass } from '@/api/user.js'
-
- import SmsBox from './components/SmsBox.vue'
- export default {
- components: {
- SmsBox
- },
- data() {
- return {
- rules: {
-
- newPassword: {
- rules: [{
- required: true,
- errorMessage: '新密码不能为空!'
- }]
- }
- },
- postForm: {
- captchaKey: '',
- captchaValue: '',
- smsCode: '',
- mobile: '',
- newPassword: ''
- }
- }
- },
-
- created(){
-
-
- },
- methods: {
-
- async handleReset() {
-
- let that = this
-
- // 消息框
- const smsCheck = await this.$refs.smsBox.validate().then(res=>{return res});
-
- if(!smsCheck){
- return;
- }
-
-
- // 对整个表单进行校验,返回一个 Promise
- this.$refs.postForm.validate().then((res)=>{
-
- uni.showLoading({
- title: '加载中...'
- });
-
- // 快速注册后开始考试
- resetPass(this.postForm).then(data => {
-
- // 关闭加载
- uni.hideLoading()
-
- uni.showToast({
- title: '密码重置成功,请重新登录!',
- icon:'none',
- duration: 2000
- })
-
- setTimeout(()=>{
- //打印请求返回的数据
- uni.switchTab({
- url: '/pages/index/index'
- });
- },1500)
-
- });
-
-
- }).catch((err)=>{
-
- })
-
- }
- }
- }
- </script>
- <style>
-
-
- </style>
|