whyczyk
2022-03-02 d6a8de9744f60c5f09f18ffe349bbc1e4fc1405c
fix bug
3个文件已修改
1个文件已添加
51 ■■■■ 已修改文件
src/assets/js/axios.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/exhibition.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/index.js 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/app.js 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/axios.js
@@ -1,7 +1,7 @@
import Vue from 'vue';
import axios from 'axios';
import store from '@/store'
// import qs from 'qs';
let newPlatform = sessionStorage.getItem('newPlatform')
if (process.env.NODE_ENV == 'dev') {
    // 跨域请求
    axios.defaults.baseURL = 'http://localhost:8090/screen';
@@ -14,13 +14,13 @@
axios.interceptors.request.use(function (config) {
    if (config.asy) {
        if (process.env.NODE_ENV == 'dev') {
            if (newPlatform == 1) {
            if (store.state.app.newPlatform == 1) {
                config.baseURL = 'http://localhost:8091/fg';
            } else {
                config.baseURL = 'http://localhost:8919/fg';
            }
        } else {
            if (newPlatform == 1) {
            if (store.state.app.newPlatform == 1) {
                config.baseURL = `http://${location.hostname}:8091/fg`;
            } else {
                config.baseURL = `http://${location.hostname}:8919/fg`;
src/pages/exhibition.vue
@@ -3,7 +3,7 @@
        <screen-title :title="nowlayOut.appName" :bgImg="screenTitleBg" v-if="isHeader"></screen-title>
        <div class="pageWarp" ref="pageWarp">
            <vue-draggable-resizable :w="item.w" :h="item.h" :x="item.x" :y="item.y" :parent="true" :debug="false" :snap="true" :snapTolerance="5" :draggable="false" :resizable="false" style="transition: none; will-change: transform;" v-for="(item,i) in nowlayOut.children" :key="i">
                <div @contextmenu.prevent.stop="openMenu(item,$event)" style="width:100%;height:100%;">
                <div style="width:100%;height:100%;">
                    <layout-box :title="item.name">
                        <div style="width:100%;height:100%" :id="'layout-box'+item.id" :ref="'layout-box'+item.id" v-if="isNow"></div>
                    </layout-box>
@@ -49,14 +49,14 @@
        if (this.$route.query.userId) {
            localStorage.setItem('userId', this.$route.query.userId);
        }
        if (this.$route.query.newPlatform) {
            sessionStorage.setItem('newPlatform', this.$route.query.newPlatform);
        }
        this.nowlayOut.appName = this.$route.query.name;
        if (this.$route.query.head && this.$route.query.head == 1) {
            this.isHeader = false
        }
        this.$nextTick(() => {
            if (this.$route.query.newPlatform) {
                this.$store.dispatch('app/setNewPlatform', this.$route.query.newPlatform)
            }
            clientWidth = this.$refs.pageWarp.clientWidth;
            clientHeight = this.$refs.pageWarp.clientHeight;
            this.loadLayout();
src/store/index.js
@@ -1,15 +1,13 @@
import Vue from 'vue'
import Vuex from 'vuex'
import app from './modules/app'
Vue.use(Vuex)
export default new Vuex.Store({
  state: {
  },
  mutations: {
  },
  actions: {
  },
const store = new Vuex.Store({
  modules: {
  }
    app,
  },
})
export default store
src/store/modules/app.js
New file
@@ -0,0 +1,23 @@
const state = {
  newPlatform: sessionStorage.getItem('newPlatform') || 0
}
const mutations = {
  setNewPlatform: (state, newPlatform) => {
    sessionStorage.setItem('newPlatform', newPlatform)
    state.newPlatform = Number(newPlatform)
  }
}
const actions = {
  setNewPlatform({ commit }, device) {
    commit('setNewPlatform', device)
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}