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.

108 lines
25 KiB

4 years ago
  1. <script>
  2. import Vue from 'vue'
  3. let __timerId = 0;
  4. export default {
  5. onLaunch() {
  6. /* uniCloud.callFunction({
  7. name: 'bak',
  8. success(e) {
  9. console.log(e);
  10. },
  11. }) */
  12. uni.getSystemInfo({
  13. success: e=> {
  14. this.initSize(e);
  15. }
  16. })
  17. this.initLogin();
  18. },
  19. methods: {
  20. //登录状态
  21. async initLogin(){
  22. const token = uni.getStorageSync('uniIdToken');
  23. if(token){
  24. this.$store.commit('setToken', {
  25. token
  26. });
  27. }
  28. },
  29. /**
  30. * 存储设备信息 参考colorUI
  31. * @param {Object}
  32. */
  33. initSize(e){
  34. const systemInfo = e;
  35. let navigationBarHeight;
  36. let custom = {};
  37. // #ifndef MP
  38. custom = {height: 36,width: 88};
  39. navigationBarHeight = 44;
  40. // #endif
  41. // #ifdef MP-WEIXIN
  42. custom = wx.getMenuButtonBoundingClientRect();
  43. navigationBarHeight = custom.bottom + custom.top - e.statusBarHeight * 2;
  44. // #endif
  45. systemInfo.custom = custom;
  46. systemInfo.navigationBarHeight = navigationBarHeight;
  47. Vue.prototype.systemInfo = systemInfo;
  48. },
  49. //打开全局定时器
  50. openTimer(){
  51. this.closeTimer();
  52. __timerId = setInterval(()=>{
  53. this.$store.commit('setStateAttr', {
  54. key: 'timerIdent',
  55. val: !this.$store.state.timerIdent
  56. })
  57. }, 1000)
  58. },
  59. //关闭定时器
  60. closeTimer(){
  61. if(__timerId != 0){
  62. clearInterval(__timerId);
  63. __timerId = 0;
  64. }
  65. },
  66. },
  67. onShow() {
  68. console.log('app show');
  69. this.openTimer();
  70. },
  71. onHide() {
  72. this.closeTimer();
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. /*每个页面公共css */
  78. @import url("./common/css/common.css");
  79. @import url("./common/css/icon.css");
  80. .lazyload{
  81. position: relative;
  82. &.lazypic{
  83. &:after{
  84. content: '';
  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Ib0QZIicUE4soMqiIBsgmzsgydOCC1PRB2/abmuYQIAs6BMQ91KMtF6SHgoExjfEXK1CpgyIWDXRSRRnqiWjFWItNXSrEwfxUU6Rd1RHVRMAQFBMMUEREIAAGiBYC6AABQHttmgWoyAMZIMiUnYhBsu7MgPFANgMUC0Rj7lLBnSaupgDACoqkEJSIsroYg4oEwD3VGTADFBNRSijEtZQOhWKWAVRaHsgGa6CQEmQBAIQY0hA6AgiKoMyigzoILlAhheyDBiCXFlNCIxzSDu6cmSi0gXN7MkQt1YKqtJxFEFpj5ImoA4WQ1po1YIgpiFQUFlVheWSKmGSiVlkRoBrKjTUspVjDVYqKmBQGkitkKqC+KJFGIuDRFTRrZ0CGbqiAk4IoY3QQPwQRqUF5IMSgTVADUAyDWk40UotLYoKioTtk2QZO3IFkDpIF1KsTzOCGrS5QBiRYqoBGQq6BNfFBOWYoEwBsgjBggyw80FRAHMIBwboMkgmpogfZYIlEtuOCisaWKo7wiGQMYSfogTQYMiM0Q1aBWp6IJ5RHyRBU9FQl0gn8lV01zQ1ECmeSIGxwQRfBAGUhZSrCxxRUw/giajJlDSzjrggNJH6oqMQcEBpJDIhAoyKkEwwQTUQBz+CCIEhXBBkxIQWkMgtDB0GWyQaiTbFA1DoBBp0GZMgAwDoLVEoAjJAswqgjOLIBwUGSD6IISGKBZBkxDs3mgxPayKAER6IYWayCEq1QdzzsgBKQLu72H8UQtankiGx6ZIKshSw6Kg0gj9gmCAAHjgmCHXyQJIYuqI6PF0BTCvVAg9KICoPRAkOKBQDMaIuokoiEX/AERYiGtdSg1HGqKa+SCALoNE0QZBD1CCdA+ToM18kQ0QNadUVloO2KCMS9KoMnbDvigWyugLlscUFpqgCA
  91. background-size: 100% 100%;
  92. opacity: 0.3;
  93. }
  94. }
  95. image{
  96. position: relative;
  97. z-index: 1;
  98. opacity: 0;
  99. }
  100. &.loaded image{
  101. transition: .7s;
  102. opacity: 1 !important;
  103. }
  104. }
  105. </style>