Browse Source

Merge branch 'master' of https://gitee.com/godoos/godoos

master
godo 5 months ago
parent
commit
882f2e3eb2
  1. 6
      frontend/src/assets/chat.scss
  2. 3
      frontend/src/components/localchat/AiChatMain.vue
  3. 251
      frontend/src/components/setting/SetSystem.vue
  4. 28
      frontend/src/components/setting/setStyle.css

6
frontend/src/assets/chat.scss

@ -108,11 +108,9 @@
@media screen and (max-width: 768px) {
.chat-bot{
.input-area{
padding: 0;
.file-btn{
margin-left: vw(-20);
}
.websearch-btn{
margin-left: vw(-5);
margin-left: vw(-10);
}
}
}

3
frontend/src/components/localchat/AiChatMain.vue

@ -7,6 +7,7 @@ import { ElScrollbar } from "element-plus";
import { getSystemConfig } from "@/system/config";
import { Vue3Lottie } from "vue3-lottie";
import { file } from "jszip";
import { isMobileDevice } from "@/util/device";
const chatStore = useAiChatStore();
const modelStore = useModelStore();
const isPadding = ref(false); //
@ -242,7 +243,7 @@ const uploadImage = async (event: any) => {
</el-col>
<el-col :span="17">
<el-input v-model="userMessage" :placeholder="t('aichat.askme')" size="large" clearable
@keydown="handleKeydown" autofocus class="ai-input-area" />
@keydown="handleKeydown" :autofocus="isMobileDevice() ? false : true" class="ai-input-area" />
</el-col>
<el-col :span="2">
<el-button v-if="!isPadding" @click="sendMessage" icon="Promotion" type="info" size="large" circle />

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

@ -2,87 +2,54 @@
<div class="container">
<div class="nav">
<ul>
<li
v-for="(item, index) in items"
:key="index"
@click="selectItem(index)"
:class="{ active: index === activeIndex }"
>
<li v-for="(item, index) in items" :key="index" @click="selectItem(index)"
:class="{ active: index === activeIndex }">
{{ item }}
</li>
</ul>
</div>
<div class="setting">
<div v-if="1 === activeIndex">
<div
class="setting-item"
style="margin-top: 60px"
>
<div class="setting-item" style="margin-top: 60px">
<label>存储方式</label>
<el-select v-model="config.storeType">
<el-option
v-for="(item, key) in storeList"
:key="key"
:label="item.title"
:value="item.value"
/>
<el-option v-for="(item, key) in storeList" :key="key" :label="item.title"
:value="item.value" />
</el-select>
</div>
<template v-if="config.storeType === 'local'">
<div class="setting-item">
<label>存储地址</label>
<el-input
v-model="config.storePath"
@click="selectFile()"
placeholder="可为空,为空则取系统默认存储地址:/用户目录/.godoos/os"
/>
<el-input v-model="config.storePath" @click="selectFile()"
placeholder="可为空,为空则取系统默认存储地址:/用户目录/.godoos/os" />
</div>
<div class="setting-item">
<label>自定义端口</label>
<el-input
v-model="config.netPort"
placeholder="可为空,为空则取系统默认56780"
/>
<el-input v-model="config.netPort" placeholder="可为空,为空则取系统默认56780" />
</div>
<div class="setting-item">
<label>自定义路径</label>
<el-input
v-model="config.netPath"
placeholder="自定义web访问路径,英文,不要加斜杠,可为空"
/>
<el-input v-model="config.netPath" placeholder="自定义web访问路径,英文,不要加斜杠,可为空" />
</div>
</template>
<template v-if="config.storeType === 'net'">
<div class="setting-item">
<label>服务器地址</label>
<el-input
v-model="config.storenet.url"
placeholder="可访问的地址,例如http://192.168.1.6:56780 不要加斜杠"
/>
<el-input v-model="config.storenet.url" placeholder="可访问的地址,例如http://192.168.1.6:56780 不要加斜杠" />
</div>
<div class="setting-item">
<label>允许跨域</label>
<el-switch
v-model="config.storenet.isCors"
active-text="允许"
inactive-text="不允许"
style="
<el-switch v-model="config.storenet.isCors" active-text="允许" inactive-text="不允许" style="
--el-switch-on-color: #13ce66;
--el-switch-off-color: #ff4949;
"
active-value="1"
inactive-value=""
/>
" active-value="1" inactive-value="" />
</div>
</template>
<template v-if="config.storeType === 'webdav'">
<div class="setting-item">
<label>服务器地址</label>
<el-input
v-model="config.webdavClient.url"
placeholder="https://godoos.com/webdav 不要加斜杠"
/>
<el-input v-model="config.webdavClient.url" placeholder="https://godoos.com/webdav 不要加斜杠" />
</div>
<div class="setting-item">
<label>登陆用户名</label>
@ -90,46 +57,30 @@
</div>
<div class="setting-item">
<label>登陆密码</label>
<el-input
v-model="config.webdavClient.password"
type="password"
/>
<el-input v-model="config.webdavClient.password" type="password" />
</div>
</template>
<div class="setting-item">
<label></label>
<el-button
@click="submitOsInfo"
type="primary"
>
<el-button @click="submitOsInfo" type="primary">
{{ t("confirm") }}
</el-button>
</div>
</div>
<div v-if="2 === activeIndex">
<div
class="setting-item"
style="margin-top: 60px"
>
<div class="setting-item" style="margin-top: 60px">
<label>编辑器类型</label>
<el-select v-model="config.editorType">
<el-option
v-for="(item, key) in editorType"
:key="key"
:label="item.title"
:value="item.value"
/>
<el-option v-for="(item, key) in editorType" :key="key" :label="item.title"
:value="item.value" />
</el-select>
</div>
<template v-if="config.editorType === 'onlyoffice'">
<div class="setting-item">
<label>地址</label>
<el-input
v-model="config.onlyoffice.url"
placeholder="https://godoos.com/onlyoffice 不要加斜杠"
/>
<el-input v-model="config.onlyoffice.url" placeholder="https://godoos.com/onlyoffice 不要加斜杠" />
</div>
<!-- <div class="setting-item">
<label>私钥</label>
@ -138,10 +89,7 @@
</template>
<div class="setting-item">
<label></label>
<el-button
@click="submitEditInfo"
type="primary"
>
<el-button @click="submitEditInfo" type="primary">
{{ t("confirm") }}
</el-button>
</div>
@ -152,10 +100,7 @@
</div>
<div class="setting-item">
<label></label>
<el-button
@click="exportBackup"
type="primary"
>
<el-button @click="exportBackup" type="primary">
导出
</el-button>
</div>
@ -164,73 +109,42 @@
</div>
<div class="setting-item">
<label></label>
<el-button
@click="selectZipfile"
type="primary"
>
<el-button @click="selectZipfile" type="primary">
导入
</el-button>
<input
type="file"
accept=".zip"
style="display: none"
ref="zipFileInput"
/>
<input type="file" accept=".zip" style="display: none" ref="zipFileInput" />
</div>
</div>
<div v-if="0 === activeIndex">
<div
class="setting-item"
style="margin-top: 60px"
>
<div class="setting-item" style="margin-top: 60px">
<label>用户角色</label>
<el-select v-model="config.userType">
<el-option
v-for="(item, key) in userTypes"
:key="key"
:label="item.title"
:value="item.value"
/>
<el-option v-for="(item, key) in userTypes" :key="key" :label="item.title"
:value="item.value" />
</el-select>
</div>
<template v-if="config.userType === 'member'">
<div class="setting-item">
<label>服务器地址</label>
<el-input
v-model="config.userInfo.url"
placeholder="网址或域名,例子:https://godoos.com 不要加斜杠"
/>
<el-input v-model="config.userInfo.url" placeholder="网址或域名,例子:https://godoos.com 不要加斜杠" />
</div>
<div class="setting-item">
<label>用户名</label>
<el-input
v-model="config.userInfo.username"
placeholder="登录用户名"
/>
<el-input v-model="config.userInfo.username" placeholder="登录用户名" />
</div>
<div class="setting-item">
<label>密码</label>
<el-input
v-model="config.userInfo.password"
type="password"
placeholder="登录密码"
/>
<el-input v-model="config.userInfo.password" type="password" placeholder="登录密码" />
</div>
</template>
<div class="setting-item">
<label></label>
<el-button
@click="saveUserInfo"
type="primary"
>
<el-button @click="saveUserInfo" type="primary">
{{ t("confirm") }}
</el-button>
</div>
</div>
<div
v-if="4 === activeIndex"
class="setting-area"
>
<div v-if="4 === activeIndex" class="setting-area">
<SetFilePwd v-if="config.userType === 'person'"></SetFilePwd>
</div>
</div>
@ -238,20 +152,20 @@
</template>
<script lang="ts" setup>
import { Dialog, join, System, t } from "@/system";
import { getSystemConfig, setSystemConfig } from "@/system/config";
import { GetClientId } from "@/util/clientid.ts";
import { OpenDirDialog, RestartApp } from "@/util/goutil";
import { notifyError, notifySuccess } from "@/util/msg";
import FileSaver from "file-saver";
import JSZip from "jszip";
import { inject, ref } from "vue";
const config = ref(getSystemConfig());
const sys = inject<System>("system")!;
let zipFile: File | undefined = undefined;
const zipFileInput = ref();
const fileName: any = ref("");
const storeList = [
import { Dialog, join, System, t } from "@/system";
import { getSystemConfig, setSystemConfig } from "@/system/config";
import { GetClientId } from "@/util/clientid.ts";
import { OpenDirDialog, RestartApp } from "@/util/goutil";
import { notifyError, notifySuccess } from "@/util/msg";
import FileSaver from "file-saver";
import JSZip from "jszip";
import { inject, ref } from "vue";
const config = ref(getSystemConfig());
const sys = inject<System>("system")!;
let zipFile: File | undefined = undefined;
const zipFileInput = ref();
const fileName: any = ref("");
const storeList = [
// {
// title: "",
// value: "browser",
@ -268,16 +182,19 @@
// title: "webdav",
// value: "webdav",
// },
];
];
const items = [
const items = [
"用户角色",
"存储配置",
"编辑器类型",
"备份还原",
"文件密码箱",
];
const editorType = [
];
if (config.value.userType !== "person") {
items.pop()
}
const editorType = [
{
title: "系统默认",
value: "local",
@ -286,9 +203,9 @@
title: "OnlyOffice",
value: "onlyoffice",
},
];
const urlRegex = /^(https?:\/\/)/;
const userTypes = [
];
const urlRegex = /^(https?:\/\/)/;
const userTypes = [
{
title: "独立用户",
value: "person",
@ -297,19 +214,19 @@
title: "企业用户",
value: "member",
},
];
const activeIndex = ref(0);
];
const activeIndex = ref(0);
const selectItem = (index: number) => {
const selectItem = (index: number) => {
activeIndex.value = index;
};
function selectFile() {
};
function selectFile() {
OpenDirDialog().then((res: string) => {
config.value.storePath = res;
});
}
}
function submitOsInfo() {
function submitOsInfo() {
const saveData = toRaw(config.value);
if (saveData.storeType === "local") {
const postData = parseData(saveData);
@ -415,8 +332,8 @@
// }
// });
// }
}
function submitEditInfo() {
}
function submitEditInfo() {
const saveData = toRaw(config.value);
setSystemConfig(saveData);
Dialog.showMessageBox({
@ -424,8 +341,8 @@
type: "success",
});
return;
}
function parseData(saveData: any) {
}
function parseData(saveData: any) {
let postData = [];
if (saveData.storePath !== "") {
postData.push({ name: "osPath", value: saveData.storePath });
@ -449,8 +366,8 @@
});
}
return postData;
}
async function saveUserInfo() {
}
async function saveUserInfo() {
const saveData = toRaw(config.value);
console.log(saveData);
if (saveData.userType == "person") {
@ -516,8 +433,8 @@
notifyError("登录失败");
}
return;
}
async function exportBackup() {
}
async function exportBackup() {
const { setProgress } = Dialog.showProcessDialog({
message: `正在打包`,
});
@ -539,8 +456,8 @@
setProgress(100);
});
}
}
async function dfsPackage(path: string, zip: JSZip, setProgress: any) {
}
async function dfsPackage(path: string, zip: JSZip, setProgress: any) {
const dir = await sys.fs.readdir(path);
for (let i = 0; i < dir.length; i++) {
@ -561,8 +478,8 @@
}
}
}
}
function selectZipfile() {
}
function selectZipfile() {
zipFileInput.value.click();
zipFileInput.value.onchange = (e: any) => {
const tar: any = e.target as HTMLInputElement;
@ -575,8 +492,8 @@
fileName.value = "";
}
};
}
async function importBackup(path = "") {
}
async function importBackup(path = "") {
if (!zipFile) {
return;
}
@ -618,22 +535,22 @@
});
}, 100);
}
}
}
</script>
<style scoped>
@import "./setStyle.css";
@import "./setStyle.css";
.ctrl {
.ctrl {
width: 100px;
}
}
.setting-item {
.setting-item {
display: flex;
align-items: center;
}
}
.setting-area {
.setting-area {
width: 100%;
height: 90%;
}
}
</style>

28
frontend/src/components/setting/setStyle.css

@ -74,8 +74,34 @@
text-align: right;
}
@media screen and (max-width: 768px) {
.container {
flex-direction: column;
}
.nav {
width: 25%;
background-color: #f9f9f9;
width: 100%;
}
.nav ul {
display: flex;
justify-content: space-evenly;
}
.nav li {
flex: 1;
padding: 10px 0;
text-align: center;
}
.nav li.active {
background-color: #fff;
}
.nav li.active:hover {
background-color: #fff;
}
.nav li.active::after {
background-color: #80bbe9;
}
.setting {
margin-top: 20px;
box-sizing: border-box;
}
.setting-item:first-child {
margin-top: 0px !important;

Loading…
Cancel
Save