Browse Source

add choose pwd

master
godo 6 months ago
parent
commit
4eb32ee93c
  1. 1
      README.md
  2. 13
      frontend/components.d.ts
  3. 28
      frontend/src/components/builtin/FileList.vue
  4. 28
      frontend/src/components/computer/Computer.vue
  5. 125
      frontend/src/components/oa/ShareFiles.vue
  6. 9
      frontend/src/hook/useComputer.ts
  7. 7
      frontend/src/system/core/FileOs.ts
  8. 2
      frontend/src/system/index.ts

1
README.md

@ -29,6 +29,7 @@
- 内网聊天新增ai对话,可保存对话历史,可更换模型和prompt
- 新增可定义端口和访问路径,支持web端系统重启
- 新增企业端gitee登录和github登录
- 新增每个文件可独立设置密码,支持不可逆加密文件(加密文件后不可更改密码)
## 🏭 第三阶段目标(十二月底发布)
1. **文档处理与Markdown智能升级**

13
frontend/components.d.ts

@ -74,24 +74,16 @@ declare module 'vue' {
ElCol: typeof import('element-plus/es')['ElCol']
ElCollapse: typeof import('element-plus/es')['ElCollapse']
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
ElContainer: typeof import('element-plus/es')['ElContainer']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElFooter: typeof import('element-plus/es')['ElFooter']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElHeader: typeof import('element-plus/es')['ElHeader']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage']
ElInput: typeof import('element-plus/es')['ElInput']
ElMain: typeof import('element-plus/es')['ElMain']
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption']
ElPageHeader: typeof import('element-plus/es')['ElPageHeader']
ElPagination: typeof import('element-plus/es')['ElPagination']
@ -100,18 +92,15 @@ declare module 'vue' {
ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSelectV2: typeof import('element-plus/es')['ElSelectV2']
ElSlider: typeof import('element-plus/es')['ElSlider']
ElSpace: typeof import('element-plus/es')['ElSpace']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag']
ElText: typeof import('element-plus/es')['ElText']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTransfer: typeof import('element-plus/es')['ElTransfer']
ElTree: typeof import('element-plus/es')['ElTree']
Error: typeof import('./src/components/taskbar/Error.vue')['default']
FileIcon: typeof import('./src/components/builtin/FileIcon.vue')['default']
FileIconImg: typeof import('./src/components/builtin/FileIconImg.vue')['default']

28
frontend/src/components/builtin/FileList.vue

@ -291,7 +291,7 @@ function handleRightClick(
// },
// },
];
if (item.isDirectory && !item.isShare) {
if (item.isDirectory) {
if (getSystemKey("storeType") == "local") {
menuArr.push({
label: t("zip"),
@ -383,7 +383,7 @@ function handleRightClick(
},
},
];
if (!item.isShare || item.path.indexOf("/F/othershare") !== 0) {
if (item.path.indexOf("/F") < 0) {
fileMenus.push({
label: t("delete"),
click: async () => {
@ -399,8 +399,6 @@ function handleRightClick(
}
},
});
}
if (!item.isShare) {
fileMenus.push({
label: t("create.shortcut"),
click: () => {
@ -412,7 +410,7 @@ function handleRightClick(
});
}
const userType = sys.getConfig("userType");
if (userType == "member" && !item.isShare && !item.isDirectory) {
if (userType == "member") {
menuArr.push({
label: "分享给...",
click: () => {
@ -429,24 +427,8 @@ function handleRightClick(
win.show();
},
});
// menuArr.push({
// label: "",
// click: () => {
// const win = new BrowserWindow({
// title: "",
// content: "CommentsFiles",
// config: {
// path: item.path,
// },
// width: 350,
// height: 400,
// center: true,
// });
// win.show();
// },
// });
}
if (!item.isDirectory) {
menuArr.push({
label: "文件加密",
click: () => {
@ -463,6 +445,8 @@ function handleRightClick(
win.show();
},
});
}
menuArr.push.apply(menuArr, fileMenus);
}
const sysEndMenu = [

28
frontend/src/components/computer/Computer.vue

@ -132,8 +132,6 @@
</template>
<script lang="ts" setup>
import { inject, onMounted, ref } from "vue";
//import foldericon from '@/assets/folder.png';
import { useComputer } from "@/hook/useComputer";
import { useContextMenu } from "@/hook/useContextMenu";
import { useFileDrag } from "@/hook/useFileDrag";
@ -148,11 +146,6 @@
t,
useSystem,
} from "@/system/index.ts";
import {
isRootShare,
isShareFile,
turnLocalPath,
} from "@/util/sharePath.ts";
import { useChooseStore } from "@/stores/choose";
@ -244,22 +237,7 @@
isDirectory(file) {
return file.isDirectory;
},
//
async readShareDir(path) {
// let file: OsFileWithoutContent
// if (type === 'path') {
// file = await system.fs.getShareInfo(params)
// file = file.fi
// file.path = turnLocalPath(file.path, currentPath, 1)
// } else {
// file = params
// }
// return system.fs.readShareFileDir(getSystemConfig().userInfo.id, file)
return system.fs.readShareFileDir(
getSystemConfig().userInfo.id,
path
);
},
notify(title, content) {
new Notify({
title,
@ -311,9 +289,9 @@
isSymlink: false,
mode: 2147484141,
name: "myshare",
oldPath: "/F/myshare",
oldPath: "/F",
parentPath: "/F",
path: "/F/myshare",
path: "/F",
title: "myshare",
size: 64,
mtime: "",

125
frontend/src/components/oa/ShareFiles.vue

@ -1,79 +1,79 @@
<template>
<el-form
:model="form"
label-width="auto"
style="max-width: 560px; margin-top: 20px; padding: 20px"
>
<el-form :model="form" label-width="auto" style="max-width: 560px; margin-top: 20px; padding: 20px">
<el-form-item label="分享给">
<el-select
v-model="form.receverid"
filterable
multiple
clearable
collapse-tags
placeholder="选择人员"
popper-class="custom-header"
:max-collapse-tags="1"
value-key="id"
style="width: 240px"
@change="checkUsers"
>
<el-select v-model="form.receiverId" remote :remote-method="handleSearch" filterable multiple clearable collapse-tags placeholder="选择人员"
popper-class="custom-header" :max-collapse-tags="1" value-key="id" style="width: 240px"
@change="checkUsers">
<template #header>
<el-checkbox
v-model="checkAll"
@change="handleCheckAll"
>
<el-checkbox v-model="checkAll" @change="handleCheckAll">
全选
</el-checkbox>
</template>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.nickname"
:value="item.id"
/>
<el-option v-for="item in userList" :key="item.id" :label="item.nickname" :value="item.id" />
<template #footer v-if="total > 10">
<el-pagination small background layout="prev, pager, next" :total="total"
:page-size="pageSize" :current-page="currentPage" @current-change="handlePageChange"
style="margin-top: 10px" />
</template>
</el-select>
</el-form-item>
<el-form-item label="编辑权限">
<el-switch
v-model="form.iswrite"
active-value="1"
inactive-value="0"
/>
<el-switch v-model="form.iswrite" active-value="1" inactive-value="0" />
</el-form-item>
<div class="btn-group">
<el-button
type="primary"
@click="onSubmit"
>发布分享</el-button
>
<el-button type="primary" @click="onSubmit">发布分享</el-button>
</div>
</el-form>
</template>
<script lang="ts" setup>
import { BrowserWindow, useSystem } from "@/system";
import { fetchPost, getSystemConfig } from "@/system/config";
import { BrowserWindow } from "@/system";
import { fetchPost, getSystemConfig, getUrl } from "@/system/config";
import { notifyError, notifySuccess } from "@/util/msg";
import { inject, onMounted, ref } from "vue";
const window: BrowserWindow | undefined = inject("browserWindow");
const sys = useSystem();
const userInfo: any = sys.getConfig("userInfo");
let userList = ref(userInfo.user_shares);
//const sys = useSystem();
//const userInfo: any = sys.getConfig("userInfo");
const userList: any = ref([]);
const checkAll = ref(false);
const form: any = ref({
senderid: "",
receverid: [],
receiverId: [],
path: "",
iswrite: "0",
});
const currentPage = ref(1);
const pageSize = 10;
const total = ref(0);
const config = ref(getSystemConfig());
const pageUrl = ref("")
const getList = async() => {
const apiUrl = getUrl(pageUrl.value, true)
//console.log(apiUrl)
const res: any = await fetch(apiUrl);
//console.log(res)
if (res.ok) {
const rt = await res.json();
//console.log(rt)
userList.value = rt.data.list;
total.value = rt.data.total;
userList.value = userList.value.filter((item: any) => {
return item?.id !== config.value.userInfo.id;
});
if(userList.value.length != rt.data.list.length){
total.value = total.value - 1;
}
}
}
onMounted(async () => {
pageUrl.value = '/user/sharelist?page='+currentPage.value
await getList()
});
const handleCheckAll = (val: any) => {
if (val) {
form.value.receverid = userList.value.map((d: any) => d.value);
form.value.receiverId = userList.value.map((d: any) => d.value);
} else {
form.value.receverid.value = [];
form.value.receiverId.value = [];
}
};
const checkUsers = (val: any) => {
@ -83,28 +83,39 @@
res.push(item);
}
});
form.value.receverid = res;
form.value.receiverId = res;
};
const onSubmit = async () => {
const apiUrl = config.value.userInfo.url + "/files/share";
form.value.senderid = config.value.userInfo.id;
form.value.path = window?.config.path || "";
const temp = { ...form.value };
temp.senderid = temp.senderid.toString();
temp.receverid = temp.receverid.map((item: any) => item.toString());
temp.receiverId = temp.receiverId.map((item: any) => item.toString());
const res = await fetchPost(apiUrl, new URLSearchParams(temp));
const result = await res.json();
if (res.ok) {
if (res.ok && result.success) {
notifySuccess(result.message || "分享文件成功");
window?.close()
} else {
notifyError(result.message || "分享文件失败");
}
};
onMounted(() => {
userList.value = userList.value.filter((item: any) => {
return item?.id !== config.value.userInfo.id;
});
});
const handleSearch = async (val:any) => {
if(val !== ''){
pageUrl.value = '/user/sharelist?page=1&nickname='+val
}else{
pageUrl.value = '/user/sharelist?page=1'
}
await getList()
};
const handlePageChange = async (page: number) => {
currentPage.value = page;
await getList()
};
// onMounted(() => {
// userList.value = userList.value.filter((item: any) => {
// return item?.id !== config.value.userInfo.id;
// });
// });
</script>
<style scoped>
.btn-group {

9
frontend/src/hook/useComputer.ts

@ -15,7 +15,7 @@ export const useComputer = (adpater: {
isDirectory: (file: OsFileWithoutContent) => boolean;
notify: (title: string, content: string) => void;
search: (keyword: string) => Promise<OsFileWithoutContent[]>;
readShareDir: (path: RouterPath) => Promise<OsFileWithoutContent[]>;
//readShareDir: (path: RouterPath) => Promise<OsFileWithoutContent[]>;
}) => {
const isVia = async (path: RouterPath) => {
if (path === '') path = '/';
@ -43,12 +43,7 @@ export const useComputer = (adpater: {
return;
}
if (!(await isVia(currentPath))) return;
let result
if (currentPath === '/F/myshare' || currentPath === '/F/othershare') {
result = await adpater.sharedir(currentPath)
} else {
result = await adpater.readdir(currentPath);
}
const result = await adpater.readdir(currentPath);
// else if (currentPath.indexOf('/F') === 0) {
// //判断是否是回退
// // console.log('currentPath:', currentPath);

7
frontend/src/system/core/FileOs.ts

@ -1,9 +1,6 @@
import { getSystemConfig } from "@/system/config";
import { isShareFile, turnLocalPath, turnServePath } from "@/util/sharePath.ts";
import { md5 } from "js-md5";
import { fetchGet, fetchPost, getFileUrl } from "../config.ts";
import { OsFileMode } from '../core/FileMode';
import { OsFile } from "./FileSystem.ts";
const API_BASE_URL = getFileUrl()
// import { notifyError } from "@/util/msg";
export async function handleReadDir(path: any): Promise<any> {
@ -288,10 +285,6 @@ export const useOsFile = () => {
return false;
},
async writeFile(path: string, content: string | Blob, header?: { [key: string]: any }) {
// const head: any = header ? { ...header } : {}
// if (head.pwd && head.pwd !== '') {
// head.pwd = md5(head.pwd)
// }
const response = await handleWriteFile(path, content, header);
if (response) {
return response;

2
frontend/src/system/index.ts

@ -19,7 +19,7 @@ import { useModelStore } from "@/stores/model.ts";
import { useUpgradeStore } from '@/stores/upgrade';
import { RestartApp } from '@/util/goutil';
import { notifyError } from '@/util/msg';
import { isShareFile } from '@/util/sharePath';
//import { isShareFile } from '@/util/sharePath';
import { pick } from '../util/modash';
import { clearSystemConfig, fetchGet, getClientId, getFileUrl, getSystemConfig, getSystemKey, setSystemConfig, setSystemKey } from './config';
import { OsFileInterface } from './core/FIleInterface';

Loading…
Cancel
Save