11
jhzh
2024-08-01 4ebbadfe4c8c7aa6404dcd9b126cc8265bf03c0d
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<template>
    <div class="changePassword">
        <assets-head :title="$t('修改登录密码')" />
        <div class="line"></div>
        <div class="content">
            <ExInput :label="$t('新密码')" :placeholderText="$t('请输入密码')" :tips="$t('请输入6-12个字符,包括数字或字母')"
                v-model="newPassword" typeText="password" />
            <ExInput :label="$t('确认新密码')" :placeholderText="$t('请输入密码')" :tips="$t('请输入6-12个字符,包括数字或字母')"
                v-model="rePassword" typeText="password" />
            <button :disabled="!hightLight" class="btn" @click="submit" :class="hightLight ? 'hightLight' : ''">{{
                $t('确定')
            }}</button>
        </div>
    </div>
</template>
 
<script>
import assetsHead from "@/components/assets-head";
import ExInput from "@/components/ex-input";
import Axios from "@/API/userCenter.js";
export default {
    props: {
 
    },
    components: {
        assetsHead,
        ExInput,
    },
    data() {
        return {
            newPassword: '',
            rePassword: '',
            type: '',
            username: '',
            verifcode: '',
            account: ''
        }
    },
    computed: {
        hightLight() {
            if (this.newPassword.length >= 6 && this.rePassword.length >= 6) {
                return true
            } else {
                return false
            }
        }
    },
    mounted() {
        this.type = this.$route.query.type;
        this.username = this.$route.query.username;
        this.account = this.$route.query.account;
        this.verifcode = this.$route.query.verifycode;
        console.log(this.verifcode)
    },
    methods: {
        submit() {
            if (this.newPassword !== this.rePassword) {
                this.$toast(this.$t('密码不一致'));
                return false
            }
            Axios.resetpsw({
                username: this.type == 1 ? this.account : this.username,
                password: this.newPassword,
                verifcode_type: this.type,
                verifcode: this.verifcode,
            }).then((res) => {
                this.$router.push('/passSuccess')
            }).catch((error) => {
                if (error.code === 'ECONNABORTED') { this.$toast(this.$t('网络超时!')); }
                else if (error.msg !== undefined) { this.$toast(this.$t(error.msg)); }
            });
        }
    }
}
</script>
 
<style lang="scss" scoped>
.changePassword {
    width: 100%;
    box-sizing: border-box;
}
 
.line {
    width: 100%;
    height: 2px;
 
    @include themify() {
        background: themed("tab_background");
    }
}
 
.content {
    padding: 32px;
    font-size: 26px;
}
 
.btn {
    @include themify() {
        background: themed("bg_dark");
    }
 
    color: #C0C4CC;
    height: 88px;
    line-height: 88px;
    text-align: center;
    font-size: 32px;
    margin-top: 44px;
    border-radius: 10px;
    width: 100%;
    border: none;
}
 
.hightLight {
    @include themify() {
        background: themed("btn_main");
    }
 
    color: #fff;
}
</style>