Commit 742df99b by 李伟康

commit 默认车型

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