@@ -412,6 +412,28 @@ onMounted(() => { | |||
clearInterval(timer.value); | |||
startCamera(); | |||
}); | |||
//#region 页面初始化和卸载 | |||
const resetTimer = ref(null); | |||
onMounted(() => { | |||
window.document.addEventListener("touchstart", () => { | |||
// 用户点击时,清除之前的定时器 | |||
clearTimeout(resetTimer.value); | |||
// 重新设定120秒后触发的定时器 | |||
resetTimer.value = setTimeout(() => { | |||
userInfoModulesPinia.clearStorage(); | |||
uni.redirectTo({ url: "/pages/login/index" }); | |||
}, 100000); | |||
}); | |||
resetTimer.value = setTimeout(() => { | |||
userInfoModulesPinia.clearStorage(); | |||
uni.redirectTo({ url: "/pages/login/index" }); | |||
}, 100000); | |||
}); | |||
onUnload(() => { | |||
clearTimeout(resetTimer.value); | |||
}); | |||
//#endregion ----------------------- | |||
</script> | |||
<style lang="scss" scoped> | |||
@@ -1,5 +1,5 @@ | |||
<template> | |||
<view class="page"> | |||
<view class="page" id="page"> | |||
<!-- tab栏 --> | |||
<view class="tabBox"> | |||
<u-tabs | |||
@@ -82,8 +82,11 @@ | |||
<script setup> | |||
//#region 导入 | |||
import { ref, watch } from "vue"; | |||
import { ref, watch, onMounted } from "vue"; | |||
import { getListApi } from "../../api/closeStyle"; | |||
import { onLoad, onUnload } from "@dcloudio/uni-app"; | |||
import { userInfoModules } from "@/store/modules/userInfo"; | |||
const userInfoModulesPinia = userInfoModules(); | |||
//#endregion ----------------------- | |||
//#region tab栏 | |||
@@ -129,6 +132,7 @@ function chooseSex(item) { | |||
} | |||
} else { | |||
sex.value = item.id; | |||
mouldType.value = ""; | |||
} | |||
} | |||
// 更多里的tab 类型 | |||
@@ -141,6 +145,7 @@ function chooseMouldType(item) { | |||
} | |||
} else { | |||
mouldType.value = item.id; | |||
sex.value = ""; | |||
} | |||
} | |||
//#endregion | |||
@@ -266,8 +271,26 @@ function createPhoto(item) { | |||
} | |||
//#endregion --------------------- | |||
//#region | |||
//#region 页面初始化和卸载 | |||
const resetTimer = ref(null); | |||
onMounted(() => { | |||
window.document.addEventListener("touchstart", () => { | |||
// 用户点击时,清除之前的定时器 | |||
clearTimeout(resetTimer.value); | |||
// 重新设定120秒后触发的定时器 | |||
resetTimer.value = setTimeout(() => { | |||
userInfoModulesPinia.clearStorage(); | |||
uni.redirectTo({ url: "/pages/login/index" }); | |||
}, 100000); | |||
}); | |||
resetTimer.value = setTimeout(() => { | |||
userInfoModulesPinia.clearStorage(); | |||
uni.redirectTo({ url: "/pages/login/index" }); | |||
}, 100000); | |||
}); | |||
onUnload(() => { | |||
clearTimeout(resetTimer.value); | |||
}); | |||
//#endregion ----------------------- | |||
</script> | |||
@@ -41,7 +41,7 @@ | |||
<script setup> | |||
//#region 导入 | |||
import { onLoad, onUnload } from "@dcloudio/uni-app"; | |||
import { ref, watch } from "vue"; | |||
import { ref, watch, onMounted } from "vue"; | |||
import { | |||
getPhotoListApi, | |||
photoSupperApi, | |||
@@ -212,6 +212,28 @@ function loginOut() { | |||
}); | |||
} | |||
//#endregion --------------------- | |||
//#region 页面初始化和卸载 | |||
const resetTimer = ref(null); | |||
onMounted(() => { | |||
window.document.addEventListener("touchstart", () => { | |||
// 用户点击时,清除之前的定时器 | |||
clearTimeout(resetTimer.value); | |||
// 重新设定120秒后触发的定时器 | |||
resetTimer.value = setTimeout(() => { | |||
userInfoModulesPinia.clearStorage(); | |||
uni.redirectTo({ url: "/pages/login/index" }); | |||
}, 100000); | |||
}); | |||
resetTimer.value = setTimeout(() => { | |||
userInfoModulesPinia.clearStorage(); | |||
uni.redirectTo({ url: "/pages/login/index" }); | |||
}, 100000); | |||
}); | |||
onUnload(() => { | |||
clearTimeout(resetTimer.value); | |||
}); | |||
//#endregion ----------------------- | |||
</script> | |||
<style lang="scss"> | |||
@@ -20,8 +20,8 @@ | |||
<view class="orangeBtn" @click="createing1" style="margin-top: -20rpx" | |||
>开始制作写真 | |||
</view> | |||
<view class="orangeBtn" @click="toCamera" style="margin-top: 10rpx" | |||
>摄像头调试 | |||
<view class="grayBtn" @click="toChooseModel" style="margin-top: 30rpx" | |||
>重新选择模版 | |||
</view> | |||
<!-- 登录二维码弹出层 --> | |||
<u-overlay | |||
@@ -58,7 +58,7 @@ | |||
<script setup> | |||
//#region 导入 | |||
import { ref, watch } from "vue"; | |||
import { ref, watch, onMounted } from "vue"; | |||
import { onLoad, onShow, onUnload } from "@dcloudio/uni-app"; | |||
import { | |||
findByIdApi, | |||
@@ -306,6 +306,11 @@ onUnload(() => { | |||
//#endregion --------------------- | |||
//#region 路由跳转 | |||
function toChooseModel() { | |||
uni.navigateTo({ | |||
url: `/pages/chooseStyle/index`, | |||
}); | |||
} | |||
function toCamera() { | |||
const url = styleData.value.coverImg; | |||
const id = styleData.value.id; | |||
@@ -336,6 +341,28 @@ function loginOut() { | |||
//#region | |||
//#endregion --------------------- | |||
//#region 页面初始化和卸载 | |||
const resetTimer = ref(null); | |||
onMounted(() => { | |||
window.document.addEventListener("touchstart", () => { | |||
// 用户点击时,清除之前的定时器 | |||
clearTimeout(resetTimer.value); | |||
// 重新设定120秒后触发的定时器 | |||
resetTimer.value = setTimeout(() => { | |||
userInfoModulesPinia.clearStorage(); | |||
uni.redirectTo({ url: "/pages/login/index" }); | |||
}, 100000); | |||
}); | |||
resetTimer.value = setTimeout(() => { | |||
userInfoModulesPinia.clearStorage(); | |||
uni.redirectTo({ url: "/pages/login/index" }); | |||
}, 100000); | |||
}); | |||
onUnload(() => { | |||
clearTimeout(resetTimer.value); | |||
}); | |||
//#endregion ----------------------- | |||
</script> | |||
<style lang="scss"> | |||
@@ -38,6 +38,7 @@ export const userInfoModules = defineStore("userInfoStore", () => { | |||
uni.setStorageSync("token", null); | |||
uni.setStorageSync("createTimes", null); | |||
uni.setStorageSync("phone", null); | |||
uni.setStorageSync("UserId", null); | |||
} | |||
return { token, phone, createTimes, clearStorage }; | |||
}, | |||