mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-23 13:13:09 +00:00
优化pinia相关
This commit is contained in:
@@ -284,7 +284,7 @@
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import { ref, reactive, onMounted, h, watch } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import type { MenuProps, UploadChangeParam } from "ant-design-vue";
|
||||
import type { UploadChangeParam } from "ant-design-vue";
|
||||
import {
|
||||
UserOutlined,
|
||||
LockOutlined,
|
||||
@@ -293,19 +293,16 @@ import {
|
||||
IdcardOutlined,
|
||||
TeamOutlined,
|
||||
ApartmentOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
UploadOutlined,
|
||||
KeyOutlined,
|
||||
CheckOutlined,
|
||||
SaveOutlined,
|
||||
QuestionCircleOutlined,
|
||||
CheckCircleOutlined,
|
||||
CloseCircleOutlined,
|
||||
ClockCircleOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import store from '@/store';
|
||||
import { useUserStore } from "@/store/index";
|
||||
import storage from 'store';
|
||||
import request from "@/utils/request";
|
||||
import { updateCurrentUserInfo, changeCurrentUserPassword, avatarHandleChange } from '@/api/system/user';
|
||||
import type { InfoFormState, PasswordFormState } from './types';
|
||||
|
||||
@@ -313,7 +310,6 @@ import type { InfoFormState, PasswordFormState } from './types';
|
||||
const passwordChanging = ref(false);
|
||||
const infoSubmitting = ref(false);
|
||||
const selectedKeys = ref<string[]>(['1']);
|
||||
const avatarFileList = ref([]);
|
||||
|
||||
// 表单状态
|
||||
const infoFormState = reactive<InfoFormState>({
|
||||
@@ -348,10 +344,7 @@ watch(selectedKeys, (newVal) => {
|
||||
}
|
||||
});
|
||||
|
||||
// 菜单点击事件
|
||||
const menuClick = ({ key }: { key: string }) => {
|
||||
selectedKeys.value = [key];
|
||||
};
|
||||
const userStore = useUserStore();
|
||||
|
||||
// 基本信息表单提交
|
||||
const onInfoFormFinish = async (values: any) => {
|
||||
@@ -363,7 +356,8 @@ const onInfoFormFinish = async (values: any) => {
|
||||
content: response.data.msg,
|
||||
icon: h(CheckCircleOutlined, { style: "color: #52c41a" })
|
||||
});
|
||||
await store.dispatch('getUserInfo');
|
||||
|
||||
await userStore.getUserInfo;
|
||||
} catch (error) {
|
||||
console.error('更新基本信息失败:', error);
|
||||
message.error({
|
||||
@@ -430,7 +424,7 @@ const avatarHandleChange = (info: UploadChangeParam) => {
|
||||
|
||||
// 初始化表单
|
||||
const initInfoForm = () => {
|
||||
const basicInfo = store.state.user.basicInfo;
|
||||
const basicInfo = userStore.basicInfo;
|
||||
console.log("basicInfo", basicInfo);
|
||||
Object.assign(infoFormState, {
|
||||
name: basicInfo.name,
|
||||
|
||||
@@ -132,7 +132,6 @@ let timefix = timeFix();
|
||||
|
||||
const userInfo = userStore.basicInfo;
|
||||
|
||||
console.log("store.state.user.basicInfo",userStore.basicInfo)
|
||||
const welcome = '祝你开心每一天!';
|
||||
|
||||
const projectItems = [
|
||||
|
||||
@@ -316,7 +316,12 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.container {
|
||||
background-size: 100% 100%;
|
||||
height: 100vh;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
.desc {
|
||||
text-align: center;
|
||||
|
||||
@@ -206,6 +206,7 @@ const handleSave = async () => {
|
||||
// 调用更新配置接口
|
||||
await updateConfig(configData);
|
||||
message.success('配置保存成功');
|
||||
window.location.reload();
|
||||
} catch (error) {
|
||||
console.error('保存配置失败:', error);
|
||||
message.error('配置保存失败');
|
||||
|
||||
@@ -361,8 +361,6 @@ import { getDeptList } from '@/api/system/dept'
|
||||
import { getUserList, createUser, updateUser, deleteUser, batchAvailableUser, exportUser, downloadTemplate, importUser } from '@/api/system/user'
|
||||
import SelectorModal from './SelectorModal.vue'
|
||||
import type { searchDataType, tableDataType, deptTreeType, roleSelectorType, positionSelectorType } from './types'
|
||||
import XLSX from 'xlsx';
|
||||
import store from '@/store';
|
||||
import storage from 'store';
|
||||
|
||||
const tableLoading = ref(false);
|
||||
|
||||
Reference in New Issue
Block a user