Commit dbdabf98 by 李伟康

commit

1 parent 2d67bd18
...@@ -53,7 +53,7 @@ const getMockData = async (immediate = false) => { ...@@ -53,7 +53,7 @@ const getMockData = async (immediate = false) => {
} }
} }
/** /**
*获取后台素材配置 *获取后台轻改素材配置
*/ */
const findReceptionpriproConfigList = data => { const findReceptionpriproConfigList = data => {
return http.post({ return http.post({
...@@ -63,6 +63,26 @@ const findReceptionpriproConfigList = data => { ...@@ -63,6 +63,26 @@ const findReceptionpriproConfigList = data => {
}) })
} }
/** /**
*获取后台延保素材ID
*/
const getEquityMaterialId = data => {
return http.post({
method: 'dj.api.smartcarlife.reception.home.page.material.view',
projectName: 'boutique',
...data
})
}
/**
*获取后台延保素材配置
*/
const getEquityMaterialConfig = data => {
return http.post({
method: 'dj.api.car.boutique.reception.home.page.entrance.material.detail',
projectName: 'boutique',
...data
})
}
/**
*获取轻改配置 *获取轻改配置
*/ */
const getBoutiqueMockData = async (immediate = false) => { const getBoutiqueMockData = async (immediate = false) => {
...@@ -105,7 +125,30 @@ const getImageVersion = async () => { ...@@ -105,7 +125,30 @@ const getImageVersion = async () => {
return accountInfo?.version || Date.now() return accountInfo?.version || Date.now()
} }
/**获取素材配置 */ /**获取素材配置 */
const getSoureData = async (channelType = 1, shopMerchantId, sceneType = 0) => { const getSoureData = async (shopMerchantId, sceneType) => {
try {
const { id } = await getEquityMaterialId({
merchantId: shopMerchantId
})
if (id) {
let data = await getEquityMaterialConfig({
id
}),
{ toolList, materialInfoList } = data,
storageName = `source_${sceneType}_${shopMerchantId}`
data.moduleList = materialInfoList
data.moduleList = await imgTransformBase64(materialInfoList, ['thumbnail', 'receptionSourceDetailList', 'screenList'])
data.toolList = await imgTransformBase64(toolList, ['shortTitleUrl'])
uni.setStorageSync(storageName, {
moduleList, toolList
})
return Promise.resolve(data)
}
} catch (error) {
console.log(error)
}
return
// const getSoureData = async (channelType = 1, shopMerchantId, sceneType = 0) => {
const sceneData = await http.uni_request({ url: appConfigUrl }), const sceneData = await http.uni_request({ url: appConfigUrl }),
{ brandIds, merchantIds, caseCenterIds } = sceneData[sceneType] { brandIds, merchantIds, caseCenterIds } = sceneData[sceneType]
let targetUrl, let targetUrl,
...@@ -160,7 +203,7 @@ const getSoureData = async (channelType = 1, shopMerchantId, sceneType = 0) => { ...@@ -160,7 +203,7 @@ const getSoureData = async (channelType = 1, shopMerchantId, sceneType = 0) => {
/**批量图片转base64 */ /**批量图片转base64 */
const imgTransformBase64 = async (imgList = [], keyList = []) => { const imgTransformBase64 = async (imgList = [], keyList = []) => {
return await Promise.all( return await Promise.all(
imgList.map(async e => { imgList?.map(async e => {
await Promise.all( await Promise.all(
Object.keys(e).map(async key => { Object.keys(e).map(async key => {
if (keyList.includes(key)) { if (keyList.includes(key)) {
...@@ -171,7 +214,7 @@ const imgTransformBase64 = async (imgList = [], keyList = []) => { ...@@ -171,7 +214,7 @@ const imgTransformBase64 = async (imgList = [], keyList = []) => {
await Promise.all( await Promise.all(
Object.keys(i).map(async k => { Object.keys(i).map(async k => {
// i[`original_${k}`] = JSON.parse(JSON.stringify(i[k])) // i[`original_${k}`] = JSON.parse(JSON.stringify(i[k]))
if (k == 'detailUrl') i[k] = await getBase64(i[k]) if (k == 'detailUrl' && i[k]) i[k] = await getBase64(i[k])
}) })
) )
}) })
...@@ -181,7 +224,7 @@ const imgTransformBase64 = async (imgList = [], keyList = []) => { ...@@ -181,7 +224,7 @@ const imgTransformBase64 = async (imgList = [], keyList = []) => {
// e[`original_${key}`] = JSON.parse(JSON.stringify(e[key])) // e[`original_${key}`] = JSON.parse(JSON.stringify(e[key]))
e[key] = await getBase64(e[key]) e[key] = await getBase64(e[key])
} }
if (typeof e[key] === 'object') { if (e[key] && typeof e[key] === 'object') {
await Promise.all( await Promise.all(
Object.keys(e[key]).map(async k => { Object.keys(e[key]).map(async k => {
// e[key][`original_${k}`] = JSON.parse(JSON.stringify(e[key][k])) // e[key][`original_${k}`] = JSON.parse(JSON.stringify(e[key][k]))
...@@ -219,5 +262,7 @@ module.exports = { ...@@ -219,5 +262,7 @@ module.exports = {
getMockData, getMockData,
getBoutiqueMockData, getBoutiqueMockData,
findReceptionpriproConfigList, findReceptionpriproConfigList,
getSoureData getSoureData,
getEquityMaterialId,
getEquityMaterialConfig
} }
...@@ -43,8 +43,9 @@ ...@@ -43,8 +43,9 @@
</view> </view>
</view> </view>
<template v-if="list.length > 0"> <template v-if="list.length > 0">
<!-- { 'has-tabs': views && views.length > 1 } -->
<scroll-view <scroll-view
:class="['record-box', { 'has-tabs': views && views.length > 1 }]" :class="['record-box']"
scroll-y scroll-y
:scroll-top="scrollTop" :scroll-top="scrollTop"
@scrolltolower="pageonReachBottom" @scrolltolower="pageonReachBottom"
...@@ -145,7 +146,7 @@ export default { ...@@ -145,7 +146,7 @@ export default {
madiaId: Number, madiaId: Number,
show: Boolean, show: Boolean,
isByd: Boolean, isByd: Boolean,
views: Array // views: Array
}, },
data () { data () {
return { return {
......
...@@ -22,16 +22,21 @@ ...@@ -22,16 +22,21 @@
/> />
</template> </template>
<template v-else> <template v-else>
<template v-if="views[0]">
<image <image
v-if="views[0].detailUrl"
class="content" class="content"
:src="views[0].detailUrl" :src="views[0].detailUrl"
/> />
<image <image
v-if="views[0].bgUrl"
class="bg" class="bg"
:src="views[0].bgUrl" :src="views[0].bgUrl"
/> />
</template> </template>
</template>
</view> </view>
</template> </template>
</wnCanvas> </wnCanvas>
...@@ -64,7 +69,7 @@ export default { ...@@ -64,7 +69,7 @@ export default {
customerInfo () { customerInfo () {
return this.$store.state.user.customerInfo return this.$store.state.user.customerInfo
}, },
viewKey(){ viewKey () {
return this.$store.state.user.viewKey return this.$store.state.user.viewKey
} }
}, },
......
...@@ -170,11 +170,15 @@ export default { ...@@ -170,11 +170,15 @@ export default {
async getSoure (loadStorage = true) { async getSoure (loadStorage = true) {
const { channelType, shopMerchantId, sceneType } = this const { channelType, shopMerchantId, sceneType } = this
if (loadStorage) { if (loadStorage) {
let data = uni.getStorageSync(`source_${sceneType}_data_merchantId_${shopMerchantId}`) // let data = uni.getStorageSync(`source_${sceneType}_data_merchantId_${shopMerchantId}`)
if (!data) data = uni.getStorageSync(`source_${sceneType}_data_channelType_${channelType}`) // if (!data) data = uni.getStorageSync(`source_${sceneType}_data_channelType_${channelType}`)
let data = uni.getStorageSync(`source_${sceneType}_${shopMerchantId}`)
if (!data) data = uni.getStorageSync(`source_${sceneType}_${channelType}`)
if (data) this.setViewInfo(data) if (data) this.setViewInfo(data)
} }
let requestData = await uni.$api.systemApi.getSoureData(channelType, shopMerchantId, sceneType) let requestData = await uni.$api.systemApi.getSoureData(shopMerchantId, sceneType)
console.log(requestData)
// let requestData = await uni.$api.systemApi.getSoureData(channelType, shopMerchantId, sceneType)
this.setViewInfo(requestData) this.setViewInfo(requestData)
}, },
errorImg (index) { errorImg (index) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!