<script>
|
export default {
|
onShow: function() {
|
// #ifdef APP-PLUS
|
var args= plus.runtime.arguments;
|
if(args){
|
// 处理args参数,如直达到某新页面等
|
console.log('args', args)
|
if(args.indexOf('lzzzsc-app') >= 0) {
|
args = args.replace("lzzzsc-app://", "/")
|
return uni.redirectTo({
|
url: args
|
})
|
}
|
}
|
// #endif
|
},
|
onLaunch: function(options) {
|
let t = this
|
t.$util.post('Index/getConfig').then(res => {
|
console.log('getConfig', res.data)
|
if(res.code == 1){
|
try {
|
const token = uni.getStorageSync('lzsc-token');
|
if (!token) {
|
/*
|
uni.redirectTo({
|
url: '/pages/login/login'
|
})
|
return false
|
*/
|
}
|
} catch (e) {
|
uni.redirectTo({
|
url: '/pages/login/login'
|
})
|
return false
|
|
}
|
uni.setStorageSync('Config', JSON.stringify(res.data))
|
|
// #ifdef APP-PLUS
|
//机型
|
let platform = uni.getSystemInfoSync().platform.toLocaleLowerCase()
|
//console.log('platform', uni.getSystemInfoSync())
|
plus.runtime.getProperty(plus.runtime.appid, widgetInfo => {
|
//下载地址
|
let downUrl = res.data.downUrl
|
//更新标志
|
let updateFlag = false
|
//更新内容
|
let updesc = ''
|
if(platform == 'ios' && parseInt(widgetInfo.versionCode) != parseInt(res.data.ios.code)){
|
updateFlag = !updateFlag
|
updesc = res.data.ios.desc
|
}
|
if(platform == 'android' && parseInt(widgetInfo.versionCode) != parseInt(res.data.android.code)){
|
updateFlag = !updateFlag
|
updesc = res.data.android.desc
|
}
|
if (downUrl && updateFlag) {
|
uni.showModal({
|
showCancel: false,
|
confirmText: '立即更新',
|
title: '温馨提示!',
|
content: updesc || '有最新版本,请更新APP!',
|
success: res => {
|
if (res.confirm) {
|
plus.runtime.openURL(downUrl)
|
}
|
}
|
})
|
}
|
})
|
// #endif
|
}
|
})
|
},
|
onHide: function() {
|
}
|
}
|
</script>
|
|
<style>
|
/*每个页面公共css */
|
.startBar {
|
width: 100%;
|
height: var(--status-bar-height);
|
}
|
.noData{
|
width: 100%;
|
font-size: 28rpx;
|
}
|
.noData image{
|
width: 120rpx;
|
height: 100rpx;
|
display: block;
|
margin: 100rpx auto 30rpx;
|
}
|
.noData view{
|
width: 100%;
|
text-align: center;
|
color: #666666;
|
}
|
.noDataBtn{
|
width: 240rpx !important;
|
margin: 50rpx auto;
|
background-color: #ff7945;
|
color: #ffffff !important;
|
letter-spacing: 10rpx;
|
height: 70rpx;
|
line-height: 70rpx;
|
border-radius: 50rpx;
|
}
|
</style>
|