zhangzengfei
2021-11-24 e921f14f600ed33bb24c921968a048a0b39e882c
src/pages/desktop/index/App.vue
@@ -1,7 +1,7 @@
<template>
  <div id="app" @contextmenu.prevent>
    <tools @jumpToDock="onJumpToDock"></tools>
    <desktop></desktop>
    <desktop ref="desktop"></desktop>
    <tools-entry @changeBackground="onChangeBg" ref="dock_model"></tools-entry>
    <notice-tip ref="notice_tip_model"></notice-tip>
    <notification-center></notification-center>
@@ -28,7 +28,7 @@
  data() {
    return {
      buttonAuthority: sessionStorage.getItem('buttonAuthoritys') || [],
      defaultBgUrl:"/images/desktop/background.png"
      // defaultBgUrl:"/images/desktop/background.png"
    }
  },
  computed: {
@@ -43,15 +43,14 @@
        )
      }
      return false
    },
    defaultBgUrl(){
      return JSON.parse(sessionStorage.getItem('userInfo')).backgroundpic
    }
  },
  mounted() {
    // document.getElementById('app').style.backgroundImage = process.env.VUE_APP_MAIN_URL;
    const url = localStorage.getItem("backgroundPic")
    document.getElementById('app').style.backgroundImage = `url(${url||this.defaultBgUrl})`
    document.getElementById('app').style.backgroundImage = `url(${this.defaultBgUrl || "/images/desktop/background.png"})`
    this.showApps();
    let _that = this;
    let msgResp = require("./mock/messages.json")
    if (msgResp.success) {
@@ -59,7 +58,6 @@
        _that.addMessage(item);
      })
    }
    let weather = require("./mock/weather.json")
    if (weather.success) {
      _that.addWeather(weather.data.data);
@@ -78,6 +76,16 @@
      if (e.data.msg == 'AppUpdate') {
        this.showApps();
      }
      if (e.data.msg=='checkSN') {
        debugger
        this.$refs.desktop.validateSn()
      }
      if (e.data.msg === 'changeColor') {
        const iframeArr = document.querySelectorAll("iframe")
        iframeArr.forEach(item=>{
          item.contentWindow.postMessage({msg:'changeColor',color:e.data.color},"*")
        })
      }
    });
  },
  methods: {
@@ -86,8 +94,6 @@
    },
    onChangeBg(v){
       document.getElementById('app').style.backgroundImage = "url(" + v + ")"
       this.defaultBgUrl = v
      localStorage.setItem("backgroundPic", v)
    },
    showApps() {
      let _that = this;