case-data/App.vue
zoujiandong 3904393163 8.18
2025-08-18 13:04:39 +08:00

122 lines
2.9 KiB
Vue

<script setup>
import { onLaunch,onShow,onHide } from '@dcloudio/uni-app'
onLaunch(()=>{
console.log('App Launch');
// #ifdef MP-WEIXIN
// 获取小程序更新管理器实例
const updateManager = wx.getUpdateManager();
// 监听检查更新事件,当小程序有新版本时会触发此回调
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
console.log(res.hasUpdate); // 打印是否有新版本
});
// 监听更新准备就绪事件,当新版本下载完成时会触发此回调
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
showCancel:false,
content: '小程序版本已经更新,请重新进入!',
success(res) {
if (res.confirm) {
// 用户确认更新,调用 applyUpdate 应用新版本并重启小程序
updateManager.applyUpdate();
}
}
});
});
updateManager.onUpdateFailed(function () {
wx.showModal({
title: '更新失败',
content:'已经有新版本了,请您删除当前小程序,重新搜索打开',
});
// 新版本下载失败,可以在这里处理失败逻辑,例如提示用户稍后再试
});
// #endif
});
onShow(()=>{
console.log('App Show')
// #ifdef MP-WEIXIN
wx.getSystemInfo({
success: (res) => {
// windows | mac为pc端
// android | ios为手机端
console.log('getSystemInfo,', res.platform);
if( res.platform=="windows" || res.platform=="mac"){
wx.showModal({
title: '提示',
showCancel:false,
content: '请使用手机端登录',
complete: (res) => {
wx.exitMiniProgram()
}
})
}
}
});
// #endif
});
onHide(()=>{
console.log('App Hide')
});
</script>
<style>
/*每个页面公共css */
/* #ifdef H5 */
*{
margin: 0;
padding: 0;
}
uni-page-head {
display: none;
}
/* #endif */
wx-button:after{
border: none;
}
.ellipsis-two-lines {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.back{
/* margin-top: -8rpx; */
padding:0 20rpx 0rpx 20rpx;
}
.ellipsis-one-lines {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
/* #ifdef H5 */
.zp-container{
z-index: 0!important;
}
/* #endif */
.u-image{
background: none!important;
}
.u-steps-item__line{
height:36px!important;
}
.casesdown.active{
color:#3CC7C0!important;
}
.u-dropdown__menu__item__arrow--rotate .uicon-arrow-down{
color: #3cc7c0 !important;
}
.tagbox{
flex-wrap: wrap;
}
.tagbox .tag{
margin:5rpx 0 ;
}
.zp-paging-container{
background-color: #fff!important;
}
</style>