Commit d965bcf9 by 岑成威

fix:轮播图

1 parent e685a44b
...@@ -135,18 +135,23 @@ const getImageVersion = async () => { ...@@ -135,18 +135,23 @@ 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') 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) {
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)
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)
...@@ -184,6 +189,8 @@ const getSoureData = async (shopMerchantId, sceneType, params = {}) => { ...@@ -184,6 +189,8 @@ 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,
......
...@@ -45,6 +45,13 @@ ...@@ -45,6 +45,13 @@
></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">
...@@ -64,6 +71,12 @@ ...@@ -64,6 +71,12 @@
<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>
...@@ -105,7 +118,11 @@ export default { ...@@ -105,7 +118,11 @@ export default {
default: () => ({}) default: () => ({})
}, },
custom: Boolean, custom: Boolean,
swiperType: [Number, String] swiperType: [Number, String],
longImageFlagKey: {
type: String,
default: 'isLongImage'
}
}, },
watch: { watch: {
moduleList: { moduleList: {
...@@ -128,6 +145,15 @@ export default { ...@@ -128,6 +145,15 @@ 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 () {
...@@ -149,7 +175,8 @@ export default { ...@@ -149,7 +175,8 @@ export default {
{ index: 2, class: 'block-right' } { index: 2, class: 'block-right' }
]), ]),
blockX: 0, blockX: 0,
viewX: 0 viewX: 0,
longImagePopupVisible: false
} }
}, },
beforeDestroy () { beforeDestroy () {
...@@ -309,6 +336,13 @@ export default { ...@@ -309,6 +336,13 @@ 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
...@@ -464,6 +498,51 @@ export default { ...@@ -464,6 +498,51 @@ 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 = 2 const index = 1
/** /**
* *
0本地 0本地
......
...@@ -507,9 +507,15 @@ export default { ...@@ -507,9 +507,15 @@ 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)
} }
}, },
......
...@@ -148,12 +148,15 @@ export default { ...@@ -148,12 +148,15 @@ export default {
// 查询素材 // 查询素材
async getSoure (brandIdList, subBrandIdList) { async getSoure (brandIdList, subBrandIdList) {
const { shopMerchantId, sceneType } = this const { shopMerchantId, sceneType } = this
uni.$logger?.local?.info?.(`[equity/index] getSoure start, shopMerchantId=${shopMerchantId}, sceneType=${sceneType}`)
let data = uni.getStorageSync(`source_${sceneType}_${shopMerchantId}`) let data = uni.getStorageSync(`source_${sceneType}_${shopMerchantId}`)
if (data) this.setViewInfo(data) if (data) this.setViewInfo(data)
uni.$logger?.local?.info?.('[equity/index] calling systemApi.getSoureData')
let requestData = await uni.$api.systemApi.getSoureData(shopMerchantId, sceneType, { let requestData = await uni.$api.systemApi.getSoureData(shopMerchantId, sceneType, {
brandIdList, brandIdList,
subBrandIdList subBrandIdList
}) })
uni.$logger?.local?.info?.(`[equity/index] getSoureData done, hasData=${!!requestData}`)
if (requestData) this.setViewInfo(requestData) if (requestData) this.setViewInfo(requestData)
else this.loadComplete = true else this.loadComplete = true
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!