<script>
    import Vue from 'vue'
	export default {
		onLaunch: function() {
            Vue.prototype.$AppSerialNumber = this.getAppSerialNumber();
            
            Vue.prototype.$paddingTop = this.$u.getPx("44px") + this.$u.sys().statusBarHeight;
            uni.getSystemInfo({
                success: function(res) {
                // 获取屏幕可用高度
                Vue.prototype.$screenHeight = res.windowHeight;
                // 获取底部安全区域的高度
                Vue.prototype.$safeAreaBottom = res.screenHeight - res.safeArea.bottom;
                }
            });
			const updateManager = uni.getUpdateManager();
            updateManager.onCheckForUpdate(res => {
            	if (res && res.hasUpdate) {
            		uni.showLoading({ title: '小程序更新中' });
            	}
            })
            updateManager.onUpdateReady((res) => {
                uni.showModal({
                    title: '更新提示',
                    content: '新版本已经准备好，是否重启应用？',
                    success(res) {
                        if (res.confirm) updateManager.applyUpdate();
                    }
                });
            });
            updateManager.onUpdateFailed((res) => {
            	uni.hideLoading();
            })
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
        methods: {
            getAppSerialNumber() {
                let serialNumber = '';
                // #ifdef APP-PLUS
                var Build = plus.android.importClass("android.os.Build");  
                var SystemProperties = plus.android.importClass("android.os.SystemProperties");  
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {  
                    serialNumber = SystemProperties.get('ro.sunmi.serial')  
                } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {  
                    serialNumber = Build.getSerial()  
                    
                } else{  
                    serialNumber = Build.SERIAL  
                }  
                console.log('设备SN:' + serialNumber)
                // #endif
                return serialNumber;
            }
        }
	}
</script>

<style lang="scss">
/*每个页面公共css */
@import "@/uni_modules/uview-ui/index.scss";
page{ background: #F9F9F9; }
image{ width: 100%; height: 100%; vertical-align: top; }
.popup_waper{
    width: 528rpx; box-sizing: border-box; padding: 90rpx 32rpx 56rpx; background: linear-gradient( 180deg, #E8F8F4 0%, rgba(232,248,244,0) 100%); border-radius: 10px; position: relative;
    /deep/.uicon-close{
        position: absolute !important;
        right: 32rpx;
        top: 32rpx !important;
    }
    .status{
        text-align: center;
        .icon {
            width: 174rpx;
            height: 166rpx;
        }
    }
    .text{ margin-top: 43rpx; color: #333; font-size: 40rpx; font-weight: 500;  text-align: center;}
    .msg{  max-height: 400rpx; overflow-y: scroll;margin: 24rpx 37rpx 0; line-height: 40rpx; color: #333; font-size: 28rpx; text-align: center; word-break: break-all; }
    .popup_btn{ width: 408rpx; height: 80rpx; background: #03AE80; border-radius: 80rpx; color: #fff; font-size: 30rpx; font-weight: 500; text-align: center; line-height: 80rpx; margin: 48rpx auto 0; }
}

	::v-deep .u-line-progress__line {
		background: linear-gradient( 90deg, rgba(3, 174, 128, 1) 0%, rgba(106, 224, 192, 1) 100%) !important;
		background-color: transparent !important;
	}
	::v-deep .manProgress {
		.u-line-progress__line {
			background: linear-gradient( 90deg, rgba(43, 117, 233, 1) 0%, rgba(128, 177, 255, 1) 100%) !important;
			background-color: transparent !important;
		}
	}
	::v-deep .uni-table-scroll {
		.uni-table-tr:first-child {
			background: #F6F6F6;
			.uni-table-th {
				font-weight: 500 !important;
				font-size: 28rpx !important;
				color: #333333 !important;
			}
		}
		.uni-table-td {
			font-size: 28rpx !important;
			color: #666666 !important;
		}
	}
</style>
