Commit dbdabf98 by 李伟康

commit

1 parent 2d67bd18
......@@ -53,7 +53,7 @@ const getMockData = async (immediate = false) => {
}
}
/**
*获取后台素材配置
*获取后台轻改素材配置
*/
const findReceptionpriproConfigList = data => {
return http.post({
......@@ -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) => {
......@@ -105,7 +125,30 @@ const getImageVersion = async () => {
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 }),
{ brandIds, merchantIds, caseCenterIds } = sceneData[sceneType]
let targetUrl,
......@@ -160,7 +203,7 @@ const getSoureData = async (channelType = 1, shopMerchantId, sceneType = 0) => {
/**批量图片转base64 */
const imgTransformBase64 = async (imgList = [], keyList = []) => {
return await Promise.all(
imgList.map(async e => {
imgList?.map(async e => {
await Promise.all(
Object.keys(e).map(async key => {
if (keyList.includes(key)) {
......@@ -171,7 +214,7 @@ const imgTransformBase64 = async (imgList = [], keyList = []) => {
await Promise.all(
Object.keys(i).map(async 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 = []) => {
// e[`original_${key}`] = JSON.parse(JSON.stringify(e[key]))
e[key] = await getBase64(e[key])
}
if (typeof e[key] === 'object') {
if (e[key] && typeof e[key] === 'object') {
await Promise.all(
Object.keys(e[key]).map(async k => {
// e[key][`original_${k}`] = JSON.parse(JSON.stringify(e[key][k]))
......@@ -219,5 +262,7 @@ module.exports = {
getMockData,
getBoutiqueMockData,
findReceptionpriproConfigList,
getSoureData
getSoureData,
getEquityMaterialId,
getEquityMaterialConfig
}
......@@ -43,8 +43,9 @@
</view>
</view>
<template v-if="list.length > 0">
<!-- { 'has-tabs': views && views.length > 1 } -->
<scroll-view
:class="['record-box', { 'has-tabs': views && views.length > 1 }]"
:class="['record-box']"
scroll-y
:scroll-top="scrollTop"
@scrolltolower="pageonReachBottom"
......@@ -145,7 +146,7 @@ export default {
madiaId: Number,
show: Boolean,
isByd: Boolean,
views: Array
// views: Array
},
data () {
return {
......
......@@ -22,14 +22,19 @@
/>
</template>
<template v-else>
<image
class="content"
:src="views[0].detailUrl"
/>
<image
class="bg"
:src="views[0].bgUrl"
/>
<template v-if="views[0]">
<image
v-if="views[0].detailUrl"
class="content"
:src="views[0].detailUrl"
/>
<image
v-if="views[0].bgUrl"
class="bg"
:src="views[0].bgUrl"
/>
</template>
</template>
</view>
......@@ -64,7 +69,7 @@ export default {
customerInfo () {
return this.$store.state.user.customerInfo
},
viewKey(){
viewKey () {
return this.$store.state.user.viewKey
}
},
......
......@@ -170,11 +170,15 @@ export default {
async getSoure (loadStorage = true) {
const { channelType, shopMerchantId, sceneType } = this
if (loadStorage) {
let data = uni.getStorageSync(`source_${sceneType}_data_merchantId_${shopMerchantId}`)
if (!data) data = uni.getStorageSync(`source_${sceneType}_data_channelType_${channelType}`)
// let data = uni.getStorageSync(`source_${sceneType}_data_merchantId_${shopMerchantId}`)
// 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)
}
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)
},
errorImg (index) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!