feat: 初始化
This commit is contained in:
118
pages/home/changeROPwd/index.scss
Normal file
118
pages/home/changeROPwd/index.scss
Normal file
@ -0,0 +1,118 @@
|
||||
.container {
|
||||
padding: 0 24px 24px 16px;
|
||||
.title {
|
||||
margin: 14px 0 15px;
|
||||
}
|
||||
.validateStatusWrapper {
|
||||
margin-top: 6px;
|
||||
font-size: 12px;
|
||||
.validateStatus {
|
||||
display: flex;
|
||||
column-gap: 5px;
|
||||
align-items: center;
|
||||
.verificationRes {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
.right {
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
}
|
||||
.error {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
}
|
||||
.rightText {
|
||||
color: #43cf7c;
|
||||
}
|
||||
.errorText {
|
||||
color: #d43030;
|
||||
}
|
||||
}
|
||||
}
|
||||
.availableMoneyOut {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
column-gap: 16px;
|
||||
margin-bottom: 16px;
|
||||
font-size: 14px;
|
||||
color: #777777;
|
||||
.value {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #29bbe4;
|
||||
}
|
||||
}
|
||||
.exchangeRate {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12px;
|
||||
font-size: 14px;
|
||||
color: #777777;
|
||||
.value {
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
.detailModal {
|
||||
position: relative;
|
||||
width: calc(100vw - 50px);
|
||||
max-width: 363px;
|
||||
padding: 32px 29px 42px;
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
.closeIcon {
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
right: 21px;
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
}
|
||||
.titleWrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
row-gap: 12px;
|
||||
color: #333333;
|
||||
padding: 12px;
|
||||
margin: 24px 0;
|
||||
box-shadow: -1px 0 5px 1px rgba(0, 0, 0, 0.1);
|
||||
.title {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
line-height: 34px;
|
||||
}
|
||||
.value {
|
||||
font-size: 36px;
|
||||
font-weight: 700;
|
||||
color: #29bbe4;
|
||||
line-height: 52px;
|
||||
}
|
||||
}
|
||||
.resendCode {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
color: #4dc0e5;
|
||||
.resendIcon {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
&.loading {
|
||||
animation: rotate infinite 2s;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@keyframes rotate {
|
||||
0% {
|
||||
transform: rotateZ(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotateZ(360deg);
|
||||
}
|
||||
}
|
||||
246
pages/home/changeROPwd/index.vue
Normal file
246
pages/home/changeROPwd/index.vue
Normal file
@ -0,0 +1,246 @@
|
||||
<template>
|
||||
<NavBar />
|
||||
<view class="container">
|
||||
<view class="title">
|
||||
<PageTitle :title="$t('home.changeROPwd')" />
|
||||
</view>
|
||||
<uni-forms ref="changeTradePwdForm" :modelValue="changeTradePwdFormData" :rules="changeTradePwdFormRules">
|
||||
<view class="availableMoneyOut">
|
||||
{{ $t('form.mtAccount.label') }}
|
||||
<text class="value">{{ mt4_login ?? '-' }}</text>
|
||||
</view>
|
||||
<uni-forms-item name="mt4_password_investor">
|
||||
<text class="uni-subtitle">{{ $t('form.ROPassword.label') }}</text>
|
||||
<uni-easyinput
|
||||
class="uni-mt-5"
|
||||
type="password"
|
||||
trim="all"
|
||||
primaryColor="#29BBE4"
|
||||
v-model="changeTradePwdFormData.mt4_password_investor"
|
||||
@input="investorPasswordInputChange"
|
||||
></uni-easyinput>
|
||||
<view v-if="investorValidating" class="validateStatusWrapper">
|
||||
<view v-for="(status, index) in investorValidateStatuses" :key="index" class="validateStatus">
|
||||
<view class="verificationRes">
|
||||
<image :src="status.valid ? '/static/right.png' : '/static/error.png'" :class="status.valid ? 'right' : 'error'" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view :class="status.valid ? 'rightText' : 'errorText'">{{ status.text }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-popup ref="alertDialog" :isMaskClick="false">
|
||||
<view class="detailModal">
|
||||
<uni-icons type="closeempty" size="17" class="closeIcon" @click="closeDetailDialog"></uni-icons>
|
||||
<view class="detailContent">
|
||||
<uni-forms-item name="code">
|
||||
<text class="uni-subtitle">{{ $t('form.captcha.label') }}</text>
|
||||
<uni-easyinput type="password" trim="all" primaryColor="#29BBE4" v-model="changeTradePwdFormData.code"></uni-easyinput>
|
||||
<view class="resendCode" @click="sendCode">
|
||||
<image src="/static/reload.png" mode="aspectFit" :class="['resendIcon', sendCodeBtnLoading ? 'loading' : '']"></image>
|
||||
<text>{{ $t('form.verificationCode.invalid') }}</text>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<button class="primaryButton" :disabled="submitBtnLoading" @click="saveTradePwd">
|
||||
<image v-show="submitBtnLoading" src="/static/loadingCircle.svg" mode="aspectFit" style="width: 16px; height: 16px"></image>
|
||||
{{ $t('form.submit') }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</uni-forms>
|
||||
<button class="primaryButton" type="button" :disabled="nextBtnLoading" @click="showDetailDialog">
|
||||
<image v-show="nextBtnLoading" src="/static/loadingCircle.svg" mode="aspectFit" style="width: 16px; height: 16px"></image>
|
||||
{{ $t('form.next') }}
|
||||
</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getApplyLeverageList, updateLeverage, sendCodeMT, checkCodeMT, updateMTPassword } from '@/services/home/home.ts';
|
||||
import { getExchangeRate, getGoldRange } from '@/services/capital/deposit.ts';
|
||||
import { saveTransfer } from '@/services/capital/transfer.ts';
|
||||
import { getBankList } from '@/services/user.ts';
|
||||
import { getDictByCode } from '@/services/common.ts';
|
||||
import { UserLanguage, patterns } from '@/utils/const';
|
||||
import { useUserStore } from '@/stores/user';
|
||||
export default {
|
||||
name: '',
|
||||
data() {
|
||||
return {
|
||||
mt4_login: undefined,
|
||||
mt4_server: undefined,
|
||||
mt4_leverage_old: undefined,
|
||||
nextBtnLoading: false,
|
||||
sendCodeBtnLoading: false,
|
||||
submitBtnLoading: false,
|
||||
sign: undefined,
|
||||
leverageOptions: [],
|
||||
changeTradePwdFormData: {},
|
||||
changeTradePwdFormRules: {
|
||||
mt4_password_investor: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
errorMessage: this.$t('form.ROPassword.required')
|
||||
},
|
||||
{
|
||||
validateFunction: (rule, value, data, callback) => {
|
||||
// 异步需要返回 Promise 对象
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
if (this.investorValidateStatuses.every((item) => item.valid)) {
|
||||
// 通过返回 resolve
|
||||
resolve();
|
||||
} else {
|
||||
// 不通过返回 reject(new Error('错误信息'))
|
||||
reject(new Error(this.$t('form.password.invalid')));
|
||||
}
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
code: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
errorMessage: this.$t('form.captcha.required')
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
investorValidating: false,
|
||||
investorValidateStatuses: [
|
||||
{ valid: false, text: this.$t('form.password.pattern1') },
|
||||
{ valid: false, text: this.$t('form.password.pattern2') },
|
||||
{ valid: false, text: this.$t('form.password.pattern3') },
|
||||
{ valid: false, text: this.$t('form.password.pattern4') }
|
||||
]
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
investorPasswordInputChange(e) {
|
||||
this.$nextTick(() => {
|
||||
this.changeTradePwdFormData.mt4_password_investor = this.changeTradePwdFormData.mt4_password_investor.replace(/[^a-zA-Z0-9!@#]/g, '')
|
||||
if (!this.investorValidating) {
|
||||
this.investorValidating = true;
|
||||
}
|
||||
this.investorValidateStatuses.forEach((item, index) => {
|
||||
item.valid = patterns[`passwordPattern${index + 1}`].test(e);
|
||||
});
|
||||
})
|
||||
},
|
||||
async sendCode() {
|
||||
this.nextBtnLoading = true;
|
||||
this.closeDetailDialog()
|
||||
const userStore = useUserStore();
|
||||
this.sendCodeBtnLoading = true;
|
||||
const res = await sendCodeMT({
|
||||
email: userStore.userInfo.email,
|
||||
mt4_login: this.mt4_login,
|
||||
qcc_language: UserLanguage
|
||||
});
|
||||
this.sendCodeBtnLoading = false;
|
||||
this.nextBtnLoading = false;
|
||||
let success = false;
|
||||
if (res && res.code === 0) {
|
||||
this.$nextTick(() => {
|
||||
this.$cusModal.showModal({
|
||||
type: 'message',
|
||||
status: 'success',
|
||||
contentText: this.$t('form.verificationCode.sendSuccess'),
|
||||
onClose: () => {
|
||||
this.$refs.alertDialog.open();
|
||||
}
|
||||
});
|
||||
})
|
||||
success = true;
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$cusModal.showModal({
|
||||
type: 'message',
|
||||
status: 'warning',
|
||||
contentText: res.msg ?? this.$t('common.error.sysError')
|
||||
});
|
||||
})
|
||||
}
|
||||
return success;
|
||||
},
|
||||
async showDetailDialog() {
|
||||
this.$refs.changeTradePwdForm.validateField(['mt4_password_investor']).then(async () => {
|
||||
const sendSuccess = await this.sendCode();
|
||||
});
|
||||
},
|
||||
closeDetailDialog() {
|
||||
this.$refs.alertDialog.close();
|
||||
},
|
||||
async saveTradePwd() {
|
||||
this.$refs.changeTradePwdForm.validate().then(async (fields) => {
|
||||
this.submitBtnLoading = true;
|
||||
const userStore = useUserStore();
|
||||
const checkRes = await checkCodeMT({
|
||||
email: userStore.userInfo.email,
|
||||
code: fields.code,
|
||||
qcc_language: UserLanguage
|
||||
});
|
||||
if (checkRes && checkRes.code === 0) {
|
||||
this.sign = checkRes.data;
|
||||
} else {
|
||||
this.closeDetailDialog()
|
||||
this.$nextTick(() => {
|
||||
this.$cusModal.showModal({
|
||||
type: 'message',
|
||||
status: 'warning',
|
||||
contentText: checkRes.msg ?? this.$t('common.error.sysError')
|
||||
});
|
||||
})
|
||||
this.submitBtnLoading = false;
|
||||
return;
|
||||
}
|
||||
const res = await updateMTPassword({
|
||||
...fields,
|
||||
email: userStore.userInfo.email,
|
||||
mt4_login: this.mt4_login,
|
||||
mt4_server: this.mt4_server,
|
||||
qcc_language: UserLanguage,
|
||||
sign: this.sign
|
||||
});
|
||||
this.submitBtnLoading = false;
|
||||
this.closeDetailDialog()
|
||||
if (res && res.code === 0) {
|
||||
this.$nextTick(() => {
|
||||
this.$cusModal.showModal({
|
||||
type: 'message',
|
||||
status: 'success',
|
||||
contentText: this.$t('common.success.action'),
|
||||
onClose() {
|
||||
uni.redirectTo({
|
||||
url: '/pages/home/changeROPwd/success/index'
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
} else {
|
||||
this.$nextTick(() => {
|
||||
this.$cusModal.showModal({
|
||||
type: 'message',
|
||||
status: 'warning',
|
||||
contentText: res.msg ?? this.$t('common.error.sysError')
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
onLoad(params) {
|
||||
this.mt4_login = params.mt4_login;
|
||||
this.mt4_server = params.mt4_server;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './index.scss';
|
||||
</style>
|
||||
34
pages/home/changeROPwd/success/index.scss
Normal file
34
pages/home/changeROPwd/success/index.scss
Normal file
@ -0,0 +1,34 @@
|
||||
.container {
|
||||
padding: 0 24px 24px 16px;
|
||||
.title {
|
||||
margin: 14px 0 15px;
|
||||
}
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
row-gap: 10px;
|
||||
margin-top: 62px;
|
||||
.successTitle {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: #333333;
|
||||
text-align: center;
|
||||
}
|
||||
.successDesc {
|
||||
margin-top: 19px;
|
||||
font-size: 12px;
|
||||
color: #aaaaaa;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
.btns {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
row-gap: 12px;
|
||||
margin-top: 120px;
|
||||
.btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
38
pages/home/changeROPwd/success/index.vue
Normal file
38
pages/home/changeROPwd/success/index.vue
Normal file
@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<NavBar />
|
||||
<view class="container">
|
||||
<view class="title">
|
||||
<PageTitle :title="$t('home.changeROPwd')" />
|
||||
</view>
|
||||
<view class="content">
|
||||
<image src="/static/success.png" mode="aspectFit" style="width: 56px; height: 56px"></image>
|
||||
<text class="successTitle">{{ $t('changeTradePwd.success') }}</text>
|
||||
<text class="successDesc">{{ $t('changeTradePwd.successDesc') }}</text>
|
||||
</view>
|
||||
<view class="btns">
|
||||
<button class="btn primaryButton" type="button" @click="handleClose">
|
||||
{{ $t('common.back') }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: '',
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
handleClose() {
|
||||
uni.redirectTo({
|
||||
url: '/pages/home/index'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './index.scss';
|
||||
</style>
|
||||
Reference in New Issue
Block a user