im-ui-mobile 0.0.98 → 0.1.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/components/im-avatar/im-avatar.vue +121 -121
- package/components/im-button/im-button.vue +630 -626
- package/components/im-cell/im-cell.vue +10 -15
- package/components/im-cell-group/im-cell-group.vue +16 -16
- package/components/im-chat-item/im-chat-item.vue +213 -213
- package/components/im-context-menu/im-context-menu.vue +138 -138
- package/components/im-file-upload/im-file-upload.vue +309 -309
- package/components/im-friend-item/im-friend-item.vue +82 -75
- package/components/im-group-item/im-group-item.vue +62 -62
- package/components/im-group-member-selector/im-group-member-selector.vue +202 -202
- package/components/im-group-rtc-join/im-group-rtc-join.vue +112 -112
- package/components/im-image-upload/im-image-upload.vue +94 -94
- package/components/im-loading/im-loading.vue +64 -64
- package/components/im-mention-picker/im-mention-picker.vue +191 -191
- package/components/im-message-item/im-message-item.vue +555 -555
- package/components/im-nav-bar/im-nav-bar.vue +98 -98
- package/components/im-read-receipt/im-read-receipt.vue +174 -174
- package/components/im-virtual-list/im-virtual-list.vue +52 -51
- package/components/im-voice-input/im-voice-input.vue +305 -305
- package/libs/index.ts +2 -3
- package/package.json +58 -58
- package/styles/button.scss +1 -1
- package/theme.scss +61 -62
- package/types/components.d.ts +0 -1
- package/types/index.d.ts +94 -94
- package/types/libs/index.d.ts +206 -204
- package/types/utils/datetime.d.ts +9 -9
- package/types/utils/dom.d.ts +11 -11
- package/types/utils/emoji.d.ts +8 -8
- package/types/utils/enums.d.ts +73 -73
- package/types/utils/messageType.d.ts +35 -35
- package/types/utils/recorderApp.d.ts +9 -9
- package/types/utils/recorderH5.d.ts +9 -9
- package/types/utils/requester.d.ts +15 -15
- package/types/utils/url.d.ts +5 -5
- package/types/utils/useDynamicRefs.d.ts +9 -9
- package/types/utils/websocket.d.ts +34 -34
- package/utils/enums.js +1 -1
- package/components/im-virtual-scroller/im-virtual-scroller.vue +0 -54
- package/types/components/virtual-scroller.d.ts +0 -20
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view @click="selectAndUpload()">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</view>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { ref } from 'vue'
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
maxCount?: number;
|
|
12
|
-
maxSize?: number;
|
|
13
|
-
sourceType?: string;
|
|
14
|
-
isPermanent?: boolean;
|
|
15
|
-
thumbSize?: number;
|
|
16
|
-
onBefore?: (file: any) => boolean;
|
|
17
|
-
onSuccess?: (file: any, data: any) => void;
|
|
18
|
-
onError?: (file: any, error: any) => void;
|
|
19
|
-
action: string;
|
|
20
|
-
token?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface UploadResponse {
|
|
24
|
-
code: number;
|
|
25
|
-
message: string;
|
|
26
|
-
data?: any;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
30
|
-
maxCount: 1,
|
|
31
|
-
maxSize: 5 * 1024 * 1024,
|
|
32
|
-
sourceType: 'album',
|
|
33
|
-
isPermanent: false,
|
|
34
|
-
thumbSize: 50
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const selectAndUpload = () => {
|
|
38
|
-
uni.chooseImage({
|
|
39
|
-
count: props.maxCount,
|
|
40
|
-
sourceType: [props.sourceType],
|
|
41
|
-
sizeType: ['original'],
|
|
42
|
-
success: (res: any) => {
|
|
43
|
-
res.tempFiles.forEach((file: any) => {
|
|
44
|
-
if (!props.onBefore || props.onBefore(file)) {
|
|
45
|
-
// 调用上传图片的接口
|
|
46
|
-
uploadImage(file);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const uploadImage = (file: any) => {
|
|
54
|
-
let uploadUrl = props.action
|
|
55
|
-
|
|
56
|
-
if (uploadUrl.indexOf('?') === -1) {
|
|
57
|
-
uploadUrl += '?'
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
uploadUrl += `&isPermanent=${props.isPermanent}&thumbSize=${props.thumbSize}`
|
|
61
|
-
|
|
62
|
-
uni.uploadFile({
|
|
63
|
-
url: uploadUrl,
|
|
64
|
-
header: {
|
|
65
|
-
accessToken: props.token,
|
|
66
|
-
authorization: `Bearer ${props.token}`
|
|
67
|
-
},
|
|
68
|
-
filePath: file.path,
|
|
69
|
-
name: 'file',
|
|
70
|
-
success: (res) => {
|
|
71
|
-
const data: UploadResponse = JSON.parse(res.data);
|
|
72
|
-
if (data.code !== 200) {
|
|
73
|
-
uni.showToast({
|
|
74
|
-
icon: "none",
|
|
75
|
-
title: data.message,
|
|
76
|
-
});
|
|
77
|
-
props.onError?.(file, data);
|
|
78
|
-
} else {
|
|
79
|
-
props.onSuccess?.(file, data);
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
fail: (err) => {
|
|
83
|
-
console.log(err);
|
|
84
|
-
props.onError?.(file, err);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// 暴露方法给父组件
|
|
90
|
-
// defineExpose({
|
|
91
|
-
// selectAndUpload
|
|
92
|
-
// });
|
|
93
|
-
</script>
|
|
94
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view @click="selectAndUpload()">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { ref } from 'vue'
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
maxCount?: number;
|
|
12
|
+
maxSize?: number;
|
|
13
|
+
sourceType?: string;
|
|
14
|
+
isPermanent?: boolean;
|
|
15
|
+
thumbSize?: number;
|
|
16
|
+
onBefore?: (file: any) => boolean;
|
|
17
|
+
onSuccess?: (file: any, data: any) => void;
|
|
18
|
+
onError?: (file: any, error: any) => void;
|
|
19
|
+
action: string;
|
|
20
|
+
token?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface UploadResponse {
|
|
24
|
+
code: number;
|
|
25
|
+
message: string;
|
|
26
|
+
data?: any;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
30
|
+
maxCount: 1,
|
|
31
|
+
maxSize: 5 * 1024 * 1024,
|
|
32
|
+
sourceType: 'album',
|
|
33
|
+
isPermanent: false,
|
|
34
|
+
thumbSize: 50
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const selectAndUpload = () => {
|
|
38
|
+
uni.chooseImage({
|
|
39
|
+
count: props.maxCount,
|
|
40
|
+
sourceType: [props.sourceType],
|
|
41
|
+
sizeType: ['original'],
|
|
42
|
+
success: (res: any) => {
|
|
43
|
+
res.tempFiles.forEach((file: any) => {
|
|
44
|
+
if (!props.onBefore || props.onBefore(file)) {
|
|
45
|
+
// 调用上传图片的接口
|
|
46
|
+
uploadImage(file);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const uploadImage = (file: any) => {
|
|
54
|
+
let uploadUrl = props.action
|
|
55
|
+
|
|
56
|
+
if (uploadUrl.indexOf('?') === -1) {
|
|
57
|
+
uploadUrl += '?'
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
uploadUrl += `&isPermanent=${props.isPermanent}&thumbSize=${props.thumbSize}`
|
|
61
|
+
|
|
62
|
+
uni.uploadFile({
|
|
63
|
+
url: uploadUrl,
|
|
64
|
+
header: {
|
|
65
|
+
accessToken: props.token,
|
|
66
|
+
authorization: `Bearer ${props.token}`
|
|
67
|
+
},
|
|
68
|
+
filePath: file.path,
|
|
69
|
+
name: 'file',
|
|
70
|
+
success: (res) => {
|
|
71
|
+
const data: UploadResponse = JSON.parse(res.data);
|
|
72
|
+
if (data.code !== 200) {
|
|
73
|
+
uni.showToast({
|
|
74
|
+
icon: "none",
|
|
75
|
+
title: data.message,
|
|
76
|
+
});
|
|
77
|
+
props.onError?.(file, data);
|
|
78
|
+
} else {
|
|
79
|
+
props.onSuccess?.(file, data);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
fail: (err) => {
|
|
83
|
+
console.log(err);
|
|
84
|
+
props.onError?.(file, err);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// 暴露方法给父组件
|
|
90
|
+
// defineExpose({
|
|
91
|
+
// selectAndUpload
|
|
92
|
+
// });
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
95
|
<style></style>
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="loading" :style="loadingStyle">
|
|
3
|
-
<view class="rotate iconfont icon-loading" :style="icontStyle"></view>
|
|
4
|
-
<slot></slot>
|
|
5
|
-
</view>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script setup lang="ts">
|
|
9
|
-
import { computed } from 'vue'
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
size?: number;
|
|
13
|
-
iconColor?: string;
|
|
14
|
-
mask?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
18
|
-
size: 100,
|
|
19
|
-
iconColor: '',
|
|
20
|
-
mask: true
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const icontStyle = computed(() => {
|
|
24
|
-
let style = `font-size:${props.size}rpx;`;
|
|
25
|
-
if (props.iconColor) {
|
|
26
|
-
style += `color: ${props.iconColor};`;
|
|
27
|
-
} else if (props.mask) {
|
|
28
|
-
style += 'color: #eee;';
|
|
29
|
-
}
|
|
30
|
-
return style;
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const loadingStyle = computed(() => {
|
|
34
|
-
return props.mask ? "background: rgba(0, 0, 0, 0.3);" : "";
|
|
35
|
-
});
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
<style lang="scss" scoped>
|
|
39
|
-
.loading {
|
|
40
|
-
width: 100%;
|
|
41
|
-
height: 100%;
|
|
42
|
-
position: absolute;
|
|
43
|
-
left: 0;
|
|
44
|
-
top: 0;
|
|
45
|
-
z-index: 10000;
|
|
46
|
-
display: flex;
|
|
47
|
-
justify-content: center;
|
|
48
|
-
align-items: center;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.rotate {
|
|
52
|
-
animation: rotate 2s ease-in-out infinite;
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@keyframes rotate {
|
|
57
|
-
from {
|
|
58
|
-
transform: rotate(0deg)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
to {
|
|
62
|
-
transform: rotate(360deg)
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<view class="loading" :style="loadingStyle">
|
|
3
|
+
<view class="rotate iconfont icon-loading" :style="icontStyle"></view>
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { computed } from 'vue'
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
size?: number;
|
|
13
|
+
iconColor?: string;
|
|
14
|
+
mask?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
18
|
+
size: 100,
|
|
19
|
+
iconColor: '',
|
|
20
|
+
mask: true
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const icontStyle = computed(() => {
|
|
24
|
+
let style = `font-size:${props.size}rpx;`;
|
|
25
|
+
if (props.iconColor) {
|
|
26
|
+
style += `color: ${props.iconColor};`;
|
|
27
|
+
} else if (props.mask) {
|
|
28
|
+
style += 'color: #eee;';
|
|
29
|
+
}
|
|
30
|
+
return style;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const loadingStyle = computed(() => {
|
|
34
|
+
return props.mask ? "background: rgba(0, 0, 0, 0.3);" : "";
|
|
35
|
+
});
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<style lang="scss" scoped>
|
|
39
|
+
.loading {
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
position: absolute;
|
|
43
|
+
left: 0;
|
|
44
|
+
top: 0;
|
|
45
|
+
z-index: 10000;
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.rotate {
|
|
52
|
+
animation: rotate 2s ease-in-out infinite;
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@keyframes rotate {
|
|
57
|
+
from {
|
|
58
|
+
transform: rotate(0deg)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
to {
|
|
62
|
+
transform: rotate(360deg)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
65
|
</style>
|