2025-06-06 03:08:19 +08:00
|
|
|
<template>
|
|
|
|
<view class="page">
|
2025-06-07 21:01:16 +08:00
|
|
|
<nav-bar :title="$t('setPasswork.title')" bgColor="#fff"></nav-bar>
|
2025-06-06 03:08:19 +08:00
|
|
|
<view style="width: 92%; margin: 10px auto; padding: 15px 10px;">
|
|
|
|
<uni-forms label-position="top" label-width="80px" :model="model" :rules="rules" ref="model">
|
2025-06-07 21:01:16 +08:00
|
|
|
<uni-forms-item :label="$t('setPasswork.text1')" name="email" label-width="400rpx">
|
|
|
|
<uni-easyinput type="text" v-model="model.email" placeholder=""></uni-easyinput>
|
2025-06-06 03:08:19 +08:00
|
|
|
</uni-forms-item>
|
2025-06-07 21:01:16 +08:00
|
|
|
<uni-forms-item :label="$t('setPasswork.text3')" name="code" label-width="400rpx">
|
|
|
|
<uni-easyinput type="number" v-model="model.code" :placeholder="$t('setPasswork.text2')">
|
2025-06-06 03:08:19 +08:00
|
|
|
<template #right>
|
|
|
|
<button type="primary"
|
|
|
|
:disabled="isSend"
|
|
|
|
@click="sendCode()"
|
|
|
|
style="font-size: 28rpx; padding: auto 20rpx; width: 200rpx;">{{sendText}}</button>
|
|
|
|
</template>
|
|
|
|
</uni-easyinput>
|
|
|
|
</uni-forms-item>
|
2025-06-09 00:34:46 +08:00
|
|
|
<uni-forms-item :label="$t('setPasswork.text4')" name="password">
|
2025-06-07 21:01:16 +08:00
|
|
|
<uni-easyinput type="password" :passwordIcon="true" v-model="model.password" :placeholder="$t('setPasswork.text5')" />
|
2025-06-06 03:08:19 +08:00
|
|
|
</uni-forms-item>
|
2025-06-09 00:34:46 +08:00
|
|
|
<uni-forms-item :label="$t('setPasswork.text6')" name="cpassword" labelWidth="400rpx">
|
2025-06-07 21:01:16 +08:00
|
|
|
<uni-easyinput type="password" :passwordIcon="true" v-model="model.cpassword" :placeholder="$t('setPasswork.text7')" />
|
2025-06-06 03:08:19 +08:00
|
|
|
</uni-forms-item>
|
|
|
|
</uni-forms>
|
|
|
|
</view>
|
|
|
|
<view style="bottom: 0px; position: absolute; width:100vw; height: 60px;">
|
|
|
|
<view class="cell_list">
|
2025-06-07 21:01:16 +08:00
|
|
|
<button type="primary" round style="width: 100%;" @click="submit">{{$t('buttonSubmit')}}</button>
|
2025-06-06 03:08:19 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import {
|
|
|
|
mapState,
|
|
|
|
mapMutations
|
|
|
|
} from 'vuex';
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2025-06-07 21:08:06 +08:00
|
|
|
sendText: this.$t('setPasswork.text8'),
|
2025-06-06 03:08:19 +08:00
|
|
|
isSend: false,
|
|
|
|
model: {
|
|
|
|
email: '',
|
|
|
|
password: '',
|
|
|
|
cpassword: '',
|
|
|
|
code: ''
|
|
|
|
},
|
|
|
|
rules: {
|
2025-06-07 21:08:06 +08:00
|
|
|
email: {rules:[{required: true,errorMessage: this.$t('setPasswork.text9')}]},
|
|
|
|
password: {rules:[{required: true,errorMessage: this.$t('setPasswork.text10')}]},
|
|
|
|
cpassword: {rules:[{required: true,errorMessage: this.$t('setPasswork.text11')}]},
|
|
|
|
code: {rules:[{required: true,errorMessage: this.$t('setPasswork.text12')}]},
|
2025-06-06 03:08:19 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState(['userInfo'])
|
|
|
|
},
|
|
|
|
//第一次加载
|
|
|
|
onLoad(e) {
|
|
|
|
},
|
|
|
|
//页面显示
|
|
|
|
onShow() {},
|
|
|
|
//方法
|
|
|
|
methods: {
|
|
|
|
onPageJump(url) {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: url
|
|
|
|
});
|
|
|
|
},
|
|
|
|
sendCode(){
|
|
|
|
this.isSend = true;
|
|
|
|
if (!this.$base.mailRegular.test(this.model.email)) {
|
2025-06-07 21:08:06 +08:00
|
|
|
uni.showToast({title: this.$t('setPasswork.text13'), icon:'error'});
|
2025-06-06 03:08:19 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
let s = 120;
|
|
|
|
let data = {
|
|
|
|
type: "email",
|
|
|
|
event: "resetpwd",
|
|
|
|
email: this.model.email,
|
|
|
|
lang: this.$i18n.locale
|
|
|
|
}
|
|
|
|
this.$http.post('/api/common/captcha', data).then(res => {
|
|
|
|
if(res.code == 0){
|
2025-06-07 21:08:06 +08:00
|
|
|
uni.showToast({title: this.$t('setPasswork.text14')});
|
|
|
|
this.sendText = this.$t('setPasswork.text15', {par: s});
|
2025-06-06 03:08:19 +08:00
|
|
|
let intervalId = setInterval(() => {
|
|
|
|
s = s-1;
|
|
|
|
if (s == 0) {
|
|
|
|
clearInterval(intervalId);
|
|
|
|
this.isSend = false;
|
2025-06-07 21:08:06 +08:00
|
|
|
this.sendText = this.$t('setPasswork.text8');
|
2025-06-06 03:08:19 +08:00
|
|
|
}
|
|
|
|
else{
|
2025-06-07 21:08:06 +08:00
|
|
|
this.sendText = this.$t('setPasswork.text15', {par: s});
|
2025-06-06 03:08:19 +08:00
|
|
|
}
|
|
|
|
}, 1000);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
submit(){
|
|
|
|
this.$refs.model.validate().then(res=>{
|
|
|
|
if (!this.$base.mailRegular.test(this.model.email)) {
|
2025-06-07 21:08:06 +08:00
|
|
|
uni.showToast({title: this.$t('setPasswork.text13'), icon:'error'});
|
2025-06-06 03:08:19 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!this.$base.passwordRegular.test(this.model.password)) {
|
2025-06-07 21:08:06 +08:00
|
|
|
uni.showToast({title: this.$t('setPasswork.text16'), icon:'error'});
|
2025-06-06 03:08:19 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (this.model.cpassword !== this.model.password) {
|
2025-06-07 21:08:06 +08:00
|
|
|
uni.showToast({title: this.$t('setPasswork.text17'), icon:'error'});
|
2025-06-06 03:08:19 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.$http.post('/api/common/resetpwd', {email: this.model.email, newpassword: this.model.password, code: this.model.code}).then(res => {
|
|
|
|
if(res.code == 0){
|
|
|
|
uni.showToast({title: res.data.mes});
|
|
|
|
setTimeout(() => {
|
|
|
|
uni.navigateBack();
|
|
|
|
}, 1000);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
//页面隐藏
|
|
|
|
onHide() {},
|
|
|
|
//页面卸载
|
|
|
|
onUnload() {},
|
|
|
|
//页面下来刷新
|
|
|
|
onPullDownRefresh() {},
|
|
|
|
//页面上拉触底
|
|
|
|
onReachBottom() {},
|
|
|
|
//用户点击分享
|
|
|
|
onShareAppMessage(e) {
|
|
|
|
return this.wxShare();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import '@/style/mixin.scss';
|
|
|
|
body{background-color: #fff;}
|
|
|
|
.page{min-height: 95vh;position: relative;}
|
|
|
|
.rechargeTitle{
|
|
|
|
font-weight: 400;font-size: 16px;color: #999999;line-height: 23px; text-align: center; margin-top: 30px;
|
|
|
|
}
|
|
|
|
.rechargeNet{
|
|
|
|
font-weight: 600;font-size: 20px;color: #333;line-height: 23px; text-align: center; margin-top: 20px;
|
|
|
|
}
|
|
|
|
.txt{
|
|
|
|
font-size: 14px; color:#999; font-weight: 500;
|
|
|
|
}
|
|
|
|
.cell_right{
|
|
|
|
font-size: 14px; color:#333; font-weight: 500;
|
|
|
|
}
|
|
|
|
</style>
|