luke hace 6 años
padre
commit
7411a5bc53

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

@@ -19,7 +19,7 @@ const { VueLoaderPlugin } = require('vue-loader')
  * that provide pure *.vue files that need compiling
  * https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
  */
-let whiteListedModules = ['vue', 'element-ui']
+let whiteListedModules = ['vue', 'element-ui','vue-router', 'axios', 'vuex', 'vue-electron','clipboard'];
 
 let rendererConfig = {
   devtool: '#cheap-module-eval-source-map',

+ 13 - 0
service_exe/src/index.ejs

@@ -15,6 +15,19 @@
     <!-- Set `__static` path to static files in production -->
     <% if (!process.browser) { %>
       <script>
+        const { remote } = require('electron')
+        const { Menu, MenuItem } = remote
+
+        const menu = new Menu()
+        menu.append(new MenuItem({label:'复制', role: 'copy' }));
+        menu.append(new MenuItem({label:'粘贴', role: 'paste' }));
+        menu.append(new MenuItem({label:'剪切', role: 'cut' }));
+        menu.append(new MenuItem({ label:'全选', role: 'selectall' }));
+        window.addEventListener('contextmenu', (e) => {
+          e.preventDefault()
+          menu.popup({ window: remote.getCurrentWindow() })
+        }, false)
+
         if (process.env.NODE_ENV !== 'development') window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
       </script>
     <% } %>

+ 23 - 23
service_exe/src/main/index.js

@@ -1,47 +1,47 @@
-import { app, BrowserWindow } from 'electron'
+import {app, BrowserWindow} from 'electron'
 
 /**
  * Set `__static` path to static files in production
  * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
  */
 if (process.env.NODE_ENV !== 'development') {
-  global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
+	global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
 }
 
 let mainWindow
 const winURL = process.env.NODE_ENV === 'development'
-  ? `http://localhost:9080`
-  : `file://${__dirname}/index.html`
+	? `http://localhost:9080`
+	: `file://${__dirname}/index.html`
 
-function createWindow () {
-  /**
-   * Initial window options
-   */
-  mainWindow = new BrowserWindow({
-    height: 563,
-    useContentSize: true,
-    width: 1000
-  })
+function createWindow() {
+	/**
+	 * Initial window options
+	 */
+	mainWindow = new BrowserWindow({
+		height: 563,
+		useContentSize: true,
+		width: 1000
+	})
 
-  mainWindow.loadURL(winURL)
+	mainWindow.loadURL(winURL)
 
-  mainWindow.on('closed', () => {
-    mainWindow = null
-  })
+	mainWindow.on('closed', () => {
+		mainWindow = null
+	})
 }
 
 app.on('ready', createWindow)
 
 app.on('window-all-closed', () => {
-  if (process.platform !== 'darwin') {
-    app.quit()
-  }
+	if (process.platform !== 'darwin') {
+		app.quit()
+	}
 })
 
 app.on('activate', () => {
-  if (mainWindow === null) {
-    createWindow()
-  }
+	if (mainWindow === null) {
+		createWindow()
+	}
 })
 
 /**

+ 0 - 11
service_exe/src/renderer/css/index.css

@@ -2,17 +2,6 @@
 * {
   padding: 0;
   margin: 0;
-  -o-user-select: none;
-  -moz-user-select: none;
-  /*火狐 firefox*/
-  -webkit-user-select: none;
-  /*webkit浏览器*/
-  -ms-user-select: none;
-  /*IE10+*/
-  -khtml-user-select: none;
-  /*早期的浏览器*/
-  user-select: none;
-  /*  */
   box-sizing: border-box;
 }
 body,img{

+ 1 - 3
service_exe/src/renderer/pages/TheCurrentSession.vue

@@ -1097,13 +1097,11 @@
 				var clipboard = new Clipboard(".user_text");
 				// clipboard
 				clipboard.on('success', e => {
-					console.log('复制成功',e)
-					console.log(clipboard)
+					console.log('复制成功',e.text)
 					this.$message({
 						message: '复制成功',
 						type: 'success'
 					});
-					e = clipboard.e.success[0].ctx = e.text;
 					// 释放内存
 					clipboard.destroy()
 				})