Commit 39eacbea by liimin

feat(reception): 优化接待详情页功能并修复对话组件问题

- 修改取消按钮文本为"开始新的"
- 移除无用代码并优化数据结构处理
- 新增接待相关API接口
- 重构标签组件改为接收props数据
- 优化对话组件时间轴渲染逻辑
- 修复接待详情页数据加载和展示问题
- 使用Object.freeze优化性能
- 完善错误处理和日志记录
1 parent 0bb37a0c
...@@ -5,5 +5,11 @@ module.exports = { ...@@ -5,5 +5,11 @@ module.exports = {
}, },
getList (data) { getList (data) {
return http.shukeRequest('linkwe-gateway/reception/reception/page', data, 'POST',false) return http.shukeRequest('linkwe-gateway/reception/reception/page', data, 'POST',false)
},
findCheckResultListByReceptionId (data) {
return http.shukeRequest('linkwe-gateway/reception/reception/findCheckResultListByReceptionId', data, 'GET',false)
},
findConversationDetailByReceptionId (data) {
return http.shukeRequest('linkwe-gateway/reception/reception/findConversationDetailByReceptionId', data, 'GET',false)
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -267,7 +267,7 @@ export default { ...@@ -267,7 +267,7 @@ export default {
// "receptionCustomerMaterialPointList": null, // "receptionCustomerMaterialPointList": null,
// "carPurchaseMethod": null, // "carPurchaseMethod": null,
// "checkHistoryFlag": 0, // "checkHistoryFlag": 0,
// "batchId": 62377, // "batchId": 72,
// "score": 35, // "score": 35,
// "recordingUrl": "https://glsk-oss.oss-cn-shenzhen.aliyuncs.com/quality/176544865331017654474319060.mp3", // "recordingUrl": "https://glsk-oss.oss-cn-shenzhen.aliyuncs.com/quality/176544865331017654474319060.mp3",
// "recordId": null, // "recordId": null,
...@@ -296,12 +296,12 @@ export default { ...@@ -296,12 +296,12 @@ export default {
// "totalDuration": 1975 // "totalDuration": 1975
// } // }
if (this.tabIndex == 0) { // 已上传 && 新质检 if (this.tabIndex == 0) { // 已上传 && 新质检
const { sceneType } = uni.$storage.get("userInfo"); // const { sceneType } = uni.$storage.get("userInfo");
if (sceneType == 1 || item.checkHistoryFlag != 0 || item.score == null) return uni.showToast({ // if (sceneType == 1 || item.checkHistoryFlag != 0 || item.score == null) return uni.showToast({
title: '该接待尚不支持复盘', // title: '该接待尚不支持复盘',
icon: "none" // icon: "none"
}) // })
this.tabIndex = -1 // this.tabIndex = -1
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/receptionDetail/index`, url: `/pages/common/receptionDetail/index`,
success (res) { success (res) {
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
title="恢复接待" title="恢复接待"
content="检测到您有上次未完成的接待,是否继续接待?" content="检测到您有上次未完成的接待,是否继续接待?"
confirmBtnText="继续接待" confirmBtnText="继续接待"
cancelBtnText="不再提示" cancelBtnText="开始新的"
:showCancelBtn="true" :showCancelBtn="true"
:popupW="704" :popupW="704"
@confirm="resumeConfirm" @confirm="resumeConfirm"
......
...@@ -84,7 +84,6 @@ ...@@ -84,7 +84,6 @@
class="progress-bar" class="progress-bar"
:style="[{height:`${progress}%`}]" :style="[{height:`${progress}%`}]"
></view> ></view>
<template v-if="true">
<template v-for="(item,index) in axisList"> <template v-for="(item,index) in axisList">
<block :key="index"> <block :key="index">
<view <view
...@@ -112,15 +111,14 @@ ...@@ -112,15 +111,14 @@
v-for="(item,index) in axisList" v-for="(item,index) in axisList"
:key="index" :key="index"
> >
<block v-if="item.inspectionConversationDetailId"> <block v-if="item.checkResultId">
<view <view
:class="['axis-line']" :class="['axis-line']"
:style="[{height:`${item.height + 20 + 'px'}`},{top:`${item.docTop - 10 + 'px'}`}]" :style="[{top:`${item.docTop - 10 + 'px'}`}]"
></view> ></view>
</block> </block>
</block> </block>
</view> </view>
</template>
</view> </view>
</view> </view>
</view> </view>
...@@ -150,7 +148,7 @@ export default { ...@@ -150,7 +148,7 @@ export default {
batchId: { batchId: {
handler (n) { handler (n) {
const data = { const data = {
batchId: n, receptionId: n,
}; };
this.findConversationDetailByBatchIdNew(data) this.findConversationDetailByBatchIdNew(data)
}, },
...@@ -195,14 +193,13 @@ export default { ...@@ -195,14 +193,13 @@ export default {
i.detailClassName = i.detailClassName == 'up' ? 'down' : 'up' i.detailClassName = i.detailClassName == 'up' ? 'down' : 'up'
}, },
async findConversationDetailByBatchIdNew (params) { async findConversationDetailByBatchIdNew (params) {
const res = await uni.$api.receptionApi.findConversationDetailByBatchIdNew(params) const res = await uni.$api.reception.findConversationDetailByReceptionId(params)
res.map(e => { res.map(e => {
e.time = this.formatTime(e.mergedOffset) e.time = this.formatTime(e.mergedOffset)
e.text_id = `text_${e.mergedOffset}` e.text_id = `text_${e.mergedOffset}`
if (e?.recordingCheckResultList && e.recordingCheckResultList.length) { if (e?.recordingCheckResultList && e.recordingCheckResultList.length) {
e.recordingCheckResultList.map(i => { e.recordingCheckResultList.map(i => {
i.detailClassName = 'down' i.detailClassName = 'down'
console.log(i.scriptRec)
let [scriptRec] = JSON.parse(i.scriptRec) let [scriptRec] = JSON.parse(i.scriptRec)
if (scriptRec) i.scriptRec = scriptRec.replace(/\n/g, '<br>') if (scriptRec) i.scriptRec = scriptRec.replace(/\n/g, '<br>')
else i.scriptRec = '' else i.scriptRec = ''
...@@ -227,26 +224,24 @@ export default { ...@@ -227,26 +224,24 @@ export default {
this.barTop = barTop this.barTop = barTop
this.containerHeight = containerHeight this.containerHeight = containerHeight
let axisList = [] let axisList = []
data?.sort((a, b) => a.offset - b.offset).forEach(e => { data.filter(e => e.offset != null)
const { .sort((a, b) => a.offset - b.offset)
offset: mergedOffset, .forEach(e => {
id const mergedOffset = e.offset / 1000
} = e let top = mergedOffset / totalDuration * containerHeight
e.top = mergedOffset / totalDuration * containerHeight e.docTop = top
e.docTop = mergedOffset / totalDuration * containerHeight
e.text_id = `text_${mergedOffset}` e.text_id = `text_${mergedOffset}`
e.mergedOffset = mergedOffset e.mergedOffset = mergedOffset
if (mergedOffset != null) axisList.push(e)
})
axisList.map((e, index) => {
// 检查并调整 top 值,避免重叠 // 检查并调整 top 值,避免重叠
for (let i = 0; i < index; i++) { // 由于数据已按 offset (时间)排序,我们只需要检查当前元素是否与 上一个已放置的元素 重叠即可。如果重叠,直接将当前元素放置在上一个元素的下方( prevTop + margin )
if (e.top < axisList[i].top + margin && if (axisList.length > 0) {
e.top + margin > axisList[i].top) { const prevTop = axisList[axisList.length - 1].top
// 如果重叠,将当前元素的 top 设置为前一个元素的底部加上 margin if (top < prevTop + margin) {
e.top = axisList[i].top + margin; top = prevTop + margin
} }
} }
e.top = top
axisList.push(e)
}) })
this.axisList = axisList this.axisList = axisList
}) })
......
...@@ -12,14 +12,6 @@ export default { ...@@ -12,14 +12,6 @@ export default {
icon: String icon: String
}, },
name: '', name: '',
data () {
return {
}
},
mounted () {
},
methods: {
}
} }
</script> </script>
......
...@@ -21,34 +21,10 @@ export default { ...@@ -21,34 +21,10 @@ export default {
components: { components: {
ReceptionTitle ReceptionTitle
}, },
data () {
return {
tags: []
}
},
props: { props: {
batchId: [String, Number] tags: {
}, type: Array,
watch: { default: () => []
batchId: {
handler (val) {
if (val) this.getTags(val)
},
immediate: true
}
},
mounted () {
},
methods: {
async getTags (batchId) {
const res = await uni.$api.receptionApi.findRecordingTagByBatchId({
batchId
})
let tags = []
res.map(e =>{
tags.push(`${e.tagGroupName}-${e.tagName}`)
})
this.tags = tags
} }
} }
} }
......
...@@ -106,7 +106,7 @@ export default { ...@@ -106,7 +106,7 @@ export default {
typeCode, typeCode,
status: 0 status: 0
}) })
this.folderList = Array.isArray(first_res?.data) ? first_res.data : [] this.folderList = Object.freeze(Array.isArray(first_res?.data) ? first_res.data : [])
if (!this.folderList.length) return this.resetLists() if (!this.folderList.length) return this.resetLists()
// 并行请求所有文件夹内容 // 并行请求所有文件夹内容
...@@ -133,7 +133,7 @@ export default { ...@@ -133,7 +133,7 @@ export default {
}, },
processMaterials(materials) { processMaterials(materials) {
this.moduleList = materials.map(item => ({ this.moduleList = Object.freeze(materials.map(item => ({
...item, ...item,
thumbnail: item.materialUrl, thumbnail: item.materialUrl,
title: item.materialName, title: item.materialName,
...@@ -145,14 +145,14 @@ export default { ...@@ -145,14 +145,14 @@ export default {
receptionSourceDetailList: { receptionSourceDetailList: {
detailUrl: item.materialUrl detailUrl: item.materialUrl
} }
})) })))
this.toolList = materials.map(item => ({ this.toolList = Object.freeze(materials.map(item => ({
...item, ...item,
shortTitle: item.materialName, shortTitle: item.materialName,
title: item.materialName, title: item.materialName,
shortTitleUrl: item.materialUrl shortTitleUrl: item.materialUrl
})) })))
}, },
// 获取首页素材 // 获取首页素材
...@@ -162,7 +162,7 @@ export default { ...@@ -162,7 +162,7 @@ export default {
status: 0, status: 0,
showOnHomepage: 1 showOnHomepage: 1
}) })
this.homeList = Array.isArray(res?.data) ? res.data : [] this.homeList = Object.freeze(Array.isArray(res?.data) ? res.data : [])
}, },
changeType () { changeType () {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!