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.
Files changed (40) hide show
  1. package/components/im-avatar/im-avatar.vue +121 -121
  2. package/components/im-button/im-button.vue +630 -626
  3. package/components/im-cell/im-cell.vue +10 -15
  4. package/components/im-cell-group/im-cell-group.vue +16 -16
  5. package/components/im-chat-item/im-chat-item.vue +213 -213
  6. package/components/im-context-menu/im-context-menu.vue +138 -138
  7. package/components/im-file-upload/im-file-upload.vue +309 -309
  8. package/components/im-friend-item/im-friend-item.vue +82 -75
  9. package/components/im-group-item/im-group-item.vue +62 -62
  10. package/components/im-group-member-selector/im-group-member-selector.vue +202 -202
  11. package/components/im-group-rtc-join/im-group-rtc-join.vue +112 -112
  12. package/components/im-image-upload/im-image-upload.vue +94 -94
  13. package/components/im-loading/im-loading.vue +64 -64
  14. package/components/im-mention-picker/im-mention-picker.vue +191 -191
  15. package/components/im-message-item/im-message-item.vue +555 -555
  16. package/components/im-nav-bar/im-nav-bar.vue +98 -98
  17. package/components/im-read-receipt/im-read-receipt.vue +174 -174
  18. package/components/im-virtual-list/im-virtual-list.vue +52 -51
  19. package/components/im-voice-input/im-voice-input.vue +305 -305
  20. package/libs/index.ts +2 -3
  21. package/package.json +58 -58
  22. package/styles/button.scss +1 -1
  23. package/theme.scss +61 -62
  24. package/types/components.d.ts +0 -1
  25. package/types/index.d.ts +94 -94
  26. package/types/libs/index.d.ts +206 -204
  27. package/types/utils/datetime.d.ts +9 -9
  28. package/types/utils/dom.d.ts +11 -11
  29. package/types/utils/emoji.d.ts +8 -8
  30. package/types/utils/enums.d.ts +73 -73
  31. package/types/utils/messageType.d.ts +35 -35
  32. package/types/utils/recorderApp.d.ts +9 -9
  33. package/types/utils/recorderH5.d.ts +9 -9
  34. package/types/utils/requester.d.ts +15 -15
  35. package/types/utils/url.d.ts +5 -5
  36. package/types/utils/useDynamicRefs.d.ts +9 -9
  37. package/types/utils/websocket.d.ts +34 -34
  38. package/utils/enums.js +1 -1
  39. package/components/im-virtual-scroller/im-virtual-scroller.vue +0 -54
  40. package/types/components/virtual-scroller.d.ts +0 -20
@@ -35,7 +35,7 @@
35
35
  <view class="im-cell__content">
36
36
  <view class="im-cell__title">
37
37
  <slot name="title">
38
- <text v-if="title" class="im-cell__title-text" :class="[`im-cell__title--${titleSize}`]">
38
+ <text v-if="title" class="im-cell__title-text" :class="[`im-cell__title-text--${titleSize}`]">
39
39
  {{ title }}
40
40
  </text>
41
41
  </slot>
@@ -349,25 +349,22 @@ const handleLongPress = (event: TouchEvent) => {
349
349
  }
350
350
 
351
351
  &__title {
352
- margin-bottom: 4rpx;
353
-
354
352
  &-text {
355
- font-size: 32rpx;
356
353
  color: #303133;
357
354
  overflow: hidden;
358
355
  text-overflow: ellipsis;
359
356
  white-space: nowrap;
360
357
 
361
358
  &--small {
362
- font-size: 28rpx;
359
+ font-size: $im-font-size-small;
363
360
  }
364
361
 
365
362
  &--medium {
366
- font-size: 32rpx;
363
+ font-size: $im-font-size;
367
364
  }
368
365
 
369
366
  &--large {
370
- font-size: 36rpx;
367
+ font-size: $im-font-size-large;
371
368
  }
372
369
  }
373
370
  }
@@ -381,15 +378,15 @@ const handleLongPress = (event: TouchEvent) => {
381
378
  white-space: nowrap;
382
379
 
383
380
  &--small {
384
- font-size: 20rpx;
381
+ font-size: $im-font-size-small;
385
382
  }
386
383
 
387
384
  &--medium {
388
- font-size: 24rpx;
385
+ font-size: $im-font-size;
389
386
  }
390
387
 
391
388
  &--large {
392
- font-size: 28rpx;
389
+ font-size: $im-font-size-large;
393
390
  }
394
391
  }
395
392
  }
@@ -406,7 +403,7 @@ const handleLongPress = (event: TouchEvent) => {
406
403
  margin-right: 8rpx;
407
404
 
408
405
  &-text {
409
- font-size: 28rpx;
406
+ font-size: $im-font-size;
410
407
  color: #606266;
411
408
  white-space: nowrap;
412
409
  }
@@ -423,7 +420,7 @@ const handleLongPress = (event: TouchEvent) => {
423
420
  }
424
421
 
425
422
  &-text {
426
- font-size: 20rpx;
423
+ font-size: $im-font-size-small;
427
424
  color: #67c23a;
428
425
  }
429
426
  }
@@ -434,8 +431,6 @@ const handleLongPress = (event: TouchEvent) => {
434
431
  &-dot {
435
432
  background-color: #fa3534;
436
433
  border-radius: 50%;
437
- // min-width: 32rpx;
438
- // height: 32rpx;
439
434
  display: flex;
440
435
  align-items: center;
441
436
  justify-content: center;
@@ -444,7 +439,7 @@ const handleLongPress = (event: TouchEvent) => {
444
439
 
445
440
  &-text {
446
441
  color: white;
447
- font-size: 16rpx;
442
+ font-size: $im-font-size-mini;
448
443
  font-weight: bold;
449
444
  }
450
445
  }
@@ -1,17 +1,17 @@
1
- <template>
2
- <view class="cell-group">
3
- <slot></slot>
4
- </view>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- defineOptions({
9
- name: "cell-group"
10
- });
11
- </script>
12
-
13
- <style lang="scss" scoped>
14
- .cell-group {
15
- margin-bottom: 20rpx;
16
- }
1
+ <template>
2
+ <view class="cell-group">
3
+ <slot></slot>
4
+ </view>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ defineOptions({
9
+ name: "cell-group"
10
+ });
11
+ </script>
12
+
13
+ <style lang="scss" scoped>
14
+ .cell-group {
15
+ margin-bottom: 20rpx;
16
+ }
17
17
  </style>
@@ -1,214 +1,214 @@
1
- <template>
2
- <view class="chat-item" :class="active ? 'active' : ''">
3
- <!--rich-text中的表情包会屏蔽事件,所以这里用一个遮罩层捕获点击事件 -->
4
- <view class="mask" @tap="showChatBox()"></view>
5
- <view class="left">
6
- <im-avatar :url="chat.headImage" :name="chat.showName" :online="online" />
7
- </view>
8
- <view class="chat-right">
9
- <view class="chat-name">
10
- <view class="chat-name-text">
11
- <view>{{ chat.showName }}</view>
12
- </view>
13
- <view class="chat-time">{{ $datetime.toTimeText(chat.lastSendTime, true) }}</view>
14
- </view>
15
- <view class="chat-content">
16
- <view class="chat-at-text">{{ atText }}</view>
17
- <view class="chat-send-name" v-if="isShowSendName">{{ chat.sendNickName + ':&nbsp;' }}</view>
18
- <view v-if="!isTextMessage" class="chat-content-text">{{ chat.lastContent }}</view>
19
- <rich-text v-else class="chat-content-text" :nodes="nodesText"></rich-text>
20
- <view v-if="chat.isDnd" class="icon iconfont icon-dnd"></view>
21
- <u-badge v-else-if="chat.unreadCount > 0" :max="99" :value="chat.unreadCount" />
22
- </view>
23
- </view>
24
- </view>
25
- </template>
26
-
27
- <script setup lang="ts">
28
- import { computed } from 'vue'
29
- import ImAvatar from '../im-avatar/im-avatar.vue'
30
- import { datetime, dom, messageType, emoji } from '../../index'
31
- import { MESSAGE_TYPE } from '../../index'
32
-
33
- interface Props {
34
- chat?: any;
35
- index?: number;
36
- active?: boolean;
37
- online: boolean;
38
- }
39
-
40
- const $datetime = datetime
41
-
42
- const props = withDefaults(defineProps<Props>(), {
43
- active: false
44
- });
45
-
46
- interface Emits {
47
- (e: 'click', targetId: number): void
48
- }
49
-
50
- const emit = defineEmits<Emits>()
51
-
52
- const isShowSendName = computed(() => {
53
- if (!props.chat?.sendNickName) {
54
- return false;
55
- }
56
- const size = props.chat.messages.length;
57
- if (size === 0) {
58
- return false;
59
- }
60
- // 只有群聊的普通消息需要显示名称
61
- const lastMsg = props.chat.messages[size - 1];
62
- return messageType.isNormal(lastMsg.type);
63
- });
64
-
65
- const atText = computed(() => {
66
- if (props.chat?.atMe) {
67
- return "[有人@我]";
68
- } else if (props.chat?.atAll) {
69
- return "[@全体成员]";
70
- }
71
- return "";
72
- });
73
-
74
- const isTextMessage = computed(() => {
75
- if (!props.chat?.messages.length) {
76
- return false;
77
- }
78
- const idx = props.chat.messages.length - 1;
79
- const messageType = props.chat.messages[idx].type;
80
- return messageType === MESSAGE_TYPE.TEXT;
81
- });
82
-
83
- const nodesText = computed(() => {
84
- const text = dom.html2Escape(props.chat?.lastContent || '');
85
- return emoji.transform(text, 'emoji-small');
86
- });
87
-
88
- // TODO:组件化(换为props.online)
89
- // const online = computed(() => {
90
- // if (props.chat?.type === 'PRIVATE') {
91
- // const friend = useFriendStore().findFriend(props.chat.targetId);
92
- // return friend && friend.online;
93
- // }
94
- // return false;
95
- // });
96
-
97
-
98
- // 方法
99
-
100
- const showChatBox = () => {
101
- // TODO:组件化
102
- // 初始化期间进入会话会导致消息不刷新
103
- // if (!useConfigStore().appInit || useChatStore().loading) {
104
- // uni.showToast({
105
- // title: "正在初始化页面,请稍后...",
106
- // icon: 'none'
107
- // });
108
- // return;
109
- // }
110
- // uni.navigateTo({
111
- // url: "/pages-chat/pages/chat/chat-box?targetId=" + props.chat.targetId
112
- // });
113
-
114
- emit('click', props.chat.targetId)
115
- };
116
- </script>
117
-
118
- <style scoped lang="scss">
119
- .chat-item {
120
- height: 96rpx;
121
- display: flex;
122
- margin-bottom: 2rpx;
123
- position: relative;
124
- padding: 18rpx 20rpx;
125
- align-items: center;
126
- background-color: white;
127
- white-space: nowrap;
128
-
129
- &:hover {
130
- background-color: $im-bg-active;
131
- }
132
-
133
- &.active {
134
- background-color: $im-bg-active;
135
- }
136
-
137
- .mask {
138
- position: absolute;
139
- width: 100%;
140
- height: 100%;
141
- left: 0;
142
- right: 0;
143
- z-index: 99;
144
- }
145
-
146
- .left {
147
- position: relative;
148
- display: flex;
149
- justify-content: center;
150
- align-items: center;
151
- width: 100rpx;
152
- height: 100rpx;
153
- }
154
-
155
- .chat-right {
156
- height: 100%;
157
- flex: 1;
158
- display: flex;
159
- flex-direction: column;
160
- justify-content: center;
161
- padding-left: 20rpx;
162
- text-align: left;
163
- overflow: hidden;
164
-
165
- .chat-name {
166
- display: flex;
167
-
168
- .chat-name-text {
169
- flex: 1;
170
- font-size: $im-font-size-large;
171
- white-space: nowrap;
172
- overflow: hidden;
173
- display: flex;
174
- align-items: center;
175
- }
176
-
177
- .chat-time {
178
- font-size: $im-font-size-smaller-extra;
179
- color: $im-text-color-lighter;
180
- text-align: right;
181
- white-space: nowrap;
182
- overflow: hidden;
183
- }
184
- }
185
-
186
- .chat-content {
187
- display: flex;
188
- font-size: $im-font-size-smaller;
189
- color: $im-text-color-lighter;
190
- padding-top: 8rpx;
191
- align-items: center;
192
-
193
- .chat-at-text {
194
- color: $im-color-danger;
195
- }
196
-
197
- .chat-send-name {
198
- font-size: $im-font-size-smaller;
199
- }
200
-
201
- .chat-content-text {
202
- flex: 1;
203
- white-space: nowrap;
204
- overflow: hidden;
205
- text-overflow: ellipsis;
206
- }
207
-
208
- .icon {
209
- font-size: $im-font-size;
210
- }
211
- }
212
- }
213
- }
1
+ <template>
2
+ <view class="chat-item" :class="active ? 'active' : ''">
3
+ <!--rich-text中的表情包会屏蔽事件,所以这里用一个遮罩层捕获点击事件 -->
4
+ <view class="mask" @tap="showChatBox()"></view>
5
+ <view class="left">
6
+ <im-avatar :url="chat.headImage" :name="chat.showName" :online="online" />
7
+ </view>
8
+ <view class="chat-right">
9
+ <view class="chat-name">
10
+ <view class="chat-name-text">
11
+ <view>{{ chat.showName }}</view>
12
+ </view>
13
+ <view class="chat-time">{{ $datetime.toTimeText(chat.lastSendTime, true) }}</view>
14
+ </view>
15
+ <view class="chat-content">
16
+ <view class="chat-at-text">{{ atText }}</view>
17
+ <view class="chat-send-name" v-if="isShowSendName">{{ chat.sendNickName + ':&nbsp;' }}</view>
18
+ <view v-if="!isTextMessage" class="chat-content-text">{{ chat.lastContent }}</view>
19
+ <rich-text v-else class="chat-content-text" :nodes="nodesText"></rich-text>
20
+ <view v-if="chat.isDnd" class="icon iconfont icon-dnd"></view>
21
+ <u-badge v-else-if="chat.unreadCount > 0" :max="99" :value="chat.unreadCount" />
22
+ </view>
23
+ </view>
24
+ </view>
25
+ </template>
26
+
27
+ <script setup lang="ts">
28
+ import { computed } from 'vue'
29
+ import ImAvatar from '../im-avatar/im-avatar.vue'
30
+ import { datetime, dom, messageType, emoji } from '../../index'
31
+ import { MESSAGE_TYPE } from '../../index'
32
+
33
+ interface Props {
34
+ chat?: any;
35
+ index?: number;
36
+ active?: boolean;
37
+ online: boolean;
38
+ }
39
+
40
+ const $datetime = datetime
41
+
42
+ const props = withDefaults(defineProps<Props>(), {
43
+ active: false
44
+ });
45
+
46
+ interface Emits {
47
+ (e: 'click', targetId: number): void
48
+ }
49
+
50
+ const emit = defineEmits<Emits>()
51
+
52
+ const isShowSendName = computed(() => {
53
+ if (!props.chat?.sendNickName) {
54
+ return false;
55
+ }
56
+ const size = props.chat.messages.length;
57
+ if (size === 0) {
58
+ return false;
59
+ }
60
+ // 只有群聊的普通消息需要显示名称
61
+ const lastMsg = props.chat.messages[size - 1];
62
+ return messageType.isNormal(lastMsg.type);
63
+ });
64
+
65
+ const atText = computed(() => {
66
+ if (props.chat?.atMe) {
67
+ return "[有人@我]";
68
+ } else if (props.chat?.atAll) {
69
+ return "[@全体成员]";
70
+ }
71
+ return "";
72
+ });
73
+
74
+ const isTextMessage = computed(() => {
75
+ if (!props.chat?.messages.length) {
76
+ return false;
77
+ }
78
+ const idx = props.chat.messages.length - 1;
79
+ const messageType = props.chat.messages[idx].type;
80
+ return messageType === MESSAGE_TYPE.TEXT;
81
+ });
82
+
83
+ const nodesText = computed(() => {
84
+ const text = dom.html2Escape(props.chat?.lastContent || '');
85
+ return emoji.transform(text, 'emoji-small');
86
+ });
87
+
88
+ // TODO:组件化(换为props.online)
89
+ // const online = computed(() => {
90
+ // if (props.chat?.type === 'PRIVATE') {
91
+ // const friend = useFriendStore().findFriend(props.chat.targetId);
92
+ // return friend && friend.online;
93
+ // }
94
+ // return false;
95
+ // });
96
+
97
+
98
+ // 方法
99
+
100
+ const showChatBox = () => {
101
+ // TODO:组件化
102
+ // 初始化期间进入会话会导致消息不刷新
103
+ // if (!useConfigStore().appInit || useChatStore().loading) {
104
+ // uni.showToast({
105
+ // title: "正在初始化页面,请稍后...",
106
+ // icon: 'none'
107
+ // });
108
+ // return;
109
+ // }
110
+ // uni.navigateTo({
111
+ // url: "/pages-chat/pages/chat/chat-box?targetId=" + props.chat.targetId
112
+ // });
113
+
114
+ emit('click', props.chat.targetId)
115
+ };
116
+ </script>
117
+
118
+ <style scoped lang="scss">
119
+ .chat-item {
120
+ height: 96rpx;
121
+ display: flex;
122
+ margin-bottom: 2rpx;
123
+ position: relative;
124
+ padding: 18rpx 20rpx;
125
+ align-items: center;
126
+ background-color: white;
127
+ white-space: nowrap;
128
+
129
+ &:hover {
130
+ background-color: $im-bg-active;
131
+ }
132
+
133
+ &.active {
134
+ background-color: $im-bg-active;
135
+ }
136
+
137
+ .mask {
138
+ position: absolute;
139
+ width: 100%;
140
+ height: 100%;
141
+ left: 0;
142
+ right: 0;
143
+ z-index: 99;
144
+ }
145
+
146
+ .left {
147
+ position: relative;
148
+ display: flex;
149
+ justify-content: center;
150
+ align-items: center;
151
+ width: 100rpx;
152
+ height: 100rpx;
153
+ }
154
+
155
+ .chat-right {
156
+ height: 100%;
157
+ flex: 1;
158
+ display: flex;
159
+ flex-direction: column;
160
+ justify-content: center;
161
+ padding-left: 20rpx;
162
+ text-align: left;
163
+ overflow: hidden;
164
+
165
+ .chat-name {
166
+ display: flex;
167
+
168
+ .chat-name-text {
169
+ flex: 1;
170
+ font-size: $im-font-size-large;
171
+ white-space: nowrap;
172
+ overflow: hidden;
173
+ display: flex;
174
+ align-items: center;
175
+ }
176
+
177
+ .chat-time {
178
+ font-size: $im-font-size-mini;
179
+ color: $im-text-color-lighter;
180
+ text-align: right;
181
+ white-space: nowrap;
182
+ overflow: hidden;
183
+ }
184
+ }
185
+
186
+ .chat-content {
187
+ display: flex;
188
+ font-size: $im-font-size-small;
189
+ color: $im-text-color-lighter;
190
+ padding-top: 8rpx;
191
+ align-items: center;
192
+
193
+ .chat-at-text {
194
+ color: $im-color-danger;
195
+ }
196
+
197
+ .chat-send-name {
198
+ font-size: $im-font-size-small;
199
+ }
200
+
201
+ .chat-content-text {
202
+ flex: 1;
203
+ white-space: nowrap;
204
+ overflow: hidden;
205
+ text-overflow: ellipsis;
206
+ }
207
+
208
+ .icon {
209
+ font-size: $im-font-size;
210
+ }
211
+ }
212
+ }
213
+ }
214
214
  </style>