2021-11-24 23:33:06 +08:00
|
|
|
<script>
|
2021-11-26 09:47:23 +08:00
|
|
|
import Vue from 'vue'
|
|
|
|
import { getAuthToken } from '@/common/js/util.js'
|
|
|
|
let __timerId = 0;
|
2021-11-24 23:33:06 +08:00
|
|
|
export default {
|
2021-11-26 09:47:23 +08:00
|
|
|
onLaunch() {
|
|
|
|
uni.getSystemInfo({
|
|
|
|
success: e=> {
|
|
|
|
this.initSize(e);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.initLogin();
|
2021-11-24 23:33:06 +08:00
|
|
|
},
|
2021-11-26 09:47:23 +08:00
|
|
|
methods: {
|
|
|
|
// 初始化登陆状态
|
|
|
|
async initLogin(){
|
|
|
|
const token = getAuthToken()
|
|
|
|
if (!token) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// 通过设置 Token 的方式,触发加载用户信息
|
|
|
|
this.$store.commit('setToken', {
|
|
|
|
token
|
|
|
|
});
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 存储设备信息 参考colorUI
|
|
|
|
* @param {Object}
|
|
|
|
*/
|
|
|
|
initSize(e){
|
|
|
|
const systemInfo = e;
|
|
|
|
let navigationBarHeight;
|
|
|
|
let custom = {};
|
|
|
|
// #ifndef MP
|
|
|
|
custom = {height: 36,width: 88};
|
|
|
|
navigationBarHeight = 44;
|
|
|
|
// #endif
|
|
|
|
// #ifdef MP
|
|
|
|
custom = wx.getMenuButtonBoundingClientRect();
|
|
|
|
navigationBarHeight = custom.bottom + custom.top - e.statusBarHeight * 2;
|
|
|
|
// #endif
|
|
|
|
systemInfo.custom = custom;
|
|
|
|
systemInfo.navigationBarHeight = navigationBarHeight;
|
|
|
|
Vue.prototype.systemInfo = systemInfo;
|
|
|
|
},
|
|
|
|
//打开全局定时器
|
|
|
|
openTimer(){
|
|
|
|
this.closeTimer();
|
|
|
|
__timerId = setInterval(()=>{
|
|
|
|
this.$store.commit('setStateAttr', {
|
|
|
|
key: 'timerIdent',
|
|
|
|
val: !this.$store.state.timerIdent
|
|
|
|
})
|
|
|
|
}, 1000)
|
|
|
|
},
|
|
|
|
//关闭定时器
|
|
|
|
closeTimer(){
|
|
|
|
if(__timerId != 0){
|
|
|
|
clearInterval(__timerId);
|
|
|
|
__timerId = 0;
|
|
|
|
}
|
|
|
|
},
|
2021-11-24 23:33:06 +08:00
|
|
|
},
|
2021-11-26 09:47:23 +08:00
|
|
|
onShow() {
|
|
|
|
console.log('app show');
|
|
|
|
this.openTimer();
|
|
|
|
},
|
|
|
|
onHide() {
|
|
|
|
this.closeTimer();
|
2021-11-24 23:33:06 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2021-11-26 09:47:23 +08:00
|
|
|
<style lang="scss">
|
2021-11-24 23:33:06 +08:00
|
|
|
/*每个页面公共css */
|
|
|
|
@import url("./common/css/common.css");
|
|
|
|
@import url("./common/css/icon.css");
|
2021-11-27 20:09:13 +08:00
|
|
|
@import "@/uni_modules/uview-ui/index.scss";
|
2021-11-26 09:47:23 +08:00
|
|
|
|
|
|
|
.lazyload{
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
&.lazypic{
|
|
|
|
&:after{
|
|
|
|
content: '';
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
top: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
background-image: url(data:image/jpeg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAA8AAD/4QONaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjMtYzAxMSA2Ni4xNDU2NjEsIDIwMTIvMDIvMDYtMTQ6NTY6MjcgIC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PwQRqUF5IMSgTVADUAyDWk40UotLYoKioTtk2QZO3IFkDpIF1KsTzOCGrS5QBiRYqoBGQq6BNfFBOWYoEwBsgjBggyw80FRAHMIBwboMkgmpogfZYIlEtuOCisaWKo7wiGQMYSfogTQYMiM0Q1aBWp6IJ5RHyRBU9FQl0gn8lV01zQ1ECmeSIGxwQRfBAGUhZSrCxxRUw/giajJlDSzjrggNJH6oqMQcEBpJDIhAoyKkEwwQTUQBz+CCIEhXBBkxIQWkMgtDB0GWyQaiTbFA1DoBBp0GZMgAwDoLVEoAjJAswqgjOLIBwUGSD6IISGKBZBkxDs3mgxPayKAER6IYWayCEq1QdzzsgBKQLu72H8UQtankiGx6ZIKshSw6Kg0gj9gmCAAHjgmCHXyQJIYuqI6PF0BTCvVAg9KICoPRAkOKBQDMaIuokoiEX/AERYiGtdSg1HGqKa+SCALoNE0QZBD1CCdA+ToM18kQ0QNadUVloO2KCMS9KoMnbDvigWyugLlscUFpqgCA
|
|
|
|
background-size: 100% 100%;
|
|
|
|
opacity: 0.3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
image{
|
|
|
|
position: relative;
|
|
|
|
z-index: 1;
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
&.loaded image{
|
|
|
|
transition: .7s;
|
|
|
|
opacity: 1 !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|