diff --git a/dist/static/css/main.css b/dist/static/css/main.css index 32028044..20f9afe6 100644 --- a/dist/static/css/main.css +++ b/dist/static/css/main.css @@ -2895,7 +2895,6 @@ button:focus { .user_Img img { max-width: 100px; max-height: 100px; - cursor: pointer; } .userNamelabel { @@ -3060,6 +3059,9 @@ button:focus { .eidtimg { position: relative; } +.eidtimg > img { + cursor: pointer; +} .eidtimg>div { position: absolute; diff --git a/electron-main/preload.js b/electron-main/preload.js new file mode 100644 index 00000000..cd4c6daa --- /dev/null +++ b/electron-main/preload.js @@ -0,0 +1,2 @@ +global.electron = require('electron'); +global.os = require('os'); \ No newline at end of file diff --git a/main.js b/main.js index 9e05d973..e676d366 100644 --- a/main.js +++ b/main.js @@ -7,10 +7,13 @@ const url = require('url') function createWindow() { // Create the browser window. const mainWindow = new BrowserWindow({ - width: 800, + width: 1080, height: 600, webPreferences: { - // preload: path.join(__dirname, 'preload.js') + nodeIntegration: true, + // javascript: true, + // plugins: true, + preload: path.join(__dirname, 'electron-main', 'preload.js'), } }) diff --git a/src/services/back.js b/src/services/back.js deleted file mode 100644 index 68d26c91..00000000 --- a/src/services/back.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * 模拟客户端back server - * 目前还不知道back的API及具体实现,暂时先抑制代码报错 - */ - -const back = { - -} - - -export default back; diff --git a/src/services/system.js b/src/services/system.js new file mode 100644 index 00000000..358c4da7 --- /dev/null +++ b/src/services/system.js @@ -0,0 +1,27 @@ +/** + * 模拟客户端back server + * 目前还不知道back的API及具体实现,暂时先抑制代码报错 + */ + +export const isClient = process.env.IS_CLIENT; + +const noop = () => {}; + +const safeCall = f => isClient ? f : noop; + +const system = { + isClient, + test: safeCall(() => { + console.log('客户端 electron API 检测:', global.electron); + }), + /** + * 系统打开只当文件 + */ + openFile: safeCall((filePath) => { + const { shell } = global.electron; + shell.openPath(filePath); + }), +} + + +export default system; diff --git a/src/views/login/index.vue b/src/views/login/index.vue index bfc48838..ab73d2d3 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -229,7 +229,7 @@