Commit d73d13d9 by 李伟康

提交代码

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