giime 0.4.10 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +37 -36
- package/es/api/materialApi/cross/index.d.ts +1 -0
- package/es/api/materialApi/cross/index.mjs +1 -0
- package/es/api/materialApi/cross/index.mjs.map +1 -1
- package/es/api/materialApi/cross/postSaveFileResources.d.ts +27 -0
- package/es/api/materialApi/cross/postSaveFileResources.mjs +8 -0
- package/es/api/materialApi/cross/postSaveFileResources.mjs.map +1 -0
- package/es/api/materialApi/index.mjs +1 -0
- package/es/api/materialApi/index.mjs.map +1 -1
- package/es/api/materialApi/interface/index.d.ts +4 -0
- package/es/api/materialApi/interface/index.mjs +2 -0
- package/es/api/materialApi/interface/index.mjs.map +1 -0
- package/es/components/index.mjs +1 -0
- package/es/components/index.mjs.map +1 -1
- package/es/components/src/base/affix/index.d.ts +2 -421
- package/es/components/src/base/affix/index.mjs.map +1 -1
- package/es/components/src/base/input/Input.vue.d.ts +1 -1
- package/es/components/src/base/input/index.d.ts +3 -3
- package/es/components/src/business/uploadMaterial/UploadMaterial.vue.d.ts +2 -0
- package/es/components/src/business/uploadMaterial/UploadMaterial.vue.mjs +1 -1
- package/es/components/src/business/uploadMaterial/UploadMaterial.vue2.mjs +15 -2
- package/es/components/src/business/uploadMaterial/UploadMaterial.vue2.mjs.map +1 -1
- package/es/components/src/business/uploadMaterial/index.d.ts +2 -0
- package/es/components/src/business/uploadMaterial/uploadMaterial.d.ts +2 -0
- package/es/components/src/business/uploadMaterial/uploadMaterial.mjs.map +1 -1
- package/es/components/src/composite/tablePro/TablePro.vue.d.ts +4 -4
- package/es/components/src/composite/tablePro/index.d.ts +12 -12
- package/es/components/src/plugins/index.mjs +1 -0
- package/es/components/src/plugins/index.mjs.map +1 -1
- package/es/components/src/plugins/message/index.d.ts +1 -0
- package/es/components/src/plugins/message/index.mjs +1 -0
- package/es/components/src/plugins/message/index.mjs.map +1 -1
- package/es/components/src/plugins/message/method.d.ts +4 -1
- package/es/components/src/plugins/message/method.mjs +4 -4
- package/es/components/src/plugins/message/method.mjs.map +1 -1
- package/es/giime/index.mjs +1 -0
- package/es/giime/index.mjs.map +1 -1
- package/es/giime/version.d.ts +1 -1
- package/es/giime/version.mjs +1 -1
- package/es/giime/version.mjs.map +1 -1
- package/es/hooks/store/useAliossStsToken/index.mjs +1 -1
- package/es/hooks/store/useAliossStsToken/index.mjs.map +1 -1
- package/es/index.css +37 -36
- package/es/utils/src/alioss.d.ts +18 -0
- package/es/utils/src/alioss.mjs +12 -6
- package/es/utils/src/alioss.mjs.map +1 -1
- package/es/utils/src/http/createAxios.mjs +17 -8
- package/es/utils/src/http/createAxios.mjs.map +1 -1
- package/es/utils/src/http/errorMessage.d.ts +1 -1
- package/es/utils/src/http/errorMessage.mjs +28 -11
- package/es/utils/src/http/errorMessage.mjs.map +1 -1
- package/lib/api/materialApi/cross/index.d.ts +1 -0
- package/lib/api/materialApi/cross/index.js +2 -0
- package/lib/api/materialApi/cross/index.js.map +1 -1
- package/lib/api/materialApi/cross/postSaveFileResources.d.ts +27 -0
- package/lib/api/materialApi/cross/postSaveFileResources.js +10 -0
- package/lib/api/materialApi/cross/postSaveFileResources.js.map +1 -0
- package/lib/api/materialApi/index.js +2 -0
- package/lib/api/materialApi/index.js.map +1 -1
- package/lib/api/materialApi/interface/index.d.ts +4 -0
- package/lib/api/materialApi/interface/index.js +3 -0
- package/lib/api/materialApi/interface/index.js.map +1 -0
- package/lib/components/index.js +5 -2
- package/lib/components/index.js.map +1 -1
- package/lib/components/src/base/affix/index.d.ts +2 -421
- package/lib/components/src/base/affix/index.js.map +1 -1
- package/lib/components/src/base/input/Input.vue.d.ts +1 -1
- package/lib/components/src/base/input/index.d.ts +3 -3
- package/lib/components/src/business/uploadMaterial/UploadMaterial.vue.d.ts +2 -0
- package/lib/components/src/business/uploadMaterial/UploadMaterial.vue.js +1 -1
- package/lib/components/src/business/uploadMaterial/UploadMaterial.vue2.js +15 -2
- package/lib/components/src/business/uploadMaterial/UploadMaterial.vue2.js.map +1 -1
- package/lib/components/src/business/uploadMaterial/index.d.ts +2 -0
- package/lib/components/src/business/uploadMaterial/uploadMaterial.d.ts +2 -0
- package/lib/components/src/business/uploadMaterial/uploadMaterial.js.map +1 -1
- package/lib/components/src/composite/tablePro/TablePro.vue.d.ts +4 -4
- package/lib/components/src/composite/tablePro/index.d.ts +12 -12
- package/lib/components/src/plugins/index.js +5 -2
- package/lib/components/src/plugins/index.js.map +1 -1
- package/lib/components/src/plugins/message/index.d.ts +1 -0
- package/lib/components/src/plugins/message/index.js +2 -0
- package/lib/components/src/plugins/message/index.js.map +1 -1
- package/lib/components/src/plugins/message/method.d.ts +4 -1
- package/lib/components/src/plugins/message/method.js +4 -3
- package/lib/components/src/plugins/message/method.js.map +1 -1
- package/lib/giime/index.js +5 -2
- package/lib/giime/index.js.map +1 -1
- package/lib/giime/version.d.ts +1 -1
- package/lib/giime/version.js +1 -1
- package/lib/giime/version.js.map +1 -1
- package/lib/hooks/store/useAliossStsToken/index.js +1 -1
- package/lib/hooks/store/useAliossStsToken/index.js.map +1 -1
- package/lib/index.css +37 -36
- package/lib/utils/src/alioss.d.ts +18 -0
- package/lib/utils/src/alioss.js +12 -6
- package/lib/utils/src/alioss.js.map +1 -1
- package/lib/utils/src/http/createAxios.js +17 -8
- package/lib/utils/src/http/createAxios.js.map +1 -1
- package/lib/utils/src/http/errorMessage.d.ts +1 -1
- package/lib/utils/src/http/errorMessage.js +28 -11
- package/lib/utils/src/http/errorMessage.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadMaterial.mjs","sources":["../../../../../../../packages/components/src/business/uploadMaterial/uploadMaterial.ts"],"sourcesContent":["import { uploadProps } from '../../base/upload';\r\nimport type { AliOssResponse } from '@giime/utils/src/alioss';\r\n\r\nexport type UploadMaterialResponse = AliOssResponse;\r\n\r\nexport const uploadMaterialProps = {\r\n ...uploadProps,\r\n accept: {\r\n type: String,\r\n default: '*',\r\n },\r\n autoUpload: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n multiple: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n seat: {\r\n // 上传位置\r\n type: String,\r\n default: 'default',\r\n },\r\n options: {\r\n // alioss上传配置\r\n type: Object,\r\n default: () => {},\r\n },\r\n fileName: {\r\n // 上传文件名\r\n type: String,\r\n default: '',\r\n },\r\n};\r\n"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"uploadMaterial.mjs","sources":["../../../../../../../packages/components/src/business/uploadMaterial/uploadMaterial.ts"],"sourcesContent":["import { type PostSaveFileResourcesFileData } from '@giime/api/materialApi';\r\nimport { uploadProps } from '../../base/upload';\r\nimport type { AliOssResponse } from '@giime/utils/src/alioss';\r\n\r\nexport type UploadMaterialResponse = AliOssResponse;\r\n\r\nexport type SaveFileResourcesFile = PostSaveFileResourcesFileData;\r\n\r\nexport const uploadMaterialProps = {\r\n ...uploadProps,\r\n accept: {\r\n type: String,\r\n default: '*',\r\n },\r\n autoUpload: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n multiple: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n seat: {\r\n // 上传位置\r\n type: String,\r\n default: 'default',\r\n },\r\n options: {\r\n // alioss上传配置\r\n type: Object,\r\n default: () => {},\r\n },\r\n fileName: {\r\n // 上传文件名\r\n type: String,\r\n default: '',\r\n },\r\n};\r\n"],"names":[],"mappings":";;;AAQO,MAAM,mBAAsB,GAAA;AAAA,EACjC,GAAG,WAAA;AAAA,EACH,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,GAAA;AAAA,GACX;AAAA,EACA,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AAAA,EACA,QAAU,EAAA;AAAA,IACR,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,IAAA;AAAA,GACX;AAAA,EACA,IAAM,EAAA;AAAA;AAAA,IAEJ,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,SAAA;AAAA,GACX;AAAA,EACA,OAAS,EAAA;AAAA;AAAA,IAEP,IAAM,EAAA,MAAA;AAAA,IACN,SAAS,MAAM;AAAA,KAAC;AAAA,GAClB;AAAA,EACA,QAAU,EAAA;AAAA;AAAA,IAER,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,EAAA;AAAA,GACX;AACF;;;;"}
|
|
@@ -171,6 +171,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
171
171
|
sortOrders: ("ascending" | "descending" | null)[];
|
|
172
172
|
isShow: boolean;
|
|
173
173
|
isSort: boolean;
|
|
174
|
+
filters?: {
|
|
175
|
+
text: string;
|
|
176
|
+
value: string;
|
|
177
|
+
}[] | undefined;
|
|
174
178
|
label?: string | undefined;
|
|
175
179
|
filterMethod?: import("element-plus/es/components/table/src/table-column/defaults").FilterMethods<any> | undefined;
|
|
176
180
|
align?: string | undefined;
|
|
@@ -309,10 +313,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
309
313
|
headerAlign?: string | undefined;
|
|
310
314
|
selectable?: ((row: any, index: number) => boolean) | undefined;
|
|
311
315
|
filteredValue?: string[] | undefined;
|
|
312
|
-
filters?: {
|
|
313
|
-
text: string;
|
|
314
|
-
value: string;
|
|
315
|
-
}[] | undefined;
|
|
316
316
|
filterPlacement?: string | undefined;
|
|
317
317
|
filterClassName?: string | undefined;
|
|
318
318
|
}[]>;
|
|
@@ -191,6 +191,10 @@ export declare const GmTablePro: import("../../../../utils").SFCWithInstall<{
|
|
|
191
191
|
sortOrders: ("ascending" | "descending" | null)[];
|
|
192
192
|
isShow: boolean;
|
|
193
193
|
isSort: boolean;
|
|
194
|
+
filters?: {
|
|
195
|
+
text: string;
|
|
196
|
+
value: string;
|
|
197
|
+
}[] | undefined;
|
|
194
198
|
label?: string | undefined;
|
|
195
199
|
filterMethod?: import("element-plus/es/components/table/src/table-column/defaults.js").FilterMethods<any> | undefined;
|
|
196
200
|
align?: string | undefined;
|
|
@@ -329,10 +333,6 @@ export declare const GmTablePro: import("../../../../utils").SFCWithInstall<{
|
|
|
329
333
|
headerAlign?: string | undefined;
|
|
330
334
|
selectable?: ((row: any, index: number) => boolean) | undefined;
|
|
331
335
|
filteredValue?: string[] | undefined;
|
|
332
|
-
filters?: {
|
|
333
|
-
text: string;
|
|
334
|
-
value: string;
|
|
335
|
-
}[] | undefined;
|
|
336
336
|
filterPlacement?: string | undefined;
|
|
337
337
|
filterClassName?: string | undefined;
|
|
338
338
|
}[]>;
|
|
@@ -746,6 +746,10 @@ export declare const GmTablePro: import("../../../../utils").SFCWithInstall<{
|
|
|
746
746
|
sortOrders: ("ascending" | "descending" | null)[];
|
|
747
747
|
isShow: boolean;
|
|
748
748
|
isSort: boolean;
|
|
749
|
+
filters?: {
|
|
750
|
+
text: string;
|
|
751
|
+
value: string;
|
|
752
|
+
}[] | undefined;
|
|
749
753
|
label?: string | undefined;
|
|
750
754
|
filterMethod?: import("element-plus/es/components/table/src/table-column/defaults.js").FilterMethods<any> | undefined;
|
|
751
755
|
align?: string | undefined;
|
|
@@ -884,10 +888,6 @@ export declare const GmTablePro: import("../../../../utils").SFCWithInstall<{
|
|
|
884
888
|
headerAlign?: string | undefined;
|
|
885
889
|
selectable?: ((row: any, index: number) => boolean) | undefined;
|
|
886
890
|
filteredValue?: string[] | undefined;
|
|
887
|
-
filters?: {
|
|
888
|
-
text: string;
|
|
889
|
-
value: string;
|
|
890
|
-
}[] | undefined;
|
|
891
891
|
filterPlacement?: string | undefined;
|
|
892
892
|
filterClassName?: string | undefined;
|
|
893
893
|
}[]>;
|
|
@@ -1115,6 +1115,10 @@ export declare const GmTablePro: import("../../../../utils").SFCWithInstall<{
|
|
|
1115
1115
|
sortOrders: ("ascending" | "descending" | null)[];
|
|
1116
1116
|
isShow: boolean;
|
|
1117
1117
|
isSort: boolean;
|
|
1118
|
+
filters?: {
|
|
1119
|
+
text: string;
|
|
1120
|
+
value: string;
|
|
1121
|
+
}[] | undefined;
|
|
1118
1122
|
label?: string | undefined;
|
|
1119
1123
|
filterMethod?: import("element-plus/es/components/table/src/table-column/defaults.js").FilterMethods<any> | undefined;
|
|
1120
1124
|
align?: string | undefined;
|
|
@@ -1253,10 +1257,6 @@ export declare const GmTablePro: import("../../../../utils").SFCWithInstall<{
|
|
|
1253
1257
|
headerAlign?: string | undefined;
|
|
1254
1258
|
selectable?: ((row: any, index: number) => boolean) | undefined;
|
|
1255
1259
|
filteredValue?: string[] | undefined;
|
|
1256
|
-
filters?: {
|
|
1257
|
-
text: string;
|
|
1258
|
-
value: string;
|
|
1259
|
-
}[] | undefined;
|
|
1260
1260
|
filterPlacement?: string | undefined;
|
|
1261
1261
|
filterClassName?: string | undefined;
|
|
1262
1262
|
}[]>;
|
|
@@ -4,5 +4,6 @@ export { GmMessageBox } from './messageBox/index.mjs';
|
|
|
4
4
|
export { GmNotification } from './notification/index.mjs';
|
|
5
5
|
export { GmCopy } from './copy/index.mjs';
|
|
6
6
|
export { GmConfirmBox } from './confirmBox/index.mjs';
|
|
7
|
+
export { messageTypes, normalizeMessageOptions } from './message/method.mjs';
|
|
7
8
|
export { useClipboard } from './copy/method.mjs';
|
|
8
9
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../../../packages/components/src/plugins/message/index.ts"],"sourcesContent":["import { withInstallFunction } from '@giime/utils/src/vue/install';\r\nimport Message from './method';\r\nexport const GmMessage = withInstallFunction(Message, '$message');\r\nexport default GmMessage;\r\n"],"names":["Message"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../../../packages/components/src/plugins/message/index.ts"],"sourcesContent":["import { withInstallFunction } from '@giime/utils/src/vue/install';\r\nimport Message from './method';\r\nexport const GmMessage = withInstallFunction(Message, '$message');\r\nexport * from './method';\r\nexport default GmMessage;\r\n"],"names":["Message"],"mappings":";;;;AAEa,MAAA,SAAA,GAAY,mBAAoB,CAAAA,OAAA,EAAS,UAAU;;;;"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type { Message } from 'element-plus';
|
|
1
|
+
import type { Message, MessageParams } from 'element-plus';
|
|
2
2
|
export declare const messageTypes: readonly ["success", "info", "warning", "error"];
|
|
3
|
+
export declare const normalizeMessageOptions: (params?: MessageParams) => Partial<import("element-plus/es/utils").Mutable<Omit<import("element-plus").MessageProps, "id"> & {
|
|
4
|
+
appendTo?: string | HTMLElement | undefined;
|
|
5
|
+
}>>;
|
|
3
6
|
declare const _default: Message;
|
|
4
7
|
export default _default;
|
|
@@ -5,12 +5,12 @@ import { ElMessage } from 'element-plus';
|
|
|
5
5
|
import { useGlobalConfig } from '../../../../hooks/base/useGlobalConfig/index.mjs';
|
|
6
6
|
|
|
7
7
|
const messageTypes = ["success", "info", "warning", "error"];
|
|
8
|
-
const
|
|
8
|
+
const normalizeMessageOptions = (params) => {
|
|
9
9
|
const normalized = !params || isString(params) || isVNode(params) || isFunction(params) ? { message: params } : params;
|
|
10
10
|
return normalized;
|
|
11
11
|
};
|
|
12
12
|
const message = (options = {}, context) => {
|
|
13
|
-
const normalized =
|
|
13
|
+
const normalized = normalizeMessageOptions(options);
|
|
14
14
|
const messageGlobalConfig = useGlobalConfig("message") ?? {};
|
|
15
15
|
return ElMessage(
|
|
16
16
|
{
|
|
@@ -26,10 +26,10 @@ message.closeAll = ElMessage.closeAll;
|
|
|
26
26
|
message._context = ElMessage._context;
|
|
27
27
|
messageTypes.forEach((type) => {
|
|
28
28
|
message[type] = (options = {}, appContext) => {
|
|
29
|
-
const normalized =
|
|
29
|
+
const normalized = normalizeMessageOptions(options);
|
|
30
30
|
return message({ ...normalized, type }, appContext);
|
|
31
31
|
};
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
export { message as default, messageTypes };
|
|
34
|
+
export { message as default, messageTypes, normalizeMessageOptions };
|
|
35
35
|
//# sourceMappingURL=method.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.mjs","sources":["../../../../../../../packages/components/src/plugins/message/method.ts"],"sourcesContent":["import { type AppContext, isVNode } from 'vue';\r\nimport { isFunction } from '@vue/shared';\r\nimport { isString } from '@giime/utils/src/is';\r\nimport { ElMessage } from 'element-plus';\r\nimport { useGlobalConfig } from '@giime/hooks/base/useGlobalConfig';\r\nimport type { Message, MessageFn, MessageOptions, MessageParams, MessageParamsNormalized } from 'element-plus';\r\nexport const messageTypes = ['success', 'info', 'warning', 'error'] as const;\r\n\r\
|
|
1
|
+
{"version":3,"file":"method.mjs","sources":["../../../../../../../packages/components/src/plugins/message/method.ts"],"sourcesContent":["import { type AppContext, isVNode } from 'vue';\r\nimport { isFunction } from '@vue/shared';\r\nimport { isString } from '@giime/utils/src/is';\r\nimport { ElMessage } from 'element-plus';\r\nimport { useGlobalConfig } from '@giime/hooks/base/useGlobalConfig';\r\nimport type { Message, MessageFn, MessageOptions, MessageParams, MessageParamsNormalized } from 'element-plus';\r\nexport const messageTypes = ['success', 'info', 'warning', 'error'] as const;\r\n\r\nexport const normalizeMessageOptions = (params?: MessageParams) => {\r\n const normalized: MessageOptions = !params || isString(params) || isVNode(params) || isFunction(params) ? { message: params } : params;\r\n return normalized;\r\n};\r\nconst message: MessageFn & Partial<Message> & { _context: AppContext | null } = (options = {}, context) => {\r\n const normalized = normalizeMessageOptions(options);\r\n const messageGlobalConfig = useGlobalConfig('message') ?? {};\r\n return ElMessage(\r\n {\r\n grouping: true,\r\n plain: messageGlobalConfig.value?.plain,\r\n // duration: 5 * 1000,\r\n ...normalized,\r\n },\r\n context,\r\n );\r\n};\r\nmessage.closeAll = ElMessage.closeAll;\r\nmessage._context = ElMessage._context;\r\nmessageTypes.forEach(type => {\r\n message[type] = (options = {}, appContext) => {\r\n const normalized = normalizeMessageOptions(options);\r\n return message({ ...(normalized as MessageParamsNormalized), type }, appContext);\r\n };\r\n});\r\nexport default message as Message;\r\n"],"names":[],"mappings":";;;;;;AAMO,MAAM,YAAe,GAAA,CAAC,SAAW,EAAA,MAAA,EAAQ,WAAW,OAAO,EAAA;AAErD,MAAA,uBAAA,GAA0B,CAAC,MAA2B,KAAA;AACjE,EAAA,MAAM,UAA6B,GAAA,CAAC,MAAU,IAAA,QAAA,CAAS,MAAM,CAAK,IAAA,OAAA,CAAQ,MAAM,CAAA,IAAK,WAAW,MAAM,CAAA,GAAI,EAAE,OAAA,EAAS,QAAW,GAAA,MAAA,CAAA;AAChI,EAAO,OAAA,UAAA,CAAA;AACT,EAAA;AACA,MAAM,OAA0E,GAAA,CAAC,OAAU,GAAA,IAAI,OAAY,KAAA;AACzG,EAAM,MAAA,UAAA,GAAa,wBAAwB,OAAO,CAAA,CAAA;AAClD,EAAA,MAAM,mBAAsB,GAAA,eAAA,CAAgB,SAAS,CAAA,IAAK,EAAC,CAAA;AAC3D,EAAO,OAAA,SAAA;AAAA,IACL;AAAA,MACE,QAAU,EAAA,IAAA;AAAA,MACV,KAAA,EAAO,oBAAoB,KAAO,EAAA,KAAA;AAAA;AAAA,MAElC,GAAG,UAAA;AAAA,KACL;AAAA,IACA,OAAA;AAAA,GACF,CAAA;AACF,EAAA;AACA,OAAA,CAAQ,WAAW,SAAU,CAAA,QAAA,CAAA;AAC7B,OAAA,CAAQ,WAAW,SAAU,CAAA,QAAA,CAAA;AAC7B,YAAA,CAAa,QAAQ,CAAQ,IAAA,KAAA;AAC3B,EAAA,OAAA,CAAQ,IAAI,CAAI,GAAA,CAAC,OAAU,GAAA,IAAI,UAAe,KAAA;AAC5C,IAAM,MAAA,UAAA,GAAa,wBAAwB,OAAO,CAAA,CAAA;AAClD,IAAA,OAAO,QAAQ,EAAE,GAAI,UAAwC,EAAA,IAAA,IAAQ,UAAU,CAAA,CAAA;AAAA,GACjF,CAAA;AACF,CAAC,CAAA;;;;"}
|
package/es/giime/index.mjs
CHANGED
|
@@ -277,6 +277,7 @@ export { selectOptionsEmits, selectOptionsProps } from '../components/src/compos
|
|
|
277
277
|
export { GmSelectOptions } from '../components/src/composite/selectOptions/index.mjs';
|
|
278
278
|
export { importDialogEmits, importDialogProps } from '../components/src/composite/importDialog/importDialog.mjs';
|
|
279
279
|
export { GmImportDialog } from '../components/src/composite/importDialog/index.mjs';
|
|
280
|
+
export { messageTypes, normalizeMessageOptions } from '../components/src/plugins/message/method.mjs';
|
|
280
281
|
export { GmMessage } from '../components/src/plugins/message/index.mjs';
|
|
281
282
|
export { GmLoading } from '../components/src/plugins/loading/index.mjs';
|
|
282
283
|
export { GmMessageBox } from '../components/src/plugins/messageBox/index.mjs';
|
package/es/giime/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../packages/giime/index.ts"],"sourcesContent":["import installer from './defaults';\r\nimport './tailwind.css';\r\nexport * from '@giime/utils';\r\nexport * from '@giime/components';\r\nexport * from '@giime/hooks';\r\n// export * from '@giime/api'; // 用户通过giime/es/api 导入类型\r\nexport const install = installer.install;\r\nexport const version = installer.version;\r\nexport default installer;\r\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../packages/giime/index.ts"],"sourcesContent":["import installer from './defaults';\r\nimport './tailwind.css';\r\nexport * from '@giime/utils';\r\nexport * from '@giime/components';\r\nexport * from '@giime/hooks';\r\n// export * from '@giime/api'; // 用户通过giime/es/api 导入类型\r\nexport const install = installer.install;\r\nexport const version = installer.version;\r\nexport default installer;\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMO,MAAM,UAAU,SAAU,CAAA,QAAA;AAC1B,MAAM,UAAU,SAAU,CAAA;;;;"}
|
package/es/giime/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.5.0";
|
package/es/giime/version.mjs
CHANGED
package/es/giime/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../../../../packages/giime/version.ts"],"sourcesContent":["export const version = '0.
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../../../../packages/giime/version.ts"],"sourcesContent":["export const version = '0.5.0';\n"],"names":[],"mappings":"AAAO,MAAM,OAAU,GAAA;;;;"}
|
|
@@ -33,7 +33,7 @@ const useAliossStsTokenStore = defineStore("gmAliossStsToken", () => {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
const onAliossStsTokenPromise = () => {
|
|
36
|
-
return new Promise(
|
|
36
|
+
return new Promise((resolve) => {
|
|
37
37
|
aliossStsTokenResult.on((value) => resolve(value));
|
|
38
38
|
});
|
|
39
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../../packages/hooks/store/useAliossStsToken/index.ts"],"sourcesContent":["import { ref } from 'vue';\r\nimport { defineStore } from 'pinia';\r\nimport { getOssAccessToken } from '@giime/api/materialApi';\r\nimport { createEventHook } from '@vueuse/core';\r\nimport Cookies from 'js-cookie';\r\nimport type { GetOssAccessTokenResponseData } from '@giime/api/materialApi';\r\n\r\n/**\r\n * @description 素材上传权限\r\n * @param {*}\r\n * @return {*}\r\n **/\r\n\r\nexport const useAliossStsTokenStore = defineStore('gmAliossStsToken', () => {\r\n const isLoading = ref(false);\r\n const aliossStsTokenResult = createEventHook<GetOssAccessTokenResponseData>();\r\n\r\n const setCookie = (data: GetOssAccessTokenResponseData) => {\r\n if (!data) return;\r\n const { Expiration } = data;\r\n const time = new Date(new Date(Expiration ?? 0).getTime() - 10000); //-10秒作为缓冲\r\n Cookies.set('aliossStsToken', JSON.stringify(data), { expires: time });\r\n };\r\n\r\n /* 请求临时上传权限 */\r\n const getAliossStsToken = async () => {\r\n const aliossStsToken = Cookies.get('aliossStsToken');\r\n if (aliossStsToken) {\r\n return JSON.parse(aliossStsToken) as GetOssAccessTokenResponseData;\r\n }\r\n isLoading.value = true;\r\n try {\r\n const { data } = await getOssAccessToken();\r\n if (data.code === 0) {\r\n setCookie(data.data);\r\n aliossStsTokenResult.trigger(data.data);\r\n }\r\n\r\n return data.data;\r\n } finally {\r\n isLoading.value = false;\r\n }\r\n };\r\n\r\n /* 监听获取 alioss sts token 成功 promise版 */\r\n const onAliossStsTokenPromise = () => {\r\n return new Promise<GetOssAccessTokenResponseData>(
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../../packages/hooks/store/useAliossStsToken/index.ts"],"sourcesContent":["import { ref } from 'vue';\r\nimport { defineStore } from 'pinia';\r\nimport { getOssAccessToken } from '@giime/api/materialApi';\r\nimport { createEventHook } from '@vueuse/core';\r\nimport Cookies from 'js-cookie';\r\nimport type { GetOssAccessTokenResponseData } from '@giime/api/materialApi';\r\n\r\n/**\r\n * @description 素材上传权限\r\n * @param {*}\r\n * @return {*}\r\n **/\r\n\r\nexport const useAliossStsTokenStore = defineStore('gmAliossStsToken', () => {\r\n const isLoading = ref(false);\r\n const aliossStsTokenResult = createEventHook<GetOssAccessTokenResponseData>();\r\n\r\n const setCookie = (data: GetOssAccessTokenResponseData) => {\r\n if (!data) return;\r\n const { Expiration } = data;\r\n const time = new Date(new Date(Expiration ?? 0).getTime() - 10000); //-10秒作为缓冲\r\n Cookies.set('aliossStsToken', JSON.stringify(data), { expires: time });\r\n };\r\n\r\n /* 请求临时上传权限 */\r\n const getAliossStsToken = async () => {\r\n const aliossStsToken = Cookies.get('aliossStsToken');\r\n if (aliossStsToken) {\r\n return JSON.parse(aliossStsToken) as GetOssAccessTokenResponseData;\r\n }\r\n isLoading.value = true;\r\n try {\r\n const { data } = await getOssAccessToken();\r\n if (data.code === 0) {\r\n setCookie(data.data);\r\n aliossStsTokenResult.trigger(data.data);\r\n }\r\n\r\n return data.data;\r\n } finally {\r\n isLoading.value = false;\r\n }\r\n };\r\n\r\n /* 监听获取 alioss sts token 成功 promise版 */\r\n const onAliossStsTokenPromise = () => {\r\n return new Promise<GetOssAccessTokenResponseData>(resolve => {\r\n aliossStsTokenResult.on(value => resolve(value));\r\n });\r\n };\r\n\r\n /* 获取 alioss 临时上传 token*/\r\n const getAliossStsTokenAsync = () => {\r\n /* 若正在请求请求临时token接口 则其他后进来的等待 */\r\n if (isLoading.value) {\r\n return onAliossStsTokenPromise();\r\n }\r\n return getAliossStsToken();\r\n };\r\n\r\n return {\r\n isLoading,\r\n getAliossStsTokenAsync,\r\n };\r\n});\r\n"],"names":[],"mappings":";;;;;;;AAaa,MAAA,sBAAA,GAAyB,WAAY,CAAA,kBAAA,EAAoB,MAAM;AAC1E,EAAM,MAAA,SAAA,GAAY,IAAI,KAAK,CAAA,CAAA;AAC3B,EAAA,MAAM,uBAAuB,eAA+C,EAAA,CAAA;AAE5E,EAAM,MAAA,SAAA,GAAY,CAAC,IAAwC,KAAA;AACzD,IAAA,IAAI,CAAC,IAAA;AAAM,MAAA,OAAA;AACX,IAAM,MAAA,EAAE,YAAe,GAAA,IAAA,CAAA;AACvB,IAAM,MAAA,IAAA,GAAO,IAAI,IAAA,CAAK,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iBAAkB,EAAA,CAAA;AAAA,GAC3B,CAAA;AAEA,EAAO,OAAA;AAAA,IACL,SAAA;AAAA,IACA,sBAAA;AAAA,GACF,CAAA;AACF,CAAC;;;;"}
|
package/es/index.css
CHANGED
|
@@ -777,42 +777,44 @@ video {
|
|
|
777
777
|
.gm-group:hover .group-hover\:gm-block {
|
|
778
778
|
display: block;
|
|
779
779
|
}
|
|
780
|
-
|
|
781
|
-
|
|
780
|
+
.gm-upload-material .el-overlay-dialog {
|
|
781
|
+
display: flex;
|
|
782
|
+
align-items: center;
|
|
783
|
+
justify-content: center;
|
|
784
|
+
}
|
|
785
|
+
.gm-upload-material .el-dialog {
|
|
782
786
|
margin: 0;
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
|
|
787
|
+
}
|
|
788
|
+
.gm-upload-material .el-dialog__body {
|
|
789
|
+
max-height: calc(100vh - 100px);
|
|
790
|
+
overflow-y: auto;
|
|
791
|
+
}
|
|
792
|
+
.gm-upload-material .el-dialog__body video,
|
|
793
|
+
.gm-upload-material .el-dialog__body img {
|
|
794
|
+
max-height: calc(100vh - 150px);
|
|
795
|
+
}
|
|
796
|
+
[data-v-7c80c3b6] .el-upload-dragger {
|
|
786
797
|
padding: 10px;
|
|
787
798
|
border: none;
|
|
788
799
|
}
|
|
789
800
|
|
|
790
|
-
.gm-upload-preview-dialog[data-v-
|
|
801
|
+
.gm-upload-preview-dialog[data-v-7c80c3b6] [data-v-7c80c3b6] .el-dialog__body {
|
|
791
802
|
padding: 0;
|
|
792
803
|
}
|
|
793
804
|
|
|
794
|
-
[data-v-
|
|
805
|
+
[data-v-7c80c3b6] .el-upload-list__item, [data-v-7c80c3b6] .el-upload--picture-card {
|
|
795
806
|
width: 120px;
|
|
796
807
|
height: 120px;
|
|
797
808
|
display: flex;
|
|
798
809
|
align-items: center;
|
|
799
810
|
justify-content: center;
|
|
800
811
|
}
|
|
801
|
-
.gm-
|
|
802
|
-
display: flex;
|
|
812
|
+
.gm-flex-center[data-v-2a79bac9] {
|
|
803
813
|
align-items: center;
|
|
804
|
-
justify-content: center;
|
|
805
|
-
}
|
|
806
|
-
.gm-upload-material .el-dialog {
|
|
807
|
-
margin: 0;
|
|
808
|
-
}
|
|
809
|
-
.gm-upload-material .el-dialog__body {
|
|
810
|
-
max-height: calc(100vh - 100px);
|
|
811
|
-
overflow-y: auto;
|
|
812
814
|
}
|
|
813
|
-
|
|
814
|
-
.gm-
|
|
815
|
-
|
|
815
|
+
|
|
816
|
+
.gm-flex-justify-between[data-v-2a79bac9] {
|
|
817
|
+
justify-content: space-between;
|
|
816
818
|
}
|
|
817
819
|
.circular[data-v-b391445c] {
|
|
818
820
|
animation: loading-rotate-b391445c 2s linear infinite;
|
|
@@ -845,17 +847,15 @@ video {
|
|
|
845
847
|
stroke-dashoffset: -120px;
|
|
846
848
|
}
|
|
847
849
|
}
|
|
850
|
+
|
|
851
|
+
.gm-range-number .el-form-item[data-v-11c39847] {
|
|
852
|
+
margin: 0;
|
|
853
|
+
}
|
|
854
|
+
|
|
848
855
|
[data-v-7b6755e2] .gmSearchForm .el-form-item {
|
|
849
856
|
margin-right: 0;
|
|
850
857
|
margin-bottom: 4px;
|
|
851
858
|
}
|
|
852
|
-
.gm-flex-center[data-v-2a79bac9] {
|
|
853
|
-
align-items: center;
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
.gm-flex-justify-between[data-v-2a79bac9] {
|
|
857
|
-
justify-content: space-between;
|
|
858
|
-
}
|
|
859
859
|
[data-v-668dc408] .gmTableNoBorder .el-table__body .el-table__cell {
|
|
860
860
|
border-right: none;
|
|
861
861
|
}
|
|
@@ -879,6 +879,15 @@ video {
|
|
|
879
879
|
[data-v-668dc408] .gmTableNoBorder .el-table__border-left-patch {
|
|
880
880
|
height: 0;
|
|
881
881
|
}
|
|
882
|
+
|
|
883
|
+
.pagination-container[data-v-19230954] {
|
|
884
|
+
background: #fff;
|
|
885
|
+
padding-top: 12px;
|
|
886
|
+
}
|
|
887
|
+
.pagination-container.hidden[data-v-19230954] {
|
|
888
|
+
display: none;
|
|
889
|
+
}
|
|
890
|
+
|
|
882
891
|
.gm-number-interval-single[data-v-47a13fd0] {
|
|
883
892
|
border-radius: var(--el-input-border-radius, var(--el-border-radius-base));
|
|
884
893
|
box-shadow: 0 0 0 1px var(--el-input-border-color, var(--el-border-color)) inset;
|
|
@@ -896,12 +905,4 @@ video {
|
|
|
896
905
|
|
|
897
906
|
.gm-number-interval-single[data-v-47a13fd0]:hover .gm-number-interval-close[data-v-47a13fd0] {
|
|
898
907
|
display: flex;
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
.pagination-container[data-v-19230954] {
|
|
902
|
-
background: #fff;
|
|
903
|
-
padding-top: 12px;
|
|
904
|
-
}
|
|
905
|
-
.pagination-container.hidden[data-v-19230954] {
|
|
906
|
-
display: none;
|
|
907
|
-
}
|
|
908
|
+
}
|
package/es/utils/src/alioss.d.ts
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
|
+
/** 上传文件到阿里云 */
|
|
1
2
|
export type AliOssParams = {
|
|
3
|
+
/** 资源文件 */
|
|
2
4
|
file: File;
|
|
5
|
+
/** 文件名 */
|
|
3
6
|
fileName?: string;
|
|
7
|
+
/** 文件存储位置 */
|
|
4
8
|
seat?: string;
|
|
9
|
+
/** 上传到oss的设置 */
|
|
5
10
|
options?: any;
|
|
6
11
|
};
|
|
12
|
+
/** 返回数据 */
|
|
7
13
|
export type AliOssResponse = {
|
|
14
|
+
/** 文件地址 */
|
|
8
15
|
url: string;
|
|
16
|
+
/** 文件名 */
|
|
9
17
|
name: string;
|
|
18
|
+
/** 文件最后修改时间 */
|
|
10
19
|
lastModified: number;
|
|
20
|
+
/** 文件md5 */
|
|
11
21
|
md5: string;
|
|
22
|
+
/** 文件大小 */
|
|
23
|
+
size: number;
|
|
24
|
+
/** 文件后缀 */
|
|
25
|
+
type: string;
|
|
26
|
+
/** 文件库是否存在 */
|
|
27
|
+
isExist: boolean;
|
|
12
28
|
};
|
|
29
|
+
/** 检测广告素材是否已存在 */
|
|
13
30
|
export declare const getFileExist: (md5Code: string, ext: string) => Promise<string | false>;
|
|
31
|
+
/** 上传文件 */
|
|
14
32
|
export declare const aliossPutFile: ({ file, fileName, seat, options }: AliOssParams) => Promise<AliOssResponse>;
|
package/es/utils/src/alioss.mjs
CHANGED
|
@@ -35,7 +35,7 @@ const getParallelPartSize = (size) => {
|
|
|
35
35
|
};
|
|
36
36
|
const getFileExist = async (md5Code, ext) => {
|
|
37
37
|
const { data } = await getAdFileExist({ md5Code, ext });
|
|
38
|
-
if (data.code !==
|
|
38
|
+
if (data.code !== 0) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
41
|
if (!data.data.count) {
|
|
@@ -47,14 +47,17 @@ const aliossPutFile = async ({ file, fileName, seat, options }) => {
|
|
|
47
47
|
const md5 = await ts_md5_file(file);
|
|
48
48
|
let { name, lastModified, size } = file;
|
|
49
49
|
const ext = name.match(/\.(\w+)$/)?.[0] || "";
|
|
50
|
-
const url = await getFileExist(md5, ext);
|
|
50
|
+
const url = await getFileExist(md5, ext.replaceAll(".", ""));
|
|
51
51
|
name = (fileName || name).slice(0, name.lastIndexOf("."));
|
|
52
52
|
if (url) {
|
|
53
53
|
return {
|
|
54
|
-
name,
|
|
54
|
+
name: name + ext,
|
|
55
55
|
url,
|
|
56
56
|
lastModified,
|
|
57
|
-
md5
|
|
57
|
+
md5,
|
|
58
|
+
size,
|
|
59
|
+
type: ext.replaceAll(".", ""),
|
|
60
|
+
isExist: true
|
|
58
61
|
};
|
|
59
62
|
}
|
|
60
63
|
const aliossStsTokenStore = useAliossStsTokenStore();
|
|
@@ -87,10 +90,13 @@ const aliossPutFile = async ({ file, fileName, seat, options }) => {
|
|
|
87
90
|
ossClient[upload](aliossPath, file, options).then(() => {
|
|
88
91
|
const url2 = `https://sucai.giikin.cn/${aliossPath}`;
|
|
89
92
|
resolve({
|
|
90
|
-
name:
|
|
93
|
+
name: name + ext,
|
|
91
94
|
url: url2,
|
|
92
95
|
lastModified,
|
|
93
|
-
md5
|
|
96
|
+
md5,
|
|
97
|
+
type: ext.replaceAll(".", ""),
|
|
98
|
+
size,
|
|
99
|
+
isExist: false
|
|
94
100
|
});
|
|
95
101
|
});
|
|
96
102
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alioss.mjs","sources":["../../../../../packages/utils/src/alioss.ts"],"sourcesContent":["import AliOss from 'ali-oss';\r\nimport { useAliossStsTokenStore } from '@giime/hooks/store/useAliossStsToken';\r\nimport { getAdFileExist } from '@giime/api/materialApi';\r\nimport { GmMessage } from '@giime/components/src/plugins/message';\r\nimport { ts_md5_file } from './crypto/md5';\r\n\r\n
|
|
1
|
+
{"version":3,"file":"alioss.mjs","sources":["../../../../../packages/utils/src/alioss.ts"],"sourcesContent":["import AliOss from 'ali-oss';\r\nimport { useAliossStsTokenStore } from '@giime/hooks/store/useAliossStsToken';\r\nimport { getAdFileExist } from '@giime/api/materialApi';\r\nimport { GmMessage } from '@giime/components/src/plugins/message';\r\nimport { ts_md5_file } from './crypto/md5';\r\n\r\n/** 上传文件到阿里云 */\r\nexport type AliOssParams = {\r\n /** 资源文件 */\r\n file: File;\r\n /** 文件名 */\r\n fileName?: string;\r\n /** 文件存储位置 */\r\n seat?: string;\r\n /** 上传到oss的设置 */\r\n options?: any;\r\n};\r\n\r\n/** 返回数据 */\r\nexport type AliOssResponse = {\r\n /** 文件地址 */\r\n url: string;\r\n /** 文件名 */\r\n name: string;\r\n /** 文件最后修改时间 */\r\n lastModified: number;\r\n /** 文件md5 */\r\n md5: string;\r\n /** 文件大小 */\r\n size: number;\r\n /** 文件后缀 */\r\n type: string;\r\n /** 文件库是否存在 */\r\n isExist: boolean;\r\n};\r\n\r\n/** 文件分片 */\r\nconst getParallelPartSize = (size: number) => {\r\n const SM = size / 1024 / 1024;\r\n let parallel = 1;\r\n let partSize = 1024 * 1024;\r\n if (SM <= 5) {\r\n partSize *= 5;\r\n }\r\n if (SM > 5 && SM <= 10) {\r\n parallel = 2;\r\n partSize *= 4;\r\n }\r\n if (SM > 10 && SM <= 30) {\r\n parallel = 4;\r\n partSize *= 5;\r\n }\r\n if (SM > 30 && SM <= 50) {\r\n parallel = 6;\r\n partSize *= 6;\r\n }\r\n if (SM > 50) {\r\n parallel = 8;\r\n partSize *= 8;\r\n }\r\n\r\n return {\r\n parallel,\r\n partSize,\r\n };\r\n};\r\n\r\n/** 检测广告素材是否已存在 */\r\nexport const getFileExist = async (md5Code: string, ext: string) => {\r\n const { data } = await getAdFileExist({ md5Code, ext });\r\n if (data.code !== 0) {\r\n return false;\r\n }\r\n if (!data.data.count) {\r\n return false;\r\n }\r\n return data.data.url;\r\n};\r\n\r\n/** 上传文件 */\r\nexport const aliossPutFile = async ({ file, fileName, seat, options }: AliOssParams): Promise<AliOssResponse> => {\r\n const md5 = await ts_md5_file(file);\r\n let { name, lastModified, size } = file;\r\n // 截取文件后缀名\r\n const ext = name.match(/\\.(\\w+)$/)?.[0] || '';\r\n const url = await getFileExist(md5, ext.replaceAll('.', ''));\r\n name = (fileName || name).slice(0, name.lastIndexOf('.'));\r\n // 文件已存在直接返回路径\r\n if (url) {\r\n return {\r\n name: name + ext,\r\n url,\r\n lastModified,\r\n md5,\r\n size,\r\n type: ext.replaceAll('.', ''),\r\n isExist: true,\r\n };\r\n }\r\n // 阿里上传权限\r\n const aliossStsTokenStore = useAliossStsTokenStore();\r\n const { AccessKeyId, AccessKeySecret, SecurityToken } = await aliossStsTokenStore.getAliossStsTokenAsync();\r\n\r\n // 文件存储路径\r\n const timestr = Date.now();\r\n const aliossPath = `material/${seat}/material-file-${timestr}-${size}-${lastModified}${ext}`;\r\n\r\n // 根据文件大小设置并发数和分片大小\r\n if (!options) {\r\n const { parallel, partSize } = getParallelPartSize(size);\r\n options = options ?? {\r\n parallel,\r\n partSize,\r\n ContentDisposition: `attachment;filename=${encodeURIComponent(name)}${ext};filename*=${encodeURIComponent(name)}${ext}`,\r\n };\r\n }\r\n\r\n const ossClient = new AliOss({\r\n // yourRegion填写Bucket所在地域。以华东1(杭州)为例,Region填写为oss-cn-hangzhou。\r\n region: 'oss-cn-shenzhen',\r\n // 从STS服务获取的临时访问密钥(AccessKey ID、AccessKey Secret、StsToken)。\r\n accessKeyId: AccessKeyId,\r\n accessKeySecret: AccessKeySecret,\r\n stsToken: SecurityToken,\r\n // 刷新临时访问凭证的时间间隔,单位为毫秒。\r\n refreshSTSTokenInterval: 300000,\r\n // 填写Bucket名称。\r\n bucket: 'giikin-material',\r\n });\r\n return new Promise((resolve, reject) => {\r\n try {\r\n // 分片数量大于1,使用 multipartUpload 方法\r\n const upload = options.parallel === 1 ? 'put' : 'multipartUpload';\r\n ossClient[upload](aliossPath, file, options).then(() => {\r\n const url = `https://sucai.giikin.cn/${aliossPath}`;\r\n resolve({\r\n name: name + ext,\r\n url,\r\n lastModified,\r\n md5,\r\n type: ext.replaceAll('.', ''),\r\n size,\r\n isExist: false,\r\n });\r\n });\r\n } catch (error) {\r\n GmMessage.error(error || '上传失败');\r\n reject(error);\r\n }\r\n });\r\n};\r\n"],"names":["url"],"mappings":";;;;;;;AAqCA,MAAM,mBAAA,GAAsB,CAAC,IAAiB,KAAA;AAC5C,EAAM,MAAA,EAAA,GAAK,OAAO,IAAO,GAAA,IAAA,CAAA;AACzB,EAAA,IAAI,QAAW,GAAA,CAAA,CAAA;AACf,EAAA,IAAI,WAAW,IAAO,GAAA,IAAA,CAAA;AACtB,EAAA,IAAI,MAAM,CAAG,EAAA;AACX,IAAY,QAAA,IAAA,CAAA,CAAA;AAAA,GACd;AACA,EAAI,IAAA,EAAA,GAAK,CAAK,IAAA,EAAA,IAAM,EAAI,EAAA;AACtB,IAAW,QAAA,GAAA,CAAA,CAAA;AACX,IAAY,QAAA,IAAA,CAAA,CAAA;AAAA,GACd;AACA,EAAI,IAAA,EAAA,GAAK,EAAM,IAAA,EAAA,IAAM,EAAI,EAAA;AACvB,IAAW,QAAA,G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AER,WAAa,EAAA,WAAA;AAAA,IACb,eAAiB,EAAA,eAAA;AAAA,IACjB,QAAU,EAAA,aAAA;AAAA;AAAA,IAEV,uBAAyB,EAAA,GAAA;AAAA;AAAA,IAEzB,MAAQ,EAAA,iBAAA;AAAA,GACT,CAAA,CAAA;AACD,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,EAAS,MAAW,KAAA;AACtC,IAAI,IAAA;AAEF,MAAA,MAAM,MAAS,GAAA,OAAA,CAAQ,QAAa,KAAA,CAAA,GAAI,KAAQ,GAAA,iBAAA,CAAA;AAChD,MAAA,SAAA,CAAU,MAAM,CAAE,CAAA,UAAA,EAAY,MAAM,OAAO,CAAA,CAAE,KAAK,MAAM;AACtD,QAAMA,MAAAA,IAAAA,GAAM,2BAA2B,UAAU,CAAA,CAAA,CAAA;AACjD,QAAQ,OAAA,CAAA;AAAA,UACN,MAAM,IAAO,GAAA,GAAA;AAAA,UACb,GAAAA,EAAAA,IAAAA;AAAA,UACA,YAAA;AAAA,UACA,GAAA;AAAA,UACA,IAAM,EAAA,GAAA,CAAI,UAAW,CAAA,GAAA,EAAK,EAAE,CAAA;AAAA,UAC5B,IAAA;AAAA,UACA,OAAS,EAAA,KAAA;AAAA,SACV,CAAA,CAAA;AAAA,OACF,CAAA,CAAA;AAAA,aACM,KAAO,EAAA;AACd,MAAU,SAAA,CAAA,KAAA,CAAM,SAAS,0BAAM,CAAA,CAAA;AAC/B,MAAA,MAAA,CAAO,KAAK,CAAA,CAAA;AAAA,KACd;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
|
|
@@ -40,22 +40,31 @@ const createAxios = (config, options) => {
|
|
|
40
40
|
service.interceptors.response.use(
|
|
41
41
|
async (response) => {
|
|
42
42
|
const res = response.data;
|
|
43
|
+
const msg = (res?.comment ?? res?.message ?? res?.errMsg ?? res?.msg) || "\u63A5\u53E3\u8BF7\u6C42\u9519\u8BEF";
|
|
43
44
|
if (!isNumber(res?.code)) {
|
|
44
|
-
return response;
|
|
45
|
-
}
|
|
46
|
-
if (res.code === 401) {
|
|
47
|
-
const res2 = await res401Interceptors(service, response.config);
|
|
48
|
-
return res2;
|
|
49
|
-
} else if (res.code !== successCode && res.errCode !== successCode) {
|
|
50
45
|
ElMessage({
|
|
51
|
-
message:
|
|
46
|
+
message: "\u670D\u52A1\u5668\u63A5\u53E3\u9519\u8BEF\uFF1A\u5E94\u8FD4\u56DE\u6B63\u786E\u7684code\u7801",
|
|
52
47
|
type: "error",
|
|
53
48
|
grouping: true,
|
|
54
49
|
duration: 5 * 1e3,
|
|
55
50
|
showClose: true
|
|
56
51
|
});
|
|
52
|
+
return Promise.reject({ code: 400, data: null, msg: msg || "\u63A5\u53E3\u8BF7\u6C42\u9519\u8BEF" });
|
|
53
|
+
}
|
|
54
|
+
if (res.code === successCode || res.errCode === successCode) {
|
|
55
|
+
return response;
|
|
56
|
+
} else if (res.code === 401) {
|
|
57
|
+
const res2 = await res401Interceptors(service, response.config);
|
|
58
|
+
return res2;
|
|
57
59
|
}
|
|
58
|
-
|
|
60
|
+
ElMessage({
|
|
61
|
+
message: msg,
|
|
62
|
+
type: "error",
|
|
63
|
+
grouping: true,
|
|
64
|
+
duration: 5 * 1e3,
|
|
65
|
+
showClose: true
|
|
66
|
+
});
|
|
67
|
+
return Promise.reject(response);
|
|
59
68
|
},
|
|
60
69
|
async (err) => {
|
|
61
70
|
console.error(err.config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAxios.mjs","sources":["../../../../../../packages/utils/src/http/createAxios.ts"],"sourcesContent":["import axios from 'axios';\
|
|
1
|
+
{"version":3,"file":"createAxios.mjs","sources":["../../../../../../packages/utils/src/http/createAxios.ts"],"sourcesContent":["import axios from 'axios';\nimport { ElMessage } from 'element-plus';\nimport Cookies from 'js-cookie';\nimport { useLoginStore } from '@giime/hooks/store/useLogin';\nimport { isNumber } from '../is';\nimport { res401Interceptors } from './interceptors';\nimport { responseErrorMessage } from './errorMessage';\nimport type { AxiosError, CreateAxiosDefaults, InternalAxiosRequestConfig } from 'axios';\nexport interface CreateAxiosConfig extends CreateAxiosDefaults {\n baseURL: string;\n /**服务器调用成功的code 一般是 0 或 200 */\n successCode: number;\n}\n\nexport const createAxios = (\n config: CreateAxiosConfig,\n options?: {\n requestInterceptors?: (config: InternalAxiosRequestConfig<any>) => any;\n },\n) => {\n const successCode = config.successCode ?? 0;\n const service = axios.create({\n withCredentials: true, // send cookies when cross-domain requests\n timeout: 120_000,\n headers: {\n 'content-type': 'application/json',\n Accept: '*/*',\n },\n ...config,\n });\n\n // 请求拦截器\n service.interceptors.request.use(\n async config => {\n const logingStore = useLoginStore();\n const _token = Cookies.get('token') ?? logingStore.userToken;\n const _user = Cookies.get('sso_user_id') ?? logingStore.userId;\n if (!config.params) {\n config.params = {};\n }\n config.params._token = _token;\n config.params._user = _user;\n config.headers.Authorization = `Bearer ${_token}`;\n await options?.requestInterceptors?.(config);\n return config;\n },\n error => {\n console.error('请求错误', error); // for debug\n return Promise.reject(error);\n },\n );\n // 添加响应拦截器\n service.interceptors.response.use(\n async response => {\n // 对响应数据做点什么\n const res = response.data;\n const msg = (res?.comment ?? res?.message ?? res?.errMsg ?? res?.msg) || '接口请求错误';\n if (!isNumber(res?.code)) {\n ElMessage({\n message: '服务器接口错误:应返回正确的code码',\n type: 'error',\n grouping: true,\n duration: 5 * 1000,\n showClose: true,\n });\n return Promise.reject({ code: 400, data: null, msg: msg || '接口请求错误' });\n // return response;\n }\n // 成功情况\n if (res.code === successCode || res.errCode === successCode) {\n return response;\n // 401\n } else if (res.code === 401) {\n const res = await res401Interceptors(service, response.config);\n return res;\n }\n ElMessage({\n message: msg,\n type: 'error',\n grouping: true,\n duration: 5 * 1000,\n showClose: true,\n });\n return Promise.reject(response);\n // return response;\n },\n async (err: AxiosError) => {\n console.error(err.config);\n if (err?.response?.status === 401 && !err.message.includes('timeout')) {\n const res = await res401Interceptors(service, err.config!);\n return res;\n } else {\n // 对响应错误做点什么\n respon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V,UAAU,CAAI,GAAA,GAAA;AAAA,QACd,SAAW,EAAA,IAAA;AAAA,OACZ,CAAA,CAAA;AACD,MAAO,OAAA,OAAA,CAAQ,OAAO,QAAQ,CAAA,CAAA;AAAA,KAEhC;AAAA,IACA,OAAO,GAAoB,KAAA;AACzB,MAAQ,OAAA,CAAA,KAAA,CAAM,IAAI,MAAM,CAAA,CAAA;AACxB,MAAI,IAAA,GAAA,EAAK,UAAU,MAAW,KAAA,GAAA,IAAO,CAAC,GAAI,CAAA,OAAA,CAAQ,QAAS,CAAA,SAAS,CAAG,EAAA;AACrE,QAAA,MAAM,GAAM,GAAA,MAAM,kBAAmB,CAAA,OAAA,EAAS,IAAI,MAAO,CAAA,CAAA;AACzD,QAAO,OAAA,GAAA,CAAA;AAAA,OACF,MAAA;AAEL,QAAA,oBAAA,CAAqB,GAAG,CAAA,CAAA;AACxB,QAAO,OAAA,OAAA,CAAQ,OAAO,GAAG,CAAA,CAAA;AAAA,OAC3B;AAAA,KACF;AAAA,GACF,CAAA;AAEA,EAAO,OAAA;AAAA,IACL,OAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -4,4 +4,4 @@ import type { AxiosError } from 'axios';
|
|
|
4
4
|
* 统一错误弹窗
|
|
5
5
|
*/
|
|
6
6
|
export declare const errorMessage: (options: MessageOptions) => import("element-plus").MessageHandler;
|
|
7
|
-
export declare const responseErrorMessage: (error: AxiosError<any, any
|
|
7
|
+
export declare const responseErrorMessage: (error: AxiosError<any, any>, options?: MessageOptions) => import("element-plus").MessageHandler | Promise<never> | undefined;
|