qiutianhong 7 months ago
parent
commit
5ac19d2ae8
  1. 3
      frontend/auto-imports.d.ts
  2. 1
      frontend/components.d.ts
  3. 22
      frontend/src/components/builtin/FileList.vue
  4. 114
      frontend/src/components/chat/ChatUserSetting.vue
  5. 33
      frontend/src/components/oa/FilePwd.vue
  6. 6
      frontend/src/components/setting/SetFilePwd.vue
  7. 2
      frontend/src/components/setting/SetSystem.vue
  8. 5
      frontend/src/system/config.ts

3
frontend/auto-imports.d.ts

@ -3,7 +3,6 @@
// @ts-nocheck // @ts-nocheck
// noinspection JSUnusedGlobalSymbols // noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import // Generated by unplugin-auto-import
// biome-ignore lint: disable
export {} export {}
declare global { declare global {
const EffectScope: typeof import('vue')['EffectScope'] const EffectScope: typeof import('vue')['EffectScope']
@ -72,6 +71,6 @@ declare global {
// for type re-export // for type re-export
declare global { declare global {
// @ts-ignore // @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue' export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
import('vue') import('vue')
} }

1
frontend/components.d.ts

@ -95,6 +95,7 @@ declare module 'vue' {
FileIconIs: typeof import('./src/components/builtin/FileIconIs.vue')['default'] FileIconIs: typeof import('./src/components/builtin/FileIconIs.vue')['default']
FileList: typeof import('./src/components/builtin/FileList.vue')['default'] FileList: typeof import('./src/components/builtin/FileList.vue')['default']
FileProps: typeof import('./src/components/builtin/FileProps.vue')['default'] FileProps: typeof import('./src/components/builtin/FileProps.vue')['default']
FilePwd: typeof import('./src/components/oa/FilePwd.vue')['default']
FileTree: typeof import('./src/components/builtin/FileTree.vue')['default'] FileTree: typeof import('./src/components/builtin/FileTree.vue')['default']
FileViewer: typeof import('./src/components/builtin/FileViewer.vue')['default'] FileViewer: typeof import('./src/components/builtin/FileViewer.vue')['default']
IframeFile: typeof import('./src/components/window/IframeFile.vue')['default'] IframeFile: typeof import('./src/components/window/IframeFile.vue')['default']

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

@ -408,8 +408,26 @@ function handleRightClick(mouse: MouseEvent, item: OsFileWithoutContent, index:
config: { config: {
path: item.path, path: item.path,
}, },
width: 500, width: 450,
height: 500, height: 280,
center: true,
});
win.show();
},
}
)
menuArr.push(
{
label: '文件加密',
click: () => {
const win = new BrowserWindow({
title: '文件加密',
content: "FilePwd",
config: {
path: item.path,
},
width: 400,
height: 200,
center: true, center: true,
}); });
win.show(); win.show();

114
frontend/src/components/chat/ChatUserSetting.vue

@ -5,35 +5,28 @@ import { useChatStore } from "@/stores/chat";
import { notifyError, notifySuccess } from "@/util/msg"; import { notifyError, notifySuccess } from "@/util/msg";
import { fetchGet, fetchPost, getSystemConfig, setSystemKey } from "@/system/config"; import { fetchGet, fetchPost, getSystemConfig, setSystemKey } from "@/system/config";
const store = useChatStore() const store = useChatStore()
const form = ref({ // const form = ref({
nickname: '', // nickname: '',
}) // })
interface ImgItem { interface ImgItem {
url: string; url: string;
name: string; name: string;
} }
const editType = ref(0) const editType = ref(0)
const userInfo = getSystemConfig().userInfo const userInfo = getSystemConfig().userInfo
const userInfoForm: {[key: string]: any} = reactive({
nickname: '',
phone: '',
email: '',
desc: ''
})
const dialogShow = ref(false) const dialogShow = ref(false)
let imgList = reactive<ImgItem[]>([]) let imgList = reactive<ImgItem[]>([])
let pos = ref(0) let pos = ref(0)
//
const showChange = (val: boolean) =>{ const showChange = (val: boolean) =>{
dialogShow.value = val dialogShow.value = val
} }
const toChangeHead = async ()=>{
let res = await fetchGet(`${userInfo.url}/files/saveavatar?id=${userInfo.id}&name=${imgList[pos.value]?.name}`)
if (!res.ok) {
notifyError("头像换取失败")
} else {
const response = await res.json()
notifySuccess(response?.message || '头像换取成功')
userInfo.avatar = imgList[pos.value]?.name
store.userInfo.avatar = userInfo.url + '/upload/avatar/' + userInfo.avatar
setSystemKey('userInfo', userInfo)
}
showChange(false)
}
// //
const getHeadList = async () => { const getHeadList = async () => {
let res = await fetchGet (`${userInfo.url}/files/avatarlist`) let res = await fetchGet (`${userInfo.url}/files/avatarlist`)
@ -49,12 +42,62 @@ const getHeadList = async () => {
} }
} }
} }
//
const chooseImg = (index: number) => { const chooseImg = (index: number) => {
pos.value = index pos.value = index
} }
const onSubmit = async () => { const toChangeHead = async ()=>{
console.log('提交'); let res = await fetchGet(`${userInfo.url}/files/saveavatar?id=${userInfo.id}&name=${imgList[pos.value]?.name}`)
if (!res.ok) {
notifyError("头像换取失败")
} else {
const response = await res.json()
notifySuccess(response?.message || '头像换取成功')
userInfo.avatar = imgList[pos.value]?.name
store.userInfo.avatar = userInfo.url + '/upload/avatar/' + userInfo.avatar
setSystemKey('userInfo', userInfo)
}
showChange(false)
}
//
const userRef:any = ref(null)
const userRule = {
nickname: [
{ required: true, message: '昵称不能为空', trigger: 'blur'},
{ min: 2, max: 10, message: '昵称长度应该在2到10位', trigger: 'blur'}
],
phone: [
{ required: true, message: '手机号不能为空', trigger: 'blur'},
{ pattern: /^1[3-9]\d{9}$/, message: '手机号格式不正确', trigger: 'blur'}
],
email: [
{ required: true, message: '邮箱不能为空', trigger: 'blur'},
{ pattern: /^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$/, message: '邮箱格式不正确', trigger: 'blur'}
]
// desc: [
// { required: true, message: '', trigger: 'blur'},
// { min: 2, max: 10, message: '210', trigger: 'blur'}
// ],
}
const onSubmit = async () => {
try {
for (const key in userInfoForm) {
userInfo[key] = userInfoForm[key]
}
const head = {
'AuthorizationAdmin': userInfo.token
}
await userRef.value.validate()
const res = await fetchPost(`${userInfo.url}/user/editdata?id=${userInfo.id}`, JSON.stringify(userInfoForm), head)
const result = await res.json()
if (result?.success) {
notifySuccess(result?.message)
setSystemKey('userInfo', userInfo)
} else {
notifyError(result?.message)
}
}catch (e) {
console.log(e)
}
} }
// //
const passwordForm = reactive({ const passwordForm = reactive({
@ -73,7 +116,9 @@ const rules = {
], ],
confirmPassword: [ confirmPassword: [
{ required: true, message: '请再次输入密码', trigger: 'blur' }, { required: true, message: '请再次输入密码', trigger: 'blur' },
{ validator: (value:any, callback:any) => { { validator: (rule: any, value:any, callback:any) => {
console.log('rule:', rule);
if (value === '') { if (value === '') {
callback(new Error('请再次输入密码')); callback(new Error('请再次输入密码'));
} else if (value !== passwordForm.newPassword) { } else if (value !== passwordForm.newPassword) {
@ -103,6 +148,9 @@ const toChangePwd = async () => {
} }
onMounted(()=>{ onMounted(()=>{
getHeadList() getHeadList()
for (const key in userInfoForm) {
userInfoForm[key] = userInfo[key]
}
store.userInfo.avatar = userInfo.url + '/upload/avatar/' + userInfo.avatar store.userInfo.avatar = userInfo.url + '/upload/avatar/' + userInfo.avatar
}) })
</script> </script>
@ -113,21 +161,21 @@ onMounted(()=>{
<div @click="editType = 1" :class="{'is-active': editType == 1}">修改密码</div> <div @click="editType = 1" :class="{'is-active': editType == 1}">修改密码</div>
</el-aside> </el-aside>
<el-main> <el-main>
<el-form v-if="editType == 0" :model="form" label-width="150px" style="padding: 30px;"> <el-form v-if="editType == 0" :model="userInfoForm" :rules="userRule" ref="userRef" label-width="130px" style="padding: 30px;">
<el-form-item label="头像"> <el-form-item label="头像">
<el-avatar :size="90" :src="store.userInfo.avatar" @click="showChange(true)"/> <el-avatar :size="90" :src="store.userInfo.avatar" @click="showChange(true)"/>
</el-form-item> </el-form-item>
<el-form-item label="昵称"> <el-form-item label="昵称" prop="nickname">
<el-input v-model="store.userInfo.nickname" /> <el-input v-model="userInfoForm.nickname" />
</el-form-item> </el-form-item>
<el-form-item label="手机号"> <el-form-item label="手机号" prop="phone">
<el-input v-model="store.userInfo.phone" /> <el-input v-model="userInfoForm.phone" />
</el-form-item> </el-form-item>
<el-form-item label="工号"> <el-form-item label="邮箱" prop="email">
<el-input v-model="store.userInfo.job_number" /> <el-input v-model="userInfoForm.email" />
</el-form-item> </el-form-item>
<el-form-item label="自我介绍"> <el-form-item label="自我介绍" prop="desc">
<el-input v-model="store.userInfo.desc" /> <el-input v-model="userInfoForm.desc" type="textarea" maxlength="100" show-word-limit/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="onSubmit">保存</el-button> <el-button type="primary" @click="onSubmit">保存</el-button>
@ -190,6 +238,12 @@ onMounted(()=>{
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
:deep(.el-dialog) {
.el-dialog__body {
max-height: 300px;
overflow-y: scroll
}
}
.img-box { .img-box {
position: relative; position: relative;
.el-avatar { .el-avatar {

33
frontend/src/components/oa/FilePwd.vue

@ -0,0 +1,33 @@
<template>
<el-form label-width="auto" style="max-width: 560px;margin-top:20px;padding: 20px;">
<el-form-item label="文件密码">
<el-input v-model="filePwd" type="password" show-password/>
</el-form-item>
<div class="btn-group">
<el-button type="primary" @click="setFilePwd">提交</el-button>
</div>
</el-form>
</template>
<script lang="ts" setup>
import { fetchPost } from '@/system/config';
import { ref } from 'vue'
import { getSystemConfig } from "@/system/config";
import { BrowserWindow } from '@/system';
const window: BrowserWindow | undefined = inject("browserWindow");
const filePwd = ref('')
const userInfo = getSystemConfig().userInfo
async function setFilePwd() {
if (filePwd.value !== '' && filePwd.value.length >= 6 && filePwd.value.length <= 10) {
const path = window?.config.path || ''
const res = await fetchPost(`${userInfo.url}`, filePwd.value)
console.log('路径:', res, path);
}
}
</script>
<style scoped>
.btn-group{
display: flex;
justify-content: center;
}
</style>

6
frontend/src/components/setting/SetFilePwd.vue

@ -3,7 +3,7 @@
<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"/> <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>
@ -26,6 +26,7 @@ import { fetchGet, getApiUrl, setSystemKey, getSystemConfig } from "@/system/con
import { notifySuccess, notifyError } from "@/util/msg"; import { notifySuccess, notifyError } from "@/util/msg";
const filePwd = ref('') const filePwd = ref('')
const setPwd = ref(false) const setPwd = ref(false)
const config = getSystemConfig()
const params = { const params = {
isPwd: 1, isPwd: 1,
pwd: '', pwd: '',
@ -58,9 +59,12 @@ async function toSetFilePwd() {
async function clearPwd() { async function clearPwd() {
setPwd.value = false setPwd.value = false
filePwd.value = '' filePwd.value = ''
params.isPwd = 0
await fetchGet(`${getApiUrl()}/file/changeispwd?ispwd=0`) await fetchGet(`${getApiUrl()}/file/changeispwd?ispwd=0`)
setSystemKey('file',params)
} }
onMounted(()=>{ onMounted(()=>{
params.isPwd = config.file.isPwd
setPwd.value = params.isPwd ? true : false setPwd.value = params.isPwd ? true : false
}) })
</script> </script>

2
frontend/src/components/setting/SetSystem.vue

@ -47,7 +47,7 @@
{{ t("confirm") }} {{ t("confirm") }}
</el-button> </el-button>
</div> </div>
<SetFilePwd></SetFilePwd> <SetFilePwd v-if="config.userType === 'person'"></SetFilePwd>
</div> </div>
<div v-if="2 === activeIndex"> <div v-if="2 === activeIndex">

5
frontend/src/system/config.ts

@ -234,7 +234,7 @@ export function fetchGet(url: string, headerConfig?: {[key: string]: string}) {
}) })
} }
} }
export function fetchPost(url: string, data: any) { export function fetchPost(url: string, data: any, headerConfig?: {[key: string]: string}) {
const config = getSystemConfig(); const config = getSystemConfig();
if (config.userType == 'person') { if (config.userType == 'person') {
return fetch(url, { return fetch(url, {
@ -248,7 +248,8 @@ export function fetchPost(url: string, data: any) {
body: data, body: data,
headers: { headers: {
'ClientID': getClientId(), 'ClientID': getClientId(),
'Authorization': config.userInfo.token 'Authorization': config.userInfo.token,
...headerConfig
} }
}) })
} }

Loading…
Cancel
Save