Skip to content

Commit

Permalink
Merge pull request #70 from suyuan32/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
suyuan32 authored Jul 3, 2023
2 parents 3c5d29d + 29eb284 commit 42085b2
Show file tree
Hide file tree
Showing 23 changed files with 572 additions and 94 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-admin",
"version": "1.0.11",
"version": "1.0.12",
"homepage": "https://github.com/suyuan32/simple-admin-backend-ui",
"bugs": {
"url": "https://github.com/suyuan32/simple-admin-backend-ui/issue"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface fileInfo {
size: number;
path: string;
publicPath: string;
tagIds: number[];
}

/**
Expand All @@ -37,4 +38,5 @@ export interface changeStatusReq {
export interface updateFileInfoReq {
id: string;
name: string;
tagIds: number[];
}
19 changes: 19 additions & 0 deletions src/api/fms/model/tagModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { BaseListResp } from '/@/api/model/baseModel';

/**
* @description: Tag info response
*/
export interface TagInfo {
id: number;
createdAt?: number;
updatedAt?: number;
status?: number;
name?: string;
remark?: string;
}

/**
* @description: Tag list response
*/

export type TagListResp = BaseListResp<TagInfo>;
74 changes: 74 additions & 0 deletions src/api/fms/tag.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
import { BaseDataResp, BaseListReq, BaseResp, BaseIDsReq, BaseIDReq } from '/@/api/model/baseModel';
import { TagInfo, TagListResp } from './model/tagModel';

enum Api {
CreateTag = '/fms-api/tag/create',
UpdateTag = '/fms-api/tag/update',
GetTagList = '/fms-api/tag/list',
DeleteTag = '/fms-api/tag/delete',
GetTagById = '/fms-api/tag',
}

/**
* @description: Get tag list
*/

export const getTagList = (params: BaseListReq, mode: ErrorMessageMode = 'notice') => {
return defHttp.post<BaseDataResp<TagListResp>>(
{ url: Api.GetTagList, params },
{ errorMessageMode: mode },
);
};

/**
* @description: Create a new tag
*/
export const createTag = (params: TagInfo, mode: ErrorMessageMode = 'notice') => {
return defHttp.post<BaseResp>(
{ url: Api.CreateTag, params: params },
{
errorMessageMode: mode,
successMessageMode: mode,
},
);
};

/**
* @description: Update the tag
*/
export const updateTag = (params: TagInfo, mode: ErrorMessageMode = 'notice') => {
return defHttp.post<BaseResp>(
{ url: Api.UpdateTag, params: params },
{
errorMessageMode: mode,
successMessageMode: mode,
},
);
};

/**
* @description: Delete tags
*/
export const deleteTag = (params: BaseIDsReq, mode: ErrorMessageMode = 'notice') => {
return defHttp.post<BaseResp>(
{ url: Api.DeleteTag, params: params },
{
errorMessageMode: mode,
successMessageMode: mode,
},
);
};

/**
* @description: Get tag By ID
*/
export const getTagById = (params: BaseIDReq, mode: ErrorMessageMode = 'notice') => {
return defHttp.post<BaseDataResp<TagInfo>>(
{ url: Api.GetTagById, params: params },
{
errorMessageMode: mode,
},
);
};
2 changes: 1 addition & 1 deletion src/components/Cropper/src/CopperModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
if (uploadApi && isFunction(uploadApi)) {
const blob = dataURLtoBlob(previewSource.value);
try {
message.loading(t('fileManager.preprocessing'));
message.loading(t('fms.file.preprocessing'));
await file2md5(blobToFile(blob, 'avatar.jpg'), { chunkSize: 3 * 1024 * 1024 })
.then((data) => {
message.success(t('common.successful'));
Expand Down
8 changes: 4 additions & 4 deletions src/components/Upload/src/UploadModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
};
// 计算md5
message.loading(t('fileManager.preprocessing'));
message.loading(t('fms.file.preprocessing'));
file2md5(file, { chunkSize: 3 * 1024 * 1024 })
.then((data) => {
message.success(t('common.successful'));
Expand Down Expand Up @@ -187,17 +187,17 @@
try {
if (record.responseData !== undefined) {
await toClipboard(record.responseData?.data.url);
createMessage.success(t('fileManager.copyURLSuccess'));
createMessage.success(t('fms.file.copyURLSuccess'));
} else {
createErrorModal({
title: t('common.failed'),
content: t('fileManager.uploadFirst'),
content: t('fms.file.uploadFirst'),
});
}
} catch (e) {
console.error(e);
createErrorModal({
title: t('fileManager.copyURLFailed'),
title: t('fms.file.copyURLFailed'),
content: record.responseData?.data.url,
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Upload/src/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function createActionColumn(handleRemove: Function, handleCopy: Function)
customRender: ({ record }) => {
const actions: ActionItem[] = [
{
label: t('fileManager.copyURL'),
label: t('fms.file.copyURL'),
color: 'success',
onClick: handleCopy.bind(null, record),
},
Expand Down
26 changes: 0 additions & 26 deletions src/locales/lang/en/fileManager.ts

This file was deleted.

37 changes: 37 additions & 0 deletions src/locales/lang/en/fms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export default {
file: {
// noun
fileName: 'File Name',
fileType: 'File Type',
filePath: 'File Path',
fileSize: 'File Size',
video: 'Video',
audio: 'Audio',
image: 'Image',
other: 'Other',
public: 'Public',
private: 'Private',
download: 'Download',
fileList: 'File List',
// notification
overSizeError: 'The file is over size',
wrongTypeError: 'The file type is illegal',
preprocessing: 'File is preprocessing ...',
copyURLFailed: 'Copy the file path failed, please copy manually',
copyURLSuccess: 'Copy the path successfully',
copyURL: 'Copy URL',
uploadFirst: 'Please upload the file firstly',

addFile: 'Add File',
editFile: 'Edit File',
},
tag: {
tag: 'Tags',
status: 'Status',
name: 'Name',
remark: 'Remark',
addTag: 'Add Tag',
editTag: 'Edit Tag',
tagList: 'Tag List',
},
};
26 changes: 0 additions & 26 deletions src/locales/lang/zh-CN/fileManager.ts

This file was deleted.

37 changes: 37 additions & 0 deletions src/locales/lang/zh-CN/fms.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export default {
file: {
// noun
fileName: '文件名称',
fileType: '文件类型',
filePath: '文件路径',
fileSize: '文件大小',
video: '视频',
audio: '音频',
image: '图片',
other: '其他',
public: '公开',
private: '私密',
download: '下载',
fileList: '文件列表',
// notification
overSizeError: '文件大小超过规定值',
wrongTypeError: '文件类型不合法',
preprocessing: '文件预处理中...',
copyURLFailed: '复制文件地址失败,请手动复制',
copyURLSuccess: '复制文件地址成功',
copyURL: '复制地址',
uploadFirst: '请先上传文件',

addFile: '添加文件',
editFile: '编辑文件',
},
tag: {
tag: '标签',
status: '状态',
name: '标签名称',
remark: '备注',
addTag: '添加标签',
editTag: '编辑标签',
tagList: '标签列表',
},
};
2 changes: 1 addition & 1 deletion src/views/dashboard/workbench/components/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ export const navItems: NavItem[] = [

export const systemInfoData = [
['sys.sys.Name', 'Simple Admin'],
['sys.sys.version', 'V 1.0.11'],
['sys.sys.version', 'V 1.0.12'],
];
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
import { formSchema } from './file.data';
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
import { useI18n } from 'vue-i18n';
import { updateFileInfoReq } from '/@/api/file/model/fileModel';
import { UpdateFileInfo } from '../../api/file/file';
import { UpdateFileInfo } from '/@/api/fms/file';
export default defineComponent({
name: 'FileDrawer',
Expand Down Expand Up @@ -48,18 +47,14 @@
});
const getTitle = computed(() =>
!unref(isUpdate) ? t('fileManager.addFile') : t('fileManager.editFile'),
!unref(isUpdate) ? t('fms.file.addFile') : t('fms.file.editFile'),
);
async function handleSubmit() {
try {
const values = await validate();
setDrawerProps({ confirmLoading: true });
let params: updateFileInfoReq = {
id: values['id'],
name: values['name'],
};
await UpdateFileInfo(params);
await UpdateFileInfo(values);
closeDrawer();
emit('success');
} finally {
Expand Down
Loading

0 comments on commit 42085b2

Please sign in to comment.