Commit f97509f9 by 岑成威

fix: 长图

1 parent 4e5f4a3b
...@@ -135,109 +135,17 @@ const getImageVersion = async () => { ...@@ -135,109 +135,17 @@ const getImageVersion = async () => {
/**获取素材配置 */ /**获取素材配置 */
const getSoureData = async (shopMerchantId, sceneType, params = {}) => { const getSoureData = async (shopMerchantId, sceneType, params = {}) => {
try { try {
uni.$logger?.local?.info?.(`[systemApi/getSoureData] start, shopMerchantId=${shopMerchantId}, sceneType=${sceneType}`)
const res = await getEquityMaterialId({ const res = await getEquityMaterialId({
merchantId: shopMerchantId, merchantId: shopMerchantId,
...params ...params
}) })
uni.$logger?.local?.info?.(`[systemApi/getSoureData] getEquityMaterialId done, id=${res?.id || ''}`)
if (res && res.id) { if (res && res.id) {
console.log(res.id, 'res.idres.idres.idres.id')
let data = await getEquityMaterialConfig({ let data = await getEquityMaterialConfig({
id: res.id id: res.id
}) })
if (data) { if (data) {
// detail 接口原始返回(可读写关键字段;图片 URL 过长会截断)
const detailRawForLog = {
id: data.id,
topKeys: Object.keys(data || {}),
toolListLength: data.toolList?.length || 0,
materialInfoList: (data.materialInfoList || []).map(item => {
const copy = { ...item }
;['thumbnail', 'shortTitleUrl', 'productPoster'].forEach(k => {
if (typeof copy[k] === 'string' && copy[k].length > 120) {
copy[k] = `${copy[k].slice(0, 80)}...(len=${copy[k].length})`
}
})
if (Array.isArray(copy.receptionSourceDetailList)) {
copy.receptionSourceDetailList = copy.receptionSourceDetailList.map(d => {
const detail = { ...d }
Object.keys(detail).forEach(k => {
if (typeof detail[k] === 'string' && detail[k].length > 120) {
detail[k] = `${detail[k].slice(0, 80)}...(len=${detail[k].length})`
}
})
return detail
})
}
if (Array.isArray(copy.screenList)) {
copy.screenList = copy.screenList.map(s => {
const screen = { ...s }
Object.keys(screen).forEach(k => {
if (typeof screen[k] === 'string' && screen[k].length > 120) {
screen[k] = `${screen[k].slice(0, 80)}...(len=${screen[k].length})`
}
})
return screen
})
}
return copy
})
}
console.log(
'[detail接口] dj.api.car.boutique.reception.home.page.entrance.material.detail 原始返回:',
JSON.stringify(detailRawForLog, null, 2)
)
console.log('[getSoureData] getEquityMaterialConfig response:', data)
let { toolList, materialInfoList } = data, let { toolList, materialInfoList } = data,
storageName = `source_${sceneType}_${shopMerchantId}` storageName = `source_${sceneType}_${shopMerchantId}`
console.log('[getSoureData] materialInfoList:', materialInfoList)
if (materialInfoList?.[0]) {
const first = materialInfoList[0]
console.log('[getSoureData] first item keys:', Object.keys(first))
console.log('[getSoureData] first item long-related:', {
longImage: first.longImage,
isLongImage: first.isLongImage,
is_long_image: first.is_long_image,
imageWidth: first.imageWidth,
imageHeight: first.imageHeight,
image_width: first.image_width,
image_height: first.image_height,
materialTitle: first.materialTitle,
materialName: first.materialName,
detailTitle: first.detailTitle,
thumbnailType: typeof first.thumbnail
})
if (Array.isArray(first.receptionSourceDetailList) && first.receptionSourceDetailList[0]) {
console.log(
'[getSoureData] first receptionSourceDetailList[0] keys:',
Object.keys(first.receptionSourceDetailList[0])
)
console.log(
'[getSoureData] first receptionSourceDetailList[0] long-related:',
{
longImage: first.receptionSourceDetailList[0].longImage,
isLongImage: first.receptionSourceDetailList[0].isLongImage,
imageWidth: first.receptionSourceDetailList[0].imageWidth,
imageHeight: first.receptionSourceDetailList[0].imageHeight
}
)
}
}
console.log(
'[getSoureData] longImage flags:',
(materialInfoList || []).map(i => ({
id: i.id,
detailTitle: i.detailTitle || i.materialTitle || i.materialName,
longImage: i.longImage,
isLongImage: i.isLongImage,
imageWidth: i.imageWidth,
imageHeight: i.imageHeight,
hasOwnLongImage: Object.prototype.hasOwnProperty.call(i, 'longImage'),
hasOwnIsLongImage: Object.prototype.hasOwnProperty.call(i, 'isLongImage')
}))
)
uni.$logger?.local?.info?.(`[systemApi/getSoureData] materialInfoList length=${materialInfoList?.length || 0}`)
if (params.brandId && params.subBrandId) storageName += `_${params.brandId}_${params.subBrandId}` if (params.brandId && params.subBrandId) storageName += `_${params.brandId}_${params.subBrandId}`
let insurance = materialInfoList.find(e => e.componentName == 'insurance'), let insurance = materialInfoList.find(e => e.componentName == 'insurance'),
hasEquity = toolList.find(e => e.id == insurance.id) hasEquity = toolList.find(e => e.id == insurance.id)
...@@ -275,8 +183,6 @@ const getSoureData = async (shopMerchantId, sceneType, params = {}) => { ...@@ -275,8 +183,6 @@ const getSoureData = async (shopMerchantId, sceneType, params = {}) => {
} }
data.toolList = await imgTransformBase64(toolList, ['shortTitleUrl']) data.toolList = await imgTransformBase64(toolList, ['shortTitleUrl'])
data.moduleList = await imgTransformBase64(materialInfoList, ['thumbnail', 'receptionSourceDetailList', 'screenList']) data.moduleList = await imgTransformBase64(materialInfoList, ['thumbnail', 'receptionSourceDetailList', 'screenList'])
console.log('[getSoureData] moduleList(after transform):', data.moduleList)
uni.$logger?.local?.info?.(`[systemApi/getSoureData] moduleList length=${data.moduleList?.length || 0}`)
uni.setStorageSync(storageName, { uni.setStorageSync(storageName, {
moduleList: data.moduleList, moduleList: data.moduleList,
toolList: data.toolList, toolList: data.toolList,
......
...@@ -132,6 +132,8 @@ export default { ...@@ -132,6 +132,8 @@ export default {
index = 0 index = 0
if (clickFlga) return if (clickFlga) return
this.clickFlga = true this.clickFlga = true
// 进入车系选择过程中保持弹层打开态,避免「查看长图」按钮冒出来
this.$store.dispatch('setCarBrandOpenStatus', true)
this.selectItem = { this.selectItem = {
carBrand: e.brandName, carBrand: e.brandName,
carBrandId: e.brandId, carBrandId: e.brandId,
...@@ -166,7 +168,10 @@ export default { ...@@ -166,7 +168,10 @@ export default {
if (index < 0) index = 0 if (index < 0) index = 0
this.handleSelect(res[index]) this.handleSelect(res[index])
} }
else this.$refs.carBoxVisible.open() else {
this.$store.dispatch('setCarBrandOpenStatus', true)
this.$refs.carBoxVisible.open()
}
} }
this.clickFlga = false this.clickFlga = false
}).catch(err => { }).catch(err => {
...@@ -197,6 +202,8 @@ export default { ...@@ -197,6 +202,8 @@ export default {
this.$store.dispatch('setCurrentCarInfo', selectItem) this.$store.dispatch('setCurrentCarInfo', selectItem)
} }
this.$refs.carBoxVisible?.close(); this.$refs.carBoxVisible?.close();
this.$refs.carBrandListVisible?.close();
this.carBrandListOff = false
this.$store.dispatch('setCarBrandOpenStatus', false) this.$store.dispatch('setCarBrandOpenStatus', false)
this.$emit('select', { this.$emit('select', {
...item, ...item,
...@@ -211,10 +218,16 @@ export default { ...@@ -211,10 +218,16 @@ export default {
}, },
closeCarBoxVisible() { closeCarBoxVisible() {
if (this.carBrandListOff) return // 关车系弹窗:若还要从品牌列表回来,保持打开态;否则关闭
else this.$emit('close') if (this.carBrandListOff) {
this.$store.dispatch('setCarBrandOpenStatus', true)
return
}
this.$store.dispatch('setCarBrandOpenStatus', false)
this.$emit('close')
}, },
clickClose() { clickClose() {
this.carBrandListOff = false
this.$store.dispatch('setCarBrandOpenStatus', false) this.$store.dispatch('setCarBrandOpenStatus', false)
this.$emit('close') this.$emit('close')
}, },
......
const target = ['ip', 'dev', 'uat', 'prod', 'beta'] const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 1 const index = 2
/** /**
* *
0本地 0本地
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
:drawStatus="penSwitch" :drawStatus="penSwitch"
custom custom
@scale="$emit('scale',$event)" @scale="$emit('scale',$event)"
ref="canvasRef"
> >
<template slot="customContent"> <template slot="customContent">
<view class="layout-content"> <view class="layout-content">
...@@ -64,10 +65,6 @@ ...@@ -64,10 +65,6 @@
class="content-image" class="content-image"
:src="contentUrl()" :src="contentUrl()"
/> />
<!-- <image
class="content-bg"
:src="receptionBg()"
/> -->
</view> </view>
</view> </view>
</template> </template>
...@@ -75,7 +72,7 @@ ...@@ -75,7 +72,7 @@
<car-brands <car-brands
ref="carBrandListVisible" ref="carBrandListVisible"
@select="handleSelect($event,'carBrandListVisible')" @select="handleSelect($event,'carBrandListVisible')"
@close="resetFocusIndex" @close="onBrandClose"
/> />
</view> </view>
</template> </template>
...@@ -154,6 +151,23 @@ export default { ...@@ -154,6 +151,23 @@ export default {
inputCustomer () { inputCustomer () {
this.$store.dispatch('setCustomerInfo', this.customerInfo) this.$store.dispatch('setCustomerInfo', this.customerInfo)
}, },
showPopup (e, index) {
this.focusIndex = index
if (e === 'carBrandListVisible') this.$emit('brandPopupChange', true)
this.$refs[e].open()
},
closeAllPopup () {
this.$refs.carBrandListVisible.close()
this.resetFocusIndex()
this.$emit('brandPopupChange', false)
},
onBrandClose () {
this.resetFocusIndex()
this.$emit('brandPopupChange', false)
},
resetFocusIndex () {
this.focusIndex = -1
},
handleSelect (item, popkey) { handleSelect (item, popkey) {
this.$refs[popkey].close() this.$refs[popkey].close()
if (popkey == 'employeeBoxVisible') { if (popkey == 'employeeBoxVisible') {
...@@ -165,19 +179,9 @@ export default { ...@@ -165,19 +179,9 @@ export default {
this.customerInfo.carModelId = item.id this.customerInfo.carModelId = item.id
} }
this.resetFocusIndex() this.resetFocusIndex()
this.$emit('brandPopupChange', false)
this.$store.dispatch('setCustomerInfo', this.customerInfo) this.$store.dispatch('setCustomerInfo', this.customerInfo)
}, },
showPopup (e, index) {
this.focusIndex = index
this.$refs[e].open()
},
closeAllPopup () {
this.$refs.carBrandListVisible.close()
this.resetFocusIndex()
},
resetFocusIndex () {
this.focusIndex = -1
},
chooseCustomer (e) { chooseCustomer (e) {
this.customerInfo = { this.customerInfo = {
...this.customerInfo, ...this.customerInfo,
...@@ -232,10 +236,13 @@ export default { ...@@ -232,10 +236,13 @@ export default {
color: #1a1a1a; color: #1a1a1a;
} }
.content { .content {
position: relative;
width: 100%;
height: 100%;
.form-box { .form-box {
height: toRpx(80); height: toRpx(80);
padding: 0 toRpx(110); padding: 0 toRpx(110);
z-index: 2; z-index: 3;
position: absolute; position: absolute;
left: toRpx(64); left: toRpx(64);
top: toRpx(168); top: toRpx(168);
......
...@@ -29,7 +29,11 @@ ...@@ -29,7 +29,11 @@
<!-- 极端性能优化:只渲染当前页及其左右邻居的空壳容器,更远的直接移除 DOM --> <!-- 极端性能优化:只渲染当前页及其左右邻居的空壳容器,更远的直接移除 DOM -->
<view <view
v-if="shouldRender(index)" v-if="shouldRender(index)"
:class="['view', { showView: id == item.id }, modeName]" :class="[
'view',
{ showView: id == item.id },
modeName
]"
:key="item.id" :key="item.id"
:style="getViewStyle(item.id)" :style="getViewStyle(item.id)"
@touchstart.stop="touchStart" @touchstart.stop="touchStart"
...@@ -44,7 +48,7 @@ ...@@ -44,7 +48,7 @@
v-if="isComponentLoaded(index) && shouldRenderContent(index)" v-if="isComponentLoaded(index) && shouldRenderContent(index)"
@full="handleFull" @full="handleFull"
:detail="item" :detail="item"
:is="item.componentName" :is="normalizeComponentName(item.componentName)"
:views="item.receptionSourceDetailList || []" :views="item.receptionSourceDetailList || []"
:penSwitch="penSwitch" :penSwitch="penSwitch"
:show="id == item.id" :show="id == item.id"
...@@ -59,6 +63,7 @@ ...@@ -59,6 +63,7 @@
:isByd="isByd" :isByd="isByd"
:hasCarBrand="item.hasCarBrand" :hasCarBrand="item.hasCarBrand"
:aitoCarModelIds="aitoCarModelIds" :aitoCarModelIds="aitoCarModelIds"
@brandPopupChange="brandPopupVisible = $event"
/> />
</view> </view>
</view> </view>
...@@ -97,7 +102,7 @@ ...@@ -97,7 +102,7 @@
@finish="open" @finish="open"
/> />
<view <view
v-if="showLongImageBtn" v-if="showLongImageBtn && !longImagePopupVisible && !brandPopupVisible && !carBrandOpenStatus"
class="long-image-btn" class="long-image-btn"
@click.stop="openLongImagePopup" @click.stop="openLongImagePopup"
> >
...@@ -113,7 +118,7 @@ ...@@ -113,7 +118,7 @@
</template> </template>
<script> <script>
import ToolBox from '@/components/ToolBox.vue' import ToolBox from '@/components/ToolBox.vue'
import Reception from './components/Reception.vue' import ReceptionPage from './components/Reception.vue'
import CaseCenter from './components/CaseCenter.vue' import CaseCenter from './components/CaseCenter.vue'
import MediaComponent from './components/MediaComponent.vue' import MediaComponent from './components/MediaComponent.vue'
import History from './components/History.vue' import History from './components/History.vue'
...@@ -127,7 +132,7 @@ import { receptionTrackMixin } from '@/mixin/index.js' ...@@ -127,7 +132,7 @@ import { receptionTrackMixin } from '@/mixin/index.js'
export default { export default {
components: { components: {
ToolBox, ToolBox,
Reception, Reception: ReceptionPage,
MediaComponent, MediaComponent,
payPop, payPop,
CaseCenter, CaseCenter,
...@@ -167,8 +172,9 @@ export default { ...@@ -167,8 +172,9 @@ export default {
currentMediaId: '', currentMediaId: '',
touchDiffX: 0, touchDiffX: 0,
isTouching: false, isTouching: false,
loadedIndexes: [], // 记录已加载组件的索引 loadedIndexes: [],
longImagePopupVisible: false longImagePopupVisible: false,
brandPopupVisible: false
} }
}, },
computed: { computed: {
...@@ -363,19 +369,6 @@ export default { ...@@ -363,19 +369,6 @@ export default {
handleFull (val) { handleFull (val) {
this.backZindex = val ? 0 : 9 this.backZindex = val ? 0 : 9
}, },
/**切换素材 */
choose (e) {
Object.keys(this.$refs).map(refKey => {
let ref = this.$refs[refKey]
if (ref) {
if (Array.isArray(ref)) ref = ref[0]
ref && ref.closeAllPopup && ref.closeAllPopup()
}
})
this.receptionTrackLeave()
this.$emit('update:id', e.id)
uni.$logger.local.info(`预览${e.title}`)
},
back () { back () {
if (this.longImagePopupVisible) { if (this.longImagePopupVisible) {
this.closeLongImagePopup() this.closeLongImagePopup()
...@@ -392,6 +385,21 @@ export default { ...@@ -392,6 +385,21 @@ export default {
this.receptionTrackLeave() this.receptionTrackLeave()
this.$emit('done', e) this.$emit('done', e)
}, },
/**切换素材 */
choose (e) {
this.closeLongImagePopup()
this.brandPopupVisible = false
Object.keys(this.$refs).map(refKey => {
let ref = this.$refs[refKey]
if (ref) {
if (Array.isArray(ref)) ref = ref[0]
ref && ref.closeAllPopup && ref.closeAllPopup()
}
})
this.receptionTrackLeave()
this.$emit('update:id', e.id)
uni.$logger.local.info(`预览${e.title}`)
},
toPay () { toPay () {
this.$refs.pay.show() this.$refs.pay.show()
}, },
...@@ -560,15 +568,9 @@ export default { ...@@ -560,15 +568,9 @@ export default {
let storageName = `source_${sceneType}_${shopMerchantId}_${carBrandId}_${carChildsBrandId}` let storageName = `source_${sceneType}_${shopMerchantId}_${carBrandId}_${carChildsBrandId}`
let data = uni.getStorageSync(storageName) let data = uni.getStorageSync(storageName)
try { try {
uni.$logger?.local?.info?.(`[equity/detail] setPageData start, shopMerchantId=${shopMerchantId}, sceneType=${sceneType}, brandId=${carBrandId}, subBrandId=${carChildsBrandId}`)
let requestData = await uni.$api.systemApi.getSoureData(shopMerchantId, sceneType, params) let requestData = await uni.$api.systemApi.getSoureData(shopMerchantId, sceneType, params)
uni.$logger?.local?.info?.(`[equity/detail] getSoureData done, hasData=${!!requestData}, moduleListLength=${requestData?.moduleList?.length || 0}`)
console.log('[equity/detail] getSoureData result:', requestData)
console.log('[equity/detail] getSoureData moduleList:', requestData?.moduleList || [])
if (requestData) this.setViewInfo(requestData) if (requestData) this.setViewInfo(requestData)
} catch (error) { } catch (error) {
uni.$logger?.local?.info?.(`[equity/detail] getSoureData error: ${error}`)
console.log('[equity/detail] getSoureData error:', error)
if (data) this.setViewInfo(data) if (data) this.setViewInfo(data)
} }
}, },
...@@ -670,8 +672,9 @@ export default { ...@@ -670,8 +672,9 @@ export default {
}, },
openLongImagePopup () { openLongImagePopup () {
if (!this.showLongImageBtn) return if (!this.showLongImageBtn) return
// 查看长图时关闭画笔并清空当前页笔迹
this.clearPenBoard()
const item = this.currentMaterial || {} const item = this.currentMaterial || {}
const matchedDetail = this.getMatchedMaterialDetail(item)
if (item?.id) { if (item?.id) {
const businessParam = { const businessParam = {
materialId: item.id, materialId: item.id,
...@@ -681,10 +684,36 @@ export default { ...@@ -681,10 +684,36 @@ export default {
uni.$track.add({ eventCode: 'app-longImage-detail', businessParam }) uni.$track.add({ eventCode: 'app-longImage-detail', businessParam })
} }
this.longImagePopupVisible = true this.longImagePopupVisible = true
this.$nextTick(() => this.clearPenBoard())
},
// 接口 componentName 可能是小写 reception,需映射到已注册的 Reception
normalizeComponentName (name) {
if (!name) return name
const key = String(name)
if (key.toLowerCase() === 'reception') return 'Reception'
return key
},
clearPenBoard () {
this.drawStatus = false
let mediaRef = this.$refs['media' + this.id]
if (Array.isArray(mediaRef)) mediaRef = mediaRef[0]
if (!mediaRef) return
// Reception / MediaComponent / ThreeGuarantees 上的画布
let canvasRef =
mediaRef.$refs?.canvasRef ||
mediaRef.$refs?.threeGuarantees ||
mediaRef.$refs?.receptionCanvas
if (Array.isArray(canvasRef)) canvasRef = canvasRef[0]
if (canvasRef?.clearBoard) {
canvasRef.clearBoard()
return
}
// 兼容直接挂在子组件上的 clearBoard
mediaRef.clearBoard?.()
}, },
closeLongImagePopup () { closeLongImagePopup () {
const item = this.currentMaterial || {} const item = this.currentMaterial || {}
if (item?.id) { if (this.longImagePopupVisible && item?.id) {
const businessParam = { const businessParam = {
materialId: item.id, materialId: item.id,
title: item.title || item.detailTitle || item.materialTitle title: item.title || item.detailTitle || item.materialTitle
...@@ -799,7 +828,7 @@ export default { ...@@ -799,7 +828,7 @@ export default {
left: 50%; left: 50%;
bottom: toRpx(48); bottom: toRpx(48);
transform: translateX(-50%); transform: translateX(-50%);
z-index: 20; z-index: 11;
padding: toRpx(14) toRpx(36); padding: toRpx(14) toRpx(36);
border-radius: toRpx(32); border-radius: toRpx(32);
font-size: toRpx(28); font-size: toRpx(28);
...@@ -828,7 +857,7 @@ export default { ...@@ -828,7 +857,7 @@ export default {
font-size: toRpx(48); font-size: toRpx(48);
color: #ffffff; color: #ffffff;
background: rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.16);
z-index: 2; z-index: 30;
} }
.popup-scroll { .popup-scroll {
width: 100%; width: 100%;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!