Browse Source

增加标签管理相关action

master
zmh 2 years ago
parent
commit
f29d8dba14
  1. 2
      web/client/src/sections/metadataManagement/actions/index.js
  2. 90
      web/client/src/sections/metadataManagement/actions/tags.js
  3. 7
      web/client/src/sections/metadataManagement/containers/style.less
  4. 8
      web/client/src/utils/webapi.js

2
web/client/src/sections/metadataManagement/actions/index.js

@ -1,7 +1,9 @@
'use strict';
import * as example from './example'
import * as tags from './tags'
export default {
...example,
...tags
}

90
web/client/src/sections/metadataManagement/actions/tags.js

@ -0,0 +1,90 @@
'use strict';
import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'
export function getTagList(params) {
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
query: params,
actionType: 'GET_TAG_LIST',
url: ApiTable.getTags,
msg: { error: '获取标签列表失败' },
reducer: { name: 'tagList' }
});
}
export function postTagSets(data) {
return dispatch => basicAction({
type: 'post',
data: data,
dispatch: dispatch,
actionType: 'POST_TAG_SET',
url: ApiTable.postTagSets,
msg: { option: '新增标签集' },
reducer: {}
});
}
export function putTagSets(id, data) {
return dispatch => basicAction({
type: 'put',
data: data,
dispatch,
actionType: 'PUT_TAG_SET',
url: ApiTable.putTagSets.replace('{id}', id),
msg: {
option: '修改标签集',
}
});
}
export function delTagSets(id) {
return dispatch => basicAction({
type: 'del',
dispatch,
actionType: 'DELETE_TAG_SET',
url: ApiTable.delTagSets.replace('{id}', id),
msg: {
option: '删除标签集',
}
});
}
export function postTags(data) {
return dispatch => basicAction({
type: 'post',
data: data,
dispatch: dispatch,
actionType: 'POST_TAGS',
url: ApiTable.postTags,
msg: { option: '新增标签' },
reducer: {}
});
}
export function putTags(id, data) {
return dispatch => basicAction({
type: 'put',
data: data,
dispatch,
actionType: 'PUT_TAGS',
url: ApiTable.putTags.replace('{id}', id),
msg: {
option: '修改标签',
}
});
}
export function delTags(id) {
return dispatch => basicAction({
type: 'del',
dispatch,
actionType: 'DELETE_TAGS',
url: ApiTable.delTags.replace('{id}', id),
msg: {
option: '删除标签',
}
});
}

7
web/client/src/sections/metadataManagement/containers/style.less

@ -0,0 +1,7 @@
.tags {
line-height: 26px;
background: rgb(228, 228, 228);
color: rgb(0, 0, 0);
margin-right: 20px;
margin-bottom: 16px;
}

8
web/client/src/utils/webapi.js

@ -5,6 +5,14 @@ export const ApiTable = {
login: 'login',
logout: 'logout',
validatePhone: 'validate/phone',
//标签管理
getTags: 'tags',
postTagSets: 'tag-sets',
putTagSets: 'tag-sets/{id}',
delTagSets: 'tag-sets/{id}',
postTags: 'tags',
putTags: 'tags/{id}',
delTags: 'tags/{id}',
};

Loading…
Cancel
Save