2023-09-08 15:17:21 +08:00
|
|
|
|
<script>
|
2025-12-22 09:34:09 +08:00
|
|
|
|
let platform = ""
|
|
|
|
|
|
let SystemVersion = ""
|
2023-09-08 15:17:21 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
onLaunch: function() {
|
2025-12-01 09:59:25 +08:00
|
|
|
|
let that = this
|
2025-12-22 09:34:09 +08:00
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
|
uni.getSystemInfo({
|
|
|
|
|
|
success(e) {
|
|
|
|
|
|
platform = e.platform
|
|
|
|
|
|
that.$store.commit('changePhoneInfo', {
|
|
|
|
|
|
platform: e.platform
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
if (platform === 'ios') { // ios首次安装没有网络
|
|
|
|
|
|
uni.onNetworkStatusChange(function(res) {
|
|
|
|
|
|
if (res.isConnected == true) {
|
|
|
|
|
|
that.handleoginversion()
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
plus.runtime.getProperty(plus.runtime.appid, function(info) {
|
|
|
|
|
|
uni.setStorageSync('VERSION', info.version)
|
|
|
|
|
|
SystemVersion = info.version
|
|
|
|
|
|
that.$store.commit('changePhoneInfo', {
|
|
|
|
|
|
info: info
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
// #endif
|
|
|
|
|
|
that.handleoginversion()
|
|
|
|
|
|
// that.$store.dispatch("getHomeConfig")
|
|
|
|
|
|
},
|
|
|
|
|
|
onHide: function() {
|
|
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
|
uni.offNetworkStatusChange(function(res) {
|
|
|
|
|
|
console.log("取消网络监听")
|
|
|
|
|
|
})
|
|
|
|
|
|
// #endif
|
2023-09-08 15:17:21 +08:00
|
|
|
|
},
|
|
|
|
|
|
onShow: function() {
|
2025-12-22 09:34:09 +08:00
|
|
|
|
let that = this
|
|
|
|
|
|
that.handleTabBarItem()
|
2023-09-08 15:17:21 +08:00
|
|
|
|
console.log('App Show')
|
|
|
|
|
|
},
|
|
|
|
|
|
onHide: function() {
|
|
|
|
|
|
console.log('App Hide')
|
2025-03-25 10:17:30 +08:00
|
|
|
|
},
|
2025-04-02 09:49:39 +08:00
|
|
|
|
methods: {
|
2025-12-22 09:34:09 +08:00
|
|
|
|
// 版本信息
|
|
|
|
|
|
handleoginversion() {
|
|
|
|
|
|
let that = this
|
|
|
|
|
|
that.$model.getloginversion({}).then(res => {
|
|
|
|
|
|
let language = res.data.language == "zh" ? 'zh-Hans' : res.data.language
|
2025-12-27 15:47:56 +08:00
|
|
|
|
console.log("res.data",res.data.language, language, res)
|
2025-12-22 09:34:09 +08:00
|
|
|
|
uni.setLocale(language)
|
2025-12-27 15:47:56 +08:00
|
|
|
|
that.$i18n.locale =language
|
|
|
|
|
|
that.$store.commit('changeLocale', res.data.language)
|
2025-12-22 09:34:09 +08:00
|
|
|
|
uni.setStorageSync('language', res.data.language)
|
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
|
that.$store.dispatch("getHomeConfig")
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.setStorageSync('token', null)
|
|
|
|
|
|
uni.setStorageSync('aan_id', null)
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
uni.reLaunch({
|
|
|
|
|
|
url: '/pageTwo/login/login'
|
|
|
|
|
|
})
|
|
|
|
|
|
}, 500);
|
|
|
|
|
|
}
|
|
|
|
|
|
// #ifdef APP-PLUS||APP
|
|
|
|
|
|
that.$store.commit('changePhoneInfo', {
|
|
|
|
|
|
versionUrl: res.data
|
|
|
|
|
|
})
|
|
|
|
|
|
// 比对版本号
|
|
|
|
|
|
let version = that.$tools.compareVersions(SystemVersion, res.data.version)
|
|
|
|
|
|
console.log("是否登录及版本号", res, res.data.version, SystemVersion, version)
|
|
|
|
|
|
if (version == -1) { // 0版本号相通,1,:第一个版本号大于第二个版本号,-1:第一个版本号小于第二个版本号
|
|
|
|
|
|
uni.showModal({
|
|
|
|
|
|
title: '发现新版本',
|
|
|
|
|
|
content: '检查到新版本' + res.data.version + ',是否更新?',
|
|
|
|
|
|
cancelText: that.$t('btnSancellation'),
|
|
|
|
|
|
confirmText: that.$t('btnConfirm'),
|
|
|
|
|
|
success: (modalRes) => {
|
|
|
|
|
|
if (modalRes.confirm) { //确定更新
|
|
|
|
|
|
if (platform === 'android') { //安卓更新
|
|
|
|
|
|
uni.setStorageSync('VERSION', res.data.version)
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: "/pageTwo/me/about"
|
|
|
|
|
|
})
|
|
|
|
|
|
} else { //ios跳转
|
|
|
|
|
|
plus.runtime.launchApplication({
|
|
|
|
|
|
action: `itms-apps://itunes.apple.com/cn/app/id6654906497?mt=8`
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
that.$tools.msg("稍后可在'关于我们'内更新程序!")
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
// #endif
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
handleTabBarItem() {
|
|
|
|
|
|
let that = this
|
|
|
|
|
|
uni.setTabBarItem({
|
|
|
|
|
|
index: 0,
|
|
|
|
|
|
text: that.$t('titleHome')
|
|
|
|
|
|
})
|
|
|
|
|
|
uni.setTabBarItem({
|
|
|
|
|
|
index: 1,
|
|
|
|
|
|
text: that.$t('titleCount')
|
|
|
|
|
|
})
|
|
|
|
|
|
uni.setTabBarItem({
|
|
|
|
|
|
index: 2,
|
|
|
|
|
|
text: that.$t('titleMe')
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2023-09-08 15:17:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
2025-11-08 16:50:26 +08:00
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
/* #ifndef APP-NVUE */
|
|
|
|
|
|
@import "/assets/common.scss";
|
|
|
|
|
|
@import "/assets/iconfont.css";
|
|
|
|
|
|
@import "/assets/iconfont-weapp-icon.css";
|
|
|
|
|
|
|
|
|
|
|
|
/* #endif*/
|
2023-09-08 15:17:21 +08:00
|
|
|
|
/*每个页面公共css */
|
|
|
|
|
|
.content {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
/* justify-content: center; */
|
2025-11-25 14:21:22 +08:00
|
|
|
|
background-color: #f7f7f7;
|
2023-09-08 15:17:21 +08:00
|
|
|
|
min-height: 100vh;
|
|
|
|
|
|
}
|
2025-04-02 09:49:39 +08:00
|
|
|
|
</style>
|