Commit 2c5a31c5 by 李伟康

commit 提交

1 parent 519bf1f3
...@@ -5,7 +5,7 @@ const serverConfig = { ...@@ -5,7 +5,7 @@ const serverConfig = {
mockRequestCount: null, mockRequestCount: null,
mockTimer: {}, mockTimer: {},
mockCache: null mockCache: null
}, },
bydServerConfig = { bydServerConfig = {
mockRequestCount: null, mockRequestCount: null,
mockTimer: {}, mockTimer: {},
...@@ -60,10 +60,11 @@ const getMockData = async (immediate = false) => { ...@@ -60,10 +60,11 @@ const getMockData = async (immediate = false) => {
return Promise.reject(error) return Promise.reject(error)
} }
} }
const imgToBase64 = (list, urlKey) => { const imgToBase64 = (list, urlKey, isArray = true) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let arr = [], let arr = [],
newList = JSON.parse(JSON.stringify(list)) newList = JSON.parse(JSON.stringify(list))
if (isArray) {
list.map((e, index) => { list.map((e, index) => {
if (!e[urlKey]) return resolve(list) if (!e[urlKey]) return resolve(list)
if (!e[urlKey].startsWith('https')) return resolve(list) if (!e[urlKey].startsWith('https')) return resolve(list)
...@@ -83,6 +84,25 @@ const imgToBase64 = (list, urlKey) => { ...@@ -83,6 +84,25 @@ const imgToBase64 = (list, urlKey) => {
} }
}) })
}) })
} else {
Object.keys(list).map(key => {
if (!list[key].startsWith('https')) return resolve(list)
uni.request({
url: list[key],
method: 'GET',
responseType: 'arraybuffer',
success: res => {
const base64 = `data:image/png;base64,${uni.arrayBufferToBase64(res.data)}`
newList[key] = base64
arr.push(key)
if (arr.length === Object.keys(list).length) resolve(newList)
},
fail: err => {
reject(err)
}
})
})
}
}) })
} }
const updateMockData = (dataList, keyList, storageName = 'mock_data') => { const updateMockData = (dataList, keyList, storageName = 'mock_data') => {
......
No preview for this file type

7.47 MB | W: | H:

7.47 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template> <template>
<view class="layout"> <view class="layout">
<template v-if="views.length>1">
<view class="tabs-box">
<tabs
:list="views"
@tabclick="changeTab"
></tabs>
</view>
</template>
<wnCanvas <wnCanvas
:drawStatus="penSwitch" :drawStatus="penSwitch"
:canvasId="`c-${madiaId}`" :canvasId="`c-${madiaId}`"
...@@ -17,15 +9,28 @@ ...@@ -17,15 +9,28 @@
> >
<template slot="customContent"> <template slot="customContent">
<view class="layout-content"> <view class="layout-content">
<view class="title">{{title}}</view> <page-title
:title="title"
:hasCarBrand="hasCarBrand"
:show="show"
/>
<template v-if="hasCarBrand">
<image <image
:class="['content',modeName]" class="content"
:src="views[viewIndex].detailUrl" :src="views[customerInfo.carModelId] || require('@/assets/images/media/nothing.webp')"
/> />
</template>
<template v-else>
<image <image
:class="['bg',modeName]" class="content"
:src="views[viewIndex].bgUrl" :src="views[0].detailUrl"
/> />
<image
class="bg"
:src="views[0].bgUrl"
/>
</template>
</view> </view>
</template> </template>
</wnCanvas> </wnCanvas>
...@@ -33,42 +38,35 @@ ...@@ -33,42 +38,35 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import Tabs from './Tabs.vue' import PageTitle from './PageTitle.vue'
export default { export default {
props: { props: {
views: Array, views: [Array, Object],
penSwitch: Boolean, penSwitch: Boolean,
title: String, title: String,
madiaId: Number, madiaId: Number,
isByd: Boolean isByd: Boolean,
show: Boolean,
hasCarBrand: Boolean
}, },
components: { components: {
Tabs PageTitle
}, },
name: 'MediaComponent', name: 'MediaComponent',
data () { data () {
return { return {
viewIndex: 0,
modeName: ''
} }
}, },
watch: { watch: {
}, },
computed: { computed: {
customerInfo () {
return this.$store.state.user.customerInfo
},
}, },
mounted () { mounted () {
}, },
methods: { methods: {
changeTab (index) {
if (this.viewIndex == index) return
let { viewIndex } = this
this.modeName = viewIndex > index ? 'to-left' : 'to-right'
this.viewIndex = index
this.$refs.canvasRef.clearBoard()
setTimeout(() => {
this.modeName = ''
}, 300)
}
} }
} }
</script> </script>
...@@ -82,19 +80,6 @@ export default { ...@@ -82,19 +80,6 @@ export default {
position: relative; position: relative;
margin: $margin; margin: $margin;
} }
.title {
position: absolute;
left: 0;
top: toRpx(112);
font-weight: 700;
font-size: toRpx(48);
color: #1a1a1a;
letter-spacing: toRpx(4);
line-height: toRpx(64);
text-align: center;
width: 100%;
z-index: 2;
}
.content { .content {
position: absolute; position: absolute;
width: 100%; width: 100%;
...@@ -108,35 +93,5 @@ export default { ...@@ -108,35 +93,5 @@ export default {
left: 0; left: 0;
top: 0; top: 0;
} }
.tabs-box {
width: toRpx(1112);
position: absolute;
top: toRpx(228);
left: 50%;
transform: translateX(-50%);
z-index: 100;
}
}
.to-left {
animation: to-left 0.25s forwards;
}
.to-right {
animation: to-right 0.25s forwards;
}
@keyframes to-left {
0% {
left: -100%;
}
100% {
left: 0;
}
}
@keyframes to-right {
0% {
left: 100%;
}
100% {
left: 0;
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
<template>
<view class="page-title-box flex">
{{title}}
<view
class="car-options flex"
v-if="hasCarBrand"
@click="$refs.carBrandListVisible.open()"
>
{{customerInfo.carModel}}
<view class="sprite-icon icon-arrow-bottom"></view>
</view>
<car-brands
ref="carBrandListVisible"
@select="handleSelect($event,'carBrandListVisible')"
/>
</view>
</template>
<script type='text/ecmascript-6'>
import CarBrands from '@/components/CarBrands.vue'
export default {
components: { CarBrands },
name: 'PageTitle',
props: {
title: String,
hasCarBrand: Boolean,
show: Boolean
},
data () {
return {
customerInfo: {}
}
},
watch: {
show: {
immediate: true,
handler (newval) {
if (newval && this.hasCarBrand && !this.customerInfo.carModel && this.watchChannelType == 1) this.$refs.carBrandListVisible.autoSelect()
}
},
watchCustomerInfo: {
immediate: true,
handler (newval) {
if (newval) this.customerInfo = newval
}
},
},
computed: {
watchCustomerInfo () {
return this.$store.state.user.customerInfo
},
watchStatus () {
return this.$store.state.user.historyStatus
},
watchChannelType () {
// 默认1 1问界 2 比亚迪 3 其他
return uni.$storage.get('userInfo').channelType
}
},
mounted () {
},
methods: {
handleSelect (item, popkey) {
this.$refs[popkey].close()
this.$refs.carBrandListVisible.close()
this.customerInfo.carModel = item.name
this.customerInfo.carModelId = item.id
this.$store.dispatch('setCustomerInfo', this.customerInfo)
},
}
}
</script>
<style scoped lang='scss'>
.page-title-box {
justify-content: center;
position: absolute;
height: toRpx(96);
left: 0;
top: toRpx(48);
font-weight: 500;
font-size: toRpx(36);
color: #333;
text-align: center;
width: 100%;
z-index: 2;
.car-options {
&::before {
content: '';
width: 2rpx;
height: 36rpx;
opacity: 1;
background: #333333;
margin: 0 24rpx;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<view :class="['layout',`${isByd?'byd-layout':'aito-layout'}`]"> <view :class="['layout',`${isByd?'byd-layout':''}`]">
<wnCanvas <wnCanvas
saveImageType="3" saveImageType="3"
canvasId="c-1" canvasId="c-1"
...@@ -60,10 +60,18 @@ ...@@ -60,10 +60,18 @@
</template> </template>
</view> </view>
</view> </view>
<template v-if="isByd">
<image <image
:class="['content-image']" class="content-image"
:src="views[viewIndex].detailUrl" :src="views[0].detailUrl"
/> />
</template>
<template v-else>
<image
class="content-image"
:src="views[customerInfo.carModelId] || require('@/assets/images/media/nothing.webp')"
/>
</template>
</view> </view>
</view> </view>
</template> </template>
...@@ -85,7 +93,7 @@ export default { ...@@ -85,7 +93,7 @@ export default {
penSwitch: Boolean, penSwitch: Boolean,
show: Boolean, show: Boolean,
title: String, title: String,
views: Array, views: [Array, Object],
isByd: Boolean, isByd: Boolean,
}, },
name: 'Reception', name: 'Reception',
...@@ -115,7 +123,6 @@ export default { ...@@ -115,7 +123,6 @@ export default {
], ],
customerInfo: {}, customerInfo: {},
focusIndex: -1, focusIndex: -1,
viewIndex: 0,
} }
}, },
watch: { watch: {
...@@ -149,6 +156,7 @@ export default { ...@@ -149,6 +156,7 @@ export default {
} else { } else {
this.$refs.carBrandListVisible.close() this.$refs.carBrandListVisible.close()
this.customerInfo.carModel = item.name this.customerInfo.carModel = item.name
this.customerInfo.carModelId = item.id
} }
this.resetFocusIndex() this.resetFocusIndex()
this.$store.dispatch('setCustomerInfo', this.customerInfo) this.$store.dispatch('setCustomerInfo', this.customerInfo)
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<template slot="customContent"> <template slot="customContent">
<view class="layout-content"> <view class="layout-content">
<view class="title">{{title}}</view> <view class="title flex">{{title}}</view>
<view class="container"> <view class="container">
<view class="left-tab"> <view class="left-tab">
<view <view
...@@ -155,14 +155,14 @@ export default { ...@@ -155,14 +155,14 @@ export default {
position: relative; position: relative;
} }
.title { .title {
justify-content: center;
position: absolute; position: absolute;
height: toRpx(96);
left: 0; left: 0;
top: toRpx(112); top: toRpx(48);
font-weight: 700; font-weight: 500;
font-size: toRpx(48); font-size: toRpx(36);
color: #1a1a1a; color: #333;
letter-spacing: toRpx(4);
line-height: toRpx(64);
text-align: center; text-align: center;
width: 100%; width: 100%;
z-index: 2; z-index: 2;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</view> </view>
<template v-for="(item, index) in media"> <template v-for="(item, index) in media">
<view :class="['view', { showView: id == item.id }, modeName]" :key="index" @touchstart.stop="touchStart" @touchend.stop="touchEnd"> <view :class="['view', { showView: id == item.id }, modeName]" :key="index" @touchstart.stop="touchStart" @touchend.stop="touchEnd">
<component @full="handleFull" :detail="item" :is="item.componentName" :views="item.receptionSourceDetailList || []" :penSwitch="penSwitch" :show="id == item.id" :ref="'media' + item.id" :title="item.detailTitle || ''" :madiaId="item.id" @scale="scale" :ulList="item.ulList" :screenList="item.screenList" @onProductModel="productModelStatus = $event" :isPreview="isPreview" :isByd="isByd" /> <component @full="handleFull" :detail="item" :is="item.componentName" :views="item.receptionSourceDetailList || []" :penSwitch="penSwitch" :show="id == item.id" :ref="'media' + item.id" :title="item.detailTitle || ''" :madiaId="item.id" @scale="scale" :ulList="item.ulList" :screenList="item.screenList" @onProductModel="productModelStatus = $event" :isPreview="isPreview" :isByd="isByd" :hasCarBrand="item.hasCarBrand" />
</view> </view>
</template> </template>
<template v-if="type != 'preview'"> <template v-if="type != 'preview'">
...@@ -228,12 +228,14 @@ export default { ...@@ -228,12 +228,14 @@ export default {
left: 0; left: 0;
top: toRpx(48); top: toRpx(48);
z-index: 9; z-index: 9;
pointer-events: none;
.back { .back {
height: 100%; height: 100%;
aspect-ratio: 1/1; aspect-ratio: 1/1;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
pointer-events: auto;
} }
} }
.pen-box { .pen-box {
......
<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" @back="back" @done="done" ref="detail" /> <detail
:id.sync="id"
:media="moduleList"
:type.sync="type"
:toolList="toolList"
@back="back"
@done="done"
ref="detail"
/>
</template> </template>
<template slot="content"> <template slot="content">
<!-- <novice-guide <!-- <novice-guide
...@@ -42,7 +72,7 @@ import HomeFrame from '@/components/HomeFrame/index.vue' ...@@ -42,7 +72,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: [],
...@@ -54,12 +84,12 @@ export default { ...@@ -54,12 +84,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') {
// 物理返回按钮触发 // 物理返回按钮触发
// 阻止默认行为,即不执行页面返回 // 阻止默认行为,即不执行页面返回
...@@ -69,12 +99,12 @@ export default { ...@@ -69,12 +99,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')
...@@ -88,11 +118,11 @@ export default { ...@@ -88,11 +118,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'),
...@@ -128,7 +158,7 @@ export default { ...@@ -128,7 +158,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)
...@@ -219,12 +249,16 @@ export default { ...@@ -219,12 +249,16 @@ export default {
} else { } else {
/**默认问界 */ /**默认问界 */
moduleList = await Promise.all( moduleList = await Promise.all(
moduleList.map(async e => ({ moduleList.map(async e => {
const receptionSourceDetailListType = Array.isArray(e.receptionSourceDetailList)
return {
...e, ...e,
receptionSourceDetailList: e.receptionSourceDetailList ? await uni.$api.systemApi.imgToBase64(e.receptionSourceDetailList, 'detailUrl') : undefined, 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, carTypeList: e.carTypeList ? await uni.$api.systemApi.imgToBase64(e.carTypeList, 'url') : undefined,
screenList: e.screenList ? await uni.$api.systemApi.imgToBase64(e.screenList, 'url') : undefined screenList: e.screenList ? await uni.$api.systemApi.imgToBase64(e.screenList, 'url') : undefined
})) }
})
) )
toolList = await uni.$api.systemApi.imgToBase64(toolList, 'shortTitleUrl') toolList = await uni.$api.systemApi.imgToBase64(toolList, 'shortTitleUrl')
uni.$api.systemApi.updateMockData( uni.$api.systemApi.updateMockData(
...@@ -240,11 +274,11 @@ export default { ...@@ -240,11 +274,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
...@@ -267,14 +301,14 @@ export default { ...@@ -267,14 +301,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
...@@ -282,7 +316,7 @@ export default { ...@@ -282,7 +316,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
...@@ -294,14 +328,14 @@ export default { ...@@ -294,14 +328,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 = ''
...@@ -310,23 +344,23 @@ export default { ...@@ -310,23 +344,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
...@@ -350,13 +384,13 @@ export default { ...@@ -350,13 +384,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`)
...@@ -373,7 +407,7 @@ export default { ...@@ -373,7 +407,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
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!