Commit 544667ef by 岑成威

fix: app商品

1 parent 4867473b
...@@ -147,10 +147,96 @@ const getSoureData = async (shopMerchantId, sceneType, params = {}) => { ...@@ -147,10 +147,96 @@ const getSoureData = async (shopMerchantId, sceneType, params = {}) => {
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) 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) 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}`) 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'),
......
...@@ -45,13 +45,6 @@ ...@@ -45,13 +45,6 @@
></div> ></div>
</template> </template>
</view> </view>
<view
v-if="showLongImageBtn"
class="long-image-btn"
@click.stop="openLongImagePopup"
>
查看长图
</view>
</template> </template>
<template v-else> <template v-else>
<view class="nothing flex"> <view class="nothing flex">
...@@ -71,12 +64,6 @@ ...@@ -71,12 +64,6 @@
<image class="gif" src="../assets/images/common/loadding.gif" /> <image class="gif" src="../assets/images/common/loadding.gif" />
</view> </view>
</template> </template>
<view v-if="longImagePopupVisible" class="long-image-popup" @click.stop>
<view class="popup-close" @click.stop="closeLongImagePopup">×</view>
<scroll-view class="popup-scroll" scroll-y show-scrollbar>
<image class="popup-long-image" :src="currentImageUrl" mode="widthFix" />
</scroll-view>
</view>
</view> </view>
</template> </template>
<script> <script>
...@@ -118,11 +105,7 @@ export default { ...@@ -118,11 +105,7 @@ export default {
default: () => ({}) default: () => ({})
}, },
custom: Boolean, custom: Boolean,
swiperType: [Number, String], swiperType: [Number, String]
longImageFlagKey: {
type: String,
default: 'isLongImage'
}
}, },
watch: { watch: {
moduleList: { moduleList: {
...@@ -130,8 +113,9 @@ export default { ...@@ -130,8 +113,9 @@ export default {
if (!val.length) { if (!val.length) {
this.datalist = [] this.datalist = []
this.imagelist = [] this.imagelist = []
return
} }
if (val.length && !this.imagelist.length) this.getDatalist() if (!this.imagelist.length) this.getDatalist()
}, },
deep: true deep: true
}, },
...@@ -145,15 +129,6 @@ export default { ...@@ -145,15 +129,6 @@ export default {
computed: { computed: {
moduleTitle () { moduleTitle () {
return this.moduleList[this.currentIndex]?.detailTitle || '' return this.moduleList[this.currentIndex]?.detailTitle || ''
},
currentModule () {
return this.moduleList[this.currentIndex] || {}
},
currentImageUrl () {
return this.currentModule?.[this.imgKey] || ''
},
showLongImageBtn () {
return !!this.currentModule?.[this.longImageFlagKey] && !!this.currentImageUrl
} }
}, },
created () { created () {
...@@ -175,8 +150,7 @@ export default { ...@@ -175,8 +150,7 @@ export default {
{ index: 2, class: 'block-right' } { index: 2, class: 'block-right' }
]), ]),
blockX: 0, blockX: 0,
viewX: 0, viewX: 0
longImagePopupVisible: false
} }
}, },
beforeDestroy () { beforeDestroy () {
...@@ -336,13 +310,6 @@ export default { ...@@ -336,13 +310,6 @@ export default {
if (toor == 2) this.updateCarouselPositions() if (toor == 2) this.updateCarouselPositions()
this.$emit('click', item.isIndex) this.$emit('click', item.isIndex)
}, },
openLongImagePopup () {
if (!this.showLongImageBtn) return
this.longImagePopupVisible = true
},
closeLongImagePopup () {
this.longImagePopupVisible = false
},
starts (e) { starts (e) {
this.ismove = e.touches[0].pageX this.ismove = e.touches[0].pageX
this.playStatus = false this.playStatus = false
...@@ -498,51 +465,6 @@ export default { ...@@ -498,51 +465,6 @@ export default {
background: #fff; background: #fff;
} }
} }
.long-image-btn {
position: absolute;
left: 50%;
bottom: toRpx(40);
transform: translateX(-50%);
z-index: 25;
padding: toRpx(12) toRpx(28);
border-radius: toRpx(28);
font-size: toRpx(24);
color: #ffffff;
background: linear-gradient(90deg, #61c0ff 0%, #2c66f7 100%);
}
.long-image-popup {
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
z-index: 9999;
background: rgba(0, 0, 0, 0.92);
.popup-close {
position: absolute;
right: toRpx(28);
top: toRpx(28);
width: toRpx(56);
height: toRpx(56);
line-height: toRpx(56);
text-align: center;
border-radius: 50%;
font-size: toRpx(48);
color: #ffffff;
background: rgba(255, 255, 255, 0.16);
z-index: 2;
}
.popup-scroll {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: toRpx(100) 0 toRpx(40);
}
.popup-long-image {
width: 100%;
display: block;
}
}
.nothing { .nothing {
width: 100%; width: 100%;
height: 100%; height: 100%;
......
const target = ['ip', 'dev', 'uat', 'prod', 'beta'] const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 1 const index = 2
/** /**
* *
0本地 0本地
......
...@@ -163,7 +163,6 @@ export default { ...@@ -163,7 +163,6 @@ export default {
console.log(this.orderObj, 'orderObj') console.log(this.orderObj, 'orderObj')
handleTransactionData(newVal) handleTransactionData(newVal)
} else { } else {
this.userInfo = uni.$storage.get('userInfo') || {}
this.baseConfigData = uni.$storage.get('mock_data') || {} this.baseConfigData = uni.$storage.get('mock_data') || {}
this.orderCreateType = 'createWithPay' this.orderCreateType = 'createWithPay'
this.orderObj = { this.orderObj = {
...@@ -193,7 +192,6 @@ export default { ...@@ -193,7 +192,6 @@ export default {
orderCreateType: 'createWithPay', // supplementOrder(补录订单) createWithPay(新增) orderCreateType: 'createWithPay', // supplementOrder(补录订单) createWithPay(新增)
titleList, titleList,
formList: utils.deepClone(FORM_LIST), formList: utils.deepClone(FORM_LIST),
userInfo: {},
baseConfigData: {}, baseConfigData: {},
requiredList: [], // 录单设置的必填项 requiredList: [], // 录单设置的必填项
orderObj: { orderObj: {
...@@ -260,7 +258,6 @@ export default { ...@@ -260,7 +258,6 @@ export default {
}, },
mounted() { mounted() {
console.log('mounted', this.orderCreateType) console.log('mounted', this.orderCreateType)
this.userInfo = uni.$storage.get('userInfo') || {}
this.baseConfigData = uni.$storage.get('mock_data') || {} this.baseConfigData = uni.$storage.get('mock_data') || {}
this.initData() this.initData()
}, },
......
...@@ -96,6 +96,19 @@ ...@@ -96,6 +96,19 @@
:showPayPage.sync="showPayPage" :showPayPage.sync="showPayPage"
@finish="open" @finish="open"
/> />
<view
v-if="showLongImageBtn"
class="long-image-btn"
@click.stop="openLongImagePopup"
>
查看长图
</view>
<view v-if="longImagePopupVisible" class="long-image-popup" @click.stop>
<view class="popup-close" @click.stop="closeLongImagePopup">×</view>
<scroll-view class="popup-scroll" scroll-y show-scrollbar>
<image class="popup-long-image" :src="longImageUrl" mode="widthFix" />
</scroll-view>
</view>
</view> </view>
</template> </template>
<script> <script>
...@@ -154,7 +167,8 @@ export default { ...@@ -154,7 +167,8 @@ export default {
currentMediaId: '', currentMediaId: '',
touchDiffX: 0, touchDiffX: 0,
isTouching: false, isTouching: false,
loadedIndexes: [] // 记录已加载组件的索引 loadedIndexes: [], // 记录已加载组件的索引
longImagePopupVisible: false
} }
}, },
computed: { computed: {
...@@ -216,6 +230,37 @@ export default { ...@@ -216,6 +230,37 @@ export default {
if (!this.renderList || !this.renderList.length) return -1 if (!this.renderList || !this.renderList.length) return -1
return this.renderList.findIndex(i => i.id == this.id) return this.renderList.findIndex(i => i.id == this.id)
}, },
currentMaterial () {
if (this.currentIndex < 0) return {}
return this.renderList[this.currentIndex] || {}
},
longImageUrl () {
const item = this.currentMaterial || {}
const matched = this.getMatchedMaterialDetail(item)
// 有车系详情时,图也以匹配到的 materialDetailList 项为准(未选车则无图)
if (Array.isArray(item.materialDetailList) && item.materialDetailList.length) {
return matched?.contentPicUrl || ''
}
const carKey = this.getCustomerCarKey()
const views = item.receptionSourceDetailList
// 车系映射:{ [seriesId]: url }
if (views && typeof views === 'object' && !Array.isArray(views) && !views.detailUrl) {
if (carKey && views[carKey]) return views[carKey]
const firstUrl = Object.values(views).find(v => typeof v === 'string' && v)
if (firstUrl) return firstUrl
}
if (views?.detailUrl) return views.detailUrl
if (Array.isArray(views) && views[0]?.detailUrl) return views[0].detailUrl
return item.homeEntranceCover || item.thumbnail || item.contentPicUrl || ''
},
showLongImageBtn () {
return this.isLongImageItem(this.currentMaterial) && !!this.longImageUrl
},
carBrandOpenStatus () { carBrandOpenStatus () {
return this.$store.state.user.carBrandOpenStatus return this.$store.state.user.carBrandOpenStatus
}, },
...@@ -261,6 +306,7 @@ export default { ...@@ -261,6 +306,7 @@ export default {
immediate: true, immediate: true,
handler (newval) { handler (newval) {
if (newval) { if (newval) {
this.closeLongImagePopup()
this.useCarConfig = false this.useCarConfig = false
this.dateilKey = Date.now() this.dateilKey = Date.now()
this.pageToolList = this.toolList this.pageToolList = this.toolList
...@@ -278,7 +324,8 @@ export default { ...@@ -278,7 +324,8 @@ export default {
id: { id: {
immediate: true, immediate: true,
handler (newval) { handler (newval) {
if(!this.pageToolList.length) this.pageToolList = this.toolList this.closeLongImagePopup()
if (!this.pageToolList.length) this.pageToolList = this.toolList
} }
} }
// toolList: { // toolList: {
...@@ -293,6 +340,7 @@ export default { ...@@ -293,6 +340,7 @@ export default {
this.screenWidth = systemInfo.screenWidth this.screenWidth = systemInfo.screenWidth
}, },
beforeDestroy() { beforeDestroy() {
this.closeLongImagePopup()
// 1. 清理所有定时器 // 1. 清理所有定时器
if (this.preloadTimer) clearTimeout(this.preloadTimer) if (this.preloadTimer) clearTimeout(this.preloadTimer)
if (this.rafId) clearTimeout(this.rafId) // 兼容 raf if (this.rafId) clearTimeout(this.rafId) // 兼容 raf
...@@ -329,11 +377,16 @@ export default { ...@@ -329,11 +377,16 @@ export default {
uni.$logger.local.info(`预览${e.title}`) uni.$logger.local.info(`预览${e.title}`)
}, },
back () { back () {
if (this.longImagePopupVisible) {
this.closeLongImagePopup()
return
}
this.$refs?.toolRef?.hide() this.$refs?.toolRef?.hide()
this.$emit('back') this.$emit('back')
}, },
done (e) { done (e) {
this.showPayPage = false this.showPayPage = false
this.closeLongImagePopup()
this.$refs.toolRef.hide() this.$refs.toolRef.hide()
this.$refs.stepRef.close() this.$refs.stepRef.close()
this.receptionTrackLeave() this.receptionTrackLeave()
...@@ -575,6 +628,52 @@ export default { ...@@ -575,6 +628,52 @@ export default {
if (!this.loadedIndexes.includes(index)) { if (!this.loadedIndexes.includes(index)) {
this.loadedIndexes.push(index) this.loadedIndexes.push(index)
} }
},
getCustomerCarKey () {
const customerInfo = this.customerInfo || {}
return (
customerInfo.carModelId ||
customerInfo.carSeriesId ||
customerInfo.oneCarBrandId ||
''
)
},
// 与接待页 views[carModelId] 一致:必须已选车才能匹配;未选车返回 null
getMatchedMaterialDetail (item = {}) {
const list = item.materialDetailList
if (!Array.isArray(list) || !list.length) return null
const carKey = this.getCustomerCarKey()
if (!carKey) return null
return (
list.find(
d =>
String(d.relVehicleSeriesId) === String(carKey) ||
String(d.relVehicleModelId) === String(carKey)
) || null
)
},
isTruthyLongImageFlag (flag) {
return flag === true || flag === 1 || flag === '1' || flag === 'true'
},
isLongImageItem (item = {}) {
if (!item || !Object.keys(item).length) return false
// 有 materialDetailList:必须已选车系且匹配项 longImage 为 true 才显示
if (Array.isArray(item.materialDetailList) && item.materialDetailList.length) {
const matched = this.getMatchedMaterialDetail(item)
if (!matched) return false
return this.isTruthyLongImageFlag(matched.longImage ?? matched.isLongImage)
}
// 无车系详情列表时,才看素材外层字段
return this.isTruthyLongImageFlag(item.longImage ?? item.isLongImage)
},
openLongImagePopup () {
if (!this.showLongImageBtn) return
this.longImagePopupVisible = true
},
closeLongImagePopup () {
this.longImagePopupVisible = false
} }
} }
} }
...@@ -676,4 +775,51 @@ export default { ...@@ -676,4 +775,51 @@ export default {
opacity: 1; opacity: 1;
} }
} }
.long-image-btn {
position: fixed;
left: 50%;
bottom: toRpx(48);
transform: translateX(-50%);
z-index: 20;
padding: toRpx(14) toRpx(36);
border-radius: toRpx(32);
font-size: toRpx(28);
line-height: toRpx(36);
color: #ffffff;
background: linear-gradient(90deg, #61c0ff 0%, #2c66f7 100%);
white-space: nowrap;
}
.long-image-popup {
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
z-index: 9999;
background: rgba(0, 0, 0, 0.92);
.popup-close {
position: absolute;
right: toRpx(28);
top: toRpx(28);
width: toRpx(56);
height: toRpx(56);
line-height: toRpx(56);
text-align: center;
border-radius: 50%;
font-size: toRpx(48);
color: #ffffff;
background: rgba(255, 255, 255, 0.16);
z-index: 2;
}
.popup-scroll {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: toRpx(100) 0 toRpx(40);
}
.popup-long-image {
width: 100%;
display: block;
}
}
</style> </style>
...@@ -200,6 +200,7 @@ export default { ...@@ -200,6 +200,7 @@ export default {
}, },
// 完成接待 // 完成接待
done (e) { done (e) {
this.$refs.detail?.closeLongImagePopup?.()
this.$refs.home.finishRef.close() this.$refs.home.finishRef.close()
if (this.recording) this.$refs.home.stopAudio() if (this.recording) this.$refs.home.stopAudio()
this.recording = false this.recording = false
...@@ -213,12 +214,18 @@ export default { ...@@ -213,12 +214,18 @@ export default {
}, },
back () { back () {
const detailRef = this.$refs.detail const detailRef = this.$refs.detail
if (detailRef.showPayPage) return (detailRef.showPayPage = false) // 手势/物理返回走父页,须先关掉详情里的长图弹层,否则组件常挂载会把状态带回
if (detailRef?.longImagePopupVisible) {
detailRef.closeLongImagePopup()
return
}
if (detailRef?.showPayPage) return (detailRef.showPayPage = false)
if (!this.id) return uni.navigateBack() if (!this.id) return uni.navigateBack()
if (this.type != 'preview') return this.$refs.home.finishRef.open() if (this.type != 'preview') return this.$refs.home.finishRef.open()
this.backHome() this.backHome()
}, },
backHome () { backHome () {
this.$refs.detail?.closeLongImagePopup?.()
if (this.recording) this.$refs.home.stopAudio(true) if (this.recording) this.$refs.home.stopAudio(true)
this.$refs.home.finishRef.close() this.$refs.home.finishRef.close()
this.id = '' this.id = ''
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!