zhangzengfei
2020-07-21 e861494f28d797ce06509e9d845eacd9076eb6b4
src/pages/desktop/index/App.vue
File was renamed from src/pages/home/desktop/App.vue
@@ -26,31 +26,37 @@
  mounted() {
    document.getElementById('app').style.backgroundImage = process.env.VUE_APP_MAIN_URL;
    let _that = this;
    // eslint-disable-next-line
    axios.get(process.env.VUE_APP_USER_DATA_URL).then(function (res) {
      if (res.data.success) {
        res.data.data.docks.forEach(function (item) {
          _that.$store.commit('desktop/addDock', item);
        });
      }
      setTimeout(function () {
        _that.$refs.dock_model.initDockItem();
      }, 100);
    });
    // eslint-disable-next-line
    axios.get(process.env.VUE_APP_MESSAGE_URL).then(function (res) {
      if (res.data.success) {
        res.data.data.forEach(function (item) {
          _that.addMessage(item);
        })
      }
    });
    // eslint-disable-next-line
    axios.get(process.env.VUE_APP_WEATHER_URL).then(function (res) {
      if (res.data.success) {
        _that.addWeather(res.data.data);
      }
    });
    let user_res = require("./mock/userData.json")
    if (user_res.success) {
      user_res.data.docks.forEach(function (item) {
        _that.$store.commit('desktop/addDock', item);
      });
    }
    setTimeout(function () {
      _that.$refs.dock_model.initDockItem();
    }, 100);
    // axios.get(process.env.VUE_APP_USER_DATA_URL).then(function (res) {
    // });
    let msgResp = require("./mock/messages.json")
    if (msgResp.success) {
      msgResp.data.forEach(function (item) {
        _that.addMessage(item);
      })
    }
    // axios.get(process.env.VUE_APP_MESSAGE_URL).then(function (res) {
    // });
    let weather = require("./mock/weather.json")
    if (weather.success) {
      _that.addWeather(weather.data.data);
    }
    // axios.get(process.env.VUE_APP_WEATHER_URL).then(function (res) {
    // });
    setTimeout(function () {
      _that.addMessage({
@@ -74,6 +80,7 @@
      }, true);
    }, 6000);
    console.log(this.$store.state.desktop)
  },
  methods: {
    addMessage: function (message, ding) {
@@ -106,5 +113,6 @@
  width: 100%;
  height: 100%;
  background-size: 100% 100%;
  background-image: url("../../../assets/img/desktop/main.jpg");
}
</style>