| | |
| | | <template> |
| | | <div id="app" @contextmenu.prevent=""> |
| | | <div id="app" @contextmenu.prevent> |
| | | <tools></tools> |
| | | <desktop></desktop> |
| | | <tools-entry ref="dock_model"></tools-entry> |
| | |
| | | import ToolsEntry from './components/ToolsEntry'; |
| | | import axios from 'axios' |
| | | |
| | | import { getApps } from '@/api/app' |
| | | |
| | | export default { |
| | | name: 'app', |
| | | components: { |
| | | Desktop, NotificationCenter, NoticeTip, Tools, ToolsEntry |
| | | }, |
| | | |
| | | |
| | | mounted() { |
| | | document.getElementById('app').style.backgroundImage = process.env.VUE_APP_MAIN_URL; |
| | | let _that = this; |
| | | let user_res = require("./mock/userData.json") |
| | | if (user_res.success) { |
| | | user_res.data.docks.forEach(function (item) { |
| | | _that.$store.commit('desktop/addDock', item); |
| | | }); |
| | | } |
| | | this.showApps(); |
| | | |
| | | let _that = this; |
| | | let msgResp = require("./mock/messages.json") |
| | | if (msgResp.success) { |
| | | msgResp.data.forEach(function (item) { |
| | |
| | | }, 1000); |
| | | }, |
| | | methods: { |
| | | showApps() { |
| | | let _that = this; |
| | | |
| | | getApps().then(rsp => { |
| | | if (rsp && rsp.success) { |
| | | rsp.data.forEach(function (item) { |
| | | _that.$store.commit('desktop/addDock', item); |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | addMessage: function (message, ding) { |
| | | this.$store.dispatch('desktop/addMessage', message); |
| | | // if (ding) { |
| | |
| | | addWeather: function (weather) { |
| | | this.$store.commit('desktop/addWeather', weather); |
| | | }, |
| | | screenShot(dock){ |
| | | screenShot(dock) { |
| | | //找到当前的iframe |
| | | let curIframe = Array.from(document.querySelectorAll('iframe')).find(iframe => iframe.src.indexOf(dock.url) >= 0); |
| | | //保存当前应用快照 |
| | |
| | | // type: "3", |
| | | // screenshot: shotSrc |
| | | // }); |
| | | this.$store.commit('desktop/shotscreen', {id:dock.id, src:shotSrc}); |
| | | |
| | | this.$store.commit('desktop/shotscreen', { id: dock.id, src: shotSrc }); |
| | | |
| | | }).catch(e => { |
| | | this.$store.commit('desktop/shotscreen', {id:dock.id, src:''}); |
| | | this.$store.commit('desktop/shotscreen', { id: dock.id, src: '' }); |
| | | }); |
| | | } |
| | | } |