Commit d7fbfee8 by Jaxon

fix: 修复接待记录解析异常并优化界面显示

- 修复解析scriptRec字段时JSON.parse可能报错的问题
- 移除接待时长显示中多余的"分钟"单位
- 格式化多个WXML文件,统一缩进和属性书写风格
- 优化对话组件的数据加载逻辑,提升性能
1 parent a9c82271
<view class="view">
<block wx:if="{{flag}}">
<block wx:if="{{dialogueList.length}}">
<scroll-view class="scroll-view" enhanced scroll-y scroll-into-view="{{toId}}" show-scrollbar="{{false}}" bindtouchstart="touchstart" bindtouchend="touchend" scroll-with-animation bindscroll="watchScrollTrack" data-event-code="dialogue">
<block wx:for="{{dialogueList}}" wx:key="index">
<view class="item {{activeId == item.text_id?'active':''}}" id="{{item.text_id}}" data-click bindtap="seekPlay" data-item="{{item}}" data-index="{{index}}">
<block wx:if="{{item.visible}}">
<view class="avatar-box">
<view class="icon">
<gl-image class="icon" webp src="/equity/reception/role-{{item.role}}.png" />
</view>
<view class="time">{{item.time}}</view>
</view>
<view class="text">
{{item.content}}
</view>
</block>
<block wx:else>
<view class="loading"></view>
</block>
</view>
<!-- 意图匹配 -->
<block wx:if="{{item.recordingCheckResultList}}">
<block wx:for="{{item.recordingCheckResultList}}" wx:key="ind" wx:for-item="i" wx:for-index="ind">
<view class="detail-box {{i.showCheckDetail?'up':'down'}}">
<view class="text-box">
<view class="btn" bindtap="switchDetail" data-index="{{index}}" data-ind="{{ind}}" data-key="showCheckDetail" data-value="{{i.showCheckDetail}}">
意图匹配
<gl-image class="arrow" webp src="/equity/date-arrow.png" />
</view>
{{i.tagGroupName}}
<view class="score">{{i.score}}分</view>
</view>
<view class="content-box">
<block wx:if="{{!i.scriptRec}}">
<view class="suggestions-box no">
<gl-image class="icon" webp src="/equity/reception/no-suggestions.png" />
暂无话术推荐
</view>
</block>
<block wx:else>
<view class="suggestions-box">
<view class="title">
<gl-image class="icon" webp src="/equity/reception/suggestions-icon.png" />
话术推荐
</view>
<view class="text">
<rich-text nodes="{{i.scriptRec}}"></rich-text>
</view>
</view>
</block>
</view>
</view>
</block>
</block>
</block>
<view class="safeAreaInset">到底了!</view>
</scroll-view>
</block>
<block wx:else>
<view class="nothing flex">
<gl-image class="icon" webp src="/equity/reception/quality-no-data.png" />
分析中,稍等...
</view>
</block>
</block>
<view class="axis-bar-area" bindtap="barSeek" hidden="{{!qualityData.length}}">
<view class="axis-bar">
<view class="progress-bar" style="height:{{progress + '%'}}"></view>
<block wx:for="{{axisList}}" wx:key="index">
<view class="axis-item {{activeId == item.text_id?'axis-active':''}}" style="top:{{item.docTop + 'px'}};">
<view class="axis-dot {{!isPlayIng && !isScrollling?'':'radius'}}" catchtap="seekPlay" data-item="{{item}}" data-scroll></view>
</view>
<block wx:if="{{!isPlayIng && !isScrollling}}">
<view class="axis-text {{activeId == item.text_id?'axis-text-active':''}}" catchtap="seekPlay" data-item="{{item}}" data-scroll style="top:{{item.top + 'px'}};">
{{item.tagGroupName}}+{{item.score}}
</view>
</block>
</block>
<view class="hide-bar">
<block wx:for="{{axisList}}" wx:key="index">
<block wx:if="{{item.inspectionConversationDetailId}}">
<view class="axis-line {{item.colorName}}" style="height:{{item.height + 20 + 'px'}};top:{{item.docTop - 10 + 'px'}};"></view>
</block>
</block>
</view>
</view>
</view>
</view>
\ No newline at end of file
<block wx:if="{{ flag }}">
<block wx:if="{{ dialogueList.length }}">
<scroll-view class="scroll-view"
enhanced
scroll-y
scroll-into-view="{{ toId }}"
show-scrollbar="{{ false }}"
bindtouchstart="touchstart"
bindtouchend="touchend"
scroll-with-animation
bindscroll="watchScrollTrack"
data-event-code="dialogue">
<block wx:for="{{ dialogueList }}" wx:key="index">
<view class="item {{ activeId == item.text_id?'active':'' }}"
id="{{ item.text_id }}"
data-click
bindtap="seekPlay"
data-item="{{ item }}"
data-index="{{ index }}">
<block wx:if="{{ item.visible }}">
<view class="avatar-box">
<view class="icon">
<gl-image class="icon"
webp
src="/equity/reception/role-{{ item.role }}.png" />
</view>
<view class="time">
{{ item.time }}
</view>
</view>
<view class="text">
{{ item.content }}
</view>
</block>
<block wx:else>
<view class="loading"></view>
</block>
</view>
<!-- 意图匹配 -->
<block wx:if="{{ item.recordingCheckResultList }}">
<block wx:for="{{ item.recordingCheckResultList }}"
wx:key="ind"
wx:for-item="i"
wx:for-index="ind">
<view class="detail-box {{ i.showCheckDetail?'up':'down' }}">
<view class="text-box">
<view class="btn"
bindtap="switchDetail"
data-index="{{ index }}"
data-ind="{{ ind }}"
data-key="showCheckDetail"
data-value="{{ i.showCheckDetail }}">
意图匹配
<gl-image class="arrow"
webp
src="/equity/date-arrow.png" />
</view>
{{ i.tagGroupName }}
<view class="score">
{{ i.score }}分
</view>
</view>
<view class="content-box">
<block wx:if="{{ !i.scriptRec }}">
<view class="suggestions-box no">
<gl-image class="icon"
webp
src="/equity/reception/no-suggestions.png" />
暂无话术推荐
</view>
</block>
<block wx:else>
<view class="suggestions-box">
<view class="title">
<gl-image class="icon"
webp
src="/equity/reception/suggestions-icon.png" />
话术推荐
</view>
<view class="text">
<rich-text nodes="{{ i.scriptRec }}"></rich-text>
</view>
</view>
</block>
</view>
</view>
</block>
</block>
</block>
<view class="safeAreaInset">
到底了!
</view>
</scroll-view>
</block>
<block wx:else>
<view class="nothing flex">
<gl-image class="icon"
webp
src="/equity/reception/quality-no-data.png" />
分析中,稍等...
</view>
</block>
</block>
<view class="axis-bar-area"
bindtap="barSeek"
hidden="{{ !qualityData.length }}">
<view class="axis-bar">
<view class="progress-bar" style="height:{{ progress + '%' }}"></view>
<block wx:for="{{ axisList }}" wx:key="index">
<view class="axis-item {{ activeId == item.text_id?'axis-active':'' }}"
style="top:{{ item.docTop + 'px' }};">
<view class="axis-dot {{ !isPlayIng && !isScrollling?'':'radius' }}"
catchtap="seekPlay"
data-item="{{ item }}"
data-scroll></view>
</view>
<block wx:if="{{ !isPlayIng && !isScrollling }}">
<view class="axis-text {{ activeId == item.text_id?'axis-text-active':'' }}"
catchtap="seekPlay"
data-item="{{ item }}"
data-scroll
style="top:{{ item.top + 'px' }};">
{{ item.tagGroupName }}+{{ item.score }}
</view>
</block>
</block>
<view class="hide-bar">
<block wx:for="{{ axisList }}" wx:key="index">
<block wx:if="{{ item.inspectionConversationDetailId }}">
<view class="axis-line {{ item.colorName }}"
style="height:{{ item.height + 20 + 'px' }};top:{{ item.docTop - 10 + 'px' }};"></view>
</block>
</block>
</view>
</view>
</view>
</view>
<view class="view">
<block wx:if="{{qualityData.length}}">
<view class="classify-wrap">
<block wx:for="{{qualityData}}" wx:key="index">
<view class="classify-item flex {{index == activeIndex?'active':''}}" bindtap="changeClassifyType" data-index="{{index}}">
<view class="title">{{item.tagGroupName}}</view>
<view class="score">{{item.formatScore}}</view>
</view>
</block>
</view>
<scroll-view class="scroll-view" enhanced scroll-y scroll-with-animation scroll-into-view="{{activeId}}">
<block wx:if="{{qualityData[activeIndex]}}">
<view class="quality-block">
<view class="title flex">
{{qualityData[activeIndex].tagGroupName}}
<view class="matched-btn flex {{qualityData[activeIndex].matchedClass}}">{{qualityData[activeIndex].matchedText}}</view>
</view>
<block wx:for="{{qualityData[activeIndex].conversationDetailDTOList}}" wx:key="index">
<block wx:if="{{item.text_id}}">
<view id="{{item.text_id}}" class="quality-item flex {{item.text_id == activeId?'active':''}}" bind:tap="seekPlay" data-item="{{item}}">
<view class="avatar-box">
<view class="icon">
<gl-image class="icon" webp src="/equity/reception/role-{{item.role}}.png" />
</view>
<view class="time">{{item.time}}</view>
</view>
<view class="text flex">{{item.content}}</view>
</view>
</block>
<block wx:if="{{item.scriptRec}}">
<view class="script-rec">
<view class="suggestions-box">
<view class="suggestions-title">
<gl-image class="icon" webp src="/equity/reception/suggestions-icon.png" />
话术推荐
</view>
<view class="text">
<rich-text nodes="{{item.scriptRec}}"></rich-text>
</view>
</view>
</view>
</block>
</block>
</view>
</block>
</scroll-view>
</block>
<block wx:else>
<view class="nothing flex">
<gl-image class="icon" webp src="/equity/reception/quality-no-data.png" />
分析中,稍等...
</view>
</block>
</view>
\ No newline at end of file
<block wx:if="{{ qualityData.length }}">
<view class="classify-wrap">
<block wx:for="{{ qualityData }}" wx:key="index">
<view class="classify-item flex {{ index == activeIndex?'active':'' }}"
bindtap="changeClassifyType"
data-index="{{ index }}">
<view class="title">
{{ item.tagGroupName }}
</view>
<view class="score">
{{ item.formatScore }}
</view>
</view>
</block>
</view>
<scroll-view class="scroll-view"
enhanced
scroll-y
scroll-with-animation
scroll-into-view="{{ activeId }}">
<block wx:if="{{ qualityData[activeIndex] }}">
<view class="quality-block">
<view class="title flex">
{{ qualityData[activeIndex].tagGroupName }}
<view class="matched-btn flex {{ qualityData[activeIndex].matchedClass }}">
{{ qualityData[activeIndex].matchedText }}
</view>
</view>
<block wx:for="{{ qualityData[activeIndex].conversationDetailDTOList }}"
wx:key="index">
<block wx:if="{{ item.text_id }}">
<view id="{{ item.text_id }}"
class="quality-item flex {{ item.text_id == activeId?'active':'' }}"
bind:tap="seekPlay"
data-item="{{ item }}">
<view class="avatar-box">
<view class="icon">
<gl-image class="icon"
webp
src="/equity/reception/role-{{ item.role }}.png" />
</view>
<view class="time">
{{ item.time }}
</view>
</view>
<view class="text flex">
{{ item.content }}
</view>
</view>
</block>
<block wx:if="{{ item.scriptRec }}">
<view class="script-rec">
<view class="suggestions-box">
<view class="suggestions-title">
<gl-image class="icon"
webp
src="/equity/reception/suggestions-icon.png" />
话术推荐
</view>
<view class="text">
<rich-text nodes="{{ item.scriptRec }}"></rich-text>
</view>
</view>
</view>
</block>
</block>
</view>
</block>
</scroll-view>
</block>
<block wx:else>
<view class="nothing flex">
<gl-image class="icon"
webp
src="/equity/reception/quality-no-data.png" />
分析中,稍等...
</view>
</block>
</view>
......@@ -77,7 +77,7 @@ Page({
}
item.matchedClass = matchedClass;
item.matchedText = matchedText;
let [scriptRec] = JSON.parse(item.scriptRec);
let [scriptRec] = JSON.parse(item.scriptRec || "['']");
if (scriptRec) scriptRec = scriptRec.replace(/\n/g, "<br>");
if (item.conversationDetailDTOList && item.conversationDetailDTOList.length) {
item.conversationDetailDTOList.map((e) => {
......@@ -104,6 +104,7 @@ Page({
});
} else throw message;
} catch (error) {
console.log("error????", error);
wx.$util.showToast(error);
}
},
......
// packageEquity/pages/receptionDetail/components/quality/index.js
import api from "../../../../carEquityApi";
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
import watchScrollMixin from '../watchScrollMixin'
const IMG_URL = "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/";
import watchScrollMixin from "../watchScrollMixin";
Component({
behaviors: [watchScrollMixin],
/**
* 组件的属性列表
*/
properties: {
batchId: Number,
defenceResultFlag: Number
},
lifetimes: {
ready() {
this.getReceptionResult()
}
},
/**
* 组件的初始数据
*/
data: {
scrollTop: '',
IMG_URL,
activeIndex: 0,
list: '',
isShow: false
},
behaviors: [watchScrollMixin],
/**
* 组件的属性列表
*/
properties: {
batchId: Number,
defenceResultFlag: Number,
},
lifetimes: {
ready() {
this.getReceptionResult();
},
},
/**
* 组件的初始数据
*/
data: {
scrollTop: "",
IMG_URL,
activeIndex: 0,
list: "",
isShow: false,
},
/**
* 组件的方法列表
*/
methods: {
changeAttackType(e) {
let {
index
} = e.currentTarget.dataset
this.setData({
activeIndex: index,
scrollTop: 0
})
this.setTrackData('offense_and_defense_toggle')
},
getReceptionResult() {
let {
list,
batchId
} = this.data;
let params = {
batchId
}
api.getDefenceDetail(params).then(res => {
if (res.data) {
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
avgDefence: res.data ? parseInt(res.data.avgDefence) : ''
})
res.data.detailList.forEach(item => {
item.highlight = item.highlight && JSON.parse(item.highlight)
item.highlight.forEach((high) => {
if (item.suggestionsForImprovement) {
item.suggestionsForImprovement = item.suggestionsForImprovement.replace(high, function (match) {
return '<span style="color: #347BFF;font-weight: 500">' + match + "</span>"
})
}
if (item.refineTheExpression) {
item.refineTheExpression = item.refineTheExpression.replace(high, function (match) {
return '<span style="color: #347BFF; font-weight: 500;">' + match + "</span>"
})
}
})
})
this.setData({
})
}
this.setData({
isShow: true,
list: res.data ? res.data : ''
})
})
},
lookMore() {
let thisPage = wx.$router.getPageInstance();
let {
activeIndex,
list
} = this.data;
this.setTrackData('go_to_dialogue_view')
let mergedOffset = list.detailList[activeIndex].mergedOffset;
thisPage.seek(mergedOffset)
thisPage.setData({
activeIndex: 0,
avgDefence: ''
}, () => {
thisPage.dialogueRef().toDefenceItem(mergedOffset)
thisPage.play()
})
},
practiceHandle() {
},
/**设置埋点数据 */
setTrackData(code) {
let {
batchId
} = this.data
wx.$track.setTrackData(0, code, {
batchId
})
}
}
})
\ No newline at end of file
/**
* 组件的方法列表
*/
methods: {
changeAttackType(e) {
let { index } = e.currentTarget.dataset;
this.setData({
activeIndex: index,
scrollTop: 0,
});
this.setTrackData("offense_and_defense_toggle");
},
getReceptionResult() {
let { list, batchId } = this.data;
let params = {
batchId,
};
api.getDefenceDetail(params).then((res) => {
if (res.data) {
let thisPage = wx.$router.getPageInstance();
thisPage.setData({
avgDefence: res.data ? parseInt(res.data.avgDefence) : "",
});
res.data.detailList.forEach((item) => {
item.highlight = item.highlight && JSON.parse(item.highlight);
item.highlight.forEach((high) => {
if (item.suggestionsForImprovement) {
item.suggestionsForImprovement = item.suggestionsForImprovement.replace(high, function (match) {
return '<span style="color: #347BFF;font-weight: 500">' + match + "</span>";
});
}
if (item.refineTheExpression) {
item.refineTheExpression = item.refineTheExpression.replace(high, function (match) {
return '<span style="color: #347BFF; font-weight: 500;">' + match + "</span>";
});
}
});
});
this.setData({});
}
this.setData({
isShow: true,
list: res?.data || {},
});
});
},
lookMore() {
let thisPage = wx.$router.getPageInstance();
let { activeIndex, list } = this.data;
this.setTrackData("go_to_dialogue_view");
let mergedOffset = list.detailList[activeIndex].mergedOffset;
thisPage.seek(mergedOffset);
thisPage.setData(
{
activeIndex: 0,
avgDefence: "",
},
() => {
thisPage.dialogueRef().toDefenceItem(mergedOffset);
thisPage.play();
},
);
},
practiceHandle() {},
/**设置埋点数据 */
setTrackData(code) {
let { batchId } = this.data;
wx.$track.setTrackData(0, code, {
batchId,
});
},
},
});
<!--packageEquity/pages/receptionDetail/components/attack/index.wxml-->
<view class="attack-wrap">
<block wx:if="{{isShow}}">
<block wx:if="{{list&&list.detailList&&list.detailList.length>0}}">
<scroll-view scroll-x class="scroll-view" wx:if="{{list&&list.detailList&&list.detailList.length>0}}">
<view class="attack-bout {{list.detailList.length>4?'attach-list-scroll':''}}">
<view class="attack-list {{activeIndex==index?'active':''}}" wx:for="{{list.detailList}}" data-index="{{index}}" bind:tap="changeAttackType">
<view class="title">攻防回合{{index+1}}</view>
<view class="score">{{item.defScore}}<text>分</text></view>
</view>
</view>
</scroll-view>
<scroll-view scroll-y class="attack-content" scroll-top="{{scrollTop}}" bindscroll="watchScrollTrack" data-event-code="offense_and_defense">
<view class="content">
<view class="left attack">
攻
</view>
<view class="text">{{list.detailList[activeIndex].question}}</view>
</view>
<view class="content">
<view class="left defend">
防
</view>
<view class="text">{{list.detailList[activeIndex].answer}}</view>
</view>
<view class="verbal-wrap">
<view class="verbal-wrap-content">
<view class="title">
<gl-image class="improve" webp src="/improve.png" />话术建议
</view>
<view class="suggest-content">
<rich-text nodes="{{list.detailList[activeIndex].suggestionsForImprovement}}"></rich-text>
</view>
<view class="line"></view>
<view class="title">
<gl-image class="improve" webp src="/polish.png" />润色表达
</view>
<view class="suggest-content">
<rich-text nodes="{{list.detailList[activeIndex].refineTheExpression}}"></rich-text>
</view>
</view>
</view>
<view class="footer">
<view class="more" bind:tap="lookMore" >去对话查看</view>
</view>
<view class="safeAreaInset"></view>
</scroll-view>
</block>
<block wx:else>
<view class="no-data">
<gl-image class="no-data-img" webp src="/equity/empty.png" />
<view class="list-not"> {{
defenceResultFlag === 1 ||
defenceResultFlag === 0 ||
defenceResultFlag === 4
? "数据分析中,请稍等"
: defenceResultFlag === 3
? "未发现攻防"
: "未进行攻防识别"
}}</view>
</view>
</block>
</block>
</view>
\ No newline at end of file
<block wx:if="{{ isShow }}">
<block wx:if="{{ list && list.detailList && list.detailList.length>0 }}">
<scroll-view scroll-x
class="scroll-view"
wx:if="{{ list && list.detailList && list.detailList.length>0 }}">
<view class="attack-bout {{ list.detailList.length>4?'attach-list-scroll':'' }}">
<view class="attack-list {{ activeIndex==index?'active':'' }}"
wx:for="{{ list.detailList }}"
data-index="{{ index }}"
bind:tap="changeAttackType">
<view class="title">
攻防回合{{ index+1 }}
</view>
<view class="score">
{{ item.defScore }}<text>分</text>
</view>
</view>
</view>
</scroll-view>
<scroll-view scroll-y
class="attack-content"
scroll-top="{{ scrollTop }}"
bindscroll="watchScrollTrack"
data-event-code="offense_and_defense">
<view class="content">
<view class="left attack">
攻
</view>
<view class="text">
{{ list.detailList[activeIndex].question }}
</view>
</view>
<view class="content">
<view class="left defend">
防
</view>
<view class="text">
{{ list.detailList[activeIndex].answer }}
</view>
</view>
<view class="verbal-wrap">
<view class="verbal-wrap-content">
<view class="title">
<gl-image class="improve"
webp
src="/improve.png" />
话术建议
</view>
<view class="suggest-content">
<rich-text nodes="{{ list.detailList[activeIndex].suggestionsForImprovement }}"></rich-text>
</view>
<view class="line"></view>
<view class="title">
<gl-image class="improve"
webp
src="/polish.png" />
润色表达
</view>
<view class="suggest-content">
<rich-text nodes="{{ list.detailList[activeIndex].refineTheExpression }}"></rich-text>
</view>
</view>
</view>
<view class="footer">
<view class="more" bind:tap="lookMore">
去对话查看
</view>
</view>
<view class="safeAreaInset"></view>
</scroll-view>
</block>
<block wx:else>
<view class="no-data">
<gl-image class="no-data-img"
webp
src="/equity/empty.png" />
<view class="list-not">
{{ defenceResultFlag === 1 || defenceResultFlag === 0 || defenceResultFlag === 4 ? "数据分析中,请稍等" : defenceResultFlag === 3 ? "未发现攻防" : "未进行攻防识别" }}
</view>
</view>
</block>
</block>
</view>
......@@ -36,7 +36,7 @@
接待时长
</view>
<view class="value">
{{ caseData.duration || '-' }}分钟
{{ caseData.duration || '-' }}
</view>
</view>
<view class="label-item">
......
......@@ -35,6 +35,7 @@ Page({
//
showRecordProgress: false,
form: "serverCenter",
staticDate: item.receptionDate,
};
if (item.checkHistoryFlag == 0) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!