Commit 742df99b by 李伟康

commit 默认车型

1 parent bd13d3c8
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
</view> </view>
</template> </template>
<movable-area <movable-area
class="canvas-box" :class="['canvas-box',{fill:custom}]"
scale-area scale-area
:style="{height:height}" :style="{height:height}"
> >
...@@ -73,25 +73,29 @@ ...@@ -73,25 +73,29 @@
@scale="scale" @scale="scale"
> >
<canvas <canvas
class="board-canvas" :class="['board-canvas',{'draw-canvas':drawStatus}]"
:canvas-id="canvasId" :canvas-id="canvasId"
:disable-scroll="drawStatus" :disable-scroll="drawStatus"
@touchstart="touchStart" @touchstart="touchStart"
@touchmove="touchMove" @touchmove="touchMove"
@touchend="touchEnd" @touchend="touchEnd"
></canvas> ></canvas>
<!-- <image :src="drawImage" class="under-image" mode="" v-if="isUnderBkg"></image> --> <template v-if="custom">
<template v-if="aspectRatio"> <slot name="customContent"></slot>
<view
class="under-image"
:style="{backgroundImage:`URL(${drawImage})`,aspectRatio:aspectRatio}"
>
</view>
</template> </template>
<template v-else> <template v-else>
<view class="skeleton-box"></view> <!-- <image :src="drawImage" class="under-image" mode="" v-if="isUnderBkg"></image> -->
<template v-if="aspectRatio">
<view
class="under-image"
:style="{backgroundImage:`URL(${drawImage})`,aspectRatio:aspectRatio}"
>
</view>
</template>
<template v-else>
<view class="skeleton-box"></view>
</template>
</template> </template>
<!-- <image class="under-image" :src="drawImage" <!-- <image class="under-image" :src="drawImage"
mode="scaleToFill" mode="scaleToFill"
/> --> /> -->
...@@ -238,7 +242,8 @@ export default { ...@@ -238,7 +242,8 @@ export default {
canvasId: { canvasId: {
type: String, type: String,
default: 'drawCanvas' default: 'drawCanvas'
} },
custom: Boolean, //自定义
}, },
computed: { computed: {
watchStatus () { watchStatus () {
...@@ -839,41 +844,44 @@ export default { ...@@ -839,41 +844,44 @@ export default {
//清空画板 //清空画板
clearBoard () { clearBoard () {
this.defaultScaleValue = 1.1 this.defaultScaleValue = 1.1
setTimeout(()=>{ setTimeout(() => {
this.defaultScaleValue = 1 this.defaultScaleValue = 1
},100) }, 100)
this.historyList = []; this.historyList = [];
this.drawContext?.draw() this.drawContext?.draw()
}, },
async initBoard () { async initBoard () {
try {
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
if (systemInfo.screenWidth > systemInfo.screenHeight) { if (systemInfo.screenWidth > systemInfo.screenHeight) {
this.isLandScape = true this.isLandScape = true
} else { } else {
this.isLandScape = false this.isLandScape = false
} }
if (this.drawImage) { if (this.drawImage) {
let imageInfoObj = (await uni.getImageInfo({ let imageInfoObj = (await uni.getImageInfo({
src: this.drawImage src: this.drawImage
}))[1] || {}; }))[1] || {};
this.aspectRatio = imageInfoObj.width / imageInfoObj.height; this.aspectRatio = imageInfoObj.width / imageInfoObj.height;
this.height = `${imageInfoObj.height * (systemInfo.windowWidth / imageInfoObj.width)}px` this.height = `${imageInfoObj.height * (systemInfo.windowWidth / imageInfoObj.width)}px`
} }
if (this.isUnderBkg) { if (this.isUnderBkg) {
this.bgColor = "rgba(0,0,0,0)" this.bgColor = "rgba(0,0,0,0)"
} else { } else {
this.bgColor = "rgb(255,255,255)" this.bgColor = "rgba(255,255,255,0)"
}
this.drawContext.setLineCap('round') // 让线条圆润
this.drawContext.strokeStyle = this.currentColor; //设置画笔颜色
this.drawContext.setLineWidth(this.lineWidth); //设置画笔粗细
this.$nextTick(() => {
this.drawContext.setLineWidth(this.lineWidth)
this.fillBackground();
})
} catch (error) {
console.log(error)
} }
this.drawContext.setLineCap('round') // 让线条圆润
this.drawContext.strokeStyle = this.currentColor; //设置画笔颜色
this.drawContext.setLineWidth(this.lineWidth); //设置画笔粗细
this.$nextTick(() => {
this.drawContext.setLineWidth(this.lineWidth)
this.fillBackground();
})
}, },
/**缩放 */ /**缩放 */
scale (e) { scale (e) {
...@@ -1024,6 +1032,7 @@ export default { ...@@ -1024,6 +1032,7 @@ export default {
//margin-right: 2.2rem; //margin-right: 2.2rem;
position: relative; position: relative;
// height: 100vh; // height: 100vh;
z-index: 99;
.canvas-view { .canvas-view {
height: 100%; height: 100%;
width: 100%; width: 100%;
...@@ -1033,7 +1042,15 @@ export default { ...@@ -1033,7 +1042,15 @@ export default {
width: 100%; width: 100%;
position: absolute; position: absolute;
background: rgba(0, 0, 0, 0); background: rgba(0, 0, 0, 0);
pointer-events: none;
z-index: 9;
} }
.draw-canvas {
pointer-events: auto;
}
}
.fill {
height: 100% !important;
} }
} }
</style> </style>
...@@ -46,6 +46,9 @@ ...@@ -46,6 +46,9 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
export default { export default {
name: 'CarBrands', name: 'CarBrands',
props: {
autoSelect: Boolean
},
data () { data () {
return { return {
carlist: [], carlist: [],
...@@ -60,6 +63,13 @@ export default { ...@@ -60,6 +63,13 @@ export default {
this.close() this.close()
} }
}, },
carBrandList: {
immediate: true,
handler (newval) {
const { sceneType } = uni.$storage.get("userInfo")
if (newval.length && sceneType == 0 && this.autoSelect) this.selectCar(newval[0], true)
}
},
}, },
computed: { computed: {
watchStatus () { watchStatus () {
...@@ -69,7 +79,7 @@ export default { ...@@ -69,7 +79,7 @@ export default {
return this.$store.state.user.customerInfo.carModel return this.$store.state.user.customerInfo.carModel
}, },
carBrandList () { carBrandList () {
return this.$store.state.user.carBrands return this.$store.state.user.carBrands || []
}, },
carBrand () { carBrand () {
return this.$store.state.user.customerInfo.carBrand return this.$store.state.user.customerInfo.carBrand
...@@ -81,7 +91,7 @@ export default { ...@@ -81,7 +91,7 @@ export default {
open () { open () {
this.$refs.carBrandListVisible.open() this.$refs.carBrandListVisible.open()
}, },
selectCar (e) { selectCar (e, auto = false) {
let { clickFlga } = this let { clickFlga } = this
if (clickFlga) return if (clickFlga) return
this.clickFlga = true this.clickFlga = true
...@@ -95,16 +105,16 @@ export default { ...@@ -95,16 +105,16 @@ export default {
carChildsBrandName: e.name, carChildsBrandName: e.name,
carChildsBrandId: e.id carChildsBrandId: e.id
} }
console.log(e)
uni.$api.commonApi.getCarBrandsList({ uni.$api.commonApi.getCarBrandsList({
brandId: e.brandId, brandId: e.brandId,
childBrandId: e.id childBrandId: e.id
}).then(res => { }).then(res => {
uni.hideLoading() uni.hideLoading()
this.carlist = res this.carlist = res
this.$refs.carBoxVisible.open() if (auto && res.length) this.handleSelect(res[0])
else this.$refs.carBoxVisible.open()
this.clickFlga = false this.clickFlga = false
}).catch(() => { }).catch(err => {
this.clickFlga = false this.clickFlga = false
uni.hideLoading() uni.hideLoading()
}) })
......
<template> <template>
<view class="layout"> <view class="layout">
<view class="bg"> <wnCanvas
<!-- <image src="../../../assets/images/media/bg-1.webp" /> --> saveImageType="3"
</view> canvasId="c-1-1"
<view class="content"> :drawStatus="penSwitch"
<view class="title">{{title}}</view> custom
<view class="form" :key="watchStatus"> >
<template v-for="(i, index) in formObject"> <template slot="customContent">
<view class="bg">
<!-- <image src="../../../assets/images/media/bg-1.webp" /> -->
</view>
<view class="content">
<view <view
class="form-item" class="form-box"
:key="index" :key="watchStatus"
> >
<view class="label">{{ i.label }}</view> <view class="form">
<view class="value"> <template v-for="(i, index) in formObject">
<template v-if="i.type == 'input'">
<input
:type="i.inputType"
:maxlength="i.maxlength"
v-model="customerInfo[i.key]"
class="input"
@input="inputCustomer"
/>
</template>
<template v-else>
<view <view
class="select" :class="['form-item' ,{active:focusIndex == index}]"
@click="showPopup(i.popKey)" :key="index"
> >
{{ customerInfo[i.key] }} <view class="form-item-box">
<uni-icons <template v-if="i.type == 'input'">
class="arrow" <input
type="down" :type="i.inputType"
:size="16" :maxlength="i.maxlength"
></uni-icons> v-model="customerInfo[i.key]"
class="input"
@input="inputCustomer"
:placeholder="i.placeholder"
@focus="focusIndex = index"
@blur="resetFocusIndex"
/>
</template>
<template v-else>
<view
:class="['select flex',{placeholderStyle:!customerInfo[i.key]}]"
@click="showPopup(i.popKey,index)"
>
<view class="value text-hide">{{customerInfo[i.key] ||i.placeholder}}</view>
<uni-icons
class="arrow"
type="right"
:size="16"
></uni-icons>
</view>
</template>
</view>
</view> </view>
</template> </template>
</view> </view>
</view> </view>
</template>
</view>
<template v-for="(i, index) in views">
<view
class="view"
:key="index"
>
<wnCanvas
saveImageType="3"
:drawImage="i.detailUrl"
:canvasId="`c-1-${index}`"
:drawStatus="penSwitch"
></wnCanvas>
</view> </view>
</template> </template>
</view> </wnCanvas>
<car-brands <car-brands
ref="carBrandListVisible" ref="carBrandListVisible"
@select="handleSelect($event,'carBrandListVisible')" @select="handleSelect($event,'carBrandListVisible')"
/> @close="resetFocusIndex"
<employee autoSelect
ref="employeeBoxVisible"
@select="handleSelect($event,'employeeBoxVisible')"
/> />
</view> </view>
</template> </template>
...@@ -72,47 +72,42 @@ export default { ...@@ -72,47 +72,42 @@ export default {
props: { props: {
views: Array, views: Array,
penSwitch: Boolean, penSwitch: Boolean,
title: String title: String,
}, },
name: 'Media_1', name: 'Media_1',
data () { data () {
return { return {
formObject: [ formObject: [
{ {
label: '车主姓名', placeholder: '车主姓名',
key: 'customerName', key: 'customerName',
type: 'input', type: 'input',
inputType: 'text', inputType: 'text',
maxlength: 50 maxlength: 50
}, },
{ {
label: '车型', placeholder: '电话',
key: 'carModel',
type: 'select',
popKey: 'carBrandListVisible'
},
{
label: '电话',
key: 'phoneNumber', key: 'phoneNumber',
type: 'input', type: 'input',
inputType: 'tel', inputType: 'tel',
maxlength: 11 maxlength: 11
}, },
{ {
label: '销售姓名', placeholder: '车型',
key: 'staffName', key: 'carModel',
type: 'select', type: 'select',
popKey: 'employeeBoxVisible' popKey: 'carBrandListVisible'
} },
], ],
customerInfo: {} customerInfo: {},
focusIndex: -1
} }
}, },
watch: { watch: {
watchCustomerInfo: { watchCustomerInfo: {
immediate: true, immediate: true,
handler (newval) { handler (newval) {
if(newval) this.customerInfo = newval if (newval) this.customerInfo = newval
} }
}, },
}, },
...@@ -137,34 +132,29 @@ export default { ...@@ -137,34 +132,29 @@ export default {
this.$refs.carBrandListVisible.close() this.$refs.carBrandListVisible.close()
this.customerInfo.carModel = item.name this.customerInfo.carModel = item.name
} }
this.resetFocusIndex()
this.$store.dispatch('setCustomerInfo', this.customerInfo) this.$store.dispatch('setCustomerInfo', this.customerInfo)
}, },
showPopup (e) { showPopup (e, index) {
this.focusIndex = index
this.$refs[e].open() this.$refs[e].open()
}, },
closeAllPopup () { closeAllPopup () {
this.$refs.carBrandListVisible.close() this.$refs.carBrandListVisible.close()
this.$refs.employeeBoxVisible.close() this.resetFocusIndex()
} },
resetFocusIndex () {
this.focusIndex = -1
},
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.layout { .layout {
padding-top: 192rpx;
position: relative; position: relative;
.bg { width: 100vw;
position: absolute; height: 100vh;
left: 0;
top: 0;
width: 100%;
height: 560rpx;
image {
width: 100%;
height: 100%;
}
}
.content { .content {
border-radius: 40rpx 40rpx 0 0; border-radius: 40rpx 40rpx 0 0;
background: linear-gradient(180deg, #f7f9fc 0%, #f7f9fc 100%); background: linear-gradient(180deg, #f7f9fc 0%, #f7f9fc 100%);
...@@ -172,61 +162,70 @@ export default { ...@@ -172,61 +162,70 @@ export default {
position: relative; position: relative;
z-index: 1; z-index: 1;
min-height: calc(100vh - 200rpx); min-height: calc(100vh - 200rpx);
.title { box-sizing: border-box;
font-size: 40rpx; padding-top: 196rpx;
line-height: 48rpx; .form-box {
color: #1a1a1a; height: 80rpx;
padding: 32rpx 0; margin-bottom: 48rpx;
text-align: center; padding: 0 64rpx;
} .form {
.form {
display: flex;
flex-wrap: wrap;
gap: 28rpx 0;
padding: 30rpx 0;
&-item {
flex: 50%;
display: flex; display: flex;
align-items: center; gap: 0 28rpx;
color: #292d33; height: 100%;
font-size: 32rpx; &-item {
box-sizing: border-box; width: 336rpx;
padding-right: 64rpx; height: 100%;
.label { position: relative;
margin-left: auto;
flex-shrink: 0; &-box {
} position: relative;
.value { width: 100%;
width: 828rpx; height: 100%;
height: 80rpx; background: #ffffff;
border: 2rpx solid #e8e8ea; border: 3rpx solid #a8c1ff;
background: #ffffff; border-radius: 16rpx;
margin-left: 32rpx; box-sizing: border-box;
box-sizing: border-box; padding: 0 24rpx;
padding: 0 40rpx; z-index: 2;
border-radius: 8rpx; }
.input, .input,
.select { .select {
width: 100%; width: 100%;
height: 100%; height: 100%;
border: none !important; border: none !important;
outline: none; outline: none;
} font-size: 28rpx;
.select { color: #333333;
display: flex; border-radius: 16rpx;
align-items: center; box-sizing: border-box;
.arrow { &::placeholder {
margin-left: auto; color: #999999;
} }
} }
.placeholderStyle {
color: #999999;
}
.arrow {
color: #999 !important;
margin-left: auto;
flex-shrink: 0;
}
}
.active {
&::after {
position: absolute;
left: -2rpx;
top: -2rpx;
width: calc(100% + 4rpx);
height: calc(100% + 4rpx);
content: "";
background-image: linear-gradient(#2f6af7, #75bcff);
box-shadow: 0 0 0 8rpx #2c66f71a;
border-radius: 16rpx;
}
} }
} }
} }
.view {
position: relative;
z-index: 2;
margin-top: 44rpx;
}
} }
} }
</style> </style>
...@@ -120,22 +120,6 @@ export default { ...@@ -120,22 +120,6 @@ export default {
// 查询素材 // 查询素材
async getSoure () { async getSoure () {
let { moduleList, toolList } = await uni.$api.systemApi.getMockData(true); let { moduleList, toolList } = await uni.$api.systemApi.getMockData(true);
moduleList.map((e, index) => {
if (index == 3) e.class = 'vertical'
else if (index == 2) e.class = 'square'
else {
e.class = 'landscape'
e.style = {
0: 'width:974rpx;',
1: 'width:652rpx;',
4: 'width: 1282rpx;height: 288rpx;',
5: 'width: 1282rpx;height: 288rpx;',
6: 'display:none;'
}[index]
}
e.showTitle = false
});
console.log(moduleList)
this.moduleList = moduleList this.moduleList = moduleList
this.toolList = toolList this.toolList = toolList
}, },
...@@ -264,9 +248,9 @@ export default { ...@@ -264,9 +248,9 @@ export default {
&-text { &-text {
width: 100%; width: 100%;
height: 100%; height: 100%;
background: #999; background: #fff;
justify-content: center; justify-content: center;
color: #fff; color: #3773f8;
} }
} }
.landscape { .landscape {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!