Commit b90a614a by 李伟康

极狐需求

1 parent 2e47017f
...@@ -16,12 +16,20 @@ const serverConfig = { ...@@ -16,12 +16,20 @@ const serverConfig = {
mockTimer: {}, mockTimer: {},
mockCache: null mockCache: null
}, },
jihuServerConfig = {
mockRequestCount: null,
mockTimer: {},
mockCache: null
},
configModule = 'app-tape', configModule = 'app-tape',
bydConfigModule = 'byd-pad-config', bydConfigModule = 'byd-pad-config',
boutiqueConfigModule = 'boutique-pad-config', boutiqueConfigModule = 'boutique-pad-config',
jihuConfigModule = 'jihu-pad-config',
configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`, configUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${configModule}&env=${env}`,
bydConfigUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${bydConfigModule}&env=${env}`, bydConfigUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${bydConfigModule}&env=${env}`,
boutiqueConfigUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${boutiqueConfigModule}&env=${env}` boutiqueConfigUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${boutiqueConfigModule}&env=${env}`,
jihuConfigUrl = `https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=${jihuConfigModule}&env=${env}`
/**获取mock数据 */ /**获取mock数据 */
const getMockData = async (immediate = false) => { const getMockData = async (immediate = false) => {
...@@ -199,6 +207,43 @@ const getBoutiqueMockData = async (immediate = false) => { ...@@ -199,6 +207,43 @@ const getBoutiqueMockData = async (immediate = false) => {
return Promise.reject(error) return Promise.reject(error)
} }
} }
/**
*获取极狐配置
*/
const getJihuMockData = async (immediate = false) => {
const MOCKDATA = uni.$storage.get('jihu_mock_data')
try {
if (!immediate && MOCKDATA && Date.now() - MOCKDATA.createTime < 5 * 60e3) {
return Promise.resolve(MOCKDATA)
} else {
if (!jihuServerConfig.mockRequestCount || immediate) {
jihuServerConfig.mockCache = null
jihuServerConfig.mockRequestCount = Date.now()
const data = await http.uni_request({ url: jihuConfigUrl })
data.createTime = Date.now()
data.moduleList = await imgToBase64(data.moduleList, 'thumbnail')
jihuServerConfig.mockCache = data
uni.$storage.set('jihu_mock_data', data)
return Promise.resolve(data)
} else {
const key = Date.now()
return new Promise(resolve => {
jihuServerConfig.mockTimer[key] = setInterval(() => {
if (jihuServerConfig.mockCache) {
clearInterval(jihuServerConfig.mockTimer[key])
jihuServerConfig.mockRequestCount = null
resolve(jihuServerConfig.mockCache)
}
}, 1e3)
})
}
}
} catch (error) {
if (jihuServerConfig.mockTimer[key]) clearInterval(jihuServerConfig.mockTimer[key])
jihuServerConfig.mockRequestCount = null
return Promise.reject(error)
}
}
// 图片版本号 // 图片版本号
const getImageVersion = async () => { const getImageVersion = async () => {
const accountInfo = await getMockData() const accountInfo = await getMockData()
...@@ -212,5 +257,6 @@ module.exports = { ...@@ -212,5 +257,6 @@ module.exports = {
updateMockData, updateMockData,
getBydMockData, getBydMockData,
getBoutiqueMockData, getBoutiqueMockData,
findReceptionpriproConfigList findReceptionpriproConfigList,
getJihuMockData
} }
...@@ -69,11 +69,11 @@ ...@@ -69,11 +69,11 @@
<template v-else> <template v-else>
<image <image
class="content-image" class="content-image"
:src="views[customerInfo.carModelId] || require('@/assets/images/media/nothing.webp')" :src="views[customerInfo.carModelId] || views[0].detailUrl || require('@/assets/images/media/nothing.webp')"
/> />
<image <image
class="content-bg" class="content-bg"
:src="receptionBg(customerInfo.carModelId)" :src="receptionBg(customerInfo.carModelId, views[0].bgUrl)"
/> />
</template> </template>
</view> </view>
...@@ -186,10 +186,11 @@ export default { ...@@ -186,10 +186,11 @@ export default {
} }
this.inputCustomer() this.inputCustomer()
}, },
receptionBg (carModelId) { receptionBg (carModelId, _bgUrl) {
const isAito = this.aitoCarModelIds.findIndex(e => e == carModelId) const isAito = this.aitoCarModelIds.findIndex(e => e == carModelId)
let bgUrl = require('@/assets/images/common/aito-bg.webp') let bgUrl = require('@/assets/images/common/aito-bg.webp')
if (isAito == -1) bgUrl = require('@/assets/images/common/zj-xj-bg.webp') if (isAito == -1) bgUrl = require('@/assets/images/common/zj-xj-bg.webp')
if(_bgUrl) bgUrl = _bgUrl
return bgUrl return bgUrl
} }
} }
......
<template> <template>
<view> <view>
<home-frame @preview="preview" @start="start" ref="home" :id="id" @openStep="openStep" @backHome="backHome" @changeTab="changeTab"> <home-frame
<view class="module-box" slot="module"> @preview="preview"
@start="start"
ref="home"
:id="id"
@openStep="openStep"
@backHome="backHome"
@changeTab="changeTab"
>
<view
class="module-box"
slot="module"
>
<template v-for="(i, index) in moduleList"> <template v-for="(i, index) in moduleList">
<view :key="index" :class="['item', i.class]" :style="i.style" @click="toDetail(i)" v-if="!i.hide"> <view
:key="index"
:class="['item', i.class]"
:style="i.style"
@click="toDetail(i)"
v-if="!i.hide"
>
<template v-if="i.showAlt"> <template v-if="i.showAlt">
<view class="item-text flex">{{ i.title }}</view> <view class="item-text flex">{{ i.title }}</view>
</template> </template>
<template v-else> <template v-else>
<image class="item-img" :src="i.thumbnail" mode="scaleToFill" @error="errorImg(index)" /> <image
class="item-img"
:src="i.thumbnail"
mode="scaleToFill"
@error="errorImg(index)"
/>
</template> </template>
</view> </view>
</template> </template>
</view> </view>
<template slot="detail"> <template slot="detail">
<detail :id.sync="id" :media="moduleList" :type.sync="type" :toolList="toolList" :aitoCarModelIds="aitoCarModelIds" @back="back" @done="done" ref="detail" /> <detail
:id.sync="id"
:media="moduleList"
:type.sync="type"
:toolList="toolList"
:aitoCarModelIds="aitoCarModelIds"
@back="back"
@done="done"
ref="detail"
/>
</template> </template>
<template slot="content"> <template slot="content">
<!-- <novice-guide <!-- <novice-guide
...@@ -42,7 +73,7 @@ import HomeFrame from '@/components/HomeFrame/index.vue' ...@@ -42,7 +73,7 @@ import HomeFrame from '@/components/HomeFrame/index.vue'
export default { export default {
// mixins: [storge], // mixins: [storge],
components: { HomeFrame, detail, NoviceGuide }, components: { HomeFrame, detail, NoviceGuide },
data() { data () {
return { return {
moduleList: [], moduleList: [],
toolList: [], toolList: [],
...@@ -55,12 +86,12 @@ export default { ...@@ -55,12 +86,12 @@ export default {
} }
}, },
computed: { computed: {
channelType() { channelType () {
const { channelType } = uni.$storage.get('userInfo') const { channelType } = uni.$storage.get('userInfo')
return channelType || 1 //默认问界 return channelType || 1 //默认问界
} }
}, },
onBackPress(options) { onBackPress (options) {
if (options.from === 'backbutton') { if (options.from === 'backbutton') {
// 物理返回按钮触发 // 物理返回按钮触发
// 阻止默认行为,即不执行页面返回 // 阻止默认行为,即不执行页面返回
...@@ -70,12 +101,12 @@ export default { ...@@ -70,12 +101,12 @@ export default {
// 其他情况允许正常返回 // 其他情况允许正常返回
return false return false
}, },
onLoad() { onLoad () {
this.setViewInfo() this.setViewInfo()
this.getSoure() this.getSoure()
this.get_Vehicle_Sales_Data() this.get_Vehicle_Sales_Data()
}, },
onShow() { onShow () {
const userInfo = uni.$storage.get('userInfo') const userInfo = uni.$storage.get('userInfo')
if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) { if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) {
uni.$storage.rm('userInfo') uni.$storage.rm('userInfo')
...@@ -89,11 +120,11 @@ export default { ...@@ -89,11 +120,11 @@ export default {
}, },
methods: { methods: {
...mapMutations('audio', ['setReceptionStatus']), ...mapMutations('audio', ['setReceptionStatus']),
init() { init () {
this.findPayInfo() this.findPayInfo()
}, },
/**获取车型&销售数据 */ /**获取车型&销售数据 */
get_Vehicle_Sales_Data() { get_Vehicle_Sales_Data () {
const userInfo = uni.$storage.get('userInfo'), const userInfo = uni.$storage.get('userInfo'),
storageCarBrandList = uni.$storage.get('carBrandList'), storageCarBrandList = uni.$storage.get('carBrandList'),
storageEmployeeList = uni.$storage.get('employeeList'), storageEmployeeList = uni.$storage.get('employeeList'),
...@@ -129,7 +160,7 @@ export default { ...@@ -129,7 +160,7 @@ export default {
}, },
// 查询素材 // 查询素材
// 查询素材 // 查询素材
async getSoure() { async getSoure () {
/**比亚迪 */ /**比亚迪 */
if (this.channelType == 2) { if (this.channelType == 2) {
let { moduleList, toolList } = await uni.$api.systemApi.getBydMockData(true) let { moduleList, toolList } = await uni.$api.systemApi.getBydMockData(true)
...@@ -177,7 +208,10 @@ export default { ...@@ -177,7 +208,10 @@ export default {
'byd_mock_data' 'byd_mock_data'
) )
this.setViewInfo(moduleList, toolList) this.setViewInfo(moduleList, toolList)
} else { }
/**极狐 */
else if (this.channelType == 4) this.getJihuMockData()
else {
let { moduleList, toolList, default_moduleList, default_toolList, boutiqueDefaultCarBrandId, aitoCarModelIds } = await uni.$api.systemApi.getMockData(true) let { moduleList, toolList, default_moduleList, default_toolList, boutiqueDefaultCarBrandId, aitoCarModelIds } = await uni.$api.systemApi.getMockData(true)
if (this.channelType == 3) { if (this.channelType == 3) {
let configList let configList
...@@ -244,11 +278,11 @@ export default { ...@@ -244,11 +278,11 @@ export default {
} }
} }
}, },
errorImg(index) { errorImg (index) {
this.moduleList[index].showAlt = true this.moduleList[index].showAlt = true
}, },
async start() { async start () {
if (this.recording) return if (this.recording) return
uni.showLoading({ uni.showLoading({
mask: true mask: true
...@@ -263,14 +297,14 @@ export default { ...@@ -263,14 +297,14 @@ export default {
uni.hideLoading() uni.hideLoading()
}, 1e3) }, 1e3)
}, },
toDetail(item) { toDetail (item) {
this.chooseItem = item this.chooseItem = item
this.$refs.home.previewRef.open() this.$refs.home.previewRef.open()
}, },
cancel() { cancel () {
this.$refs.home.previewRef.close() this.$refs.home.previewRef.close()
}, },
preview() { preview () {
let { id, title } = this.chooseItem let { id, title } = this.chooseItem
this.type = 'preview' this.type = 'preview'
this.id = id this.id = id
...@@ -278,7 +312,7 @@ export default { ...@@ -278,7 +312,7 @@ export default {
this.cancel() this.cancel()
}, },
// 完成接待 // 完成接待
done(e) { done (e) {
this.$refs.home.finishRef.close() this.$refs.home.finishRef.close()
if (this.recording) this.$refs.home.stopAudio() if (this.recording) this.$refs.home.stopAudio()
this.recording = false this.recording = false
...@@ -290,14 +324,14 @@ export default { ...@@ -290,14 +324,14 @@ export default {
this.$store.dispatch('clearReceptionTrack') this.$store.dispatch('clearReceptionTrack')
}, 1500) }, 1500)
}, },
back() { back () {
const detailRef = this.$refs.detail const detailRef = this.$refs.detail
if (detailRef.showPayPage) return (detailRef.showPayPage = false) if (detailRef.showPayPage) return (detailRef.showPayPage = false)
if (!this.id) return uni.navigateBack() if (!this.id) return uni.navigateBack()
if (this.type != 'preview') return this.$refs.home.finishRef.open() if (this.type != 'preview') return this.$refs.home.finishRef.open()
this.backHome() this.backHome()
}, },
backHome() { backHome () {
if (this.recording) this.$refs.home.stopAudio(true) if (this.recording) this.$refs.home.stopAudio(true)
this.$refs.home.finishRef.close() this.$refs.home.finishRef.close()
this.id = '' this.id = ''
...@@ -306,23 +340,23 @@ export default { ...@@ -306,23 +340,23 @@ export default {
this.init() this.init()
this.recording = false this.recording = false
}, },
nextStep() { nextStep () {
let { id } = this.moduleList[0] let { id } = this.moduleList[0]
this.type = 'preview' this.type = 'preview'
this.id = id this.id = id
}, },
clearHistory() { clearHistory () {
this.$store.dispatch('clearCustomerInfo') this.$store.dispatch('clearCustomerInfo')
this.$store.dispatch('clearHistory') this.$store.dispatch('clearHistory')
this.$refs.home.setBooks([]) this.$refs.home.setBooks([])
this.$store.dispatch('clearReceptionTrack') this.$store.dispatch('clearReceptionTrack')
}, },
openStep() { openStep () {
this.$refs.home.finishRef.close() this.$refs.home.finishRef.close()
this.$refs.detail.open() this.$refs.detail.open()
}, },
// 查询门店支付配置 // 查询门店支付配置
async findPayInfo() { async findPayInfo () {
const { shopMerchantId } = uni.$storage.get('userInfo') const { shopMerchantId } = uni.$storage.get('userInfo')
const data = await uni.$api.commonApi.findPayInfo({ const data = await uni.$api.commonApi.findPayInfo({
merchantId: shopMerchantId merchantId: shopMerchantId
...@@ -346,13 +380,13 @@ export default { ...@@ -346,13 +380,13 @@ export default {
}) })
this.$store.dispatch('setPaymentType', paymentType) this.$store.dispatch('setPaymentType', paymentType)
}, },
changeTab(index) { changeTab (index) {
this.tabIndex = index this.tabIndex = index
if (index == 0) this.init() if (index == 0) this.init()
}, },
/**按序加载车型 */ /**按序加载车型 */
async getCarBrandsList(carBrandList, index) { async getCarBrandsList (carBrandList, index) {
const item = carBrandList[index] const item = carBrandList[index]
if (!item) return if (!item) return
const carList = uni.getStorageSync(`${item.id}_${item.brandId}_carlist`) const carList = uni.getStorageSync(`${item.id}_${item.brandId}_carlist`)
...@@ -369,7 +403,7 @@ export default { ...@@ -369,7 +403,7 @@ export default {
} }
}, },
/**素材内容 */ /**素材内容 */
setViewInfo(_moduleList, _toolList) { setViewInfo (_moduleList, _toolList) {
if (_moduleList && _toolList) { if (_moduleList && _toolList) {
this.moduleList = _moduleList this.moduleList = _moduleList
this.toolList = _toolList this.toolList = _toolList
...@@ -390,6 +424,30 @@ export default { ...@@ -390,6 +424,30 @@ export default {
1: toolList 1: toolList
}[this.channelType] }[this.channelType]
} }
},
async getJihuMockData () {
let { moduleList, toolList } = 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
}
})
)
toolList = await uni.$api.systemApi.imgToBase64(toolList, 'shortTitleUrl')
uni.$api.systemApi.updateMockData(
{
moduleList,
toolList
},
['moduleList', 'toolList'],
'byd_mock_data'
)
this.setViewInfo(moduleList, toolList)
} }
} }
} }
......
...@@ -28,5 +28,6 @@ export const STORAGE_OBJECTKEY = { ...@@ -28,5 +28,6 @@ export const STORAGE_OBJECTKEY = {
byd_mock_data: 'byd_mock_data', byd_mock_data: 'byd_mock_data',
boutique_mock_data: 'boutique_mock_data', boutique_mock_data: 'boutique_mock_data',
findReceptionpriproConfigList: 'findReceptionpriproConfigList', findReceptionpriproConfigList: 'findReceptionpriproConfigList',
appInfoList: 'appInfoList' 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!