Commit 2d02aa7d by 前端

Merge branch 'v1.0.7' of http://192.168.3.233:8090/glsx/gl_tape into v1.0.7

2 parents e24b1ac8 e346c639
...@@ -900,9 +900,10 @@ export default { ...@@ -900,9 +900,10 @@ export default {
}, },
/**缩放 */ /**缩放 */
scale: utils.throttle(function (e) { scale (e) {
this.scaleValue = e.scale this.scaleValue = e.scale
}, 200), this.$emit('scale', e.scale)
}
} }
} }
</script> </script>
......
...@@ -76,7 +76,6 @@ export default { ...@@ -76,7 +76,6 @@ export default {
[this.startX, this.startY] = [e.touches[0].pageX, e.touches[0].pageY]; [this.startX, this.startY] = [e.touches[0].pageX, e.touches[0].pageY];
this.moveX = 0 this.moveX = 0
this.moveY = 0 this.moveY = 0
this.transformOriginStyle = `${this.startX}px ${this.startY}px`;
} }
}, },
handleTouchMove: utils.throttle(function (e) { handleTouchMove: utils.throttle(function (e) {
...@@ -89,10 +88,12 @@ export default { ...@@ -89,10 +88,12 @@ export default {
this.setScale(newScale, this.getTouchCenter(e.touches)); // 更新缩放同时更新中心点 this.setScale(newScale, this.getTouchCenter(e.touches)); // 更新缩放同时更新中心点
this.lastTouchDistance = currentDistance; this.lastTouchDistance = currentDistance;
} else if (this.isDragging && e.touches.length === 1 && this.scale !== 1) { } else if (this.isDragging && e.touches.length === 1 && this.scale !== 1) {
this.transformOriginStyle = `${this.startX}px ${this.startY}px`;
const newX = e.touches[0].pageX; const newX = e.touches[0].pageX;
const newY = e.touches[0].pageY; const newY = e.touches[0].pageY;
this.moveX = (newX - this.startX) / this.scale; this.moveX = (newX - this.startX) / this.scale;
this.moveY = (newY - this.startY) / this.scale; this.moveY = (newY - this.startY) / this.scale;
// 确保计算基于初始未缩放的触摸点,并考虑当前缩放比例
this.updatePosition(); this.updatePosition();
} }
}, 16), }, 16),
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
--> -->
<template> <template>
<view class="layout" @click.prevent="touch"> <view class="layout" @click.prevent="touch">
<wnCanvas :drawStatus="penSwitch" :canvasId="`c-${madiaId}`" custom> <wnCanvas :drawStatus="penSwitch" :canvasId="`c-${madiaId}`" custom @scale="$emit('scale',$event)">
<template slot="customContent"> <template slot="customContent">
<view class="title">{{ title }}</view> <view class="title">{{ title }}</view>
<view class="container"> <view class="container">
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
:drawStatus="penSwitch" :drawStatus="penSwitch"
:canvasId="`c-${madiaId}`" :canvasId="`c-${madiaId}`"
custom custom
@scale="$emit('scale',$event)"
> >
<template slot="customContent"> <template slot="customContent">
<view class="title">{{title}}</view> <view class="title">{{title}}</view>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
canvasId="c-1" canvasId="c-1"
:drawStatus="penSwitch" :drawStatus="penSwitch"
custom custom
@scale="$emit('scale',$event)"
> >
<template slot="customContent"> <template slot="customContent">
<view class="carType"> <view class="carType">
...@@ -147,7 +148,7 @@ export default { ...@@ -147,7 +148,7 @@ export default {
return this.$store.state.user.historyStatus return this.$store.state.user.historyStatus
}, },
carImg () { carImg () {
let name = { let name = {
'问界M5': 0, '问界M5': 0,
'问界M7': 1, '问界M7': 1,
'问界M9': 2 '问界M9': 2
...@@ -159,7 +160,7 @@ export default { ...@@ -159,7 +160,7 @@ export default {
inputCustomer () { inputCustomer () {
this.$store.dispatch('setCustomerInfo', this.customerInfo) this.$store.dispatch('setCustomerInfo', this.customerInfo)
}, },
handleSelect(item, popkey) { handleSelect (item, popkey) {
this.$refs[popkey].close() this.$refs[popkey].close()
if (popkey == 'employeeBoxVisible') { if (popkey == 'employeeBoxVisible') {
this.customerInfo.salesUuid = item.uuid this.customerInfo.salesUuid = item.uuid
...@@ -317,37 +318,37 @@ export default { ...@@ -317,37 +318,37 @@ export default {
* animation slide-bl * animation slide-bl
* ---------------------------------------- * ----------------------------------------
*/ */
@-webkit-keyframes slide-bl { @-webkit-keyframes slide-bl {
0% { 0% {
-webkit-transform: translateY(-100%) translateX(-100%); -webkit-transform: translateY(-100%) translateX(-100%);
transform: translateY(-100%) translateX(-100%); transform: translateY(-100%) translateX(-100%);
opacity: 0.2; opacity: 0.2;
filter: blur(0.5px); filter: blur(0.5px);
} }
100% { 100% {
-webkit-transform: translateY(0) translateX(0); -webkit-transform: translateY(0) translateX(0);
transform: translateY(0) translateX(0); transform: translateY(0) translateX(0);
opacity: 1; opacity: 1;
filter: blur(0); filter: blur(0);
} }
} }
@keyframes slide-bl { @keyframes slide-bl {
0% { 0% {
-webkit-transform: translateY(-100%) translateX(100%) scale(0.5); -webkit-transform: translateY(-100%) translateX(100%) scale(0.5);
transform: translateY(-100%) translateX(100%) scale(0.5); transform: translateY(-100%) translateX(100%) scale(0.5);
opacity: 0.2; opacity: 0.2;
filter: blur(0.5px); filter: blur(0.5px);
} }
100% { 100% {
-webkit-transform: translateY(0) translateX(0); -webkit-transform: translateY(0) translateX(0);
transform: translateY(0) translateX(0); transform: translateY(0) translateX(0);
opacity: 1; opacity: 1;
filter: blur(0); filter: blur(0);
} }
} }
.slide-bl { .slide-bl {
-webkit-animation: slide-bl 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; -webkit-animation: slide-bl 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
animation: slide-bl 0.5s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; animation: slide-bl 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
} }
</style> </style>
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
:drawStatus="penSwitch" :drawStatus="penSwitch"
:canvasId="`c-${madiaId}`" :canvasId="`c-${madiaId}`"
custom custom
@scale="$emit('scale',$event)"
> >
<template slot="customContent"> <template slot="customContent">
<view class="title">{{title}}</view> <view class="title">{{title}}</view>
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
:title="item.detailTitle || ''" :title="item.detailTitle || ''"
:madiaId="item.id" :madiaId="item.id"
:carTypeList="item.carTypeList || []" :carTypeList="item.carTypeList || []"
@scale="scale"
/> />
</view> </view>
</template> </template>
...@@ -103,7 +104,8 @@ export default { ...@@ -103,7 +104,8 @@ export default {
drawStatus: false, drawStatus: false,
startX: null, startX: null,
startY: null, startY: null,
screenWidth: null screenWidth: null,
scaleValueObject: {}
}; };
}, },
computed: { computed: {
...@@ -174,14 +176,15 @@ export default { ...@@ -174,14 +176,15 @@ export default {
}, },
touchEnd (e) { touchEnd (e) {
try { try {
let { toolList, drawStatus, startX, screenWidth, id } = this let { toolList, drawStatus, startX, screenWidth, id, scaleValueObject } = this
if (!e || !e.changedTouches || drawStatus || toolList.length == 0 || e.changedTouches.length === 0) return if (!e || !e.changedTouches || drawStatus || toolList.length == 0 || e.changedTouches.length === 0) return
let halfScreenWidth = screenWidth / 2, let halfScreenWidth = screenWidth / 2,
touch = e.changedTouches[0], touch = e.changedTouches[0],
isDistanceSignificant = Math.abs(touch.pageX - startX) > screenWidth / 3, isDistanceSignificant = Math.abs(touch.pageX - startX) > screenWidth / 3,
index = toolList.findIndex(item => item.id == id) index = toolList.findIndex(item => item.id == id)
if(Math.abs(this.startY - touch.pageY) > 100) return if (Math.abs(this.startY - touch.pageY) > 100) return
if (isDistanceSignificant && index != -1) { if(!scaleValueObject[id]) scaleValueObject[id] = 1
if (isDistanceSignificant && index != -1 && scaleValueObject[id] == 1) {
const nextId = this.getNextId(index, toolList, startX, halfScreenWidth) const nextId = this.getNextId(index, toolList, startX, halfScreenWidth)
this.$emit('update:id', nextId) this.$emit('update:id', nextId)
} }
...@@ -195,6 +198,10 @@ export default { ...@@ -195,6 +198,10 @@ export default {
} else { } else {
return index === 0 ? toolList[toolList.length - 1].id : toolList[index - 1].id; return index === 0 ? toolList[toolList.length - 1].id : toolList[index - 1].id;
} }
},
scale(e){
let {id} = this
this.scaleValueObject[id] = e
} }
}, },
......
...@@ -81,6 +81,11 @@ export default { ...@@ -81,6 +81,11 @@ export default {
// 其他情况允许正常返回 // 其他情况允许正常返回
return false; return false;
}, },
onLoad () {
const mock_data = uni.$storage.get('mock_data') || {}
this.moduleList = mock_data.moduleList || []
this.toolList = mock_data.toolList || []
},
onShow () { onShow () {
const userInfo = uni.$storage.get("userInfo") const userInfo = uni.$storage.get("userInfo")
if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) { if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) {
...@@ -148,7 +153,7 @@ export default { ...@@ -148,7 +153,7 @@ export default {
}, },
// 查询素材 // 查询素材
async getSoure () { async getSoure () {
let { moduleList, toolList } = await uni.$api.systemApi.getMockData(true); const { moduleList, toolList } = await uni.$api.systemApi.getMockData(true);
await moduleList.map(async e => { await moduleList.map(async e => {
if (e.receptionSourceDetailList) e.receptionSourceDetailList = await uni.$api.systemApi.imgToBase64(e.receptionSourceDetailList, 'detailUrl') if (e.receptionSourceDetailList) e.receptionSourceDetailList = await uni.$api.systemApi.imgToBase64(e.receptionSourceDetailList, 'detailUrl')
if (e.carTypeList) e.carTypeList = await uni.$api.systemApi.imgToBase64(e.carTypeList) if (e.carTypeList) e.carTypeList = await uni.$api.systemApi.imgToBase64(e.carTypeList)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!