im-ui-mobile 0.0.82 → 0.0.84
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/LICENSE +21 -0
- package/components/{im-head-image/im-head-image.vue → im-avatar/im-avatar.vue} +2 -2
- package/components/im-button/im-button.vue +603 -38
- package/components/im-cell/im-cell.vue +462 -0
- package/components/{im-bar-group/im-bar-group.vue → im-cell-group/im-cell-group.vue} +4 -4
- package/components/im-cell-switch/im-cell-switch.vue +223 -0
- package/components/im-chat-item/im-chat-item.vue +4 -5
- package/components/{im-long-press-menu/im-long-press-menu.vue → im-context-menu/im-context-menu.vue} +2 -2
- package/components/im-file-upload/im-file-upload.vue +9 -2
- package/components/im-friend-item/im-friend-item.vue +2 -2
- package/components/im-group-item/im-group-item.vue +2 -2
- package/components/im-group-member-selector/im-group-member-selector.vue +3 -3
- package/components/im-group-rtc-join/im-group-rtc-join.vue +3 -3
- package/components/im-image-upload/im-image-upload.vue +3 -2
- package/components/{im-chat-at-box/im-chat-at-box.vue → im-mention-picker/im-mention-picker.vue} +5 -5
- package/components/{im-chat-message-item/im-chat-message-item.vue → im-message-item/im-message-item.vue} +19 -21
- package/components/{im-chat-group-readed/im-chat-group-readed.vue → im-read-receipt/im-read-receipt.vue} +5 -5
- package/components/im-virtual-list/im-virtual-list.vue +444 -0
- package/components/{im-chat-record/im-chat-record.vue → im-voice-input/im-voice-input.vue} +11 -11
- package/index.js +7 -13
- package/package.json +4 -4
- package/types/components/{head-image.d.ts → avatar.d.ts} +4 -4
- package/types/components/button.d.ts +73 -3
- package/types/components/{bar-group.d.ts → cell-group.d.ts} +4 -4
- package/types/components/cell-switch.d.ts +31 -0
- package/types/components/cell.d.ts +46 -0
- package/types/components/context-menu.d.ts +23 -0
- package/types/components/{chat-at-box.d.ts → mention-picker.d.ts} +6 -6
- package/types/components/{chat-message-item.d.ts → message-item.d.ts} +6 -6
- package/types/components/{chat-group-readed.d.ts → read-receipt.d.ts} +6 -6
- package/types/components/virtual-list.d.ts +148 -0
- package/types/components/{chat-record.d.ts → voice-input.d.ts} +4 -4
- package/types/components.d.ts +9 -10
- package/types/index.d.ts +4 -2
- package/utils/config.js +17 -0
- package/utils/datetime.js +1 -1
- package/utils/emoji.js +9 -4
- package/components/im-arrow-bar/im-arrow-bar.vue +0 -59
- package/components/im-sample/im-sample.vue +0 -192
- package/components/im-switch-bar/im-switch-bar.vue +0 -62
- package/types/components/long-press-menu.d.ts +0 -23
- package/types/components/switch-bar.d.ts +0 -19
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { AllowedComponentProps, VNodeProps } from '../common'
|
|
2
2
|
|
|
3
|
-
declare interface
|
|
3
|
+
declare interface CellGroupSlots {
|
|
4
4
|
default?: () => any
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
declare interface
|
|
7
|
+
declare interface _CellGroup {
|
|
8
8
|
new(): {
|
|
9
9
|
$props: AllowedComponentProps & VNodeProps
|
|
10
|
-
$slots:
|
|
10
|
+
$slots: CellGroupSlots
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const CellGroup: _CellGroup
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AllowedComponentProps, VNodeProps } from 'vue'
|
|
2
|
+
import { ImCellProps } from './im-cell'
|
|
3
|
+
|
|
4
|
+
export interface ImCellSwitchProps extends Omit<ImCellProps, 'arrow'> {
|
|
5
|
+
// 必须的属性
|
|
6
|
+
checked?: boolean
|
|
7
|
+
|
|
8
|
+
// Switch 特有属性
|
|
9
|
+
switchDisabled?: boolean
|
|
10
|
+
switchColor?: string
|
|
11
|
+
switchBackgroundColor?: string
|
|
12
|
+
loading?: boolean
|
|
13
|
+
async?: boolean
|
|
14
|
+
beforeChange?: (newValue: boolean) => Promise<boolean> | boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ImCellSwitchEmits {
|
|
18
|
+
(e: 'update:checked', value: boolean): void
|
|
19
|
+
(e: 'change', value: boolean): void
|
|
20
|
+
(e: 'click', event: TouchEvent): void
|
|
21
|
+
(e: 'longpress', event: TouchEvent): void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare interface _ImCellSwitch {
|
|
25
|
+
new(): {
|
|
26
|
+
$props: AllowedComponentProps & VNodeProps & ImCellSwitchProps
|
|
27
|
+
$emit: ImCellSwitchEmits
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare const ImCellSwitch: _ImCellSwitch
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AllowedComponentProps, VNodeProps } from 'vue'
|
|
2
|
+
|
|
3
|
+
declare interface CellProps {
|
|
4
|
+
// 基础属性
|
|
5
|
+
type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info'
|
|
6
|
+
size?: 'small' | 'medium' | 'large'
|
|
7
|
+
disabled?: boolean
|
|
8
|
+
border?: boolean
|
|
9
|
+
hover?: boolean
|
|
10
|
+
clickable?: boolean
|
|
11
|
+
|
|
12
|
+
// 左侧内容
|
|
13
|
+
icon?: string
|
|
14
|
+
iconPosition?: 'left' | 'right'
|
|
15
|
+
avatar?: string
|
|
16
|
+
title?: string
|
|
17
|
+
titleSize?: 'small' | 'medium' | 'large'
|
|
18
|
+
description?: string
|
|
19
|
+
descriptionSize?: 'small' | 'medium' | 'large'
|
|
20
|
+
|
|
21
|
+
// 右侧内容
|
|
22
|
+
value?: string
|
|
23
|
+
label?: string
|
|
24
|
+
badge?: boolean | number | string
|
|
25
|
+
arrow?: boolean
|
|
26
|
+
|
|
27
|
+
// 样式
|
|
28
|
+
padding?: string
|
|
29
|
+
margin?: string
|
|
30
|
+
bgColor?: string
|
|
31
|
+
textColor?: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare interface CellEvents {
|
|
35
|
+
onClick: (event: PointerEvent) => void
|
|
36
|
+
onLongpress: (event: TouchEvent) => void
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare interface _Cell {
|
|
40
|
+
new(): {
|
|
41
|
+
$props: AllowedComponentProps & VNodeProps & CellProps
|
|
42
|
+
$emit: CellEvents
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export declare const Cell: _Cell
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AllowedComponentProps, VNodeProps } from '../common'
|
|
2
|
+
|
|
3
|
+
declare interface ContextMenuProps {
|
|
4
|
+
items?: any[]
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare interface ContextMenuEmits {
|
|
8
|
+
(e: 'select', item: any): void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare interface ContextMenuSlots {
|
|
12
|
+
default?: () => any
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare interface _ContextMenu {
|
|
16
|
+
new(): {
|
|
17
|
+
$props: AllowedComponentProps & VNodeProps & ContextMenuProps
|
|
18
|
+
$emit: ContextMenuEmits
|
|
19
|
+
$slots: ContextMenuSlots
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare const ContextMenu: _ContextMenu
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { AllowedComponentProps, VNodeProps } from '../common'
|
|
2
2
|
import { GroupMember } from '../../libs'
|
|
3
3
|
|
|
4
|
-
declare interface
|
|
4
|
+
declare interface MentionPickerProps {
|
|
5
5
|
ownerId?: number
|
|
6
6
|
members?: any[]
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
declare interface
|
|
9
|
+
declare interface MentionPickerEmits {
|
|
10
10
|
(e: 'complete', userIds: number[]): void
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
declare interface
|
|
13
|
+
declare interface _MentionPicker {
|
|
14
14
|
new(): {
|
|
15
|
-
$props: AllowedComponentProps & VNodeProps &
|
|
16
|
-
$emit:
|
|
15
|
+
$props: AllowedComponentProps & VNodeProps & MentionPickerProps
|
|
16
|
+
$emit: MentionPickerEmits
|
|
17
17
|
}
|
|
18
18
|
init: (userId: number, atUserIds: number[]) => void
|
|
19
19
|
open: () => void
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export declare const
|
|
22
|
+
export declare const MentionPicker: _MentionPicker
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AllowedComponentProps, VNodeProps } from '../common'
|
|
2
2
|
|
|
3
|
-
declare interface
|
|
3
|
+
declare interface MessageItemProps {
|
|
4
4
|
avatar?: string
|
|
5
5
|
showName: string
|
|
6
6
|
msgInfo: any
|
|
7
7
|
groupMembers?: any[]
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
declare interface
|
|
10
|
+
declare interface MessageItemEmits {
|
|
11
11
|
(e: 'call'): void
|
|
12
12
|
(e: 'longPressHead'): void
|
|
13
13
|
(e: 'resend', msgInfo: any): void
|
|
@@ -18,11 +18,11 @@ declare interface ChatMessageItemEmits {
|
|
|
18
18
|
(e: 'download', msgInfo: any): void
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
declare interface
|
|
21
|
+
declare interface _MessageItem {
|
|
22
22
|
new(): {
|
|
23
|
-
$props: AllowedComponentProps & VNodeProps &
|
|
24
|
-
$emit:
|
|
23
|
+
$props: AllowedComponentProps & VNodeProps & MessageItemProps
|
|
24
|
+
$emit: MessageItemEmits
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export declare const
|
|
28
|
+
export declare const MessageItem: _MessageItem
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AllowedComponentProps, VNodeProps } from '../common'
|
|
2
2
|
import { Chat, Message } from '../../libs'
|
|
3
3
|
|
|
4
|
-
declare interface
|
|
4
|
+
declare interface ReadReceiptProps {
|
|
5
5
|
msgInfo: {
|
|
6
6
|
groupId: number
|
|
7
7
|
id: number
|
|
@@ -10,7 +10,7 @@ declare interface ChatGroupReadedProps {
|
|
|
10
10
|
groupMembers: any[]
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
declare interface
|
|
13
|
+
declare interface ReadReceiptEmits {
|
|
14
14
|
(e: 'loaded', chatInfo: Chat, msgInfo: Message): void
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -19,12 +19,12 @@ declare interface Member {
|
|
|
19
19
|
quit?: boolean
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
declare interface
|
|
22
|
+
declare interface _ReadReceipt {
|
|
23
23
|
new(): {
|
|
24
|
-
$props: AllowedComponentProps & VNodeProps &
|
|
25
|
-
$emit:
|
|
24
|
+
$props: AllowedComponentProps & VNodeProps & ReadReceiptProps
|
|
25
|
+
$emit: ReadReceiptEmits
|
|
26
26
|
}
|
|
27
27
|
open: (userIds: number[]) => void
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export declare const
|
|
30
|
+
export declare const ReadReceipt: _ReadReceipt
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { AllowedComponentProps, VNodeProps, ComponentCustomProps } from 'vue'
|
|
2
|
+
|
|
3
|
+
declare type LoadingStatus = 'loading' | 'no-more' | 'error' | 'idle'
|
|
4
|
+
declare type ScrollAlign = 'top' | 'center' | 'bottom'
|
|
5
|
+
|
|
6
|
+
declare interface ScrollToItemOptions {
|
|
7
|
+
align?: ScrollAlign
|
|
8
|
+
animated?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare interface VirtualListProps<T = any> {
|
|
12
|
+
// 数据相关
|
|
13
|
+
data?: T[]
|
|
14
|
+
keyField?: string
|
|
15
|
+
|
|
16
|
+
// 尺寸相关
|
|
17
|
+
estimatedItemSize?: number
|
|
18
|
+
buffer?: number
|
|
19
|
+
height?: string | number
|
|
20
|
+
|
|
21
|
+
// 滚动相关
|
|
22
|
+
lowerThreshold?: number
|
|
23
|
+
upperThreshold?: number
|
|
24
|
+
scrollTop?: number
|
|
25
|
+
|
|
26
|
+
// 加载相关
|
|
27
|
+
showTopLoading?: boolean
|
|
28
|
+
showBottomLoading?: boolean
|
|
29
|
+
topStatus?: LoadingStatus
|
|
30
|
+
bottomStatus?: LoadingStatus
|
|
31
|
+
|
|
32
|
+
// 功能相关
|
|
33
|
+
showBackToTop?: boolean
|
|
34
|
+
backToTopThreshold?: number
|
|
35
|
+
scrollIntoView?: string
|
|
36
|
+
keepScrollPosition?: boolean
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare interface VirtualListEmits<T = any> {
|
|
40
|
+
// 滚动事件
|
|
41
|
+
onScroll?: (event: any) => void
|
|
42
|
+
onScrollToLower?: () => void
|
|
43
|
+
onScrollToUpper?: () => void
|
|
44
|
+
|
|
45
|
+
// 加载事件
|
|
46
|
+
onTopLoad?: () => void
|
|
47
|
+
onBottomLoad?: () => void
|
|
48
|
+
|
|
49
|
+
// 项目事件
|
|
50
|
+
onItemClick?: (item: T, index: number) => void
|
|
51
|
+
onItemLongPress?: (item: T, index: number) => void
|
|
52
|
+
|
|
53
|
+
// 更新事件
|
|
54
|
+
'onUpdate:scrollIntoView'?: (value: string) => void
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare interface VirtualListSlots<T = any> {
|
|
58
|
+
default?: (props: {
|
|
59
|
+
item: T,
|
|
60
|
+
index: number
|
|
61
|
+
}) => any
|
|
62
|
+
|
|
63
|
+
topLoading?: (props: {
|
|
64
|
+
status: LoadingStatus
|
|
65
|
+
}) => any
|
|
66
|
+
|
|
67
|
+
bottomLoading?: (props: {
|
|
68
|
+
status: LoadingStatus
|
|
69
|
+
}) => any
|
|
70
|
+
|
|
71
|
+
backToTop?: () => any
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare interface VirtualListExposed<T = any> {
|
|
75
|
+
// 滚动控制
|
|
76
|
+
scrollToTop: () => void
|
|
77
|
+
scrollToBottom: () => void
|
|
78
|
+
scrollToItem: (index: number, options?: ScrollToItemOptions) => void
|
|
79
|
+
scrollToIndex: (index: number, options?: ScrollToItemOptions) => void
|
|
80
|
+
|
|
81
|
+
// 信息获取
|
|
82
|
+
getVisibleRange: () => { start: number, end: number }
|
|
83
|
+
getContainerHeight: () => number
|
|
84
|
+
getScrollTop: () => number
|
|
85
|
+
|
|
86
|
+
// 尺寸测量
|
|
87
|
+
measureContainer: () => void
|
|
88
|
+
getItemHeight: (item: T, index: number) => number
|
|
89
|
+
|
|
90
|
+
// 数据操作
|
|
91
|
+
updateData: (data: T[]) => void
|
|
92
|
+
appendData: (data: T[]) => void
|
|
93
|
+
prependData: (data: T[]) => void
|
|
94
|
+
clearData: () => void
|
|
95
|
+
|
|
96
|
+
// 状态控制
|
|
97
|
+
startLoading: (type: 'top' | 'bottom') => void
|
|
98
|
+
stopLoading: (type: 'top' | 'bottom') => void
|
|
99
|
+
setLoadingStatus: (type: 'top' | 'bottom', status: LoadingStatus) => void
|
|
100
|
+
refresh: () => void
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
declare interface _VirtualList {
|
|
104
|
+
new(): {
|
|
105
|
+
$props: AllowedComponentProps &
|
|
106
|
+
VNodeProps &
|
|
107
|
+
ComponentCustomProps &
|
|
108
|
+
VirtualListProps
|
|
109
|
+
|
|
110
|
+
$emit: VirtualListEmits
|
|
111
|
+
$slots: VirtualListSlots
|
|
112
|
+
|
|
113
|
+
// 暴露的方法
|
|
114
|
+
scrollToTop: VirtualListExposed['scrollToTop']
|
|
115
|
+
scrollToBottom: VirtualListExposed['scrollToBottom']
|
|
116
|
+
scrollToItem: VirtualListExposed['scrollToItem']
|
|
117
|
+
scrollToIndex: VirtualListExposed['scrollToIndex']
|
|
118
|
+
getVisibleRange: VirtualListExposed['getVisibleRange']
|
|
119
|
+
getContainerHeight: VirtualListExposed['getContainerHeight']
|
|
120
|
+
getScrollTop: VirtualListExposed['getScrollTop']
|
|
121
|
+
measureContainer: VirtualListExposed['measureContainer']
|
|
122
|
+
getItemHeight: VirtualListExposed['getItemHeight']
|
|
123
|
+
updateData: VirtualListExposed['updateData']
|
|
124
|
+
appendData: VirtualListExposed['appendData']
|
|
125
|
+
prependData: VirtualListExposed['prependData']
|
|
126
|
+
clearData: VirtualListExposed['clearData']
|
|
127
|
+
startLoading: VirtualListExposed['startLoading']
|
|
128
|
+
stopLoading: VirtualListExposed['stopLoading']
|
|
129
|
+
setLoadingStatus: VirtualListExposed['setLoadingStatus']
|
|
130
|
+
refresh: VirtualListExposed['refresh']
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export declare const VirtualList: _VirtualList
|
|
135
|
+
|
|
136
|
+
// 默认导出
|
|
137
|
+
export default VirtualList
|
|
138
|
+
|
|
139
|
+
// 类型导出
|
|
140
|
+
export {
|
|
141
|
+
type LoadingStatus,
|
|
142
|
+
type ScrollAlign,
|
|
143
|
+
type ScrollToItemOptions,
|
|
144
|
+
type VirtualListProps,
|
|
145
|
+
type VirtualListEmits,
|
|
146
|
+
type VirtualListSlots,
|
|
147
|
+
type VirtualListExposed
|
|
148
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { AllowedComponentProps, VNodeProps } from '../common'
|
|
2
2
|
|
|
3
|
-
declare interface
|
|
3
|
+
declare interface VoiceInputEmits {
|
|
4
4
|
(e: 'send', data: any): void
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
declare interface
|
|
7
|
+
declare interface _VoiceInput {
|
|
8
8
|
new(): {
|
|
9
9
|
$props: AllowedComponentProps & VNodeProps
|
|
10
|
-
$emit:
|
|
10
|
+
$emit: VoiceInputEmits
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const VoiceInput: _VoiceInput
|
package/types/components.d.ts
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
declare module 'vue' {
|
|
2
2
|
export interface GlobalComponents {
|
|
3
|
-
['im-
|
|
4
|
-
['im-
|
|
3
|
+
['im-cell']: typeof import('./components/cell')['Cell']
|
|
4
|
+
['im-cell-group']: typeof import('./components/cell-group')['CellGroup']
|
|
5
5
|
['im-button']: typeof import('./components/button')['Button']
|
|
6
|
-
['im-
|
|
7
|
-
['im-
|
|
6
|
+
['im-mention-picker']: typeof import('./components/mention-picker')['MentionPicker']
|
|
7
|
+
['im-read-receipt']: typeof import('./components/read-receipt')['ReadReceipt']
|
|
8
8
|
['im-chat-item']: typeof import('./components/chat-item')['ChatItem']
|
|
9
|
-
['im-
|
|
10
|
-
['im-
|
|
9
|
+
['im-message-item']: typeof import('./components/message-item')['MessageItem']
|
|
10
|
+
['im-voice-input']: typeof import('./components/voice-input')['VoiceInput']
|
|
11
11
|
['im-file-upload']: typeof import('./components/file-upload')['FileUpload']
|
|
12
12
|
['im-friend-item']: typeof import('./components/friend-item')['FriendItem']
|
|
13
13
|
['im-group-item']: typeof import('./components/group-item')['GroupItem']
|
|
14
14
|
['im-group-member-selector']: typeof import('./components/group-member-selector')['GroupMemberSelector']
|
|
15
15
|
['im-group-rtc-join']: typeof import('./components/group-rtc-join')['GroupRtcJoin']
|
|
16
|
-
['im-
|
|
16
|
+
['im-avatar']: typeof import('./components/avatar')['Avatar']
|
|
17
17
|
['im-loading']: typeof import('./components/loading')['Loading']
|
|
18
|
-
['im-
|
|
19
|
-
['im-sample']: typeof import('./components/sample')['Sample']
|
|
20
|
-
['im-switch-bar']: typeof import('./components/switch-bar')['SwitchBar']
|
|
18
|
+
['im-context-menu']: typeof import('./components/context-menu')['ContextMenu']
|
|
21
19
|
['im-virtual-scroller']: typeof import('./components/virtual-scroller')['VirtualScroller']
|
|
20
|
+
['im-virtual-list']: typeof import('./components/virtual-list')['VirtualList']
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
|
package/types/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { emoji } from "./utils/emoji.d.ts";
|
|
|
7
7
|
import { MESSAGE_TYPE, RTC_STATE, TERMINAL_TYPE, MESSAGE_STATUS } from "./utils/enums.d.ts";
|
|
8
8
|
import * as dom from "./utils/dom.d.ts";
|
|
9
9
|
import messageType from "./utils/messageType.d.ts";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
10
|
+
import RecorderApp from "./utils/recorderApp.d.ts";
|
|
11
|
+
import RecorderH5 from "./utils/recorderH5.d.ts";
|
|
12
12
|
import Requester from "./utils/requester.d.ts";
|
|
13
13
|
import * as url from "./utils/url.d.ts";
|
|
14
14
|
import { useDynamicRefs } from "./utils/useDynamicRefs.d.ts";
|
|
@@ -60,6 +60,8 @@ declare module 'im-ui-mobile' {
|
|
|
60
60
|
url,
|
|
61
61
|
useDynamicRefs,
|
|
62
62
|
WebSocket,
|
|
63
|
+
RecorderApp,
|
|
64
|
+
RecorderH5,
|
|
63
65
|
|
|
64
66
|
// 枚举类型
|
|
65
67
|
RTC_STATE,
|
package/utils/config.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
let _config = {}
|
|
2
|
+
|
|
3
|
+
// 配置管理器
|
|
4
|
+
export const configManager = {
|
|
5
|
+
setConfig(config) {
|
|
6
|
+
_config = { ..._config, ...config }
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
getConfig() {
|
|
10
|
+
return { ..._config }
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
get(key, defaultValue = undefined) {
|
|
14
|
+
return _config[key] ?? defaultValue
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
package/utils/datetime.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @param {boolean} simple - 是否使用简单格式
|
|
7
7
|
* @returns {string} 格式化后的时间文本
|
|
8
8
|
*/
|
|
9
|
-
const toTimeText = (timeStamp, simple) => {
|
|
9
|
+
const toTimeText = (timeStamp, simple = false) => {
|
|
10
10
|
const dateTime = new Date(timeStamp);
|
|
11
11
|
const currentTime = Date.now(); // 当前时间戳
|
|
12
12
|
const timeDiff = currentTime - dateTime.getTime(); // 与当前时间误差
|
package/utils/emoji.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { configManager } from './config.js'
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* 表情工具类
|
|
3
5
|
*/
|
|
@@ -25,6 +27,10 @@ class Emoji {
|
|
|
25
27
|
this.regex = /\#[\u4E00-\u9FA5]{1,3}\;/gi;
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
getEmojiUrl() {
|
|
31
|
+
return configManager.get('emojiUrl', 'url not found from awear.')
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
/**
|
|
29
35
|
* 检查内容是否包含表情符号
|
|
30
36
|
* @param {string} content - 要检查的文本内容
|
|
@@ -69,8 +75,7 @@ class Emoji {
|
|
|
69
75
|
if (idx === -1) {
|
|
70
76
|
return '';
|
|
71
77
|
}
|
|
72
|
-
|
|
73
|
-
return this.emojiUrl + idx + ".gif";
|
|
78
|
+
return this.getEmojiUrl() + idx + ".gif";
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
/**
|
|
@@ -79,13 +84,13 @@ class Emoji {
|
|
|
79
84
|
* @returns {string} 表情文本,格式如 "#开心;"
|
|
80
85
|
*/
|
|
81
86
|
pathToText(path) {
|
|
82
|
-
if (!path || !this.
|
|
87
|
+
if (!path || !this.getEmojiUrl() || !path.includes(this.getEmojiUrl())) {
|
|
83
88
|
return '';
|
|
84
89
|
}
|
|
85
90
|
|
|
86
91
|
try {
|
|
87
92
|
// 从路径中提取表情索引
|
|
88
|
-
const filename = path.replace(this.
|
|
93
|
+
const filename = path.replace(this.getEmojiUrl(), '').replace('.gif', '');
|
|
89
94
|
const index = parseInt(filename);
|
|
90
95
|
|
|
91
96
|
// 检查索引是否有效
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="arrow-bar">
|
|
3
|
-
<text class="icon iconfont" :class="icon" :style="{color: textColor}"></text>
|
|
4
|
-
<text class="title">{{ title }}</text>
|
|
5
|
-
<u-icon class="arrow" name="arrow-right" size="16"></u-icon>
|
|
6
|
-
</view>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script setup lang="ts">
|
|
10
|
-
import { computed, ref } from 'vue';
|
|
11
|
-
|
|
12
|
-
interface Props {
|
|
13
|
-
title: string;
|
|
14
|
-
icon?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
18
|
-
icon: ''
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const colors = ref([
|
|
22
|
-
"#5daa31", "#c7515a", "#e03697", "#85029b",
|
|
23
|
-
"#c9b455", "#326eb6"
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
|
-
const textColor = computed(() => {
|
|
27
|
-
let hash = 0;
|
|
28
|
-
for (let i = 0; i < props.title.length; i++) {
|
|
29
|
-
hash += props.title.charCodeAt(i);
|
|
30
|
-
}
|
|
31
|
-
return colors.value[hash % colors.value.length];
|
|
32
|
-
});
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
<style lang="scss" scoped>
|
|
36
|
-
.arrow-bar {
|
|
37
|
-
width: 100%;
|
|
38
|
-
height: 90rpx;
|
|
39
|
-
font-size: $im-font-size;
|
|
40
|
-
color: $im-text-color;
|
|
41
|
-
margin-top: 5rpx;
|
|
42
|
-
background-color: white;
|
|
43
|
-
line-height: 90rpx;
|
|
44
|
-
display: flex;
|
|
45
|
-
|
|
46
|
-
.icon {
|
|
47
|
-
margin-left: 40rpx;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.title {
|
|
51
|
-
flex: 1;
|
|
52
|
-
margin-left: 10rpx;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.arrow {
|
|
56
|
-
margin-right: 40rpx;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
</style>
|