Commit e4d87c18 by 李伟康

commit

1 parent b394797c
<template> <template>
<view class="content"> <view class="content">
<template v-if="false"> <template v-if="false">
<template v-if="showPenBox"> <template v-if="showPenBox">
<view class="pen-box"> <view class="pen-box">
<view <view
class="pen" class="pen"
:style="{backgroundColor: currentColor, height: lineWidth+'px'}" :style="{backgroundColor: currentColor, height: lineWidth+'px'}"
></view> ></view>
<slider <slider
min="1" min="1"
max="20" max="20"
:value="lineWidth" :value="lineWidth"
block-size="20" block-size="20"
activeColor="#84f876" activeColor="#84f876"
class="pen-slider" class="pen-slider"
@change="penWidthChange" @change="penWidthChange"
/> />
<view class="pen-txt">{{lineWidth}}px</view> <view class="pen-txt">{{lineWidth}}px</view>
</view> </view>
</template> </template>
<image <image
v-if="isLandScape" v-if="isLandScape"
src="./img/color.png" src="./img/color.png"
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
> >
<canvas <canvas
class="board-canvas" class="board-canvas"
canvas-id="drawCanvas" :canvas-id="canvasId"
disable-scroll="true" disable-scroll="true"
@touchstart="touchStart" @touchstart="touchStart"
@touchmove="touchMove" @touchmove="touchMove"
...@@ -194,7 +194,7 @@ export default { ...@@ -194,7 +194,7 @@ export default {
toolsShow: true, toolsShow: true,
isLandScape: false, //是否横屏 isLandScape: false, //是否横屏
aspectRatio: 1,//图片宽高比 aspectRatio: 1,//图片宽高比
showPenBox: false showPenBox: false
}; };
}, },
...@@ -215,10 +215,14 @@ export default { ...@@ -215,10 +215,14 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
drawStatus: Boolean drawStatus: Boolean,
canvasId: {
type: String,
default: 'drawCanvas'
}
}, },
mounted (opt) { mounted (opt) {
this.drawContext = uni.createCanvasContext('drawCanvas', this); this.drawContext = uni.createCanvasContext(this.canvasId, this);
this.initBoard(); this.initBoard();
}, },
methods: { methods: {
...@@ -248,9 +252,9 @@ export default { ...@@ -248,9 +252,9 @@ export default {
this.colorShowHandel() this.colorShowHandel()
} }
if(item.key == 'line'){ if (item.key == 'line') {
this.showPenBox = !this.showPenBox this.showPenBox = !this.showPenBox
} }
if (item.key == "download") { if (item.key == "download") {
//下载 //下载
this.downloadHandle() this.downloadHandle()
...@@ -695,7 +699,7 @@ export default { ...@@ -695,7 +699,7 @@ export default {
} }
if (this.saveImageType == 2 || this.saveImageType == 3) { if (this.saveImageType == 2 || this.saveImageType == 3) {
uni.canvasToTempFilePath({ uni.canvasToTempFilePath({
canvasId: 'drawCanvas', canvasId: this.canvasId,
success: function (res) { success: function (res) {
console.log('回调参数:' + JSON.stringify(res)); console.log('回调参数:' + JSON.stringify(res));
// 在H5平台下,tempFilePath 为 base64 // 在H5平台下,tempFilePath 为 base64
...@@ -721,7 +725,7 @@ export default { ...@@ -721,7 +725,7 @@ export default {
that.saveImageUrl() that.saveImageUrl()
} else { } else {
uni.canvasToTempFilePath({ uni.canvasToTempFilePath({
canvasId: 'drawCanvas', canvasId: this.canvasId,
success: function (res) { success: function (res) {
console.log(res); console.log(res);
that.$emit("saveImage", res.tempFilePath) that.$emit("saveImage", res.tempFilePath)
...@@ -741,7 +745,7 @@ export default { ...@@ -741,7 +745,7 @@ export default {
this.drawContext.draw(); this.drawContext.draw();
this.drawHistory() this.drawHistory()
uni.canvasToTempFilePath({ uni.canvasToTempFilePath({
canvasId: 'drawCanvas', canvasId: this.canvasId,
success: function (res) { success: function (res) {
that.$emit("saveImage", res.tempFilePath) that.$emit("saveImage", res.tempFilePath)
} }
...@@ -812,7 +816,7 @@ export default { ...@@ -812,7 +816,7 @@ export default {
this.drawContext.setLineWidth(this.lineWidth); //设置画笔粗细 this.drawContext.setLineWidth(this.lineWidth); //设置画笔粗细
//设置背景 //设置背景
this.$nextTick(() => { this.$nextTick(() => {
this.penWidthChange() this.penWidthChange()
this.fillBackground(); this.fillBackground();
}) })
} }
...@@ -838,16 +842,16 @@ export default { ...@@ -838,16 +842,16 @@ export default {
} }
.pen-box { .pen-box {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
background-color: #fff; background-color: #fff;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
height: 3rem; height: 3rem;
z-index: 2; z-index: 2;
width: 100%; width: 100%;
.pen { .pen {
width: 3rem; width: 3rem;
border-radius: 0.2rem; border-radius: 0.2rem;
......
...@@ -20,7 +20,13 @@ ...@@ -20,7 +20,13 @@
/> />
</template> </template>
<template> <template>
<view class="select">
<uni-icons
class="arrow"
type="down"
:size="16"
></uni-icons>
</view>
</template> </template>
</view> </view>
</view> </view>
...@@ -35,6 +41,7 @@ ...@@ -35,6 +41,7 @@
saveImageType="3" saveImageType="3"
:drawImage="i.detailUrl" :drawImage="i.detailUrl"
:isUnderBkg="true" :isUnderBkg="true"
:canvasId="`c-1-${index}`"
drawStatus drawStatus
></wnCanvas> ></wnCanvas>
</view> </view>
...@@ -44,9 +51,7 @@ ...@@ -44,9 +51,7 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import Tabs from './Tabs.vue'
export default { export default {
components: { Tabs },
props: { props: {
views: Array views: Array
}, },
...@@ -84,9 +89,7 @@ export default { ...@@ -84,9 +89,7 @@ export default {
mounted () { mounted () {
}, },
methods: { methods: {
changeView (index) {
},
} }
} }
</script> </script>
...@@ -100,8 +103,7 @@ export default { ...@@ -100,8 +103,7 @@ export default {
left: 0; left: 0;
top: 0; top: 0;
width: 100%; width: 100%;
height: 864rpx; height: 432rpx;
background-color: #096;
} }
.content { .content {
border-radius: 40rpx 40rpx 0 0; border-radius: 40rpx 40rpx 0 0;
...@@ -116,15 +118,43 @@ export default { ...@@ -116,15 +118,43 @@ export default {
padding: 32rpx 0; padding: 32rpx 0;
text-align: center; text-align: center;
} }
.form{ .form {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 28rpx 0; gap: 28rpx 0;
&-item{ &-item {
flex: 50%; flex: 50%;
display: flex; display: flex;
align-items: center; align-items: center;
.value{} 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;
input,
.select {
width: 100%;
height: 100%;
}
.select {
display: flex;
align-items: center;
.arrow{
margin-left: auto;
}
}
}
} }
} }
} }
......
<template>
<view class="layout">
<view class="bg">
<glsx-image src="media/bg-2.png" />
</view>
<view class="content">
<view class="title">问界·商城延保价格明细</view>
<tabs :list="views" />
<view class="canvas-box">
<template v-for="(i,index) in views">
<view
class="canvas-view"
:key="index"
>
<wnCanvas
saveImageType="3"
:drawImage="i.detailUrl"
:isUnderBkg="true"
drawStatus
:canvasId="`c-2-${index}`"
></wnCanvas>
</view>
</template>
</view>
</view>
</view>
</template>
<script type='text/ecmascript-6'>
import Tabs from './Tabs.vue'
export default {
components: { Tabs },
props: {
views: Array
},
name: 'Media_2',
data () {
return {
viewIndex: 0
}
},
mounted () {
},
methods: {
changeView (index) {
this.viewIndex = index
},
}
}
</script>
<style scoped lang='scss'>
.layout {
padding-top: 272rpx;
position: relative;
.bg {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 432rpx;
}
.content {
border-radius: 40rpx 40rpx 0 0;
background: linear-gradient(180deg, #f7f9fc 0%, #f7f9fc 100%);
overflow: hidden;
position: relative;
z-index: 1;
.title {
font-weight: 500;
font-size: 48rpx;
color: #1a1a1a;
padding: 32rpx 0;
text-align: center;
}
.canvas-box{
display: flex;
}
.canvas-view {
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
:key="index" :key="index"
@click="tabClick(index)" @click="tabClick(index)"
> >
{{item}} {{item.tabName}}
</view> </view>
</template> </template>
</view> </view>
...@@ -27,6 +27,7 @@ export default { ...@@ -27,6 +27,7 @@ export default {
}, },
methods: { methods: {
tabClick (index) { tabClick (index) {
this.tabIndex = index
this.$emit('tabclick', index) this.$emit('tabclick', index)
} }
} }
......
...@@ -8,7 +8,14 @@ ...@@ -8,7 +8,14 @@
<template> <template>
<view class="detail-box"> <view class="detail-box">
<view class="nav-bar"> <view class="nav-bar">
<view class="back" @click="back"> <view
class="back"
@click="back"
>
<uni-icons
type="left"
:size="32"
></uni-icons>
</view> </view>
</view> </view>
<tool-box <tool-box
...@@ -16,7 +23,12 @@ ...@@ -16,7 +23,12 @@
@choose="choose" @choose="choose"
@finish="open" @finish="open"
/> />
<media_1 :views="mediaList" /> <view :class="['view',{showView:id == 1}]">
<media_1 :views="mediaList" />
</view>
<view :class="['view',{showView:id == 2}]">
<media_2 :views="mediaList" />
</view>
<pay-pop ref="pay"></pay-pop> <pay-pop ref="pay"></pay-pop>
</view> </view>
</template> </template>
...@@ -25,8 +37,9 @@ import payPop from './components/payPop.vue'; ...@@ -25,8 +37,9 @@ import payPop from './components/payPop.vue';
import ToolBox from './components/ToolBox.vue' import ToolBox from './components/ToolBox.vue'
import myClick from "@/mixin/click"; import myClick from "@/mixin/click";
import Media_1 from './components/Media_1.vue' import Media_1 from './components/Media_1.vue'
import Media_2 from './components/Media_2.vue'
export default { export default {
components: { ToolBox, payPop, Media_1 }, components: { ToolBox, payPop, Media_1, Media_2 },
mixins: [myClick], mixins: [myClick],
data () { data () {
return { return {
...@@ -55,21 +68,24 @@ export default { ...@@ -55,21 +68,24 @@ export default {
} }
}, },
back(){ back () {
uni.navigateBack() uni.navigateBack()
} }
}, },
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.nav-bar{ .detail-box{
position: relative;
}
.nav-bar {
position: fixed; position: fixed;
width: 100%; width: 100%;
height: 96rpx; height: 96rpx;
left: 0; left: 0;
top: 48rpx; top: 48rpx;
z-index: 2; z-index: 9;
.back{ .back {
height: 100%; height: 100%;
aspect-ratio: 1/1; aspect-ratio: 1/1;
display: flex; display: flex;
...@@ -77,4 +93,17 @@ export default { ...@@ -77,4 +93,17 @@ export default {
justify-content: center; justify-content: center;
} }
} }
.view {
position: absolute;
z-index: -1;
opacity: 0;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.showView {
z-index: 2;
opacity: 1;
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!