feat: 页面调整组件属性升级
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { Modal, message } from 'ant-design-vue/lib';
|
||||
import { FileType } from 'ant-design-vue/lib/upload/interface';
|
||||
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
|
||||
import { Modal, message } from 'ant-design-vue/es';
|
||||
import { FileType } from 'ant-design-vue/es/upload/interface';
|
||||
import { UploadRequestOption } from 'ant-design-vue/es/vc-upload/interface';
|
||||
import { onMounted, reactive, ref, toRaw } from 'vue';
|
||||
import { updateUserProfile, uploadAvatar } from '@/api/profile';
|
||||
import { regExpEmail, regExpMobile, regExpNick } from '@/utils/regular-utils';
|
||||
@@ -27,7 +27,7 @@ let stateForm = reactive({
|
||||
nickName: '',
|
||||
email: '',
|
||||
phonenumber: '',
|
||||
sex: undefined,
|
||||
sex: '0',
|
||||
},
|
||||
/**表单提交点击状态 */
|
||||
formClick: false,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { Modal, message } from 'ant-design-vue/lib';
|
||||
import { Modal, message } from 'ant-design-vue/es';
|
||||
import { reactive } from 'vue';
|
||||
import { updateUserPwd } from '@/api/profile';
|
||||
import { regExpPasswd } from '@/utils/regular-utils';
|
||||
@@ -147,7 +147,7 @@ function fnFinish() {
|
||||
</a-input-password>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :wrapper-col="{ span: 3 }">
|
||||
<a-form-item :wrapper-col="{ span: 4 }">
|
||||
<a-button
|
||||
block
|
||||
type="primary"
|
||||
|
||||
@@ -1,22 +1,32 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { getLocalColor, changePrimaryColor } from '@/hooks/useTheme';
|
||||
import { viewTransitionTheme } from 'antdv-pro-layout';
|
||||
import useLayoutStore from '@/store/modules/layout';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
const { t } = useI18n();
|
||||
const { proConfig, changeConf } = useLayoutStore();
|
||||
const { proConfig, changeConf, themeConfig, changePrimaryColor } =
|
||||
useLayoutStore();
|
||||
|
||||
let color = ref<string>(getLocalColor());
|
||||
let timerId: any = null;
|
||||
|
||||
/**改变主题色 */
|
||||
function fnColorChange(e: Event) {
|
||||
const target = e.target as HTMLInputElement;
|
||||
if (target.nodeName === 'INPUT') {
|
||||
changePrimaryColor(target.value ?? '#1890ff');
|
||||
} else {
|
||||
changePrimaryColor();
|
||||
}
|
||||
color.value = getLocalColor();
|
||||
// 需要防抖函数处理
|
||||
clearTimeout(timerId);
|
||||
timerId = setTimeout(() => {
|
||||
if (target.nodeName === 'INPUT') {
|
||||
changePrimaryColor(target.value ?? '#1890ff');
|
||||
} else {
|
||||
changePrimaryColor();
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
/**手动变更主题-过渡动画 */
|
||||
function changeTheme(e: any) {
|
||||
viewTransitionTheme(isDarkMode => {
|
||||
changeConf('theme', isDarkMode ? 'light' : 'dark');
|
||||
}, e);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -56,13 +66,31 @@ function fnColorChange(e: Event) {
|
||||
<template #extra>
|
||||
<a-space :size="16" align="end" direction="horizontal">
|
||||
<a-button type="primary" size="small" @click="fnColorChange">
|
||||
<BgColorsOutlined />
|
||||
{{ t('views.account.settings.colorRandomly') }}
|
||||
</a-button>
|
||||
<input type="color" :value="color" @input="fnColorChange" />
|
||||
<input
|
||||
type="color"
|
||||
:value="themeConfig?.token?.colorPrimary"
|
||||
@input="fnColorChange"
|
||||
/>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-list-item>
|
||||
<a-list-item>
|
||||
{{ t('views.account.settings.theme') }}
|
||||
<template #actions>
|
||||
{{ t('views.account.settings.themeActions') }}
|
||||
</template>
|
||||
<template #extra>
|
||||
<a-button
|
||||
:type="proConfig.theme === 'dark' ? 'primary' : 'default'"
|
||||
size="small"
|
||||
@click="changeTheme"
|
||||
>
|
||||
{{ proConfig.theme }}
|
||||
</a-button>
|
||||
</template>
|
||||
</a-list-item>
|
||||
<a-list-item>
|
||||
{{ t('views.account.settings.navTheme') }}
|
||||
<template #actions>
|
||||
|
||||
Reference in New Issue
Block a user