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