You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

132 lines
3.3 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<script>
/*每个页面公共css */
//app.js
var util = require("./utils/util.js");
export default {
onShow() {
console.log("123");
this.globalData.checkUpdate();
},
onLaunch: function() {
console.log('123');
this.globalData.getDevice();
},
globalData: {
onPageNotFound(res) {
// 重定向到404页面
uni.redirectTo({
url: '/pages/notFound/notFound'
});
},
getDevice: function() {
// 获取屏幕参数
try {
const res = uni.getSystemInfoSync();
if (res.platform == 'ios') {
this.platform = 'ios';
} else if (res.platform == 'android') {
this.platform = 'android';
} // 导航高度
let navHeight = res.statusBarHeight; // 屏幕宽度/高度单位px
this.screenWidth = res.screenWidth;
this.screenScale = res.screenWidth / 375;
this.screenHeight = res.screenHeight; // 状态栏的高度单位px
this.statusBarHeight = res.statusBarHeight; // 设备像素比
this.pixelRatio = res.pixelRatio; // 可使用窗口宽度单位px
this.winWidth = res.windowWidth; // 安卓时胶囊距离状态栏8pxiOS距离4px
if (res.system.indexOf('Android') !== -1) {
this.navHeight = navHeight + 14 + 32;
this.navTitleTop = navHeight + 8; // 视窗高度 顶部有占位栏时
this.winHeight = res.screenHeight - navHeight - 14 - 32; // tab主页视窗高度
this.winHeightTab = res.windowHeight - navHeight - 14 - 32;
} else {
this.navHeight = navHeight + 12 + 32;
this.navTitleTop = navHeight + 4; // 视窗高度 顶部有占位栏时
this.winHeight = res.screenHeight - navHeight - 12 - 32; // tab主页视窗高度
this.winHeightTab = res.windowHeight - navHeight - 12 - 32;
}
console.log(uni.getSystemInfoSync(), this.winHeightTab);
} catch (e) {
console.log(e);
}
},
// 检查更新
checkUpdate() {
// 每次进入前台,检查程序版本更新
const updateManager = uni.getUpdateManager();
updateManager.onUpdateReady(function() {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success(res) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
res.confirm && updateManager.applyUpdate();
}
});
});
updateManager.onUpdateFailed(function() {
util.alert('新版本下载失败');
});
},
userInfo: null,
screenScale: 1,
screenWidth: 375,
platform: 'ios',
pixelRatio: 2,
statusBarHeight: 20,
navHeight: 64,
navTitleTop: 26,
winHeight: 655,
winWidth: 750,
screenWidth: 375,
screenHeight: 812,
selectProjectID: "1",
selectCarer: null,
selectedProject: null
},
onError(e) {
console.log('onError:' + e);
},
methods: {}
};
</script>
<style>
/* #ifndef APP-PLUS-NVUE */
@import url("/static/style/iconfont.css");
@import url("/static/style/common.css");
page {
background-color: #f2f2f2;
font-family: Microsoft YaHei;
color: #333333;
padding-top: 160rpx;
padding-bottom: 120rpx;
font-size: 28rpx !important;
}
/* #endif*/
</style>