gx
queenwuli
2021-01-25 c4246ca910f28014efaace64ebf92f47a673a9cf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<template>
    <!-- 新密码 -->
    <view>
        <view class="input-box">
            <input type="password" v-model="newPassword" placeholder="请输入新密码" placeholder-class="placeholder" class="input-group-row"/>
            <input type="password" v-model="password" placeholder="请确认密码" placeholder-class="placeholder" class="input-group-row"/>
        </view>
        <button class="blue-btn sticky-footer" @click="submit">提交</button>
    </view>
</template>
 
<script>
    export default{
        data(){
            return{
                newPassword:'',
                password:'',
                sendCode:'',
                telphone:''
            }
        },
        onLoad(options) {
            this.sendCode = options.code;
            this.telphone = options.phone;
        },
        methods:{
            valid(){
                if(!this.newPassword.trim()){
                    this.$toast.info('请输入新密码');
                    return false;
                }
                if(this.password.trim()!==this.newPassword.trim()){
                    this.$toast.info('两次密码不一致');
                    return false;
                }
            },
            submit(){
                if(this.valid() === false){
                    return;
                }
                this.$httpUtils.request('/api/common/resetLoginPwd',{
                    code: this.sendCode,
                    newPwd: this.newPassword,
                    telphone: this.telphone
                },'POST').then((res)=>{
                    if(res.status==200){
                        uni.navigateBack({
                            delta:2
                        })
                    }
                    this.$toast.info(res.info);
                }).catch((err) => {
                    this.$toast.info(res.info);
                })
            }
        }
    }
</script>
 
<style>
    .input-box{
        margin: 20px 15px;
    }
</style>