Commit 7736deeb by 李伟康

commit 提交

1 parent 679a2cd2
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -68,6 +68,7 @@
class="canvas-view"
scale-min="1"
:scale="!drawStatus"
:disabled="drawStatus"
:direction="scaleValue == 1?'none':'all'"
:scale-value="defaultScaleValue"
@scale="scale"
......
......@@ -91,7 +91,7 @@
>
<uni-popup-message
type="success"
message="保存成功"
message="数据保存成功"
:duration="1500"
></uni-popup-message>
</uni-popup>
......
......@@ -9,6 +9,8 @@
<view
class="detail-box"
@dblclick="dbClick"
@touchstart.stop="touchStart"
@touchend.stop="touchEnd"
>
<view class="nav-bar">
<view
......@@ -92,7 +94,9 @@ export default {
data () {
return {
drawStatus: false,
showPayBtn: false
showPayBtn: false,
startX: null,
screenWidth: null
};
},
computed: {
......@@ -121,7 +125,8 @@ export default {
}
},
mounted () {
const systemInfo = uni.getSystemInfoSync()
this.screenWidth = systemInfo.screenWidth
},
methods: {
...mapMutations("audio", ["setReceptionStatus"]),
......@@ -154,13 +159,42 @@ export default {
},
dbClick () {
if (this.type != 'preview') this.drawStatus = !this.drawStatus
},
touchStart (e) {
if (!this.drawStatus && e.changedTouches?.length) this.startX = e.changedTouches[0].pageX
},
touchEnd (e) {
try {
let { toolList, drawStatus, startX, screenWidth, id } = this
if (!e || !e.changedTouches || drawStatus || toolList.length == 0 || e.changedTouches.length === 0) return
let halfScreenWidth = screenWidth / 2,
touch = e.changedTouches[0],
isDistanceSignificant = Math.abs(touch.pageX - startX) > screenWidth / 3,
index = toolList.findIndex(item => item.id == id)
if (isDistanceSignificant && index != -1) {
const nextId = this.getNextId(index, toolList, startX, halfScreenWidth)
this.$emit('update:id', nextId)
}
} catch (error) {
console.log(error)
}
},
getNextId (index, toolList, startX, halfScreenWidth) {
if (startX > halfScreenWidth) {
return index === toolList.length - 1 ? toolList[0].id : toolList[index + 1].id;
} else {
return index === 0 ? toolList[toolList.length - 1].id : toolList[index - 1].id;
}
}
},
};
</script>
<style scoped lang="scss">
.detail-box {
position: relative;
width: 100vw;
height: 100vh;
}
.nav-bar {
position: fixed;
......
......@@ -18,8 +18,9 @@
:class="['item', i.class]"
:style="i.style"
@click="toDetail(i)"
v-if="!i.hide"
>
<template v-if="i.showTitle">
<template v-if="i.showAlt">
<view class="item-text flex">{{i.title}}</view>
</template>
<template v-else>
......@@ -124,7 +125,7 @@ export default {
this.toolList = toolList
},
errorImg (index) {
this.moduleList[index].showTitle = true
this.moduleList[index].showAlt = true
},
async start () {
const result = await this.$permision.requestAndroidPermission(
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!