Files
cheflinkuser/src/App.vue
T
2026-06-05 15:03:32 +08:00

96 lines
2.2 KiB
Vue

<script setup lang="ts">
import * as R from 'ramda'
import {useConfigStore} from "@/store";
import {setDayjsLocale, setWotDesignLocale} from "@/plugin";
const configStore = useConfigStore()
onLaunch(initConfig);
onShow(() => {
console.log('%c外卖用户端--用户端', 'background: #00A76D; color: white; padding: 3px; border-radius: 2px;');
});
onHide(() => {
});
onError((error: string) => {
})
function initApp() {
// #ifdef APP-PLUS
try {
plus.screen.lockOrientation('portrait-primary')
const color = plus.android.newObject("android.graphics.Color");
const ac = plus.android.runtimeMainActivity();
const c2int = plus.android.invoke(color, "parseColor", "#FFFFFF");
const win = plus.android.invoke(ac, "getWindow");
plus.android.invoke(win, "setNavigationBarColor", c2int);
} catch (e) {
}
// #endif
}
// 初始化配置
function initConfig() {
// #ifdef APP-PLUS
setTimeout(()=> {
plus.navigator.closeSplashscreen();
}, 2000)
plus.screen.lockOrientation('portrait-primary')
// #endif
const {statusBarHeight, windowHeight, windowWidth, screenWidth, screenHeight, safeAreaInsets} =
uni.getWindowInfo()
const {deviceId} =
uni.getDeviceInfo()
const {appVersion} =
uni.getAppBaseInfo()
const {
uniPlatform,
osName,
osVersion,
} =
uni.getSystemInfoSync()
configStore.deviceId = deviceId
configStore.osName = osName
configStore.osVersion = osVersion
configStore.appVersion = appVersion
configStore.uniPlatform = uniPlatform
configStore.statusBarHeight = statusBarHeight ?? 0
configStore.windowHeight = windowHeight ?? 0
configStore.windowWidth = windowWidth ?? 0
configStore.screenWidth = screenWidth ?? 0
configStore.screenHeight = screenHeight ?? 0
configStore.safeAreaInsets = safeAreaInsets ?? {
bottom: 0,
top: 0,
}
setWotDesignLocale()
setDayjsLocale()
if (osName === 'android') {
initApp()
}
if(!configStore.isShowedLanguageSelectPage) {
uni.navigateTo({
url: '/pages-login/pages/choose-language/index',
success() {
configStore.isShowedLanguageSelectPage = true
},
})
}
}
</script>
<style lang="scss">
@import "@/styles/index.scss";
</style>