update uni-app

This commit is contained in:
全栈小学生 2023-06-03 18:28:30 +08:00
parent 4281ac05f9
commit 086549723c
2 changed files with 91 additions and 88 deletions

View File

@ -1,74 +1,75 @@
<script setup lang="ts">
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
import manifest from '@/manifest.json'
import { redirectInterceptor, launchInterceptor } from '@/utils/interceptor'
import { getToken, isWeixinBrowser,getSiteId } from '@/utils/common'
import useMemberStore from '@/stores/member'
import useConfigStore from '@/stores/config'
import useSystemStore from '@/stores/system'
import { useLogin } from '@/hooks/useLogin'
import { language } from '@/locale'
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
import manifest from '@/manifest.json'
import { redirectInterceptor, launchInterceptor } from '@/utils/interceptor'
import { getToken, isWeixinBrowser, getSiteId } from '@/utils/common'
import useMemberStore from '@/stores/member'
import useConfigStore from '@/stores/config'
import useSystemStore from '@/stores/system'
import { useLogin } from '@/hooks/useLogin'
import { language } from '@/locale'
// #ifdef H5
if (import.meta.env.VITE_APP_DEBUG) { new window.VConsole() }
// #endif
onLaunch(async (data) => {
//
launchInterceptor()
//
redirectInterceptor()
// #ifdef H5
if (import.meta.env.VITE_APP_DEBUG) { new window.VConsole() }
// #endif
// #ifdef H5
uni.getSystemInfoSync().platform == 'ios' && (uni.setStorageSync('initUrl', location.href))
// #endif
// id
if (getSiteId(uni.getStorageSync('wap_site_id') || import.meta.env.VITE_SITE_ID) === '') return;
onLaunch(async (data) => {
//
launchInterceptor()
//
redirectInterceptor()
const configStore = useConfigStore()
configStore.getTabbarConfig()
await configStore.getLoginConfig()
useSystemStore().getSitenfo()
// #ifdef H5
uni.getSystemInfoSync().platform == 'ios' && (uni.setStorageSync('initUrl', location.href))
// tabbar
uni.hideTabBar()
//
if (getToken()) {
const memberStore = useMemberStore()
await memberStore.setToken(getToken())
}
if (!getToken()) {
const login = useLogin()
//
// #ifdef MP
login.getAuthCode()
// #endif
// #ifdef H5
if (isWeixinBrowser()) {
data.query.code ? login.authLogin(data.query.code) : login.getAuthCode('snsapi_userinfo')
}
// #endif
}
//
// #ifdef H5
window.addEventListener("popstate", function(e) {
const path = '/' + location.pathname.replace(manifest.h5.router.base, '')
language.loadLocaleMessages(path, uni.getLocale())
}, false);
// #endif
})
// id
if (process.env.NODE_ENV == 'development' && (getSiteId(uni.getStorageSync('wap_site_id') || import.meta.env.VITE_SITE_ID) === '')) return;
// #endif
onShow(() => {
})
const configStore = useConfigStore()
configStore.getTabbarConfig()
await configStore.getLoginConfig()
onHide(() => {
})
useSystemStore().getSitenfo()
// tabbar
uni.hideTabBar()
//
if (getToken()) {
const memberStore = useMemberStore()
await memberStore.setToken(getToken())
}
if (!getToken()) {
const login = useLogin()
//
// #ifdef MP
login.getAuthCode()
// #endif
// #ifdef H5
if (isWeixinBrowser()) {
data.query.code ? login.authLogin(data.query.code) : login.getAuthCode('snsapi_userinfo')
}
// #endif
}
//
// #ifdef H5
window.addEventListener("popstate", function (e) {
const path = '/' + location.pathname.replace(manifest.h5.router.base, '')
language.loadLocaleMessages(path, uni.getLocale())
}, false);
// #endif
})
onShow(() => {
})
onHide(() => {
})
</script>
<style></style>

View File

@ -3,7 +3,9 @@
{
"path": "pages/index/index",
"style": {
// #ifdef H5
"navigationStyle": "custom",
// #endif
"navigationBarTitleText": "%pages.index.index%"
}
},
@ -70,20 +72,24 @@
"navigationBarTitleText": "%pages.index.diy%"
}
},
{
"path": "pages/index/close",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "%pages.index.close%"
}
},
{
"path": "pages/index/nonexistence",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "%pages.index.nonexistence%"
}
},
{
"path": "pages/index/close",
"style": {
// #ifdef H5
"navigationStyle": "custom",
// #endif
"navigationBarTitleText": "%pages.index.close%"
}
},
{
"path": "pages/index/nosite",
"style": {
// #ifdef H5
"navigationStyle": "custom",
// #endif
"navigationBarTitleText": "%pages.index.nosite%"
}
},
{
"path": "pages/article/detail",
"style": {
@ -172,20 +178,12 @@
},
{
"path": "pages/member/index",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "%pages.member.index%"
}
},
{
"path": "pages/member/info",
"style": {
// #ifdef H5
"navigationStyle": "custom",
// #endif
"navigationBarTitleText": "%pages.member.info%"
},
"needLogin": true
"navigationBarTitleText": "%pages.member.index%"
}
},
{
"path": "pages/member/personal",
@ -230,14 +228,18 @@
{
"path": "pages/pay/browser",
"style": {
// #ifdef H5
"navigationStyle": "custom",
// #endif
"navigationBarTitleText": "%pages.pay.browser%"
}
},
{
"path": "pages/pay/result",
"style": {
// #ifdef H5
"navigationStyle": "custom",
// #endif
"navigationBarTitleText": "%pages.pay.result%"
}
},
@ -268,7 +270,7 @@
// #endif
"navigationBarTitleText": "%pages.index.develop%"
}
}// {{PAGE}}
} // {{PAGE}}
],
"globalStyle": {
"navigationBarTextStyle": "black",