App.vue
1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<script>
import store from '@/store';
export default {
//设置全局变量,解绑时从这里取
globalData: {
openId: ''
},
onLaunch(e) {
this.setI18nLocale()
// #ifdef APP-PLUS
uni.reLaunch({
url: '/pages/index/splash'
})
// #endif
},
onUnload(){
uni.setStorageSync('getConfiguration', {
isConfiguration: false
});
},
methods:{
// 判断是否是第三方登录没有绑定账号不请求数据
getBindNot(){
// #ifndef H5
const userInfo = uni.getStorageSync('userInfo');
// #endif
// #ifdef H5
const userInfo = JSON.parse(sessionStorage.getItem('userInfo') || localStorage.getItem('userInfo'));
// #endif
return userInfo.isThirdLogin
},
// 判断i18n是中文还是英文
async setI18nLocale(){
// uni.setLocale('en')
try{
const {appLanguage} = (await uni.getSystemInfo())?.[1] || {}
if(appLanguage){
const i18n = appLanguage.includes('zh')?'zh-CN':'en'
this.$i18n.locale = i18n
uni.setLocale(appLanguage.includes('zh')?'zh-Hans':'en')
return
}
this.$i18n.locale = 'zh-CN'
uni.setLocale('zh-Hans')
}catch{
this.$i18n.locale = uni.getLocale()
uni.setLocale('zh-Hans')
}
}
}
};
</script>
<style lang="scss">
@import '@/uni_modules/uview-ui/index.scss';
@import './style/iconfont.scss';
@import './style/common.scss';
page {
background: #ffffff;
}
::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
}
</style>