Commit d7fbfee8 by Jaxon

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

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