Commit d73d13d9 by 李伟康

提交代码

1 parent 2ab7ee8e
...@@ -106,7 +106,7 @@ class Draw { ...@@ -106,7 +106,7 @@ class Draw {
let textArr = text.split('') let textArr = text.split('')
let newText = '' let newText = ''
try { try {
textArr.map(e =>{ textArr.map(e => {
newText += e newText += e
if (this.getTextWidth(newText) > width - fontX - this.getTextWidth('…') - fontSize) throw newText if (this.getTextWidth(newText) > width - fontX - this.getTextWidth('…') - fontSize) throw newText
}) })
...@@ -179,7 +179,7 @@ class Draw { ...@@ -179,7 +179,7 @@ class Draw {
this[_ctx_].stroke() this[_ctx_].stroke()
} }
drawLine (lineParams) { drawLine (lineParams, callback) {
this[_ctx_].beginPath() this[_ctx_].beginPath()
let { let {
opacity, opacity,
...@@ -190,6 +190,7 @@ class Draw { ...@@ -190,6 +190,7 @@ class Draw {
endX, endX,
endY, endY,
} = lineParams } = lineParams
console.log(lineParams)
startX = this.toRpx(startX) startX = this.toRpx(startX)
startY = this.toRpx(startY) startY = this.toRpx(startY)
width = this.toRpx(width) width = this.toRpx(width)
...@@ -203,6 +204,7 @@ class Draw { ...@@ -203,6 +204,7 @@ class Draw {
this[_ctx_].stroke() this[_ctx_].stroke()
this[_ctx_].restore() this[_ctx_].restore()
this[_ctx_].save() this[_ctx_].save()
if (callback) callback()
} }
setLineY = params => { setLineY = params => {
let { let {
......
<template> <template>
<div class="layout"> <div class="layout">
<div class="title">左右滑动查看核销凭证</div> <div class="title">左右滑动查看核销凭证</div>
<div class="content"> <div
class="content"
@touchend="end"
>
<van-swipe <van-swipe
class="img-box" class="img-box"
:key="updata" :key="updata"
indicator-color="#FFFFFF" indicator-color="#FFFFFF"
:width="347"
:loop="false" :loop="false"
@change="change" @change="change"
:style="swipeStyle" :style="swipeStyle"
:show-indicators="false" :show-indicators="false"
ref="swipe" ref="swipe"
duration="200"
> >
<template v-for="(i,index) in orderList"> <template v-for="(i,index) in orderList">
<van-swipe-item :key="index"> <van-swipe-item :key="index">
...@@ -68,21 +71,23 @@ export default { ...@@ -68,21 +71,23 @@ export default {
this.getOrderList() this.getOrderList()
}, },
methods: { methods: {
change (e) { end () {
this.itemIndex = e let { swipe } = this.$refs
let { track } = this.$refs.swipe.$refs, let { track } = swipe.$refs,
{ orderList } = this { itemIndex } = this,
{ offsetWidth } = swipe.$children[0].$el
this.$nextTick(() => { this.$nextTick(() => {
if (e == 0) this.swipeStyle = swipeStyle if (itemIndex == 0) this.swipeStyle = swipeStyle
else { else {
let [firstCss, last] = track.style.cssText.split('translateX(-') let width = track.style.cssText.split('width:')[1]
let [num, lastCss] = last.split('px)') let num = offsetWidth * itemIndex - 9
num = Number(num) - (e == orderList.length - 1 ? -27 : 9) track.style.cssText = `transition-duration: 200; transform: translateX(-${num}px); width:${width}`
track.style.cssText = `${firstCss}translateX(-${num}px)${lastCss}`
this.swipeStyle = '' this.swipeStyle = ''
} }
}) })
},
change (e) {
this.itemIndex = e
}, },
getOrderList () { getOrderList () {
let { id } = this.getLocalStorage('wx_scrm_link_params') let { id } = this.getLocalStorage('wx_scrm_link_params')
...@@ -135,19 +140,13 @@ export default { ...@@ -135,19 +140,13 @@ export default {
width: 100%; width: 100%;
height: 422px; height: 422px;
/deep/.van-swipe-item { /deep/.van-swipe-item {
text-align: right; width: 347px !important;
} }
.img { .img {
width: 337px; width: 337px;
height: 422px; height: 422px;
object-fit: contain; object-fit: contain;
} margin-left: 10px;
.move {
position: absolute;
left: 0;
top: 0;
width: 1103px;
height: 100%;
} }
} }
.tips { .tips {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!