4
This commit is contained in:
@@ -1,14 +1,148 @@
|
||||
import { ref } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import apiClient from '@/api/client';
|
||||
const form = ref({
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
});
|
||||
const loading = ref(false);
|
||||
async function handleChangePassword() {
|
||||
if (form.value.password !== form.value.confirmPassword) {
|
||||
ElMessage.error('两次输入的密码不一致。');
|
||||
return;
|
||||
}
|
||||
if (form.value.password.length < 8) {
|
||||
ElMessage.error('密码长度不能少于 8 位。');
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
await apiClient.patch('/auth/me', { password: form.value.password });
|
||||
ElMessage.success('密码修改成功。');
|
||||
form.value = { password: '', confirmPassword: '' };
|
||||
}
|
||||
catch { /* ignore */ }
|
||||
loading.value = false;
|
||||
}
|
||||
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
||||
const __VLS_ctx = {};
|
||||
let __VLS_components;
|
||||
let __VLS_directives;
|
||||
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({});
|
||||
__VLS_asFunctionalElement(__VLS_intrinsicElements.h1, __VLS_intrinsicElements.h1)({});
|
||||
__VLS_asFunctionalElement(__VLS_intrinsicElements.p, __VLS_intrinsicElements.p)({});
|
||||
const __VLS_0 = {}.ElCard;
|
||||
/** @type {[typeof __VLS_components.ElCard, typeof __VLS_components.elCard, typeof __VLS_components.ElCard, typeof __VLS_components.elCard, ]} */ ;
|
||||
// @ts-ignore
|
||||
const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({}));
|
||||
const __VLS_2 = __VLS_1({}, ...__VLS_functionalComponentArgsRest(__VLS_1));
|
||||
__VLS_3.slots.default;
|
||||
{
|
||||
const { header: __VLS_thisSlot } = __VLS_3.slots;
|
||||
}
|
||||
const __VLS_4 = {}.ElForm;
|
||||
/** @type {[typeof __VLS_components.ElForm, typeof __VLS_components.elForm, typeof __VLS_components.ElForm, typeof __VLS_components.elForm, ]} */ ;
|
||||
// @ts-ignore
|
||||
const __VLS_5 = __VLS_asFunctionalComponent(__VLS_4, new __VLS_4({
|
||||
model: (__VLS_ctx.form),
|
||||
labelPosition: "top",
|
||||
...{ style: {} },
|
||||
}));
|
||||
const __VLS_6 = __VLS_5({
|
||||
model: (__VLS_ctx.form),
|
||||
labelPosition: "top",
|
||||
...{ style: {} },
|
||||
}, ...__VLS_functionalComponentArgsRest(__VLS_5));
|
||||
__VLS_7.slots.default;
|
||||
const __VLS_8 = {}.ElFormItem;
|
||||
/** @type {[typeof __VLS_components.ElFormItem, typeof __VLS_components.elFormItem, typeof __VLS_components.ElFormItem, typeof __VLS_components.elFormItem, ]} */ ;
|
||||
// @ts-ignore
|
||||
const __VLS_9 = __VLS_asFunctionalComponent(__VLS_8, new __VLS_8({
|
||||
label: "新密码",
|
||||
}));
|
||||
const __VLS_10 = __VLS_9({
|
||||
label: "新密码",
|
||||
}, ...__VLS_functionalComponentArgsRest(__VLS_9));
|
||||
__VLS_11.slots.default;
|
||||
const __VLS_12 = {}.ElInput;
|
||||
/** @type {[typeof __VLS_components.ElInput, typeof __VLS_components.elInput, ]} */ ;
|
||||
// @ts-ignore
|
||||
const __VLS_13 = __VLS_asFunctionalComponent(__VLS_12, new __VLS_12({
|
||||
modelValue: (__VLS_ctx.form.password),
|
||||
type: "password",
|
||||
placeholder: "至少 8 位",
|
||||
showPassword: true,
|
||||
}));
|
||||
const __VLS_14 = __VLS_13({
|
||||
modelValue: (__VLS_ctx.form.password),
|
||||
type: "password",
|
||||
placeholder: "至少 8 位",
|
||||
showPassword: true,
|
||||
}, ...__VLS_functionalComponentArgsRest(__VLS_13));
|
||||
var __VLS_11;
|
||||
const __VLS_16 = {}.ElFormItem;
|
||||
/** @type {[typeof __VLS_components.ElFormItem, typeof __VLS_components.elFormItem, typeof __VLS_components.ElFormItem, typeof __VLS_components.elFormItem, ]} */ ;
|
||||
// @ts-ignore
|
||||
const __VLS_17 = __VLS_asFunctionalComponent(__VLS_16, new __VLS_16({
|
||||
label: "确认新密码",
|
||||
}));
|
||||
const __VLS_18 = __VLS_17({
|
||||
label: "确认新密码",
|
||||
}, ...__VLS_functionalComponentArgsRest(__VLS_17));
|
||||
__VLS_19.slots.default;
|
||||
const __VLS_20 = {}.ElInput;
|
||||
/** @type {[typeof __VLS_components.ElInput, typeof __VLS_components.elInput, ]} */ ;
|
||||
// @ts-ignore
|
||||
const __VLS_21 = __VLS_asFunctionalComponent(__VLS_20, new __VLS_20({
|
||||
modelValue: (__VLS_ctx.form.confirmPassword),
|
||||
type: "password",
|
||||
placeholder: "再次输入新密码",
|
||||
showPassword: true,
|
||||
}));
|
||||
const __VLS_22 = __VLS_21({
|
||||
modelValue: (__VLS_ctx.form.confirmPassword),
|
||||
type: "password",
|
||||
placeholder: "再次输入新密码",
|
||||
showPassword: true,
|
||||
}, ...__VLS_functionalComponentArgsRest(__VLS_21));
|
||||
var __VLS_19;
|
||||
const __VLS_24 = {}.ElFormItem;
|
||||
/** @type {[typeof __VLS_components.ElFormItem, typeof __VLS_components.elFormItem, typeof __VLS_components.ElFormItem, typeof __VLS_components.elFormItem, ]} */ ;
|
||||
// @ts-ignore
|
||||
const __VLS_25 = __VLS_asFunctionalComponent(__VLS_24, new __VLS_24({}));
|
||||
const __VLS_26 = __VLS_25({}, ...__VLS_functionalComponentArgsRest(__VLS_25));
|
||||
__VLS_27.slots.default;
|
||||
const __VLS_28 = {}.ElButton;
|
||||
/** @type {[typeof __VLS_components.ElButton, typeof __VLS_components.elButton, typeof __VLS_components.ElButton, typeof __VLS_components.elButton, ]} */ ;
|
||||
// @ts-ignore
|
||||
const __VLS_29 = __VLS_asFunctionalComponent(__VLS_28, new __VLS_28({
|
||||
...{ 'onClick': {} },
|
||||
type: "primary",
|
||||
loading: (__VLS_ctx.loading),
|
||||
}));
|
||||
const __VLS_30 = __VLS_29({
|
||||
...{ 'onClick': {} },
|
||||
type: "primary",
|
||||
loading: (__VLS_ctx.loading),
|
||||
}, ...__VLS_functionalComponentArgsRest(__VLS_29));
|
||||
let __VLS_32;
|
||||
let __VLS_33;
|
||||
let __VLS_34;
|
||||
const __VLS_35 = {
|
||||
onClick: (__VLS_ctx.handleChangePassword)
|
||||
};
|
||||
__VLS_31.slots.default;
|
||||
var __VLS_31;
|
||||
var __VLS_27;
|
||||
var __VLS_7;
|
||||
var __VLS_3;
|
||||
var __VLS_dollars;
|
||||
const __VLS_self = (await import('vue')).defineComponent({
|
||||
setup() {
|
||||
return {};
|
||||
return {
|
||||
form: form,
|
||||
loading: loading,
|
||||
handleChangePassword: handleChangePassword,
|
||||
};
|
||||
},
|
||||
});
|
||||
export default (await import('vue')).defineComponent({
|
||||
|
||||
Reference in New Issue
Block a user