Browse Source

右键菜单

yangxuxian 3 years ago
parent
commit
7bf7192255

+ 79 - 81
package-lock.json

@@ -3272,6 +3272,63 @@
           "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=",
           "dev": true
         },
+        "ansi-styles": {
+          "version": "4.3.0",
+          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+          "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "color-convert": "^2.0.1"
+          }
+        },
+        "chalk": {
+          "version": "4.1.1",
+          "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
+          "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "ansi-styles": "^4.1.0",
+            "supports-color": "^7.1.0"
+          }
+        },
+        "color-convert": {
+          "version": "2.0.1",
+          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "color-name": "~1.1.4"
+          }
+        },
+        "color-name": {
+          "version": "1.1.4",
+          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+          "dev": true,
+          "optional": true
+        },
+        "has-flag": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+          "dev": true,
+          "optional": true
+        },
+        "loader-utils": {
+          "version": "2.0.0",
+          "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
+          "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "big.js": "^5.2.2",
+            "emojis-list": "^3.0.0",
+            "json5": "^2.1.2"
+          }
+        },
         "ssri": {
           "version": "8.0.1",
           "resolved": "https://registry.nlark.com/ssri/download/ssri-8.0.1.tgz?cache=0&sync_timestamp=1621364735533&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fssri%2Fdownload%2Fssri-8.0.1.tgz",
@@ -3280,6 +3337,28 @@
           "requires": {
             "minipass": "^3.1.1"
           }
+        },
+        "supports-color": {
+          "version": "7.2.0",
+          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+          "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "has-flag": "^4.0.0"
+          }
+        },
+        "vue-loader-v16": {
+          "version": "npm:vue-loader@16.2.0",
+          "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.2.0.tgz",
+          "integrity": "sha512-TitGhqSQ61RJljMmhIGvfWzJ2zk9m1Qug049Ugml6QP3t0e95o0XJjk29roNEiPKJQBEi8Ord5hFuSuELzSp8Q==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "chalk": "^4.1.0",
+            "hash-sum": "^2.0.0",
+            "loader-utils": "^2.0.0"
+          }
         }
       }
     },
@@ -17548,87 +17627,6 @@
         }
       }
     },
-    "vue-loader-v16": {
-      "version": "npm:vue-loader@16.2.0",
-      "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.2.0.tgz",
-      "integrity": "sha512-TitGhqSQ61RJljMmhIGvfWzJ2zk9m1Qug049Ugml6QP3t0e95o0XJjk29roNEiPKJQBEi8Ord5hFuSuELzSp8Q==",
-      "dev": true,
-      "optional": true,
-      "requires": {
-        "chalk": "^4.1.0",
-        "hash-sum": "^2.0.0",
-        "loader-utils": "^2.0.0"
-      },
-      "dependencies": {
-        "ansi-styles": {
-          "version": "4.3.0",
-          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
-          "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "color-convert": "^2.0.1"
-          }
-        },
-        "chalk": {
-          "version": "4.1.1",
-          "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz",
-          "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "ansi-styles": "^4.1.0",
-            "supports-color": "^7.1.0"
-          }
-        },
-        "color-convert": {
-          "version": "2.0.1",
-          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
-          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "color-name": "~1.1.4"
-          }
-        },
-        "color-name": {
-          "version": "1.1.4",
-          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
-          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
-          "dev": true,
-          "optional": true
-        },
-        "has-flag": {
-          "version": "4.0.0",
-          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
-          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
-          "dev": true,
-          "optional": true
-        },
-        "loader-utils": {
-          "version": "2.0.0",
-          "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
-          "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "big.js": "^5.2.2",
-            "emojis-list": "^3.0.0",
-            "json5": "^2.1.2"
-          }
-        },
-        "supports-color": {
-          "version": "7.2.0",
-          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
-          "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "has-flag": "^4.0.0"
-          }
-        }
-      }
-    },
     "vue-style-loader": {
       "version": "4.1.3",
       "resolved": "https://registry.npm.taobao.org/vue-style-loader/download/vue-style-loader-4.1.3.tgz",

+ 2 - 1
src/background.js

@@ -25,11 +25,12 @@ async function createWindow() {
     frame:false,
     fullscreen:true,
     webPreferences: {
-      
+
       // Use pluginOptions.nodeIntegration, leave this alone
       // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
       nodeIntegration: true,
       contextIsolation: false,
+      enableRemoteModule: true
     }
   })
 

+ 1 - 2
src/components/StatusBar.vue

@@ -2,11 +2,10 @@
 <template>
     <div class='status-bar'>
         <el-row>
-            <el-col :span="4">
+            <el-col :span="16">
                 <span style="color: white">系统时间:</span>
                 <span style="color: white">{{currentTime}}</span>
             </el-col>
-            <el-col :span="12"></el-col>
             <el-col :span="8">
                 <el-popover placement="top-start" :width="400" trigger="hover">
                     <template #reference>

+ 48 - 43
src/components/TitleBar.vue

@@ -1,55 +1,60 @@
 /* 标题栏 */
 <template>
-  <div class="title-bar">
-    <el-row>
-      <el-col :span=3>
-        <img class="logo" src="../assets/img/main_window/logo.png" sytle="align-items"/>
-      </el-col>
-      <el-col :span=1></el-col>
-      <el-col :span=3>
-          <div class="titleinfo">
-              <ul>
-                  <li><TitleBarCard title='装机容量' unit="MW" value=20></TitleBarCard></li>
-              </ul>
-          </div>
-      </el-col>
-    </el-row>
-  </div>
+    <div class="title-bar">
+        <el-row>
+            <el-col :span=3>
+                <img class="logo" src="../assets/img/main_window/logo.png" sytle="align-items"/>
+            </el-col>
+            <el-col :span=1></el-col>
+            <el-col :span=3>
+                <div class="titleinfo">
+                    <ul>
+                        <li>
+                            <TitleBarCard title='装机容量' unit="MW" value=20></TitleBarCard>
+                        </li>
+                    </ul>
+                </div>
+            </el-col>
+        </el-row>
+    </div>
 </template>
 
 <script>
-import TitleBarCard from './area/mainwindow/TitleBarCard.vue'
-export default{
-    name:"TitleBar",
-    components:{
-        TitleBarCard,
+    import TitleBarCard from './area/mainwindow/TitleBarCard.vue'
+
+    export default {
+        name: "TitleBar",
+        components: {
+            TitleBarCard,
+        }
     }
-}
 </script>
 
 
 <style scoped>
-.title-bar {
-  height: 6vh;
-  background-color: #FF0000;
-  margin-top: 0;
-  margin-right: 0;
-  margin-left: 0;
-}
-.logo{
-    position: relative;
-    top:30%;
-}
-.titleinfo{
-    background-color: #141414;
-    height: auto;
-    padding:13px;
-    border-radius: 6px;
-    margin-top: 5px;
-    margin-bottom: 5px;
-}
+    .title-bar {
+        height: 6vh;
+        background-color: #FF0000;
+        margin-top: 0;
+        margin-right: 0;
+        margin-left: 0;
+    }
+
+    .logo {
+        position: relative;
+        top: 30%;
+    }
 
-ul li{
-    display: inline;
-}
+    .titleinfo {
+        background-color: #141414;
+        height: auto;
+        padding: 13px;
+        border-radius: 6px;
+        margin-top: 5px;
+        margin-bottom: 5px;
+    }
+
+    ul li {
+        display: inline;
+    }
 </style>

+ 24 - 1
src/components/area/gy-card.vue

@@ -2,7 +2,7 @@
 <template>
     <transition>
         <div :class='areaClass' @mouseover="hover = true"
-             @mouseleave="hover = false">
+             @mouseleave="hover = false" @contextmenu="rightClick">
             <div :class="headerClass" @dblclick="gyCardDbClick">
                 <div :class='circleClass'></div>
                 <span class="gy-card-title">{{ title }}</span>
@@ -98,6 +98,29 @@
                 } else {
                     this.big = true
                 }
+            },
+            rightClick() {
+                const {remote} = window.require('electron');
+                const {Menu, MenuItem} = remote
+                const menu = new Menu()
+                menu.append(new MenuItem({
+                    label: 'test1',
+                    click: function () {
+                        console.info("右键test1")
+                    }
+                }))
+                menu.append(new MenuItem({type: 'separator'}));
+                menu.append(new MenuItem({
+                    label: 'test2',
+                    click: function () {
+                        console.info("右键test2")
+                    }
+                }))
+                // window.addEventListener('contextmenu', (e) => {
+                //     e.preventDefault();
+                //     menu.popup({window: remote.getCurrentWindow()})
+                // }, false)
+                menu.popup(remote.getCurrentWindow())
             }
         }
     }

+ 2 - 2
src/components/area/windturbine/WindturbineMinCard.vue

@@ -92,7 +92,7 @@
 
     .card-title2-style-1 {
         margin-top: 2px;
-        font-size: 10px;
+        font-size: 12px;
         width: 100%;
         text-align: center;
     }
@@ -100,6 +100,6 @@
     .card-content-style-1 {
         width: 100%;
         text-align: right;
-        font-size: 5px;
+        font-size: 12px;
     }
 </style>

+ 1 - 1
src/main.js

@@ -1,4 +1,4 @@
-import { createApp } from 'vue'
+import {createApp} from 'vue'
 import ElementPlus from 'element-plus';
 import 'element-plus/lib/theme-chalk/index.css';
 import App from './App.vue';