im-ui-mobile 0.0.56 → 0.0.57
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.
|
@@ -103,7 +103,7 @@ const props = withDefaults(defineProps<UploadProps>(), {
|
|
|
103
103
|
uploadText: '',
|
|
104
104
|
width: 50,
|
|
105
105
|
height: 50,
|
|
106
|
-
action: '/file/upload
|
|
106
|
+
action: '', // https://example.com/file/upload
|
|
107
107
|
name: 'file',
|
|
108
108
|
headers: () => ({
|
|
109
109
|
'Authorization': `Bearer xxx`,
|
|
@@ -16,7 +16,7 @@ interface Props {
|
|
|
16
16
|
onBefore?: (file: any) => boolean;
|
|
17
17
|
onSuccess?: (file: any, data: any) => void;
|
|
18
18
|
onError?: (file: any, error: any) => void;
|
|
19
|
-
|
|
19
|
+
action: string;
|
|
20
20
|
token?: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -34,10 +34,6 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
34
34
|
thumbSize: 50
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
const uploadHeaders = ref({
|
|
38
|
-
accessToken: uni.getStorageSync('loginInfo').accessToken
|
|
39
|
-
});
|
|
40
|
-
|
|
41
37
|
const selectAndUpload = () => {
|
|
42
38
|
uni.chooseImage({
|
|
43
39
|
count: props.maxCount,
|
|
@@ -55,7 +51,13 @@ const selectAndUpload = () => {
|
|
|
55
51
|
};
|
|
56
52
|
|
|
57
53
|
const uploadImage = (file: any) => {
|
|
58
|
-
|
|
54
|
+
let uploadUrl = props.action
|
|
55
|
+
|
|
56
|
+
if (uploadUrl.indexOf('?') === -1) {
|
|
57
|
+
uploadUrl += '?'
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
uploadUrl += `&isPermanent=${props.isPermanent}&thumbSize=${props.thumbSize}`
|
|
59
61
|
|
|
60
62
|
uni.uploadFile({
|
|
61
63
|
url: uploadUrl, //env.BaseApiUrl + action,
|