修改注册银行账户 地址以及 融合样式改动
This commit is contained in:
30
src/models/connect.d.ts
vendored
Normal file
30
src/models/connect.d.ts
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
import type { MenuDataItem, Settings as ProSettings } from '@ant-design/pro-layout';
|
||||
import { GlobalModelState } from './global';
|
||||
import { UserModelState } from './user';
|
||||
import type { StateType } from './login';
|
||||
|
||||
export { GlobalModelState, UserModelState };
|
||||
|
||||
export type Loading = {
|
||||
global: boolean;
|
||||
effects: Record<string, boolean | undefined>;
|
||||
models: {
|
||||
global?: boolean;
|
||||
menu?: boolean;
|
||||
setting?: boolean;
|
||||
user?: boolean;
|
||||
login?: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
export type ConnectState = {
|
||||
global: GlobalModelState;
|
||||
loading: Loading;
|
||||
settings: ProSettings;
|
||||
user: UserModelState;
|
||||
login: StateType;
|
||||
};
|
||||
|
||||
export type Route = {
|
||||
routes?: Route[];
|
||||
} & MenuDataItem;
|
85
src/models/user.ts
Normal file
85
src/models/user.ts
Normal file
@ -0,0 +1,85 @@
|
||||
import type { Effect, Reducer } from 'umi';
|
||||
|
||||
import { queryCurrent, query as queryUsers } from '@/servers/user';
|
||||
|
||||
export type CurrentUser = {
|
||||
avatar?: string;
|
||||
name?: string;
|
||||
title?: string;
|
||||
group?: string;
|
||||
signature?: string;
|
||||
tags?: {
|
||||
key: string;
|
||||
label: string;
|
||||
}[];
|
||||
userid?: string;
|
||||
unreadCount?: number;
|
||||
};
|
||||
|
||||
export type UserModelState = {
|
||||
currentUser?: CurrentUser;
|
||||
};
|
||||
|
||||
export type UserModelType = {
|
||||
namespace: 'user';
|
||||
state: UserModelState;
|
||||
effects: {
|
||||
fetch: Effect;
|
||||
fetchCurrent: Effect;
|
||||
};
|
||||
reducers: {
|
||||
saveCurrentUser: Reducer<UserModelState>;
|
||||
changeNotifyCount: Reducer<UserModelState>;
|
||||
};
|
||||
};
|
||||
|
||||
const UserModel: UserModelType = {
|
||||
namespace: 'user',
|
||||
|
||||
state: {
|
||||
currentUser: {},
|
||||
},
|
||||
|
||||
effects: {
|
||||
*fetch(_, { call, put }) {
|
||||
const response = yield call(queryUsers);
|
||||
yield put({
|
||||
type: 'save',
|
||||
payload: response,
|
||||
});
|
||||
},
|
||||
*fetchCurrent(_, { call, put }) {
|
||||
const response = yield call(queryCurrent);
|
||||
yield put({
|
||||
type: 'saveCurrentUser',
|
||||
payload: response,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
reducers: {
|
||||
saveCurrentUser(state, action) {
|
||||
return {
|
||||
...state,
|
||||
currentUser: action.payload || {},
|
||||
};
|
||||
},
|
||||
changeNotifyCount(
|
||||
state = {
|
||||
currentUser: {},
|
||||
},
|
||||
action,
|
||||
) {
|
||||
return {
|
||||
...state,
|
||||
currentUser: {
|
||||
...state.currentUser,
|
||||
notifyCount: action.payload.totalCount,
|
||||
unreadCount: action.payload.unreadCount,
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default UserModel;
|
Reference in New Issue
Block a user