After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 413 B |
After Width: | Height: | Size: 337 B |
@ -1,82 +1,114 @@ |
|||||
<template> |
<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-form-item label="分享给"> |
||||
<el-select v-model="form.receverid" filterable multiple clearable collapse-tags placeholder="选择人员" |
<el-select |
||||
popper-class="custom-header" :max-collapse-tags="1" value-key="id" style="width: 240px" @change="checkUsers"> |
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" |
||||
|
> |
||||
<template #header> |
<template #header> |
||||
<el-checkbox v-model="checkAll" @change="handleCheckAll"> |
<el-checkbox |
||||
|
v-model="checkAll" |
||||
|
@change="handleCheckAll" |
||||
|
> |
||||
全选 |
全选 |
||||
</el-checkbox> |
</el-checkbox> |
||||
</template> |
</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" |
||||
|
/> |
||||
</el-select> |
</el-select> |
||||
</el-form-item> |
</el-form-item> |
||||
<el-form-item label="编辑权限"> |
<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> |
</el-form-item> |
||||
<div class="btn-group"> |
<div class="btn-group"> |
||||
<el-button type="primary" @click="onSubmit">发布分享</el-button> |
<el-button |
||||
|
type="primary" |
||||
|
@click="onSubmit" |
||||
|
>发布分享</el-button |
||||
|
> |
||||
</div> |
</div> |
||||
</el-form> |
</el-form> |
||||
</template> |
</template> |
||||
|
|
||||
<script lang="ts" setup> |
<script lang="ts" setup> |
||||
import { ref, inject, onMounted } from 'vue'; |
import { BrowserWindow, useSystem } from "@/system"; |
||||
import { useSystem, BrowserWindow } from '@/system'; |
import { fetchPost, getSystemConfig } from "@/system/config"; |
||||
import { getSystemConfig, fetchPost } from "@/system/config"; |
import { notifyError, notifySuccess } from "@/util/msg"; |
||||
import { notifySuccess, notifyError } from "@/util/msg"; |
import { inject, onMounted, ref } from "vue"; |
||||
const window: BrowserWindow | undefined = inject("browserWindow"); |
const window: BrowserWindow | undefined = inject("browserWindow"); |
||||
const sys = useSystem() |
const sys = useSystem(); |
||||
const userInfo: any = sys.getConfig('userInfo') |
const userInfo: any = sys.getConfig("userInfo"); |
||||
let userList = ref(userInfo.user_shares) |
let userList = ref(userInfo.user_shares); |
||||
const checkAll = ref(false) |
const checkAll = ref(false); |
||||
const form: any = ref({ |
const form: any = ref({ |
||||
senderid: '', |
senderid: "", |
||||
receverid: [], |
receverid: [], |
||||
path: '', |
path: "", |
||||
iswrite: '0' |
iswrite: "0", |
||||
}) |
}); |
||||
const config = ref(getSystemConfig()) |
const config = ref(getSystemConfig()); |
||||
|
|
||||
const handleCheckAll = (val: any) => { |
const handleCheckAll = (val: any) => { |
||||
if (val) { |
if (val) { |
||||
form.value.receverid = userList.value.map((d: any) => d.value) |
form.value.receverid = userList.value.map((d: any) => d.value); |
||||
} else { |
} else { |
||||
form.value.receverid.value = [] |
form.value.receverid.value = []; |
||||
} |
} |
||||
} |
}; |
||||
const checkUsers = (val: any) => { |
const checkUsers = (val: any) => { |
||||
const res:any = [] |
const res: any = []; |
||||
val.forEach((item: any) => { |
val.forEach((item: any) => { |
||||
if(item){ |
if (item) { |
||||
res.push(item) |
res.push(item); |
||||
} |
} |
||||
}) |
}); |
||||
form.value.receverid = res |
form.value.receverid = res; |
||||
} |
}; |
||||
const onSubmit = async () => { |
const onSubmit = async () => { |
||||
const apiUrl = config.value.userInfo.url + '/files/share' |
const apiUrl = config.value.userInfo.url + "/files/share"; |
||||
form.value.senderid = config.value.userInfo.id |
form.value.senderid = config.value.userInfo.id; |
||||
form.value.path = window?.config.path || '' |
form.value.path = window?.config.path || ""; |
||||
const temp = {...form.value} |
const temp = { ...form.value }; |
||||
temp.senderid = temp.senderid.toString() |
temp.senderid = temp.senderid.toString(); |
||||
temp.receverid = temp.receverid.map((item:any) => item.toString()) |
temp.receverid = temp.receverid.map((item: any) => item.toString()); |
||||
const res = await fetchPost(apiUrl, new URLSearchParams(temp)) |
const res = await fetchPost(apiUrl, new URLSearchParams(temp)); |
||||
|
const result = await res.json(); |
||||
if (res.ok) { |
if (res.ok) { |
||||
notifySuccess("分享文件成功") |
notifySuccess(result.message || "分享文件成功"); |
||||
} else { |
} else { |
||||
notifyError("分享文件失败") |
notifyError(result.message || "分享文件失败"); |
||||
} |
} |
||||
} |
}; |
||||
onMounted(() => { |
onMounted(() => { |
||||
userList.value = userList.value.filter((item: any)=> { |
userList.value = userList.value.filter((item: any) => { |
||||
return item?.id !== config.value.userInfo.id |
return item?.id !== config.value.userInfo.id; |
||||
}) |
}); |
||||
}) |
}); |
||||
</script> |
</script> |
||||
<style scoped> |
<style scoped> |
||||
.btn-group{ |
.btn-group { |
||||
display: flex; |
display: flex; |
||||
justify-content: center; |
justify-content: center; |
||||
} |
} |
||||
</style> |
</style> |
@ -1,81 +1,106 @@ |
|||||
<template> |
<template> |
||||
<div class="file-pwd-box"> |
<div class="file-pwd-box"> |
||||
<div v-if="setPwd"> |
<div v-if="setPwd"> |
||||
<div class="setting-item" > |
<div class="setting-item"> |
||||
<label>文件密码</label> |
<label>文件密码</label> |
||||
<el-input v-model="filePwd" placeholder="请设置6-10位的密码" type="password" show-password/> |
<el-input |
||||
|
v-model="filePwd" |
||||
|
placeholder="请设置6-10位的密码" |
||||
|
type="password" |
||||
|
show-password |
||||
|
/> |
||||
</div> |
</div> |
||||
<div class="setting-item"> |
<div class="setting-item"> |
||||
<label></label> |
<label></label> |
||||
<el-button @click="toSetFilePwd" type="primary">{{ t("setFilePwd") }}</el-button> |
<el-button |
||||
<el-button @click="clearPwd" type="primary">取消文件加密</el-button> |
@click="toSetFilePwd" |
||||
|
type="primary" |
||||
|
>{{ t("setFilePwd") }}</el-button |
||||
|
> |
||||
|
<el-button |
||||
|
@click="clearPwd" |
||||
|
type="primary" |
||||
|
>取消文件加密</el-button |
||||
|
> |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
<div v-else class="setting-item"> |
<div |
||||
|
v-else |
||||
|
class="setting-item" |
||||
|
> |
||||
<label></label> |
<label></label> |
||||
<el-button @click="setPwd = true" type="primary">设置文件密码</el-button> |
<el-button |
||||
|
@click="setPwd = true" |
||||
|
type="primary" |
||||
|
>设置文件密码</el-button |
||||
|
> |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
</template> |
</template> |
||||
|
|
||||
<script lang="ts" setup> |
<script lang="ts" setup> |
||||
import { md5 } from "js-md5"; |
import { t } from "@/system"; |
||||
import { ref, onMounted } from "vue"; |
import { |
||||
import { t } from "@/system"; |
fetchGet, |
||||
import { fetchGet, getApiUrl, setSystemKey, getSystemConfig } from "@/system/config"; |
getApiUrl, |
||||
import { notifySuccess, notifyError } from "@/util/msg"; |
getSystemConfig, |
||||
const filePwd = ref('') |
setSystemKey, |
||||
const setPwd = ref(false) |
} from "@/system/config"; |
||||
const config = getSystemConfig() |
import { notifyError, notifySuccess } from "@/util/msg"; |
||||
const params = { |
import { md5 } from "js-md5"; |
||||
|
import { onMounted, ref } from "vue"; |
||||
|
const filePwd = ref(""); |
||||
|
const setPwd = ref(false); |
||||
|
const config = getSystemConfig(); |
||||
|
const params = { |
||||
isPwd: 1, |
isPwd: 1, |
||||
pwd: '', |
pwd: "", |
||||
salt: getSystemConfig().file.salt |
salt: getSystemConfig().file.salt, |
||||
} |
}; |
||||
// 设置文件密码 |
// 设置文件密码 |
||||
async function toSetFilePwd() { |
async function toSetFilePwd() { |
||||
if (filePwd.value.length < 6 || filePwd.value.length > 10) { |
if (filePwd.value.length < 6 || filePwd.value.length > 10) { |
||||
notifyError("密码长度应该在6-10位之间") |
notifyError("密码长度应该在6-10位之间"); |
||||
return |
return; |
||||
} |
} |
||||
params.pwd = md5(filePwd.value) |
params.pwd = md5(filePwd.value); |
||||
params.isPwd = filePwd.value === '' ? 0 : 1 |
params.isPwd = filePwd.value === "" ? 0 : 1; |
||||
const url = getApiUrl() + '/file/setfilepwd' |
const url = getApiUrl() + "/file/setfilepwd"; |
||||
const header = { |
const header = { |
||||
'Salt': params.salt ? params.salt : 'vIf_wIUedciAd0nTm6qjJA==', |
salt: params.salt ? params.salt : "vIf_wIUedciAd0nTm6qjJA==", |
||||
'FilePwd': params.pwd |
pwd: params.pwd, |
||||
} |
}; |
||||
await fetchGet(`${getApiUrl()}/file/changeispwd?ispwd=${params.isPwd}`) |
await fetchGet(`${getApiUrl()}/file/changeispwd?ispwd=${params.isPwd}`); |
||||
const res = await fetchGet(url, header) |
const res = await fetchGet(url, header); |
||||
if (res.ok){ |
if (res.ok) { |
||||
notifySuccess("设置文件密码成功"); |
notifySuccess("设置文件密码成功"); |
||||
} else { |
} else { |
||||
params.isPwd = 0 |
params.isPwd = 0; |
||||
params.pwd = '' |
params.pwd = ""; |
||||
notifyError("设置文件密码失败") |
notifyError("设置文件密码失败"); |
||||
|
} |
||||
|
setSystemKey("file", params); |
||||
} |
} |
||||
setSystemKey('file',params) |
async function clearPwd() { |
||||
} |
setPwd.value = false; |
||||
async function clearPwd() { |
filePwd.value = ""; |
||||
setPwd.value = false |
params.isPwd = 0; |
||||
filePwd.value = '' |
await fetchGet(`${getApiUrl()}/file/changeispwd?ispwd=0`); |
||||
params.isPwd = 0 |
setSystemKey("file", params); |
||||
await fetchGet(`${getApiUrl()}/file/changeispwd?ispwd=0`) |
} |
||||
setSystemKey('file',params) |
onMounted(() => { |
||||
} |
params.isPwd = config.file.isPwd; |
||||
onMounted(() => { |
setPwd.value = params.isPwd ? true : false; |
||||
params.isPwd = config.file.isPwd |
}); |
||||
setPwd.value = params.isPwd ? true : false |
|
||||
}) |
|
||||
</script> |
</script> |
||||
|
|
||||
<style scoped> |
<style scoped> |
||||
@import "./setStyle.css"; |
@import "./setStyle.css"; |
||||
.file-pwd-box { |
.file-pwd-box { |
||||
padding-top: 20px; |
padding-top: 20px; |
||||
} |
} |
||||
.setting-item { |
.setting-item { |
||||
display: flex; |
display: flex; |
||||
align-items: center; |
align-items: center; |
||||
} |
} |
||||
</style> |
</style> |
||||
|
@ -0,0 +1,21 @@ |
|||||
|
module.exports = { |
||||
|
root: true, |
||||
|
env: { browser: true, es2020: true }, |
||||
|
extends: [ |
||||
|
'eslint:recommended', |
||||
|
'plugin:react/recommended', |
||||
|
'plugin:react/jsx-runtime', |
||||
|
'plugin:react-hooks/recommended', |
||||
|
], |
||||
|
ignorePatterns: ['dist', '.eslintrc.cjs'], |
||||
|
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, |
||||
|
settings: { react: { version: '18.2' } }, |
||||
|
plugins: ['react-refresh'], |
||||
|
rules: { |
||||
|
'react/jsx-no-target-blank': 'off', |
||||
|
'react-refresh/only-export-components': [ |
||||
|
'warn', |
||||
|
{ allowConstantExport: true }, |
||||
|
], |
||||
|
}, |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
# Logs |
||||
|
logs |
||||
|
*.log |
||||
|
npm-debug.log* |
||||
|
yarn-debug.log* |
||||
|
yarn-error.log* |
||||
|
pnpm-debug.log* |
||||
|
lerna-debug.log* |
||||
|
|
||||
|
node_modules |
||||
|
dist |
||||
|
dist-ssr |
||||
|
*.local |
||||
|
|
||||
|
# Editor directories and files |
||||
|
.vscode/* |
||||
|
!.vscode/extensions.json |
||||
|
.idea |
||||
|
.DS_Store |
||||
|
*.suo |
||||
|
*.ntvs* |
||||
|
*.njsproj |
||||
|
*.sln |
||||
|
*.sw? |
@ -0,0 +1 @@ |
|||||
|
# use the tldraw library |
@ -0,0 +1,13 @@ |
|||||
|
<!doctype html> |
||||
|
<html lang="en"> |
||||
|
<head> |
||||
|
<meta charset="UTF-8" /> |
||||
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
|
<title>draw</title> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div id="root"></div> |
||||
|
<script type="module" src="/src/main.jsx"></script> |
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,31 @@ |
|||||
|
{ |
||||
|
"name": "mydraw", |
||||
|
"private": true, |
||||
|
"version": "0.0.0", |
||||
|
"type": "module", |
||||
|
"scripts": { |
||||
|
"dev": "vite", |
||||
|
"build": "vite build", |
||||
|
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", |
||||
|
"preview": "vite preview" |
||||
|
}, |
||||
|
"dependencies": { |
||||
|
"@tldraw/assets": "^2.1.4", |
||||
|
"react": "^18.2.0", |
||||
|
"react-dom": "^18.2.0", |
||||
|
"tldraw": "^2.1.4" |
||||
|
}, |
||||
|
"devDependencies": { |
||||
|
"@types/react": "^18.2.66", |
||||
|
"@types/react-dom": "^18.2.22", |
||||
|
"@vitejs/plugin-react": "^4.2.1", |
||||
|
"autoprefixer": "^10.4.19", |
||||
|
"eslint": "^8.57.0", |
||||
|
"eslint-plugin-react": "^7.34.1", |
||||
|
"eslint-plugin-react-hooks": "^4.6.0", |
||||
|
"eslint-plugin-react-refresh": "^0.4.6", |
||||
|
"postcss": "^8.4.38", |
||||
|
"tailwindcss": "^3.4.4", |
||||
|
"vite": "^5.2.0" |
||||
|
} |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
export default { |
||||
|
plugins: { |
||||
|
tailwindcss: {}, |
||||
|
autoprefixer: {}, |
||||
|
}, |
||||
|
} |
After Width: | Height: | Size: 827 B |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 237 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 846 B |
After Width: | Height: | Size: 977 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 962 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 769 B |
After Width: | Height: | Size: 526 B |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 625 B |
After Width: | Height: | Size: 540 B |
After Width: | Height: | Size: 864 B |
After Width: | Height: | Size: 846 B |
After Width: | Height: | Size: 395 KiB |
After Width: | Height: | Size: 387 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 396 KiB |
After Width: | Height: | Size: 388 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 320 B |
After Width: | Height: | Size: 501 B |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 340 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 473 B |
After Width: | Height: | Size: 291 B |
After Width: | Height: | Size: 223 B |
After Width: | Height: | Size: 199 B |
After Width: | Height: | Size: 496 B |
After Width: | Height: | Size: 336 B |
After Width: | Height: | Size: 182 B |
After Width: | Height: | Size: 301 B |
After Width: | Height: | Size: 621 B |
After Width: | Height: | Size: 273 B |
After Width: | Height: | Size: 1000 B |
After Width: | Height: | Size: 276 B |
After Width: | Height: | Size: 295 B |
After Width: | Height: | Size: 645 B |
After Width: | Height: | Size: 746 B |
After Width: | Height: | Size: 494 B |
After Width: | Height: | Size: 481 B |
After Width: | Height: | Size: 488 B |
After Width: | Height: | Size: 485 B |
After Width: | Height: | Size: 481 B |
After Width: | Height: | Size: 285 B |
After Width: | Height: | Size: 285 B |
After Width: | Height: | Size: 893 B |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 149 B |
After Width: | Height: | Size: 618 B |
After Width: | Height: | Size: 885 B |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 532 B |
After Width: | Height: | Size: 170 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 699 B |
After Width: | Height: | Size: 656 B |
After Width: | Height: | Size: 154 B |