| | |
| | | <template> |
| | | <div id="app" @contextmenu.prevent> |
| | | <tools></tools> |
| | | <desktop></desktop> |
| | | <tools-entry ref="dock_model"></tools-entry> |
| | | <tools @jumpToDock="onJumpToDock"></tools> |
| | | <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> |
| | | </div> |
| | |
| | | import NoticeTip from './components/NoticeTip'; |
| | | import Tools from './components/Tools'; |
| | | import ToolsEntry from './components/ToolsEntry'; |
| | | import axios from 'axios' |
| | | |
| | | import { getApps } from '@/api/app' |
| | | import { findAllSdk } from '@/api/taskMange' |
| | | |
| | | import config from '../../../../package.json' |
| | | |
| | |
| | | components: { |
| | | Desktop, NotificationCenter, NoticeTip, Tools, ToolsEntry |
| | | }, |
| | | data () { |
| | | data() { |
| | | return { |
| | | buttonAuthority: sessionStorage.getItem('buttonAuthoritys') || [] |
| | | buttonAuthority: sessionStorage.getItem('buttonAuthoritys') || [], |
| | | // defaultBgUrl:"/images/desktop/background.png" |
| | | } |
| | | }, |
| | | computed: { |
| | | isAdmin () { |
| | | isAdmin() { |
| | | if ( |
| | | sessionStorage.getItem('userInfo') && |
| | | sessionStorage.getItem('userInfo') !== '' |
| | |
| | | ) |
| | | } |
| | | return false |
| | | }, |
| | | defaultBgUrl(){ |
| | | return JSON.parse(sessionStorage.getItem('userInfo')).backgroundpic |
| | | } |
| | | }, |
| | | mounted () { |
| | | document.getElementById('app').style.backgroundImage = process.env.VUE_APP_MAIN_URL; |
| | | mounted() { |
| | | 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) { |
| | |
| | | _that.addMessage(item); |
| | | }) |
| | | } |
| | | |
| | | let weather = require("./mock/weather.json") |
| | | if (weather.success) { |
| | | _that.addWeather(weather.data.data); |
| | |
| | | icon: '/images/desktop/message.png', |
| | | tip: '消息', |
| | | title: 'SmartAI', |
| | | body: config.version, |
| | | body: 'V' + config.version, |
| | | time: new Date() |
| | | }, true); |
| | | }, 1000); |
| | |
| | | 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: { |
| | | showApps () { |
| | | onJumpToDock(name){ |
| | | this.$refs.dock_model.onJumpToDock(name) |
| | | }, |
| | | onChangeBg(v){ |
| | | document.getElementById('app').style.backgroundImage = "url(" + v + ")" |
| | | }, |
| | | showApps() { |
| | | let _that = this; |
| | | |
| | | getApps().then(rsp => { |
| | | if (rsp && rsp.success) { |
| | | _that.$store.state.desktop.docks = []; |
| | | let installedApps = []; |
| | | let testObj = { |
| | | id: 'tjcxjq', |
| | | create_by: 'test', |
| | | create_time: '', |
| | | height: 675, |
| | | icon: '../../images/app-mid/search.png', |
| | | installed: true, |
| | | isDelete: 0, |
| | | isUpgrade: false, |
| | | title: '统计查询(集群)', |
| | | name: '统计查询(集群)', |
| | | remoteVersion: '', |
| | | type: '2', |
| | | update_by: '', |
| | | update_time: '', |
| | | url: "/view/searchForCluster/", |
| | | version: '1.0.0', |
| | | width: 1344, |
| | | isDefault: false |
| | | }; |
| | | |
| | | console.log(rsp.data); |
| | | rsp.data.push(testObj); |
| | | |
| | | rsp.data |
| | | rsp.data.forEach(function (item) { |
| | | if (item.installed) { |
| | | let temp = { |
| | |
| | | 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); |
| | | //保存当前应用快照 |
| | |
| | | width: 100%; |
| | | height: 100%; |
| | | background-size: 100% 100%; |
| | | background-image: url('/images/desktop/background.png'); |
| | | background-image: url("/images/desktop/background.png"); |
| | | background-attachment: fixed; |
| | | } |
| | | |
| | | .clearFix:after { |
| | | content: ''; |
| | | content: ""; |
| | | display: block; |
| | | height: 0; |
| | | clear: both; |