Commit 63a4e10e by 李伟康

素材增加配置服务

1 parent f14b531e
......@@ -5,6 +5,7 @@
"versionName" : "2.5.1",
"versionCode" : "251",
"transformPx" : false,
"sassImplementationName": "node-sass",
/* 5+App特有相关 */
"app-plus" : {
"cache" : false,
......@@ -16,6 +17,7 @@
"ignoreVersion" : true
},
"screenOrientation" : "landscape",
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
......
......@@ -89,6 +89,10 @@ export default {
channelType () {
const { channelType } = uni.$storage.get('userInfo')
return channelType || 1 //默认问界
},
shopMerchantId () {
const { shopMerchantId } = uni.$storage.get('userInfo')
return shopMerchantId
}
},
onBackPress (options) {
......@@ -102,7 +106,7 @@ export default {
return false
},
onLoad () {
this.setViewInfo()
uni.$api.systemApi.getMockData(true) //获取APP配置信息
this.getSoure()
this.get_Vehicle_Sales_Data()
},
......@@ -159,124 +163,15 @@ export default {
})
},
// 查询素材
// 查询素材
async getSoure () {
/**比亚迪 */
if (this.channelType == 2) {
let { moduleList, toolList } = await uni.$api.systemApi.getBydMockData(true)
let configList
try {
configList = await uni.$api.systemApi.findReceptionpriproConfigList({})
uni.$storage.set('findReceptionpriproConfigList', configList)
} catch (error) {
configList = uni.$storage.get('findReceptionpriproConfigList')
}
const toolOtherList = configList.map(i => {
return {
id: 10 + i.id,
shortTitle: i.productName,
shortTitleUrl: i.procuctLog
}
})
toolList = toolList.concat(toolOtherList)
const moduleOtherList = configList.map(i => {
return {
id: 10 + i.id,
title: i.productName,
shortTitleUrl: i.procuctLog,
productPoster: i.productPoster,
showAlt: false,
componentName: 'CaseCenter',
receptionpriproCusCaseList: i.receptionpriproCusCaseList
}
})
moduleList = moduleList.concat(moduleOtherList)
moduleList = await Promise.all(
moduleList.map(async e => ({
...e,
receptionSourceDetailList: e.receptionSourceDetailList ? await uni.$api.systemApi.imgToBase64(e.receptionSourceDetailList, 'detailUrl') : undefined,
screenList: e.screenList ? await uni.$api.systemApi.imgToBase64(e.screenList, 'url') : undefined
}))
)
toolList = await uni.$api.systemApi.imgToBase64(toolList, 'shortTitleUrl')
uni.$api.systemApi.updateMockData(
{
moduleList,
toolList
},
['moduleList', 'toolList'],
'byd_mock_data'
)
this.setViewInfo(moduleList, toolList)
}
/**极狐 */
else if (this.channelType == 4) this.getJihuMockData()
else {
let { moduleList, toolList, default_moduleList, default_toolList, boutiqueDefaultCarBrandId, aitoCarModelIds } = await uni.$api.systemApi.getMockData(true)
if (this.channelType == 3) {
let configList
try {
configList = await uni.$api.systemApi.findReceptionpriproConfigList({})
uni.$storage.set('findReceptionpriproConfigList', configList)
} catch (error) {
configList = uni.$storage.get('findReceptionpriproConfigList')
}
const toolOtherList = configList.map(i => {
return {
id: 10 + i.id,
shortTitle: i.productName,
shortTitleUrl: i.procuctLog
}
})
default_toolList = default_toolList.concat(toolOtherList)
const moduleOtherList = configList.map(i => {
return {
id: 10 + i.id,
title: i.productName,
shortTitleUrl: i.procuctLog,
productPoster: i.productPoster,
showAlt: false,
componentName: 'CaseCenter',
receptionpriproCusCaseList: i.receptionpriproCusCaseList
}
})
default_moduleList = default_moduleList.concat(moduleOtherList)
/**其他品牌 */
default_toolList = await uni.$api.systemApi.imgToBase64(default_toolList, 'shortTitleUrl')
uni.$api.systemApi.updateMockData(
{
default_moduleList,
default_toolList
},
['default_moduleList', 'default_toolList']
)
this.setViewInfo(default_moduleList, default_toolList)
} else {
this.aitoCarModelIds = aitoCarModelIds
/**默认问界 */
moduleList = await Promise.all(
moduleList.map(async e => {
const receptionSourceDetailListType = Array.isArray(e.receptionSourceDetailList)
return {
...e,
receptionSourceDetailList: e.receptionSourceDetailList ? await uni.$api.systemApi.imgToBase64(e.receptionSourceDetailList, receptionSourceDetailListType ? 'detailUrl' : '', receptionSourceDetailListType) : undefined,
carTypeList: e.carTypeList ? await uni.$api.systemApi.imgToBase64(e.carTypeList, 'url') : undefined,
screenList: e.screenList ? await uni.$api.systemApi.imgToBase64(e.screenList, 'url') : undefined
}
})
)
toolList = await uni.$api.systemApi.imgToBase64(toolList, 'shortTitleUrl')
uni.$api.systemApi.updateMockData(
{
moduleList,
toolList
},
['moduleList', 'toolList']
)
this.$store.state.user.boutiqueDefaultCarBrandId = boutiqueDefaultCarBrandId
this.setViewInfo(moduleList, toolList)
}
async getSoure (loadStorage = true) {
const { channelType, shopMerchantId } = this
if (loadStorage) {
let data = uni.getStorageSync(`source_data_merchantId_${shopMerchantId}`)
if (!data) data = uni.getStorageSync(`source_data_channelType_${channelType}`)
if (data) this.setViewInfo(data)
}
let requestData = await uni.$api.systemApi.getSoureData(channelType, shopMerchantId)
this.setViewInfo(requestData)
},
errorImg (index) {
this.moduleList[index].showAlt = true
......@@ -288,7 +183,7 @@ export default {
mask: true
})
this.$refs.home.startAudio()
this.getSoure()
this.getSoure(false)
this.clearHistory()
this.id = this.moduleList[0].id
this.type = 'edit'
......@@ -403,54 +298,16 @@ export default {
}
},
/**素材内容 */
setViewInfo (_moduleList, _toolList) {
if (_moduleList && _toolList) {
this.moduleList = _moduleList
this.toolList = _toolList
return
}
if (this.channelType == 2) {
const { moduleList, toolList } = uni.$storage.get('byd_mock_data')
setViewInfo (data) {
let { moduleList, toolList, aitoCarModelIds } = data
if (this.channelType == 1) this.aitoCarModelIds = aitoCarModelIds
this.moduleList = moduleList
this.toolList = toolList
} else {
const { default_moduleList, default_toolList, moduleList, toolList } = uni.$storage.get('mock_data') || {}
this.moduleList = {
3: default_moduleList,
1: moduleList
}[this.channelType]
this.toolList = {
3: default_toolList,
1: toolList
}[this.channelType]
}
},
async getJihuMockData () {
let { moduleList, toolList, boutiqueDefaultCarBrandId, defaultCarId } = await uni.$api.systemApi.getJihuMockData(true)
moduleList = await Promise.all(
moduleList.map(async e => {
const receptionSourceDetailListType = Array.isArray(e.receptionSourceDetailList)
return {
...e,
receptionSourceDetailList: e.receptionSourceDetailList ? await uni.$api.systemApi.imgToBase64(e.receptionSourceDetailList, receptionSourceDetailListType ? 'detailUrl' : '', receptionSourceDetailListType) : undefined,
carTypeList: e.carTypeList ? await uni.$api.systemApi.imgToBase64(e.carTypeList, 'url') : undefined,
screenList: e.screenList ? await uni.$api.systemApi.imgToBase64(e.screenList, 'url') : undefined
this.$store.state.user = {
...this.$store.state.user,
...data
}
})
)
toolList = await uni.$api.systemApi.imgToBase64(toolList, 'shortTitleUrl')
uni.$api.systemApi.updateMockData(
{
moduleList,
toolList
},
['moduleList', 'toolList'],
'jihu_mock_data'
)
this.$store.state.user.boutiqueDefaultCarBrandId = boutiqueDefaultCarBrandId
this.$store.state.user.defaultCarId = defaultCarId
this.setViewInfo(moduleList, toolList)
}
}
}
</script>
......
......@@ -25,9 +25,7 @@ export const STORAGE_OBJECTKEY = {
recordSuccessList: 'recordSuccessList',
historyList: 'historyList',
storageVersion: 'storageVersion',
byd_mock_data: 'byd_mock_data',
boutique_mock_data: 'boutique_mock_data',
findReceptionpriproConfigList: 'findReceptionpriproConfigList',
appInfoList: 'appInfoList',
jihu_mock_data: 'jihu_mock_data'
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!