wangsaitao 8 months ago
parent
commit
45897342a0
3 changed files with 32 additions and 0 deletions
  1. 3 0
      src/apps/xxscreen/api.js
  2. 26 0
      src/apps/xxscreen/views/xxscreen.js
  3. 3 0
      src/common/utils/request.js

+ 3 - 0
src/apps/xxscreen/api.js

@@ -3,6 +3,9 @@ import request from '@/common/utils/request';
 const SCREEN = '/api/screen/';
 
 export default {
+    getData(parmas) {
+        return request.post(`${SCREEN}Index/info`, parmas);
+    },
     // 获取大屏,紧急联系人及图片
     getOrgInfo() {
         return request.post(`${SCREEN}Index/getOrgInfo`);

+ 26 - 0
src/apps/xxscreen/views/xxscreen.js

@@ -94,6 +94,10 @@ export default class BannerIndex extends Vue {
 
     videoVisible9 = false;
 
+    token='';
+
+    info=null;
+
     mounted() {
         // 监听窗口大小变化
         window.onresize = () => (() => {
@@ -105,6 +109,9 @@ export default class BannerIndex extends Vue {
     }
 
     created() {
+        this.token = this.getUrlParam('token') ? this.getUrlParam('token') : '';
+
+        this.getData();
         this.changeZoom();
         this.realSysTime();
         this.getMonitor();
@@ -211,4 +218,23 @@ export default class BannerIndex extends Vue {
     clickMonitor9() {
         this.videoVisible9 = true;
     }
+
+    getUrlParam(name) {
+        return decodeURIComponent((new RegExp(`[?|&]${name}=` + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ''])[1].replace(/\+/g, '%20')) || null; // eslint-disable-line
+    }
+
+    getData() {
+        const data = {
+            token: this.token,
+        };
+
+        api.getData(data).then((res) => {
+            this.info = res.data;
+            this.info.token = this.token;
+            document.title = this.info.title;
+            this.loading = false;
+        }).catch(() => { }).finally(() => {
+            this.loading = false;
+        });
+    }
 }

+ 3 - 0
src/common/utils/request.js

@@ -29,6 +29,9 @@ request.interceptors.request.use((options) => {
     }
 
     const token = utils.getLocalStorage('token');
+    // const token1 = utils.getLocalStorage('token');
+    // console.log(token1);
+    // const token = 'MDAwMDAwMDAwMLCdyZ6xrrGg';
     // const token = utils.getUrlParam('token') ? utils.getUrlParam('token') : '';
 
     config.data.appVersion = APP_VERSION;