diff --git a/src/App.vue b/src/App.vue index fe435c8d0..4953339f9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -10,50 +10,53 @@ import { handleToken } from '@/utils/auth'; import { creatSubscribe, perpetualTopic } from '@/utils/stomp'; import DeomonTopic from '@/views/demonstration/deomonTopic'; import WindowResizeHandler from '@/mixin/WindowResizeHandler'; +import { ProjectIcon } from '@/scripts/ConstDic'; export default { - name: 'App', - components: { - DeomonTopic - }, - mixins: [ - WindowResizeHandler - ], - watch: { - '$store.state.socket.roomInvite': function (val) { - if (val.creatorId) { - this.subscribeMessage(val); - } - } - }, - mounted() { - this.prohibitSystemContextMenu(); - this.subscribe(); - }, - methods: { - resizeHandler() { - this.$store.dispatch('app/resize', {width: this._clientWidth, height: this._clientHeight}); - }, - prohibitSystemContextMenu() { - window.document.oncontextmenu = function () { - return false; - }; - }, - subscribe() { - this.$nextTick(() => { - if (!this.$route.path.includes('/login') && this.$route.path != '/404') { - const header = { group: '', 'X-Token': handleToken() }; - creatSubscribe(perpetualTopic, header); - } - }); - }, - subscribeMessage(res) { - if (this.$refs.deomonTopic) { - this.$refs.deomonTopic.doShow(res); - this.$store.dispatch('socket/setRoomInvite'); - } - } - } + name: 'App', + components: { + DeomonTopic + }, + mixins: [ + WindowResizeHandler + ], + watch: { + '$store.state.socket.roomInvite': function (val) { + if (val.creatorId) { + this.subscribeMessage(val); + } + } + }, + mounted() { + this.prohibitSystemContextMenu(); + this.subscribe(); + const project = window.sessionStorage.getItem('project'); + document.querySelector("link[rel*='icon']").href = ProjectIcon[project]; + }, + methods: { + resizeHandler() { + this.$store.dispatch('app/resize', {width: this._clientWidth, height: this._clientHeight}); + }, + prohibitSystemContextMenu() { + window.document.oncontextmenu = function () { + return false; + }; + }, + subscribe() { + this.$nextTick(() => { + if (!this.$route.path.includes('/login') && this.$route.path != '/404') { + const header = { group: '', 'X-Token': handleToken() }; + creatSubscribe(perpetualTopic, header); + } + }); + }, + subscribeMessage(res) { + if (this.$refs.deomonTopic) { + this.$refs.deomonTopic.doShow(res); + this.$store.dispatch('socket/setRoomInvite'); + } + } + } }; diff --git a/src/assets/icon/favicon.png b/src/assets/icon/favicon.png new file mode 100644 index 000000000..0af73dedc Binary files /dev/null and b/src/assets/icon/favicon.png differ diff --git a/src/assets/icon/favicon_xty.png b/src/assets/icon/favicon_xty.png new file mode 100644 index 000000000..49294e236 Binary files /dev/null and b/src/assets/icon/favicon_xty.png differ diff --git a/src/scripts/ConstDic.js b/src/scripts/ConstDic.js index 5f2ae6b11..e383f41a6 100644 --- a/src/scripts/ConstDic.js +++ b/src/scripts/ConstDic.js @@ -2198,12 +2198,20 @@ export const IbpOperation = { }; import LangStorage from '@/utils/lang'; +import Favicon from '@/assets/icon/favicon.png'; +import FaviconXty from '@/assets/icon/favicon_xty.png'; export const loginTitle = { xty: '西安铁路职业技术学院城市轨道交通实训平台', login: LangStorage.getLang() == 'en' ? ' Urban Rail Transit Practical Training Platform' : '城市轨道交通实训平台', design: LangStorage.getLang() == 'en' ? ' Urban Rail Transit Design Platform' : '城市轨道交通设计平台', designxty: '西安铁路职业技术学院城市轨道交通设计平台' }; +export const ProjectIcon = { + xty: FaviconXty, + login: Favicon, + design: Favicon, + designxty: FaviconXty +}; export const ProjectCode = { xty: 'XTY',