kim131 4 anni fa
parent
commit
19ad60f105
7 ha cambiato i file con 118 aggiunte e 84 eliminazioni
  1. +7
    -3
      main.js
  2. +6
    -5
      src/services/system.js
  3. +1
    -1
      src/views/login/index.vue
  4. +1
    -1
      src/views/main_web/cloud.vue
  5. +3
    -1
      src/views/main_web/projnotice.vue
  6. +13
    -1
      src/views/main_web/workspace/service.js
  7. +87
    -72
      src/views/main_web/workspace/workspace.vue

+ 7
- 3
main.js Vedi File

@@ -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()
}


+ 6
- 5
src/services/system.js Vedi File

@@ -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')
}),


+ 1
- 1
src/views/login/index.vue Vedi File

@@ -253,7 +253,7 @@ export default {
checkPwdTip: "", //检测提示
phoneCode: "", //手机验证码
isRemember: false, //记住密码
isClient: process.env.IS_CLIENT, //是否是客户端
isClient: system.isClient, //是否是客户端
};
},
beforeRouteLeave(to, from, next) {


+ 1
- 1
src/views/main_web/cloud.vue Vedi File

@@ -416,7 +416,7 @@
mapAddress:'北京天安门',
showImage:false,
imageUrl:'',
isClient:process.env.IS_CLIENT, //是否是客户端
isClient: back.isClient, //是否是客户端
//结束
// end
};


+ 3
- 1
src/views/main_web/projnotice.vue Vedi File

@@ -75,6 +75,8 @@
</template>
<script>
import officeview from "../components/officeview/officeview.vue";
import system from '@/services/system';
export default {
data() {
return {
@@ -85,7 +87,7 @@
showOffice: false, // 预览Office文件
officeUrl: "", // PDF URL
isShowDefault:false,
isClient: process.env.IS_CLIENT,//是否是客户端
isClient: system.isClient,//是否是客户端
};
},
mounted: function () {


+ 13
- 1
src/views/main_web/workspace/service.js Vedi File

@@ -20,7 +20,19 @@ export async function fetchWorkFlow(projectId, userId) {
*/
export async function fetchFolderFileList(folderId, userId) {
const res = await fetchApi('folder/queryFileListByFolderId', {folderId, userId});
return res;
wrapErrorHint(res);
if(res.Code !== 0) return null;
const data = res.Data || {};
const outputObj = {
folder: data.folder.map(firstCharToLowerCase),
myFile: data.myFile.map(f => {
const obj = firstCharToLowerCase(f);
obj.isShowFile = true;
return obj;
}),
workFile: data.workFile.map(firstCharToLowerCase),
}
return outputObj;
}

export async function createSubFolder(folderGroupData) {


+ 87
- 72
src/views/main_web/workspace/workspace.vue Vedi File

@@ -4571,78 +4571,93 @@ export default {
* type :1 为文件,2位协作文件
*/
clientDownLoad: function (file, type) {
var thisApp = this;
if (this.isClient) {
this.$axios({
method: "put",
url: encodeURI(
process.env.API_HOST +
"projects/download/" +
file.archID +
"/" +
sessionStorage.userId +
"/" +
type
),
})
.then((response) => {
if (response.data.state == 1) {
file.downloadStatus = 1;
file.isDownload = true;
var archid = file.archID;
var alias = file.alias;
var filename = file.archName + "." + file.extension;
if (file.version > 1) {
filename = file.archName + file.version + "." + file.extension;
}
var folderID = file.folderID;
const folderName =
thisApp.listUserFolders[thisApp.nowFolderIndex].folderName;
var projID = file.projID;
if (type == 1) {
system.downloadFile(
archid,
filename,
folderID,
sessionStorage.userId,
sessionStorage.companyId,
alias
);
} else {
const folderName =
thisApp.listUserFolders[thisApp.nowFolderIndex].folderName;
system.downloadFile(
archid,
filename,
folderID,
sessionStorage.userId,
sessionStorage.companyId,
alias,
sessionStorage.projName,
folderName,
sessionStorage.projId
);
}
} else {
this.$notify({
title: "温馨提示",
message: response.data.message,
type: "error",
offset: 30,
duration: 2000,
});
}
})
.catch((error) => {
this.$notify({
title: "温馨提示",
message: "下载失败",
type: "error",
offset: 30,
duration: 2000,
});
});
}
if(!this.isClient) return;
const { ipfsCid, archName: fileName, } = file;
const { folderName, levelId, id: folderId } = this.nowFolder;
system.downloadFile(ipfsCid, sessionStorage.projName, fileName, folderName, (resMessage, socketIns) => {
console.log('receive download file message:', resMessage, socketIns);
// {"size":"11","currentSize":"11","unit":"B","process":100,"hash":""}
try {
const out = JSON.parse(resMessage.data);
if(out.process !== 100) return;
socketIns.close();
file.downloadStatus = 1;
file.isDownload = true;
this.$forceUpdate();
} catch (e) {
console.error('socket-download-file parse data have error:', e);
}
});
// var thisApp = this;
// this.$axios({
// method: "put",
// url: encodeURI(
// process.env.API_HOST +
// "projects/download/" +
// file.archID +
// "/" +
// sessionStorage.userId +
// "/" +
// type
// ),
// })
// .then((response) => {
// if (response.data.state == 1) {
// file.downloadStatus = 1;
// file.isDownload = true;
// var archid = file.archID;
// var alias = file.alias;
// var filename = file.archName + "." + file.extension;
// if (file.version > 1) {
// filename = file.archName + file.version + "." + file.extension;
// }
// var folderID = file.folderID;
// const folderName =
// thisApp.listUserFolders[thisApp.nowFolderIndex].folderName;
// var projID = file.projID;
// if (type == 1) {
// system.downloadFile(
// archid,
// filename,
// folderID,
// sessionStorage.userId,
// sessionStorage.companyId,
// alias
// );
// } else {
// const folderName =
// thisApp.listUserFolders[thisApp.nowFolderIndex].folderName;
// system.downloadFile(
// archid,
// filename,
// folderID,
// sessionStorage.userId,
// sessionStorage.companyId,
// alias,
// sessionStorage.projName,
// folderName,
// sessionStorage.projId
// );
// }
// } else {
// this.$notify({
// title: "温馨提示",
// message: response.data.message,
// type: "error",
// offset: 30,
// duration: 2000,
// });
// }
// })
// .catch((error) => {
// this.$notify({
// title: "温馨提示",
// message: "下载失败",
// type: "error",
// offset: 30,
// duration: 2000,
// });
// });
},
/**
* 客户端上传文件


Caricamento…
Annulla
Salva