10.10综合交易所原始源码_移动端
1
2026-05-26 0dbc7465447164fef24327b5d494870832d798dd
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<template>
    <div class="forget">
        <van-loading color="#92D1FF" class="loading-box" v-if="isLoading" />
 
        <!-- 顶部返回 -->
        <div class="header">
            <div class="back-btn" @click="$router.go(-1)">
                <img src="../../assets/image/icon_back2.png" alt="" />
            </div>
        </div>
 
        <div class="forget-cont">
            <!-- 标题 -->
            <div class="title textColor">{{ $t('forgetPassword') }}</div>
 
            <!-- 账号 -->
            <ExInput :label="$t('account')" :placeholderText="$t('entryAccount')" v-model="account" />
 
            <!-- 验证码 -->
            <div class="input-wrap">
                <span class="input-label textColor">{{ $t('verifyCodeLabel') }}</span>
                <div class="code-box inputBackground">
                    <input class="inputBackground textColor" type="text" :placeholder="$t('verifyCodeLabel')"
                        v-model="verifycode" />
                    <span class="send-btn" @click="sendCode">
                        {{ countdown > 0 ? $t('codeSent') + ' (' + countdown + 's)' : $t('sendVerifyCode') }}
                    </span>
                </div>
            </div>
 
            <!-- 新密码 -->
            <ExInput :label="$t('password')" :placeholderText="$t('entryPassword')" v-model="newPassword"
                typeText="password" />
 
            <!-- 确认密码 -->
            <ExInput style="padding-bottom:0!important;" :label="$t('repassword')" :placeholderText="$t('repassword')"
                v-model="rePassword" typeText="password" />
 
            <!-- 提交按钮 -->
            <van-button class="w-full submit-btn" type="primary" @click="submit">
                {{ $t('confirm') }}
            </van-button>
        </div>
    </div>
</template>
 
<script setup>
import ExInput from "@/components/ex-input/index.vue";
import { _sendVerifyCode } from "@/service/login.api";
import { _resetpsw } from "@/service/user.api.js";
import { ref, onUnmounted } from "vue";
import { useI18n } from "vue-i18n";
import { showToast } from "vant";
import { useRouter } from "vue-router";
 
const { t } = useI18n()
const router = useRouter()
 
const account = ref('')
const verifycode = ref('')
const newPassword = ref('')
const rePassword = ref('')
const isLoading = ref(false)
const countdown = ref(0)
const timer = ref(null)
 
const clearTimer = () => {
    clearInterval(timer.value)
    timer.value = null
}
 
const sendCode = () => {
    if (!account.value) {
        showToast(t('entryAccount'))
        return
    }
    if (countdown.value > 0) return
    _sendVerifyCode({
        target: account.value,
    }).then(() => {
        countdown.value = 60
        timer.value = setInterval(() => {
            if (countdown.value > 0) {
                countdown.value--
            } else {
                clearTimer()
            }
        }, 1000)
    })
}
 
const submit = () => {
    if (!account.value) {
        showToast(t('entryAccount'))
        return
    }
    if (!verifycode.value) {
        showToast(t('entryVerifyCode'))
        return
    }
    if (!newPassword.value) {
        showToast(t('entryPassword'))
        return
    }
    if (newPassword.value !== rePassword.value) {
        showToast(t('noSamePassword'))
        return
    }
    isLoading.value = true
    _resetpsw({
        username: account.value,
        password: newPassword.value,
        // verifcode_type: type,  // 暂时注释类型参数
        verifcode: verifycode.value,
    }).then(() => {
        isLoading.value = false
        router.push('/passSuccess')
    }).catch(() => {
        isLoading.value = false
    })
}
 
onUnmounted(() => {
    clearTimer()
})
</script>
 
<style lang="scss" scoped>
:deep(.van-loading) {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
 
.forget {
    width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
    background: #fff;
}
 
/* 顶部返回 */
.header {
    padding-top: 3rem;
    padding-left: 3rem;
 
    .back-btn {
        width: 4rem;
        height: 4rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
 
        img {
            width: 100%;
        }
    }
}
 
.forget-cont {
    padding: 0 3rem 5rem;
}
 
/* 标题 */
.title {
    font-weight: 700;
    font-size: 3.25rem;
    margin-top: 2.5rem;
    margin-bottom: 4rem;
}
 
/* 验证码输入框 */
.input-wrap {
    padding-bottom: 2.75rem;
    font-size: 2rem;
 
    .input-label {
        display: block;
        margin-bottom: 1.125rem;
    }
 
    .code-box {
        height: 6.25rem;
        padding: 0 1.375rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-radius: 0.75rem;
 
        input {
            flex: 1;
            height: 100%;
            border: none;
            padding-left: 1.25rem;
            color: $text_color;
            background: transparent;
 
            &::placeholder {
                color: $dark-grey;
            }
 
            &:focus {
                outline: none;
            }
        }
 
        .send-btn {
            flex-shrink: 0;
            font-size: 2rem;
            cursor: pointer;
            white-space: nowrap;
            padding-left: 1.25rem;
        }
    }
}
 
/* 提交按钮 */
.submit-btn {
    margin-top: 5.5rem;
    border-radius: 1rem !important;
    height: 6.25rem !important;
    font-size: 2rem !important;
    font-weight: 600 !important;
}
</style>