71 lines
1.2 KiB
Plaintext
71 lines
1.2 KiB
Plaintext
|
|
<script setup lang="uts">
|
||
|
|
// #ifdef APP-ANDROID || APP-HARMONY
|
||
|
|
let firstBackTime = 0
|
||
|
|
// #endif
|
||
|
|
|
||
|
|
onLaunch(() => {
|
||
|
|
console.log('App Launch - AI助手')
|
||
|
|
})
|
||
|
|
|
||
|
|
onAppShow(() => {
|
||
|
|
console.log('App Show')
|
||
|
|
})
|
||
|
|
|
||
|
|
onAppHide(() => {
|
||
|
|
console.log('App Hide')
|
||
|
|
})
|
||
|
|
|
||
|
|
// #ifdef APP-ANDROID || APP-HARMONY
|
||
|
|
onLastPageBackPress(() => {
|
||
|
|
console.log('App LastPageBackPress')
|
||
|
|
if (firstBackTime == 0) {
|
||
|
|
uni.showToast({
|
||
|
|
title: '再按一次退出应用',
|
||
|
|
position: 'bottom',
|
||
|
|
})
|
||
|
|
firstBackTime = Date.now()
|
||
|
|
setTimeout(() => {
|
||
|
|
firstBackTime = 0
|
||
|
|
}, 2000)
|
||
|
|
} else if (Date.now() - firstBackTime < 2000) {
|
||
|
|
firstBackTime = Date.now()
|
||
|
|
uni.exit()
|
||
|
|
}
|
||
|
|
})
|
||
|
|
|
||
|
|
onExit(() => {
|
||
|
|
console.log('App Exit')
|
||
|
|
})
|
||
|
|
// #endif
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style>
|
||
|
|
/* 全局暗色主题基础样式 */
|
||
|
|
page {
|
||
|
|
background-color: #0f0f1a;
|
||
|
|
color: rgba(255, 255, 255, 0.92);
|
||
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||
|
|
}
|
||
|
|
|
||
|
|
/* 每个页面公共css */
|
||
|
|
.uni-row {
|
||
|
|
flex-direction: row;
|
||
|
|
}
|
||
|
|
|
||
|
|
.uni-column {
|
||
|
|
flex-direction: column;
|
||
|
|
}
|
||
|
|
|
||
|
|
/* 安全区域适配 */
|
||
|
|
.status-bar-placeholder {
|
||
|
|
height: var(--status-bar-height);
|
||
|
|
}
|
||
|
|
|
||
|
|
/* 滚动条隐藏 */
|
||
|
|
::-webkit-scrollbar {
|
||
|
|
display: none;
|
||
|
|
width: 0;
|
||
|
|
height: 0;
|
||
|
|
}
|
||
|
|
</style>
|