|
@@ -1,6 +1,5 @@
|
|
|
<template>
|
|
|
<div class="fourth">
|
|
|
-
|
|
|
<div class="main animate__animated">
|
|
|
<img src="../../../assets/img/top4.png" />
|
|
|
<label for="file" :class="{ camere: true, shakeSlow: dou === 2 }">
|
|
@@ -32,28 +31,39 @@ import { ref, defineEmits } from "vue";
|
|
|
* window.$originData.urlParames url参数
|
|
|
*/
|
|
|
const emits = defineEmits(["changePage"]);
|
|
|
+
|
|
|
+const dou = ref(0);
|
|
|
+
|
|
|
window.addEventListener(
|
|
|
"devicemotion",
|
|
|
- function (e) {
|
|
|
- const event = e || {};
|
|
|
- const acceleration = event.accelerationIncludingGravity;
|
|
|
- console.log(acceleration);
|
|
|
+ event => {
|
|
|
+ var acceleration = event.accelerationIncludingGravity;
|
|
|
+ let px = Math.pow(acceleration.x, 2) >= 100;
|
|
|
+ let py = Math.pow(acceleration.y, 2) >= 100;
|
|
|
+ let pz = Math.pow(acceleration.z, 2) >= 100;
|
|
|
+ console.log("----------------start------------");
|
|
|
+ if (px || py || pz) {
|
|
|
+ // 手机摇晃
|
|
|
+ dou.value = 2;
|
|
|
+ let t = setTimeout(() => {
|
|
|
+ clearTimeout(t);
|
|
|
+ emits("changePage", "five");
|
|
|
+ }, 2000);
|
|
|
+ }
|
|
|
},
|
|
|
- true
|
|
|
+ false
|
|
|
);
|
|
|
|
|
|
-const dou = ref(0);
|
|
|
-
|
|
|
function inputFile() {
|
|
|
dou.value = 1;
|
|
|
- let t = setTimeout(() => {
|
|
|
- clearTimeout(t);
|
|
|
- dou.value = 2;
|
|
|
- t = setTimeout(() => {
|
|
|
- clearTimeout(t);
|
|
|
- emits("changePage", "five");
|
|
|
- }, 2000);
|
|
|
- }, 2000);
|
|
|
+ // let t = setTimeout(() => {
|
|
|
+ // clearTimeout(t);
|
|
|
+ // dou.value = 2;
|
|
|
+ // t = setTimeout(() => {
|
|
|
+ // clearTimeout(t);
|
|
|
+ // emits("changePage", "five");
|
|
|
+ // }, 2000);
|
|
|
+ // }, 2000);
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|