Commit b90a614a by 李伟康

极狐需求

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