yangan
2024-01-22 d975fc5a97a5bc9e7cde420ed92133c290873d7d
App.vue
@@ -1,38 +1,48 @@
<script>
export default {
   onShow() {},
   methods: {}
   // created() {
   //    uni.loadFontFace({
   //       family: 'siYuanLight', // 字体名称,可以自定义
   //       source: 'url("/utils/fonts/siyuan.OTF")', // 字体文件路径
   //       success() {
   //          console.log('字体加载成功');
   //       },
   //       fail() {
   //          console.log('字体加载失败');
   //       }
   //    });
   // }
};
   import { mapState, mapMutations } from 'vuex';
   export default {
      onLaunch() {},
      onHide() {
         console.log('appvue隐藏后台');
         this.changeisconnect(false);
         console.log(this.globalisconnect, this.globalisUploadimg, this.globalisLogin);
      },
      onShow() {
         console.log('appvue显示');
         if (!this.globalisconnect && !this.globalisUploadimg && this.globalisLogin) {
            if (!this.is_open_socket) {
               this.$store.dispatch('websocketInit')
               this.changeisconnect(false);
               console.log('appvue的ws');
            }
         }
      },
      methods: {
         ...mapMutations(['changeisconnect'])
      },
      computed: {
         ...mapState(['globalisconnect', 'globalisUploadimg', 'globalisLogin', 'is_open_socket'])
      }
   };
</script>
<style lang="scss" scoped>
/*每个页面公共css */
@import '@/uni_modules/uview-ui/index.scss';
@font-face {
   font-family: siYuanLight;
   src: url('https://mx.jzeg.cn:9095/appimg/fonts/siyuan.OTF');
}
@font-face {
   font-family: weighting;
   src: url('https://mx.jzeg.cn:9095/appimg/fonts/weighting.TTF');
}
body {
   font-family: siYuanLight, sans-serif;
}
// @font-face {
//    font-family: 'weighting';
//    src: url('./utils/fonts/weighing.TTF');
// }
</style>
<style lang="scss"
   scoped>
   /*每个页面公共css */
   @import '@/uni_modules/uview-ui/index.scss';
   @font-face {
      font-family: siYuanLight;
      src: url('https://mx.jzeg.cn:9095/appimg/fonts/siyuannormal.OTF');
   }
   @font-face {
      font-family: weighting;
      src: url('https://mx.jzeg.cn:9095/appimg/fonts/weighting.TTF');
   }
   body {
      font-family: siYuanLight, sans-serif;
   }
</style>