You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
1.7 KiB
Vue
88 lines
1.7 KiB
Vue
<script>
|
|
import {
|
|
markSessionNeedsRestore,
|
|
restoreSessionIfNeeded
|
|
} from '@/utils/request.js'
|
|
import { appLog, flushLogs, installAppLogger } from '@/utils/appLog.js'
|
|
|
|
export default {
|
|
onLaunch: function() {
|
|
installAppLogger()
|
|
appLog('info', '[app] onLaunch')
|
|
const token = uni.getStorageSync('token')
|
|
const refreshToken =
|
|
uni.getStorageSync('refresh_token') ||
|
|
uni.getStorageSync('refreshToken')
|
|
appLog(
|
|
'info',
|
|
'[app] onLaunch 本地登录态',
|
|
`hasToken=${Boolean(token)}`,
|
|
`hasRefreshToken=${Boolean(refreshToken)}`
|
|
)
|
|
if (token || refreshToken) {
|
|
markSessionNeedsRestore()
|
|
}
|
|
flushLogs()
|
|
},
|
|
onShow: function() {
|
|
appLog('info', '[app] onShow 回到前台')
|
|
// #ifdef APP-PLUS
|
|
plus.navigator.setFullscreen(true); // 隐藏状态栏(全屏显示)
|
|
// #endif
|
|
restoreSessionIfNeeded().then((ok) => {
|
|
appLog('info', '[app] onShow 续会话结果:', ok)
|
|
flushLogs()
|
|
}).catch((err) => {
|
|
appLog('error', '[app] onShow 续会话异常:', err)
|
|
flushLogs()
|
|
})
|
|
},
|
|
onHide: function() {
|
|
appLog('info', '[app] onHide 进入后台/锁屏')
|
|
markSessionNeedsRestore()
|
|
flushLogs()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import '@/uni_modules/tuniaoui-vue3/index.css';
|
|
|
|
page {
|
|
--pad-h: 100vh;
|
|
--pad-vh: 1vh;
|
|
}
|
|
|
|
/*每个页面公共css */
|
|
.page-container {
|
|
height: 100vh;
|
|
width: 100vw;
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
list-style-type: none;
|
|
box-sizing: border-box;
|
|
outline: none;
|
|
}
|
|
|
|
html {
|
|
font-size: 16px !important;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
body {
|
|
font-family: Arial, Helvetica, sans-serif;
|
|
background-color: #f1f1f1;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
a {
|
|
color: #343440;
|
|
text-decoration: none;
|
|
}
|
|
</style>
|