buddhism/App.vue

99 lines
3.4 KiB
Vue
Raw Normal View History

2023-11-27 09:57:03 +08:00
<script>
2025-08-14 11:22:53 +08:00
import { initLogFiles } from './utils/logManager.js'
2025-07-30 10:45:26 +08:00
2025-08-14 11:22:53 +08:00
export default {
created() {
// #ifdef APP-PLUS
plus.navigator.closeSplashscreen()
// #endif
},
onLaunch(options) {
// 初始化日志文件系统(解决真机调试问题)
initLogFiles()
2023-12-05 16:45:28 +08:00
2025-08-14 11:22:53 +08:00
uni.setInnerAudioOption({
obeyMuteSwitch: false,
})
2023-12-05 16:45:28 +08:00
2025-08-14 11:22:53 +08:00
function autoUpdate() {
// 获取小程序更新机制兼容
if (uni.canIUse('getUpdateManager')) {
const updateManager = uni.getUpdateManager()
// 检查是否有新版本发布
updateManager.onCheckForUpdate(function (res) {
if (res.hasUpdate) {
//小程序有新版本,则静默下载新版本,做好更新准备
updateManager.onUpdateReady(function () {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function (res) {
if (res.confirm) {
//新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
} else if (res.cancel) {
//如果需要强制更新,则给出二次弹窗,如果不需要,则这里的代码都可以删掉了
uni.showModal({
title: '温馨提示',
content: '我们已经做了新的优化,请及时更新哦~',
showCancel: false, //隐藏取消按钮也可显示取消会走res.cancel然后从新开始提示
success: function (res) {
//第二次提示后,强制更新
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
} else if (res.cancel) {
//重新回到版本更新提示
autoUpdate()
}
},
})
}
},
})
})
// 新的版本下载失败
updateManager.onUpdateFailed(function () {
uni.showModal({
title: '温馨提示',
content: '新版本已经上线,请您删除当前小程序,重新搜索打开',
})
})
}
})
} else {
// 提示用户在最新版本的客户端上体验
uni.showModal({
title: '温馨提示',
content: '当前微信版本过低,可能无法使用该功能,请升级到最新版本后重试。',
})
}
}
autoUpdate()
},
2023-12-05 16:45:28 +08:00
2025-08-14 11:22:53 +08:00
onShow: function () {},
onHide: function () {},
globalData: {
topicTypeIndex: 0,
userInfo: {},
token: '',
isShow: true,
},
}
2023-11-27 09:57:03 +08:00
</script>
2023-12-05 16:45:28 +08:00
<style lang="scss">
2025-08-14 11:22:53 +08:00
/*每个页面公共css */
@import 'uview-ui/index.scss';
@import './common/css/iconfont.css';
// 自定义tabar样式修改
/deep/.u-tabbar__content__item__text {
font-size: 20rpx !important;
bottom: 10rpx !important;
}
page {
background-color: #f8f8f8;
}
2023-11-27 09:57:03 +08:00
</style>