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 @@ ...@@ -68,6 +68,7 @@
class="canvas-view" class="canvas-view"
scale-min="1" scale-min="1"
:scale="!drawStatus" :scale="!drawStatus"
:disabled="drawStatus"
:direction="scaleValue == 1?'none':'all'" :direction="scaleValue == 1?'none':'all'"
:scale-value="defaultScaleValue" :scale-value="defaultScaleValue"
@scale="scale" @scale="scale"
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
> >
<uni-popup-message <uni-popup-message
type="success" type="success"
message="保存成功" message="数据保存成功"
:duration="1500" :duration="1500"
></uni-popup-message> ></uni-popup-message>
</uni-popup> </uni-popup>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
<view <view
class="detail-box" class="detail-box"
@dblclick="dbClick" @dblclick="dbClick"
@touchstart.stop="touchStart"
@touchend.stop="touchEnd"
> >
<view class="nav-bar"> <view class="nav-bar">
<view <view
...@@ -92,7 +94,9 @@ export default { ...@@ -92,7 +94,9 @@ export default {
data () { data () {
return { return {
drawStatus: false, drawStatus: false,
showPayBtn: false showPayBtn: false,
startX: null,
screenWidth: null
}; };
}, },
computed: { computed: {
...@@ -121,7 +125,8 @@ export default { ...@@ -121,7 +125,8 @@ export default {
} }
}, },
mounted () { mounted () {
const systemInfo = uni.getSystemInfoSync()
this.screenWidth = systemInfo.screenWidth
}, },
methods: { methods: {
...mapMutations("audio", ["setReceptionStatus"]), ...mapMutations("audio", ["setReceptionStatus"]),
...@@ -154,13 +159,42 @@ export default { ...@@ -154,13 +159,42 @@ export default {
}, },
dbClick () { dbClick () {
if (this.type != 'preview') this.drawStatus = !this.drawStatus 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> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.detail-box { .detail-box {
position: relative; position: relative;
width: 100vw;
height: 100vh;
} }
.nav-bar { .nav-bar {
position: fixed; position: fixed;
......
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
:class="['item', i.class]" :class="['item', i.class]"
:style="i.style" :style="i.style"
@click="toDetail(i)" @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> <view class="item-text flex">{{i.title}}</view>
</template> </template>
<template v-else> <template v-else>
...@@ -124,7 +125,7 @@ export default { ...@@ -124,7 +125,7 @@ export default {
this.toolList = toolList this.toolList = toolList
}, },
errorImg (index) { errorImg (index) {
this.moduleList[index].showTitle = true this.moduleList[index].showAlt = true
}, },
async start () { async start () {
const result = await this.$permision.requestAndroidPermission( 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!