| | |
| | | import axios from 'axios' |
| | | |
| | | 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 |
| | | }, |
| | | |
| | | 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: 'V' + config.version, |
| | | time: new Date() |
| | | }, true); |
| | | }, 1000); |
| | | window.addEventListener('message', (e) => { |
| | | if (e.data.msg == 'AppUpdate') { |
| | | this.showApps(); |
| | | } |
| | | }); |
| | | }, |
| | | methods: { |
| | | showApps() { |
| | |
| | | |
| | | getApps().then(rsp => { |
| | | if (rsp && rsp.success) { |
| | | _that.$store.state.desktop.docks = []; |
| | | let installedApps = []; |
| | | rsp.data |
| | | rsp.data.forEach(function (item) { |
| | | _that.$store.commit('desktop/addDock', item); |
| | | if (item.installed) { |
| | | let temp = { |
| | | id: item.id, |
| | | create_by: item.create_by, |
| | | create_time: item.create_time, |
| | | height: item.height, |
| | | icon: item.icon, |
| | | src: item.iconBlob ? 'data:image/png;base64,' + item.iconBlob : item.icon, |
| | | installed: item.installed, |
| | | isDelete: item.isDelete, |
| | | isUpgrade: item.isUpgrade, |
| | | title: item.title, |
| | | name: item.package, |
| | | remoteVersion: item.remoteVersion, |
| | | type: item.type, |
| | | update_by: item.update_by, |
| | | update_time: item.update_time, |
| | | url: item.url, |
| | | version: item.version, |
| | | width: item.width, |
| | | isDefault: item.isDefault |
| | | } |
| | | |
| | | // 判断权限 |
| | | if (_that.isAdmin || _that.buttonAuthority.indexOf(item.package) >= 0) { |
| | | _that.$store.commit('desktop/addDock', temp); |
| | | } |
| | | |
| | | installedApps.push(item.package); |
| | | } |
| | | }); |
| | | |
| | | sessionStorage.setItem("apps", installedApps.join(",")); |
| | | } |
| | | }) |
| | | }, |