im-ui-mobile 0.1.0 → 0.1.2
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 +7 -7
- package/components/im-badge/im-badge.vue +326 -0
- package/components/im-button/im-button.vue +71 -34
- package/components/im-card/im-card.vue +563 -0
- package/components/im-chat-item/im-chat-item.vue +5 -4
- package/components/im-col/im-col.vue +191 -0
- package/components/im-dialog/im-dialog.vue +543 -0
- package/components/im-double-tap-view/im-double-tap-view.vue +93 -0
- package/components/im-emoji-picker/im-emoji-picker.vue +1143 -0
- package/components/im-friend-item/im-friend-item.vue +1 -1
- package/components/im-group-item/im-group-item.vue +1 -1
- package/components/im-group-member-selector/im-group-member-selector.vue +5 -5
- package/components/im-group-rtc-join/im-group-rtc-join.vue +8 -8
- package/components/im-icon/im-icon.vue +593 -0
- package/components/im-image-upload/im-image-upload.vue +0 -2
- package/components/im-link/im-link.vue +628 -0
- package/components/im-loading/im-loading.vue +13 -4
- package/components/im-mention-picker/im-mention-picker.vue +8 -7
- package/components/im-message-action/im-message-action.vue +678 -0
- package/components/im-message-item/im-message-item.vue +28 -26
- package/components/im-message-list/im-message-list.vue +1108 -0
- package/components/im-modal/im-modal.vue +373 -0
- package/components/im-nav-bar/im-nav-bar.vue +689 -75
- package/components/im-parse/im-parse.vue +1054 -0
- package/components/im-popup/im-popup.vue +467 -0
- package/components/im-read-receipt/im-read-receipt.vue +10 -10
- package/components/im-row/im-row.vue +189 -0
- package/components/im-search/im-search.vue +762 -0
- package/components/im-sku/im-sku.vue +720 -0
- package/components/im-sku/utils/helper.ts +182 -0
- package/components/im-stepper/im-stepper.vue +585 -0
- package/components/im-stepper/utils/helper.ts +167 -0
- package/components/im-tabs/im-tabs.vue +1022 -0
- package/components/im-tabs/tabs-navigation.vue +489 -0
- package/components/im-tabs/utils/helper.ts +181 -0
- package/components/im-tabs-tab-pane/im-tabs-tab-pane.vue +145 -0
- package/components/im-upload/im-upload.vue +1236 -0
- package/components/im-voice-input/im-voice-input.vue +1 -1
- package/index.js +3 -5
- package/index.scss +19 -0
- package/libs/emoji-data.ts +229 -0
- package/libs/index.ts +16 -16
- package/package.json +1 -2
- package/styles/button.scss +33 -33
- package/theme.scss +2 -2
- package/types/components/badge.d.ts +42 -0
- package/types/components/button.d.ts +2 -1
- package/types/components/card.d.ts +122 -0
- package/types/components/col.d.ts +37 -0
- package/types/components/dialog.d.ts +125 -0
- package/types/components/double-tap-view.d.ts +31 -0
- package/types/components/emoji-picker.d.ts +121 -0
- package/types/components/group-rtc-join.d.ts +1 -1
- package/types/components/icon.d.ts +77 -0
- package/types/components/link.d.ts +55 -0
- package/types/components/loading.d.ts +1 -0
- package/types/components/message-action.d.ts +96 -0
- package/types/components/message-item.d.ts +2 -2
- package/types/components/message-list.d.ts +136 -0
- package/types/components/modal.d.ts +106 -0
- package/types/components/nav-bar.d.ts +125 -0
- package/types/components/parse.d.ts +90 -0
- package/types/components/popup.d.ts +58 -0
- package/types/components/row.d.ts +31 -0
- package/types/components/search.d.ts +54 -0
- package/types/components/sku.d.ts +195 -0
- package/types/components/stepper.d.ts +99 -0
- package/types/components/tabs-tab-pane.d.ts +27 -0
- package/types/components/tabs.d.ts +117 -0
- package/types/components/upload.d.ts +137 -0
- package/types/components.d.ts +19 -1
- package/types/index.d.ts +38 -1
- package/types/libs/index.d.ts +10 -10
- package/types/utils/base64.d.ts +5 -0
- package/types/utils/dom.d.ts +3 -0
- package/types/utils/enums.d.ts +4 -5
- package/types/utils/validator.d.ts +74 -0
- package/utils/base64.js +18 -0
- package/utils/dom.js +353 -1
- package/utils/enums.js +4 -5
- package/utils/validator.js +230 -0
- package/components/im-file-upload/im-file-upload.vue +0 -309
- package/plugins/uview-plus.js +0 -29
- package/types/components/arrow-bar.d.ts +0 -14
- package/types/components/file-upload.d.ts +0 -58
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="im-card" :class="[
|
|
3
|
+
`im-card--${size}`,
|
|
4
|
+
`im-card--shadow--${shadow}`,
|
|
5
|
+
`im-card--${border}`,
|
|
6
|
+
{
|
|
7
|
+
'im-card--hoverable': hoverable,
|
|
8
|
+
'im-card--disabled': disabled,
|
|
9
|
+
'im-card--loading': loading,
|
|
10
|
+
'im-card--full': full
|
|
11
|
+
}
|
|
12
|
+
]" :style="cardStyle" @click="handleClick" @longpress="handleLongPress">
|
|
13
|
+
<!-- 加载状态 -->
|
|
14
|
+
<view v-if="loading" class="im-card__loading">
|
|
15
|
+
<im-icon :name="loadingIcon" spin />
|
|
16
|
+
<text v-if="loadingText" class="im-card__loading-text">{{ loadingText }}</text>
|
|
17
|
+
</view>
|
|
18
|
+
|
|
19
|
+
<!-- 角标 -->
|
|
20
|
+
<view v-if="badge || badgeContent" class="im-card__badge" :class="`im-card__badge--${badgePosition}`">
|
|
21
|
+
<im-badge v-if="badgeContent" :value="badgeContent" :type="badgeType" :max="badgeMax" :dot="badgeDot"
|
|
22
|
+
:custom-style="badgeStyle" />
|
|
23
|
+
</view>
|
|
24
|
+
|
|
25
|
+
<!-- 自定义顶部内容 -->
|
|
26
|
+
<slot v-if="$slots.header" name="header"></slot>
|
|
27
|
+
|
|
28
|
+
<!-- 默认顶部区域 -->
|
|
29
|
+
<view v-else-if="title || subtitle || $slots.title" class="im-card__header">
|
|
30
|
+
<view class="im-card__header-content">
|
|
31
|
+
<!-- 标题图标 -->
|
|
32
|
+
<im-icon v-if="titleIcon" :name="titleIcon" :size="titleIconSize" :color="titleIconColor"
|
|
33
|
+
class="im-card__title-icon" />
|
|
34
|
+
|
|
35
|
+
<!-- 标题 -->
|
|
36
|
+
<view class="im-card__title-wrapper">
|
|
37
|
+
<text v-if="title" class="im-card__title" :style="titleStyle">{{ title }}</text>
|
|
38
|
+
<slot v-else name="title"></slot>
|
|
39
|
+
|
|
40
|
+
<text v-if="subtitle" class="im-card__subtitle" :style="subtitleStyle">{{ subtitle }}</text>
|
|
41
|
+
</view>
|
|
42
|
+
|
|
43
|
+
<!-- 右侧操作区域 -->
|
|
44
|
+
<view v-if="extra || $slots.extra" class="im-card__extra">
|
|
45
|
+
<slot v-if="$slots.extra" name="extra"></slot>
|
|
46
|
+
<text v-else class="im-card__extra-text">{{ extra }}</text>
|
|
47
|
+
</view>
|
|
48
|
+
</view>
|
|
49
|
+
|
|
50
|
+
<!-- 描述信息 -->
|
|
51
|
+
<text v-if="description" class="im-card__description" :style="descriptionStyle">{{ description }}</text>
|
|
52
|
+
</view>
|
|
53
|
+
|
|
54
|
+
<!-- 图片区域 -->
|
|
55
|
+
<view v-if="coverImage || $slots.cover" class="im-card__cover" @click="handleCoverClick">
|
|
56
|
+
<slot v-if="$slots.cover" name="cover"></slot>
|
|
57
|
+
<image v-else class="im-card__cover-image" :src="coverImage" :mode="coverMode" :lazy-load="lazyLoad"
|
|
58
|
+
:show-menu-by-longpress="showMenuByLongpress" @load="handleImageLoad" @error="handleImageError" />
|
|
59
|
+
|
|
60
|
+
<!-- 图片标签 -->
|
|
61
|
+
<view v-if="coverTag || $slots.coverTag" class="im-card__cover-tag">
|
|
62
|
+
<slot v-if="$slots.coverTag" name="coverTag"></slot>
|
|
63
|
+
<text v-else class="im-card__cover-tag-text">{{ coverTag }}</text>
|
|
64
|
+
</view>
|
|
65
|
+
</view>
|
|
66
|
+
|
|
67
|
+
<!-- 主体内容 -->
|
|
68
|
+
<view class="im-card__body">
|
|
69
|
+
<slot></slot>
|
|
70
|
+
</view>
|
|
71
|
+
|
|
72
|
+
<!-- 底部区域 -->
|
|
73
|
+
<view v-if="$slots.footer || footer || actions" class="im-card__footer">
|
|
74
|
+
<slot v-if="$slots.footer" name="footer"></slot>
|
|
75
|
+
|
|
76
|
+
<template v-else>
|
|
77
|
+
<!-- 底部文字 -->
|
|
78
|
+
<text v-if="footer" class="im-card__footer-text">{{ footer }}</text>
|
|
79
|
+
|
|
80
|
+
<!-- 底部操作按钮 -->
|
|
81
|
+
<view v-if="actions && actions.length > 0" class="im-card__actions">
|
|
82
|
+
<im-button v-for="(action, index) in actions" :key="index" :type="action.type" :size="actionSize"
|
|
83
|
+
:plain="action.plain" :disabled="action.disabled" :loading="action.loading"
|
|
84
|
+
@click="handleActionClick(action, index)">
|
|
85
|
+
{{ action.text }}
|
|
86
|
+
</im-button>
|
|
87
|
+
</view>
|
|
88
|
+
</template>
|
|
89
|
+
</view>
|
|
90
|
+
</view>
|
|
91
|
+
</template>
|
|
92
|
+
|
|
93
|
+
<script setup lang="ts">
|
|
94
|
+
import { computed } from 'vue'
|
|
95
|
+
import type { CSSProperties } from 'vue'
|
|
96
|
+
import ImIcon from '../im-icon/im-icon.vue'
|
|
97
|
+
import ImBadge from '../im-badge/im-badge.vue'
|
|
98
|
+
|
|
99
|
+
// 类型定义
|
|
100
|
+
interface CardAction {
|
|
101
|
+
text: string
|
|
102
|
+
type?: 'primary' | 'success' | 'warning' | 'danger' | 'default'
|
|
103
|
+
plain?: boolean
|
|
104
|
+
disabled?: boolean
|
|
105
|
+
loading?: boolean
|
|
106
|
+
data?: any
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Props 定义
|
|
110
|
+
interface Props {
|
|
111
|
+
// 基础属性
|
|
112
|
+
title?: string
|
|
113
|
+
subtitle?: string
|
|
114
|
+
description?: string
|
|
115
|
+
extra?: string
|
|
116
|
+
|
|
117
|
+
// 显示控制
|
|
118
|
+
size?: 'small' | 'medium' | 'large'
|
|
119
|
+
shadow?: 'none' | 'small' | 'medium' | 'large' | 'hover'
|
|
120
|
+
border?: 'none' | 'solid' | 'dashed'
|
|
121
|
+
full?: boolean
|
|
122
|
+
hoverable?: boolean
|
|
123
|
+
disabled?: boolean
|
|
124
|
+
|
|
125
|
+
// 加载状态
|
|
126
|
+
loading?: boolean
|
|
127
|
+
loadingText?: string
|
|
128
|
+
loadingIcon?: string
|
|
129
|
+
|
|
130
|
+
// 角标
|
|
131
|
+
badge?: string | number
|
|
132
|
+
badgeContent?: string | number
|
|
133
|
+
badgeType?: 'primary' | 'success' | 'warning' | 'danger' | 'info'
|
|
134
|
+
badgeMax?: number
|
|
135
|
+
badgeDot?: boolean
|
|
136
|
+
badgePosition?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'
|
|
137
|
+
badgeStyle?: CSSProperties
|
|
138
|
+
|
|
139
|
+
// 标题区域
|
|
140
|
+
titleIcon?: string
|
|
141
|
+
titleIconSize?: string | number
|
|
142
|
+
titleIconColor?: string
|
|
143
|
+
titleStyle?: CSSProperties
|
|
144
|
+
subtitleStyle?: CSSProperties
|
|
145
|
+
descriptionStyle?: CSSProperties
|
|
146
|
+
|
|
147
|
+
// 封面图片
|
|
148
|
+
coverImage?: string
|
|
149
|
+
coverMode?: 'scaleToFill' | 'aspectFit' | 'aspectFill' | 'widthFix' | 'heightFix'
|
|
150
|
+
coverTag?: string
|
|
151
|
+
lazyLoad?: boolean
|
|
152
|
+
showMenuByLongpress?: boolean
|
|
153
|
+
|
|
154
|
+
// 底部区域
|
|
155
|
+
footer?: string
|
|
156
|
+
actions?: CardAction[]
|
|
157
|
+
actionSize?: 'mini' | 'small' | 'medium' | 'large'
|
|
158
|
+
|
|
159
|
+
// 自定义样式
|
|
160
|
+
customStyle?: CSSProperties
|
|
161
|
+
radius?: string | number
|
|
162
|
+
padding?: string | number
|
|
163
|
+
margin?: string | number
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
167
|
+
size: 'medium',
|
|
168
|
+
shadow: 'medium',
|
|
169
|
+
border: 'solid',
|
|
170
|
+
loadingIcon: 'loading',
|
|
171
|
+
loadingText: '加载中...',
|
|
172
|
+
badgeType: 'danger',
|
|
173
|
+
badgePosition: 'top-right',
|
|
174
|
+
coverMode: 'aspectFill',
|
|
175
|
+
lazyLoad: true,
|
|
176
|
+
showMenuByLongpress: false,
|
|
177
|
+
actionSize: 'small'
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
// Emits 定义
|
|
181
|
+
const emit = defineEmits<{
|
|
182
|
+
click: [event: MouseEvent]
|
|
183
|
+
longpress: [event: TouchEvent]
|
|
184
|
+
'cover-click': [event: MouseEvent]
|
|
185
|
+
'action-click': [action: CardAction, index: number]
|
|
186
|
+
'image-load': [event: any]
|
|
187
|
+
'image-error': [event: any]
|
|
188
|
+
}>()
|
|
189
|
+
|
|
190
|
+
// 计算样式
|
|
191
|
+
const cardStyle = computed(() => {
|
|
192
|
+
const style: CSSProperties = {}
|
|
193
|
+
|
|
194
|
+
if (props.radius) {
|
|
195
|
+
style.borderRadius = typeof props.radius === 'number' ? `${props.radius}px` : props.radius
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (props.padding) {
|
|
199
|
+
style.padding = typeof props.padding === 'number' ? `${props.padding}px` : props.padding
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (props.margin) {
|
|
203
|
+
style.margin = typeof props.margin === 'number' ? `${props.margin}px` : props.margin
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (props.customStyle) {
|
|
207
|
+
Object.assign(style, props.customStyle)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return style
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
// 事件处理
|
|
214
|
+
const handleClick = (event: MouseEvent) => {
|
|
215
|
+
if (!props.disabled && !props.loading) {
|
|
216
|
+
emit('click', event)
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const handleLongPress = (event: TouchEvent) => {
|
|
221
|
+
if (!props.disabled && !props.loading) {
|
|
222
|
+
emit('longpress', event)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const handleCoverClick = (event: MouseEvent) => {
|
|
227
|
+
if (!props.disabled && !props.loading) {
|
|
228
|
+
emit('cover-click', event)
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const handleActionClick = (action: CardAction, index: number) => {
|
|
233
|
+
if (!props.disabled && !props.loading && !action.disabled) {
|
|
234
|
+
emit('action-click', action, index)
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const handleImageLoad = (event: any) => {
|
|
239
|
+
emit('image-load', event)
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const handleImageError = (event: any) => {
|
|
243
|
+
emit('image-error', event)
|
|
244
|
+
}
|
|
245
|
+
</script>
|
|
246
|
+
|
|
247
|
+
<style scoped lang="scss">
|
|
248
|
+
.im-card {
|
|
249
|
+
position: relative;
|
|
250
|
+
background-color: #ffffff;
|
|
251
|
+
border-radius: 12rpx;
|
|
252
|
+
overflow: hidden;
|
|
253
|
+
transition: all 0.3s ease;
|
|
254
|
+
box-sizing: border-box;
|
|
255
|
+
|
|
256
|
+
// 尺寸变体
|
|
257
|
+
&--small {
|
|
258
|
+
padding: 20rpx;
|
|
259
|
+
|
|
260
|
+
.im-card__header,
|
|
261
|
+
.im-card__body,
|
|
262
|
+
.im-card__footer {
|
|
263
|
+
padding: 12rpx 0;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
&--medium {
|
|
268
|
+
padding: 32rpx;
|
|
269
|
+
|
|
270
|
+
.im-card__header,
|
|
271
|
+
.im-card__body,
|
|
272
|
+
.im-card__footer {
|
|
273
|
+
padding: 16rpx 0;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
&--large {
|
|
278
|
+
padding: 40rpx;
|
|
279
|
+
|
|
280
|
+
.im-card__header,
|
|
281
|
+
.im-card__body,
|
|
282
|
+
.im-card__footer {
|
|
283
|
+
padding: 20rpx 0;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// 阴影变体
|
|
288
|
+
&--shadow {
|
|
289
|
+
&--none {
|
|
290
|
+
box-shadow: none !important;
|
|
291
|
+
border: 1rpx solid #e4e7ed;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
&--small {
|
|
295
|
+
box-shadow: 0 5rpx 10rpx rgba(0, 0, 0, 0.1) !important;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
&--medium {
|
|
299
|
+
box-shadow: 0 8rpx 18rpx rgba(0, 0, 0, 0.12);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
&--large {
|
|
303
|
+
box-shadow: 0 10rpx 24rpx rgba(0, 0, 0, 0.16);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
&--hover {
|
|
307
|
+
&:hover {
|
|
308
|
+
box-shadow: 0 10rpx 24rpx rgba(0, 0, 0, 0.16);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// 边框变体
|
|
314
|
+
&--solid {
|
|
315
|
+
border: 1rpx solid #e4e7ed;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
&--dashed {
|
|
319
|
+
border: 1rpx dashed #dcdfe6;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
&--none {
|
|
323
|
+
border: none;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// 状态类
|
|
327
|
+
&--hoverable {
|
|
328
|
+
cursor: pointer;
|
|
329
|
+
|
|
330
|
+
&:hover {
|
|
331
|
+
transform: translateY(-4rpx);
|
|
332
|
+
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.16);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
&--disabled {
|
|
337
|
+
opacity: 0.6;
|
|
338
|
+
cursor: not-allowed;
|
|
339
|
+
pointer-events: none;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
&--loading {
|
|
343
|
+
position: relative;
|
|
344
|
+
min-height: 200rpx;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
&--full {
|
|
348
|
+
width: 100%;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// 加载状态
|
|
353
|
+
.im-card__loading {
|
|
354
|
+
position: absolute;
|
|
355
|
+
top: 0;
|
|
356
|
+
left: 0;
|
|
357
|
+
right: 0;
|
|
358
|
+
bottom: 0;
|
|
359
|
+
display: flex;
|
|
360
|
+
align-items: center;
|
|
361
|
+
justify-content: center;
|
|
362
|
+
background-color: rgba(255, 255, 255, 0.9);
|
|
363
|
+
z-index: 10;
|
|
364
|
+
|
|
365
|
+
&-text {
|
|
366
|
+
font-size: 28rpx;
|
|
367
|
+
color: #909399;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// 角标
|
|
372
|
+
.im-card__badge {
|
|
373
|
+
position: absolute;
|
|
374
|
+
z-index: 2;
|
|
375
|
+
|
|
376
|
+
&--top-right {
|
|
377
|
+
top: -8rpx;
|
|
378
|
+
right: 30rpx;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
&--top-left {
|
|
382
|
+
top: -8rpx;
|
|
383
|
+
left: 30rpx;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
&--bottom-right {
|
|
387
|
+
bottom: 18rpx;
|
|
388
|
+
right: 30rpx;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
&--bottom-left {
|
|
392
|
+
bottom: 18rpx;
|
|
393
|
+
left: 30rpx;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// 头部区域
|
|
398
|
+
.im-card__header {
|
|
399
|
+
margin-bottom: 16rpx;
|
|
400
|
+
|
|
401
|
+
&-content {
|
|
402
|
+
display: flex;
|
|
403
|
+
align-items: center;
|
|
404
|
+
justify-content: space-between;
|
|
405
|
+
margin-bottom: 8rpx;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.im-card__title-wrapper {
|
|
410
|
+
flex: 1;
|
|
411
|
+
display: flex;
|
|
412
|
+
flex-direction: column;
|
|
413
|
+
min-width: 0; // 防止 flex 元素溢出
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.im-card__title {
|
|
417
|
+
font-size: 32rpx;
|
|
418
|
+
font-weight: 600;
|
|
419
|
+
color: #303133;
|
|
420
|
+
line-height: 1.4;
|
|
421
|
+
display: -webkit-box;
|
|
422
|
+
-webkit-line-clamp: 2;
|
|
423
|
+
-webkit-box-orient: vertical;
|
|
424
|
+
overflow: hidden;
|
|
425
|
+
text-overflow: ellipsis;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.im-card__subtitle {
|
|
429
|
+
font-size: 26rpx;
|
|
430
|
+
color: #909399;
|
|
431
|
+
margin-top: 4rpx;
|
|
432
|
+
line-height: 1.3;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.im-card__title-icon {
|
|
436
|
+
margin-right: 12rpx;
|
|
437
|
+
flex-shrink: 0;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.im-card__extra {
|
|
441
|
+
margin-left: 16rpx;
|
|
442
|
+
flex-shrink: 0;
|
|
443
|
+
|
|
444
|
+
&-text {
|
|
445
|
+
font-size: 26rpx;
|
|
446
|
+
color: #409eff;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.im-card__description {
|
|
451
|
+
font-size: 26rpx;
|
|
452
|
+
color: #606266;
|
|
453
|
+
line-height: 1.5;
|
|
454
|
+
display: -webkit-box;
|
|
455
|
+
-webkit-line-clamp: 3;
|
|
456
|
+
-webkit-box-orient: vertical;
|
|
457
|
+
overflow: hidden;
|
|
458
|
+
text-overflow: ellipsis;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// 封面区域
|
|
462
|
+
.im-card__cover {
|
|
463
|
+
position: relative;
|
|
464
|
+
margin: -32rpx -32rpx 24rpx;
|
|
465
|
+
overflow: hidden;
|
|
466
|
+
border-radius: 12rpx 12rpx 0 0;
|
|
467
|
+
|
|
468
|
+
.im-card--small & {
|
|
469
|
+
margin: -20rpx -20rpx 16rpx;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.im-card--large & {
|
|
473
|
+
margin: -40rpx -40rpx 28rpx;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.im-card__cover-image {
|
|
478
|
+
width: 100%;
|
|
479
|
+
display: block;
|
|
480
|
+
background-color: #f5f7fa;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.im-card__cover-tag {
|
|
484
|
+
position: absolute;
|
|
485
|
+
top: 16rpx;
|
|
486
|
+
left: 16rpx;
|
|
487
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
488
|
+
color: #ffffff;
|
|
489
|
+
padding: 4rpx 12rpx;
|
|
490
|
+
border-radius: 4rpx;
|
|
491
|
+
font-size: 22rpx;
|
|
492
|
+
z-index: 1;
|
|
493
|
+
|
|
494
|
+
&-text {
|
|
495
|
+
font-size: 22rpx;
|
|
496
|
+
color: #ffffff;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// 主体内容
|
|
501
|
+
.im-card__body {
|
|
502
|
+
color: #606266;
|
|
503
|
+
line-height: 1.6;
|
|
504
|
+
font-size: 28rpx;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// 底部区域
|
|
508
|
+
.im-card__footer {
|
|
509
|
+
margin-top: 16rpx;
|
|
510
|
+
padding-top: 16rpx;
|
|
511
|
+
border-top: 1rpx solid #f0f0f0;
|
|
512
|
+
|
|
513
|
+
&-text {
|
|
514
|
+
font-size: 26rpx;
|
|
515
|
+
color: #909399;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.im-card__actions {
|
|
520
|
+
display: flex;
|
|
521
|
+
justify-content: flex-end;
|
|
522
|
+
gap: 16rpx;
|
|
523
|
+
flex-wrap: wrap;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// 暗色模式适配
|
|
527
|
+
@media (prefers-color-scheme: dark) {
|
|
528
|
+
.im-card {
|
|
529
|
+
background-color: #1a1a1a;
|
|
530
|
+
border-color: #333;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.im-card__title {
|
|
534
|
+
color: #ffffff;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.im-card__subtitle,
|
|
538
|
+
.im-card__description,
|
|
539
|
+
.im-card__footer-text {
|
|
540
|
+
color: #aaaaaa;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.im-card__extra-text {
|
|
544
|
+
color: #66b1ff;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.im-card__body {
|
|
548
|
+
color: #cccccc;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
.im-card__footer {
|
|
552
|
+
border-top-color: #333;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.im-card__loading {
|
|
556
|
+
background-color: rgba(26, 26, 26, 0.9);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
.im-card__cover-image {
|
|
560
|
+
background-color: #2a2a2a;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
</style>
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
<!--rich-text中的表情包会屏蔽事件,所以这里用一个遮罩层捕获点击事件 -->
|
|
4
4
|
<view class="mask" @tap="showChatBox()"></view>
|
|
5
5
|
<view class="left">
|
|
6
|
-
<im-avatar :url="chat.
|
|
6
|
+
<im-avatar :url="chat.avatar" :title="chat.displayName" :online="online" />
|
|
7
7
|
</view>
|
|
8
8
|
<view class="chat-right">
|
|
9
9
|
<view class="chat-name">
|
|
10
10
|
<view class="chat-name-text">
|
|
11
|
-
<view>{{ chat.
|
|
11
|
+
<view>{{ chat.displayName }}</view>
|
|
12
12
|
</view>
|
|
13
13
|
<view class="chat-time">{{ $datetime.toTimeText(chat.lastSendTime, true) }}</view>
|
|
14
14
|
</view>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<view v-if="!isTextMessage" class="chat-content-text">{{ chat.lastContent }}</view>
|
|
19
19
|
<rich-text v-else class="chat-content-text" :nodes="nodesText"></rich-text>
|
|
20
20
|
<view v-if="chat.isDnd" class="icon iconfont icon-dnd"></view>
|
|
21
|
-
<
|
|
21
|
+
<im-badge v-if="chat.unreadCount > 0" size="small" :max="99" :value="chat.unreadCount" />
|
|
22
22
|
</view>
|
|
23
23
|
</view>
|
|
24
24
|
</view>
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
<script setup lang="ts">
|
|
28
28
|
import { computed } from 'vue'
|
|
29
29
|
import ImAvatar from '../im-avatar/im-avatar.vue'
|
|
30
|
+
import ImBadge from '../im-badge/im-badge.vue'
|
|
30
31
|
import { datetime, dom, messageType, emoji } from '../../index'
|
|
31
32
|
import { MESSAGE_TYPE } from '../../index'
|
|
32
33
|
|
|
@@ -199,7 +200,7 @@ const showChatBox = () => {
|
|
|
199
200
|
}
|
|
200
201
|
|
|
201
202
|
.chat-content-text {
|
|
202
|
-
flex:
|
|
203
|
+
flex: 0.94;
|
|
203
204
|
white-space: nowrap;
|
|
204
205
|
overflow: hidden;
|
|
205
206
|
text-overflow: ellipsis;
|