File tree Expand file tree Collapse file tree 2 files changed +104
-0
lines changed
src/views/mall/promotion/kefu/components Expand file tree Collapse file tree 2 files changed +104
-0
lines changed Original file line number Diff line number Diff line change 55
55
<TextMessageItem :message =" item" />
56
56
<!-- 图片消息 -->
57
57
<ImageMessageItem :message =" item" />
58
+ <!-- 商品消息 -->
59
+ <ProductMessageItem :message =" item" />
58
60
</div >
59
61
<el-avatar
60
62
v-if =" item.senderType === UserTypeEnum.ADMIN"
@@ -101,6 +103,7 @@ import EmojiSelectPopover from './tools/EmojiSelectPopover.vue'
101
103
import PictureSelectUpload from ' ./tools/PictureSelectUpload.vue'
102
104
import TextMessageItem from ' ./message/TextMessageItem.vue'
103
105
import ImageMessageItem from ' ./message/ImageMessageItem.vue'
106
+ import ProductMessageItem from ' ./message/ProductMessageItem.vue'
104
107
import { Emoji } from ' ./tools/emoji'
105
108
import { KeFuMessageContentTypeEnum } from ' ./tools/constants'
106
109
import { isEmpty } from ' @/utils/is'
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <!-- 图片消息 -->
3
+ <template v-if =" KeFuMessageContentTypeEnum .PRODUCT === message .contentType " >
4
+ <div
5
+ :class =" [
6
+ message.senderType === UserTypeEnum.MEMBER
7
+ ? `ml-10px`
8
+ : message.senderType === UserTypeEnum.ADMIN
9
+ ? `mr-10px`
10
+ : ''
11
+ ]"
12
+ >
13
+ <div class =" goods flex items-center" >
14
+ <el-image
15
+ :src =" getMessageContent.picUrl"
16
+ class =" image"
17
+ fit =" contain"
18
+ @click =" imagePreview(getMessageContent.picUrl)"
19
+ />
20
+ <view class =" flex-1" >
21
+ <view class =" title ss-line-2" >
22
+ {{ getMessageContent.spuName }}
23
+ </view >
24
+ <view v-if =" getMessageContent.introduction" class =" subtitle ss-line-1" >
25
+ {{ getMessageContent.introduction }}
26
+ </view >
27
+ <view class =" price mt-8px" > ¥{{ getMessageContent.price }}</view >
28
+ </view >
29
+ </div >
30
+ </div >
31
+ </template >
32
+ </template >
33
+
34
+ <script lang="ts" setup>
35
+ import { KeFuMessageContentTypeEnum } from ' ../tools/constants'
36
+ import { UserTypeEnum } from ' @/utils/constants'
37
+ import { KeFuMessageRespVO } from ' @/api/mall/promotion/kefu/message'
38
+ import { createImageViewer } from ' @/components/ImageViewer'
39
+
40
+ defineOptions ({ name: ' ImageMessageItem' })
41
+ const props = defineProps <{
42
+ message: KeFuMessageRespVO
43
+ }>()
44
+ const getMessageContent = computed (() => JSON .parse (props .message .content ))
45
+ /** 图预览 */
46
+ const imagePreview = (imgUrl : string ) => {
47
+ createImageViewer ({
48
+ urlList: [imgUrl ]
49
+ })
50
+ }
51
+ </script >
52
+ <style lang="scss" scoped>
53
+ .goods {
54
+ padding : 20px ;
55
+ border-radius : 12px ;
56
+ background-color : #e1e1e1 ;
57
+
58
+ .ss-line {
59
+ min-width : 0 ;
60
+ overflow : hidden ;
61
+ text-overflow : ellipsis ;
62
+ display : -webkit-box ;
63
+ -webkit-box-orient : vertical ;
64
+
65
+ & -1 {
66
+ -webkit-line-clamp : 1 ;
67
+ }
68
+
69
+ & -2 {
70
+ -webkit-line-clamp : 2 ;
71
+ }
72
+ }
73
+
74
+ .image {
75
+ width : 116px ;
76
+ height : 116px ;
77
+ flex-shrink : 0 ;
78
+ margin-right : 20px ;
79
+ }
80
+
81
+ .title {
82
+ height : 64px ;
83
+ line-height : 32px ;
84
+ font-size : 26px ;
85
+ font-weight : 500 ;
86
+ color : #333 ;
87
+ }
88
+
89
+ .subtitle {
90
+ font-size : 24px ;
91
+ font-weight : 400 ;
92
+ color : #999 ;
93
+ }
94
+
95
+ .price {
96
+ font-size : 26px ;
97
+ font-weight : 500 ;
98
+ color : #ff3000 ;
99
+ }
100
+ }
101
+ </style >
You can’t perform that action at this time.
0 commit comments