You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

145 lines
3.2 KiB

import { basicAction } from "@peace/utils";
import { ApiTable } from "$utils";
export function getProfile(userId) {
return (dispatch) =>
basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_PROFILE",
url: ApiTable.getUserInfo.replace("{userId}", userId),
msg: { error: "获取用户信息失败" },
reducer: {
name: "profile",
},
});
}
export function getDataList({ type, page, limit, status }) {
return (dispatch) =>
basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_DATALIST",
url: ApiTable.getDataList,
query: { type, page, limit, status },
msg: { error: "获取文章信息失败" },
reducer: {
name: "articlesfrom",
},
});
}
export function editProfile(userId, params, type) {
return (dispatch) =>
basicAction({
type: "put",
data: params,
dispatch: dispatch,
actionType: "EDIT_PROFILE",
url: ApiTable.modifyUserInfo
.replace("{userId}", userId)
.replace("{type}", type || "phone"),
msg: { option: "更新个人信息" },
});
}
export function editpassword(userId, params) {
return (dispatch) =>
basicAction({
type: "put",
data: params,
dispatch: dispatch,
actionType: "EDIT_PASSWORD",
url: ApiTable.modifyPassWord.replace("{userId}", userId),
msg: { option: "更新密码" },
});
}
export function editName(userId, params) {
return (dispatch) =>
basicAction({
type: "put",
data: params,
dispatch: dispatch,
actionType: "EDIT_NAME",
url: ApiTable.modifyName.replace("{userId}", userId),
msg: { option: "修改姓名" },
});
}
export function getText(id) {
return (dispatch) =>
basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_TEXT",
url: ApiTable.getText,
query: { id },
msg: { error: "获取文章信息失败" },
reducer: {
name: "wen",
},
});
}
export function getPartyMember() {
return (dispatch) =>
basicAction({
type: "get",
dispatch: dispatch,
actionType: "PARTY_MEMBER",
url: ApiTable.getpartyMember,
msg: { option: "获取工会人数" },
reducer: {
name: "party",
},
});
}
export function getProject() {
return (dispatch) =>
basicAction({
type: "post",
dispatch: dispatch,
actionType: "PROJECT",
url: ApiTable.projectUrl,
msg: { option: "获取本周在研项目" },
reducer: {
name: "project",
},
});
}
export function getPeople() {
return (dispatch) =>
basicAction({
type: "post",
dispatch: dispatch,
actionType: "PEOPLE",
url: ApiTable.peopleUrl,
msg: { option: "获取人员情况" },
reducer: {
name: "people",
},
});
}
export function getWait() {
return (dispatch) =>
basicAction({
type: "post",
dispatch: dispatch,
actionType: "WAIT",
url: ApiTable.waitUrl,
msg: { option: "获取待研发项目" },
reducer: {
name: "wait",
},
});
}
export default {
getProfile,
editProfile,
editpassword,
editName,
getText,
getPartyMember,
};