Переглянути джерело

尝试多种方法加载打包后图片,失败

liuwei 4 роки тому
батько
коміт
a111162932

+ 2 - 1
.electron-vue/webpack.renderer.config.js

@@ -72,7 +72,8 @@ let rendererConfig = {
           loader: 'url-loader',
           query: {
             limit: 10000,
-            name: 'imgs/[name]--[folder].[ext]'
+            // name: 'imgs/[name]--[folder].[ext]'
+            name: 'imgs/[name].[ext]'
           }
         }
       },

BIN
build/icons/256x256.png


BIN
build/icons/icon.icns


BIN
build/icons/icon.ico


+ 1 - 1
src/renderer/assets/less/splitscreen.less

@@ -36,7 +36,7 @@
 
   /*分屏项(栅格)*/
   .sitem2 {
-    //float: left;
+    float: left;
     color:#000;
     border: 1px solid #3b3b3b;
     background-color: #0b0b0b;

+ 5 - 4
src/renderer/components/Admin.vue

@@ -70,12 +70,13 @@
         data() {
             return {
                 user: storageUtils.getUser(), // 本地存储的用户
-                windowJson:[]
+                windowJson:[], // 主窗口配置文件
             }
         },
 
         async beforeCreate() {
-            this.windowJson = await getStaticFile('EnityWindow.Data')
+            const result = await getStaticFile('EnityWindow.Data')
+            this.windowJson = result.filter(item => item.IsVisibility === true)
         },
 
         methods: {
@@ -96,11 +97,11 @@
             // 关闭窗口
             closeWindow() {
                 require('electron').ipcRenderer.send('window-close')
-            }
+            },
         },
 
         computed: {
-            ...mapState(['bigScale'])
+            ...mapState(['bigScale','imgPublicPath'])
         }
     }
 </script>

+ 17 - 20
src/renderer/components/BigShow.vue

@@ -190,7 +190,7 @@
         },
 
         computed: {
-            ...mapState(['splitScreenStatus','bigScale']),
+            ...mapState(['splitScreenStatus', 'bigScale']),
 
             signalPreList: {
                 get() {
@@ -198,24 +198,23 @@
                 },
 
                 set(arr) {
-                    const arr2 = []
-                    arr.forEach(item => {
-                        arr2.push(JSON.parse(JSON.stringify(item)))
-                    })
-                    arr2.forEach(item => item.Id = guId())
-                    console.log(arr2)
-
-                    if(arr2.length>0){
-                        let index = arr2.length-1
-                        arr2[index].splitScreenStatus = this.$store.state.splitScreenStatus+1
-                        arr2[index].width = this.currentBigshow[0].Width*this.$store.state.bigScale/arr2[index].splitScreenStatus
-                        arr2[index].height = this.currentBigshow[0].Height*this.$store.state.bigScale/arr2[index].splitScreenStatus
-                        arr2[index].widthScale = arr2[index].width/(this.currentBigshow[0].Width*this.$store.state.bigScale)
-                        arr2[index].heightScale = arr2[index].height/(this.currentBigshow[0].Height*this.$store.state.bigScale)
-                        this.$store.dispatch('updateSignalPreList',arr2)
-                        return
+                    if (arr.length > 0){
+                        const arr2 = []
+                        arr.forEach(item => {
+                            arr2.push(JSON.parse(JSON.stringify(item)))
+                        })
+                        arr2.forEach(item => {
+                            item.Id = guId()
+                            item.splitScreenStatus = this.$store.state.splitScreenStatus + 1
+                            item.width = this.currentBigshow[0].Width * this.$store.state.bigScale / item.splitScreenStatus
+                            item.height = this.currentBigshow[0].Height * this.$store.state.bigScale / item.splitScreenStatus
+                            item.widthScale = item.width / (this.currentBigshow[0].Width * this.$store.state.bigScale)
+                            item.heightScale = item.height / (this.currentBigshow[0].Height * this.$store.state.bigScale)
+                        })
+                        this.$store.dispatch('updateSignalPreList', arr2)
+                    }else {
+                        this.$store.dispatch('updateSignalPreList', arr)
                     }
-                    this.$store.dispatch('updateSignalPreList',arr2)
                 }
             },
 
@@ -251,11 +250,9 @@
             // 监视分屏的状态
             splitScreenStatus: function(num) {
                 this.$data.divArr = []
-
                 for (let i=0;i<(num+1)*(num+1);i++){
                     this.$data.divArr.push(i+1)
                 }
-
                 this.reqRefreshBigScreen(this.$data.streamWindows)
             }
         }

+ 4 - 1
src/renderer/store/state.js

@@ -13,5 +13,8 @@ export default {
   signalListJson:[],
 
   // 元素缩放比例
-  bigScale:1
+  bigScale:1,
+
+  // 图片公共路径
+  imgPublicPath:''
 }

+ 1 - 0
src/utils/tools.js

@@ -52,3 +52,4 @@ export function guId() {
         return v.toString(16);
     });
 }
+