From 5c6830369c3d6396646b08fff2819fc830955915 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 30 Oct 2020 14:19:40 +0800 Subject: [PATCH] update --- main.js | 10 +- src/services/system.js | 11 +- src/views/login/index.vue | 2 +- src/views/main_web/cloud.vue | 2 +- src/views/main_web/projnotice.vue | 4 +- src/views/main_web/workspace/service.js | 14 +- src/views/main_web/workspace/workspace.vue | 159 +++++++++++---------- 7 files changed, 118 insertions(+), 84 deletions(-) diff --git a/main.js b/main.js index 95889c10..6af5413c 100644 --- a/main.js +++ b/main.js @@ -14,7 +14,8 @@ function createWindow() { // javascript: true, // plugins: true, preload: path.join(__dirname, 'electron-main', 'preload.js'), - } + }, + // frame: false, }) // const startUrl = url.format({ @@ -24,8 +25,11 @@ function createWindow() { // }); // console.log('startUrl:', startUrl) // and load the index.html of the app. - mainWindow.loadFile('./dist/index.html') - + // mainWindow.loadFile('./dist/index.html') + // mainWindow.loadURL('http://47.104.91.134:9000'); + mainWindow.loadURL('http://localhost:8081'); + // 隐藏菜单栏 + mainWindow.setMenuBarVisibility(false); // Open the DevTools. mainWindow.webContents.openDevTools() } diff --git a/src/services/system.js b/src/services/system.js index 9be1fd34..e784d214 100644 --- a/src/services/system.js +++ b/src/services/system.js @@ -4,7 +4,7 @@ */ import { fetchApi } from '@/utils/request'; -export const isClient = process.env.IS_CLIENT; +export const isClient = !!global.electron; // process.env.IS_CLIENT; let socket; const noop = () => {}; @@ -70,15 +70,16 @@ const system = { /** * 下载文件到工作空间 */ - downloadFile: safeCall((fileIpfsId, projectName, fileName, dirName) => { + downloadFile: safeCall((fileIpfsId, projectName, fileName, dirName, onProcessHandler) => { const socket = io('download'); socket.on('open', () => { socket.send([fileIpfsId, projectName, fileName, dirName].join('|')); }); - socket.on('message', (...args) => { - console.log('receive download file message:', args); + socket.on('message', (e) => { + // console.log('receive download file message:', e); + onProcessHandler(e, socket); // todo 输出下载进度 - socket.close(); + // socket.close(); }); // socket.on('error') }), diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 3981bf8b..7d963125 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -253,7 +253,7 @@ export default { checkPwdTip: "", //检测提示 phoneCode: "", //手机验证码 isRemember: false, //记住密码 - isClient: process.env.IS_CLIENT, //是否是客户端 + isClient: system.isClient, //是否是客户端 }; }, beforeRouteLeave(to, from, next) { diff --git a/src/views/main_web/cloud.vue b/src/views/main_web/cloud.vue index 36727c80..55131498 100644 --- a/src/views/main_web/cloud.vue +++ b/src/views/main_web/cloud.vue @@ -416,7 +416,7 @@ mapAddress:'北京天安门', showImage:false, imageUrl:'', - isClient:process.env.IS_CLIENT, //是否是客户端 + isClient: back.isClient, //是否是客户端 //结束 // end }; diff --git a/src/views/main_web/projnotice.vue b/src/views/main_web/projnotice.vue index 43e29d22..a941109a 100644 --- a/src/views/main_web/projnotice.vue +++ b/src/views/main_web/projnotice.vue @@ -75,6 +75,8 @@