53 lines
1.1 KiB
Vue
53 lines
1.1 KiB
Vue
<script setup lang="ts">
|
|
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
|
|
import { reLaunch } from './utils/router'
|
|
import { useAuthUser } from './composables/useAuthUser'
|
|
import { useUserStore } from './stores/user'
|
|
|
|
import { TUIChatKit } from './TUIKit';
|
|
TUIChatKit.init();
|
|
|
|
const { token } = useAuthUser()
|
|
const { loginTencentIM } = useUserStore()
|
|
/** 静默登录逻辑 */
|
|
const silentLogin = async () => {
|
|
console.log(token.value, '==')
|
|
if (token.value) {
|
|
loginTencentIM()
|
|
reLaunch('/TUIKit/components/TUIConversation/index')
|
|
return
|
|
}
|
|
|
|
// 没有token去登录页
|
|
reLaunch('/pages/login/login')
|
|
}
|
|
|
|
onLaunch(() => {
|
|
console.log('App Launch111')
|
|
silentLogin()
|
|
})
|
|
|
|
onShow(() => {
|
|
console.log('App Show222')
|
|
})
|
|
|
|
onHide(() => {
|
|
console.log('App Hide333')
|
|
})
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
/*每个页面公共css */
|
|
@import './styles/global.scss';
|
|
|
|
/* common css for page */
|
|
// uni-page-body,
|
|
// html,
|
|
// body,
|
|
// page {
|
|
// width: 100% !important;
|
|
// height: 100% !important;
|
|
// overflow: hidden;
|
|
// }
|
|
</style>
|