attackDetail.vue
9.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<template>
<div v-loading="loading" class="container">
<div class="attack-detail" v-if="defenceDetail">
<div class="statistics-box">
<div
class="statistics-item"
v-for="(item, index) in statisticsObj"
:key="index"
>
<div class="text">{{ item.text }}</div>
<div class="value">{{ item.value(defenceDetail) }}</div>
</div>
</div>
<div class="dialog-box" @scroll="watchScrollTrack($event,'offense_and_defense_detail')">
<div
class="dialog-item"
v-for="(item, index) in defenceDetail.detailList"
:key="item.is"
>
<div class="dialog-head">
<img
class="attack-score"
src="../../../assets/attack-score.png"
alt=""
/>
<div class="text">攻防得分</div>
<div class="score">{{ item.defScore ? item.defScore : "-" }}</div>
<div class="text" @click="handleMapping(item.mergedOffset)">
对话开始时间
</div>
<div class="time" @click="handleMapping(item.mergedOffset)">
{{ item.conStartTime ? item.conStartTime : "-" }}
</div>
<div class="attack-index">攻防回合{{ index + 1 }}</div>
<img
class="index-logo"
src="../../../assets/index-logo.png"
alt=""
/>
</div>
<div class="dialog">
<div
:class="{
'dialog-detail': true
}"
:key="item.id"
>
<div class="name">
<img class="role" src="@/assets/role-one.png" />
客户
</div>
<div class="dig-content" @click="currentDialog(item)">
{{ item.question }}
</div>
</div>
<div class="dialog-detail nth-child" :key="item.id">
<div class="name">
销售
<img class="role two" src="@/assets/role-two.png" />
</div>
<div class="dig-content" @click="currentDialog(item)">
{{ item.answer }}
</div>
<br />
<div class="suggest">
<div class="improve">
<img src="@/assets/improve.png" class="improve-img" />
改进建议
</div>
<div
class="improve-text"
v-html="
regText(item.highlight, item.suggestionsForImprovement)
"
></div>
<div class="line"></div>
<div class="improve">
<img src="@/assets/polish.png" class="improve-img" />
润色表达
</div>
<div
class="improve-text"
v-html="regText(item.highlight, item.refineTheExpression)"
></div>
</div>
</div>
</div>
</div>
</div>
</div>
<template v-else>
<div class="empty-box">
<div class="icon">
<img src="@/assets/empty-2.png" />
</div>
<div class="text">
{{
detailObj.defence === 1 ||
detailObj.defence === 0 ||
detailObj.defence === 4
? "数据分析中,请稍等"
: detailObj.defence === 3
? "未发现攻防"
: "未进行攻防识别"
}}
</div>
</div>
</template>
</div>
</template>
<script>
import { defenceDetail } from "@api/resident"
import watchScrollTrackMixin from '@/mixins/watchScrollTrackMixin'
export default {
mixins: [watchScrollTrackMixin],
props: {
detailObj: {
type: Object,
default: {}
}
},
data() {
return {
statisticsObj: [
{
text: "攻防次数",
value: (data) => {
return data.defenceCount + "次"
}
},
{
text: "攻防平均得分",
value: (data) => {
return data.avgDefence + "分"
}
},
{
text: "客户类型",
value: (data) => {
return data.customerType ? data.customerType : "未知"
}
}
],
defenceDetail: "",
loading: true,
isFlag: false
}
},
created() {
this.getDefenceDetail()
},
methods: {
handleMapping(time) {
Array.prototype.slice
.call(this.$parent.$parent.$children)
.forEach((dom) => {
if (dom.currentDialog) {
dom.currentDialog(time)
}
})
},
getDefenceDetail() {
let params = {
batchId: this.detailObj.id
}
defenceDetail(params).then((res) => {
this.defenceDetail = res
this.loading = false
})
},
regText(highlight, value) {
highlight = highlight ? JSON.parse(highlight):[]
let replacedText = value
if (value) {
highlight.forEach((item) => {
replacedText = replacedText.replace(item, function (match) {
return '<span style="color: #FE9220;">' + match + "</span>"
})
})
}
return replacedText
}
}
}
</script>
<style scoped lang="scss">
.container {
height: 100%;
}
.attack-detail {
height: calc(100% - 55px);
overflow: hidden;
.statistics-box {
display: flex;
align-items: center;
margin-bottom: 12px;
.statistics-item {
flex: 1;
padding: 12px 16px;
background: #f7f9fa;
color: #333333;
height: 20px;
display: flex;
justify-content: space-between;
align-items: center;
margin-right: 8px;
.value {
font-weight: 600;
}
}
}
.dialog-box {
height: calc(100% - 68px);
overflow-y: scroll;
.dialog-item {
width: 100%;
background: #f7f9fa;
margin-bottom: 12px;
.dialog-head {
padding: 12px 16px;
height: 24px;
position: relative;
line-height: 24px;
display: flex;
align-items: center;
border-bottom: 1px solid #e5e5e5;
// cursor: pointer;
.attack-score {
width: 24px;
// height: 24px;
margin-right: 8px;
}
.text {
font-weight: 400;
font-size: 14px;
color: #666666;
}
.score {
font-weight: 500;
font-size: 15px;
color: #fe9220;
margin: 0 24px 0 6px;
}
.time {
font-weight: 400;
font-size: 14px;
color: #2a58ad;
margin-left: 6px;
cursor: pointer;
}
.index-logo {
width: 86px;
height: 32px;
position: absolute;
right: 0;
}
.attack-index {
font-weight: 400;
font-size: 14px;
color: #ffffff;
position: absolute;
right: 12px;
z-index: 999;
}
}
.dialog {
width: 100%;
height: 100%;
background: #f7f9fa;
border-radius: 4px;
overflow-y: scroll;
padding: 12px 8px 12px 16px;
box-sizing: border-box;
.dialog-detail {
margin-bottom: 8px;
text-align: left;
.name {
font-size: 12px;
color: #666666;
letter-spacing: 0;
line-height: 16px;
.role {
width: 32px;
height: 32px;
vertical-align: top;
margin-right: 10px;
}
.two {
margin-right: 0;
}
}
.dig-content {
width: fit-content;
max-width: 70%;
background: #e4ecf7;
border-radius: 4px;
font-size: 14px;
color: #333333;
padding: 10px 12px;
white-space: pre-wrap;
text-align: left;
margin: -14px 0 0 40px;
line-height: 20px;
}
.suggest {
width: fit-content;
max-width: 70%;
background: #fff;
border-radius: 4px;
font-size: 14px;
color: #333333;
padding: 10px 12px;
white-space: pre-wrap;
text-align: left;
line-height: 20px;
margin-top: 12px;
margin-right: 40px;
display: inline-block;
.improve {
width: 94px;
height: 28px;
background: #f2f7fc;
border-radius: 4px;
padding: 4px 8px;
display: flex;
align-items: center;
font-weight: 500;
font-size: 14px;
color: #333333;
margin-bottom: 6px;
box-sizing: border-box;
white-space: nowrap;
.improve-img {
width: 14px;
height: 14px;
margin-right: 8px;
}
}
.improve-text {
margin: 0 8px;
}
.line {
width: 100%;
height: 1px;
margin: 12px 8px;
background-color: #ebedff;
}
}
}
.nth-child {
text-align: right;
.dig-content {
display: inline-block;
background: #ffffff;
margin-right: 38px;
line-height: 22px;
}
}
}
}
}
}
.empty-box {
display: flex;
flex-direction: column;
font-size: 12px;
color: #999999;
padding-top: 184px;
text-align: center;
width: 100%;
height: 100%;
box-sizing: border-box;
border-radius: 0 4px 4px 4px;
.icon {
width: 270px;
height: 120px;
margin: 0 auto 8px;
img {
width: 100%;
height: 100%;
}
}
}
</style>