|
@@ -5,19 +5,24 @@
|
|
|
@ok="handSubmit"
|
|
@ok="handSubmit"
|
|
|
:title="t('routes.personalSetting.updateBtn')"
|
|
:title="t('routes.personalSetting.updateBtn')"
|
|
|
@visible-change="handleVisibleChange"
|
|
@visible-change="handleVisibleChange"
|
|
|
|
|
+ @cancel="resetFields"
|
|
|
>
|
|
>
|
|
|
<div class="pt-3px pr-3px">
|
|
<div class="pt-3px pr-3px">
|
|
|
- <BasicForm @register="registerForm" :model="model" />
|
|
|
|
|
|
|
+ <BasicForm @register="registerForm" />
|
|
|
</div>
|
|
</div>
|
|
|
</BasicModal>
|
|
</BasicModal>
|
|
|
</template>
|
|
</template>
|
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
import { encodeStr } from '/@/utils/encodeUtil';
|
|
import { encodeStr } from '/@/utils/encodeUtil';
|
|
|
- import { defineComponent, ref, nextTick } from 'vue';
|
|
|
|
|
|
|
+ import { defineComponent, nextTick } from 'vue';
|
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
|
import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
|
|
import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
|
|
|
import { updatePasswordApi } from '/@/api/sys/user';
|
|
import { updatePasswordApi } from '/@/api/sys/user';
|
|
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
|
|
+
|
|
|
|
|
+ const { createMessage } = useMessage();
|
|
|
|
|
+
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
|
components: { BasicModal, BasicForm },
|
|
components: { BasicModal, BasicForm },
|
|
|
props: {
|
|
props: {
|
|
@@ -41,7 +46,7 @@
|
|
|
colProps: { span: 18 },
|
|
colProps: { span: 18 },
|
|
|
},
|
|
},
|
|
|
];
|
|
];
|
|
|
- const modelRef = ref({});
|
|
|
|
|
|
|
+
|
|
|
const [
|
|
const [
|
|
|
registerForm,
|
|
registerForm,
|
|
|
{
|
|
{
|
|
@@ -59,7 +64,7 @@
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- const [register] = useModalInner((data) => {
|
|
|
|
|
|
|
+ const [register, { closeModal }] = useModalInner((data) => {
|
|
|
data && onDataReceive(data);
|
|
data && onDataReceive(data);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -70,11 +75,13 @@
|
|
|
}
|
|
}
|
|
|
async function handSubmit() {
|
|
async function handSubmit() {
|
|
|
const { id, password } = await validate();
|
|
const { id, password } = await validate();
|
|
|
- updatePasswordApi({ id, password: encodeStr(window.btoa(password)) });
|
|
|
|
|
|
|
+ await updatePasswordApi({ id, newPassword: encodeStr(window.btoa(password)) });
|
|
|
|
|
+ createMessage.success(t('common.optSuccess'));
|
|
|
|
|
+ resetFields();
|
|
|
|
|
+ closeModal();
|
|
|
}
|
|
}
|
|
|
function handleVisibleChange(v) {
|
|
function handleVisibleChange(v) {
|
|
|
v && props.userData && nextTick(() => onDataReceive(props.userData));
|
|
v && props.userData && nextTick(() => onDataReceive(props.userData));
|
|
|
- resetFields();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
@@ -83,8 +90,8 @@
|
|
|
t,
|
|
t,
|
|
|
schemas,
|
|
schemas,
|
|
|
registerForm,
|
|
registerForm,
|
|
|
- model: modelRef,
|
|
|
|
|
handleVisibleChange,
|
|
handleVisibleChange,
|
|
|
|
|
+ resetFields,
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|