| | |
| | | import { getApps } from '@/api/app' |
| | | import { findAllSdk } from '@/api/taskMange' |
| | | |
| | | import config from '../../../../package.json' |
| | | |
| | | export default { |
| | | name: 'app', |
| | | components: { |
| | | Desktop, NotificationCenter, NoticeTip, Tools, ToolsEntry |
| | | }, |
| | | |
| | | mounted() { |
| | | data () { |
| | | return { |
| | | buttonAuthority: sessionStorage.getItem('buttonAuthoritys') || [] |
| | | } |
| | | }, |
| | | computed: { |
| | | isAdmin () { |
| | | if ( |
| | | sessionStorage.getItem('userInfo') && |
| | | sessionStorage.getItem('userInfo') !== '' |
| | | ) { |
| | | let loginName = JSON.parse(sessionStorage.getItem('userInfo')).username |
| | | return ( |
| | | loginName === 'superadmin' || loginName === 'basic' |
| | | ) |
| | | } |
| | | return false |
| | | } |
| | | }, |
| | | mounted () { |
| | | document.getElementById('app').style.backgroundImage = process.env.VUE_APP_MAIN_URL; |
| | | this.showApps(); |
| | | |
| | |
| | | id: 'N2', |
| | | icon: '/images/desktop/message.png', |
| | | tip: '消息', |
| | | title: 'SmartAi', |
| | | body: 'v1.0.0', |
| | | title: 'SmartAI', |
| | | body: config.version, |
| | | time: new Date() |
| | | }, true); |
| | | }, 1000); |
| | | window.addEventListener('message', (e) => { |
| | | if (e.data.msg == 'AppUpdate') { |
| | | console.log('应用更新') |
| | | this.showApps(); |
| | | } |
| | | }); |
| | | findAllSdk().then(() => { |
| | | |
| | | }); |
| | | }, |
| | | methods: { |
| | | showApps() { |
| | | 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.forEach(function (item) { |
| | | if (item.installed) { |
| | | let temp = { |
| | |
| | | isDefault: item.isDefault |
| | | } |
| | | |
| | | _that.$store.commit('desktop/addDock', temp); |
| | | // console.log(item) |
| | | // console.log('apps update') |
| | | //console.log(this.$store.state.desktop.docks) |
| | | } |
| | | // 判断权限 |
| | | if (_that.isAdmin || _that.buttonAuthority.indexOf(item.package) >= 0) { |
| | | _that.$store.commit('desktop/addDock', temp); |
| | | } |
| | | |
| | | installedApps.push(item.package); |
| | | } |
| | | }); |
| | | |
| | | sessionStorage.setItem("apps", installedApps.join(",")); |
| | | } |
| | | }) |
| | | }, |
| | |
| | | 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; |