Commit 757fbed4 by 李伟康

commit 新增场景

1 parent d734759f
......@@ -12,7 +12,9 @@ const serverConfig = {
mockCache: null
},
configModule = 'app-tape',
appConfigModule = 'app-config-url',
boutiqueConfigModule = 'boutique-pad-config',
appConfigUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${appConfigModule}&env=${env}`,
configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`,
boutiqueConfigUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${boutiqueConfigModule}&env=${env}`
/**获取APP配置 */
......@@ -102,21 +104,21 @@ const getImageVersion = async () => {
const accountInfo = await getMockData()
return accountInfo?.version || Date.now()
}
/**获取延保素材配置 */
const getSoureData = async (channelType = 1, shopMerchantId) => {
const appConfigUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=app-config-url&env=${env}`,
{ brandIds, merchantIds, caseCenterIds } = await http.uni_request({ url: appConfigUrl })
/**获取素材配置 */
const getSoureData = async (channelType = 1, shopMerchantId, sceneType = 0) => {
const sceneData = await http.uni_request({ url: appConfigUrl }),
{ brandIds, merchantIds, caseCenterIds } = sceneData[sceneType]
let targetUrl,
storageName = 'source_data_'
storageName = `source_${sceneType}_data_`
if (merchantIds.hasOwnProperty(shopMerchantId)) {
targetUrl = `${merchantIds[shopMerchantId]}&env=${env}`
targetUrl = merchantIds[shopMerchantId]
storageName += `merchantId_${shopMerchantId}`
}
else {
targetUrl = `${brandIds[channelType]}&env=${env}`
targetUrl = brandIds[channelType]
storageName += `channelType_${channelType}`
}
let data = await http.uni_request({ url: targetUrl }),
let data = await http.uni_request({ url: `${targetUrl}&env=${env}` }),
{ moduleList, toolList } = data
/**全损无忧 */
if (caseCenterIds.includes(channelType)) {
......@@ -157,7 +159,7 @@ const getSoureData = async (channelType = 1, shopMerchantId) => {
}
/**批量图片转base64 */
const imgTransformBase64 = async (imgList = [], keyList = []) => {
const list = await Promise.all(
return await Promise.all(
imgList.map(async e => {
await Promise.all(
Object.keys(e).map(async key => {
......@@ -194,8 +196,6 @@ const imgTransformBase64 = async (imgList = [], keyList = []) => {
return e
})
)
return list
}
/**转base64 */
const getBase64 = async (url) => {
......
......@@ -93,6 +93,10 @@ export default {
shopMerchantId () {
const { shopMerchantId } = uni.$storage.get('userInfo')
return shopMerchantId
},
sceneType () {
const { sceneType } = uni.$storage.get('userInfo')
return sceneType
}
},
onBackPress (options) {
......@@ -164,13 +168,13 @@ export default {
},
// 查询素材
async getSoure (loadStorage = true) {
const { channelType, shopMerchantId } = this
const { channelType, shopMerchantId, sceneType } = this
if (loadStorage) {
let data = uni.getStorageSync(`source_data_merchantId_${shopMerchantId}`)
if (!data) data = uni.getStorageSync(`source_data_channelType_${channelType}`)
let data = uni.getStorageSync(`source_${sceneType}_data_merchantId_${shopMerchantId}`)
if (!data) data = uni.getStorageSync(`source_${sceneType}_data_channelType_${channelType}`)
if (data) this.setViewInfo(data)
}
let requestData = await uni.$api.systemApi.getSoureData(channelType, shopMerchantId)
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!