1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 16:29:17 +08:00

style: 文件页面 样式修改

This commit is contained in:
zhengkunwang223 2023-02-06 15:00:15 +08:00 committed by zhengkunwang223
parent bcff85a348
commit 4b06621274
10 changed files with 48 additions and 19 deletions

View File

@ -3,18 +3,19 @@ package viper
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/1Panel-dev/1Panel/backend/utils/cmd"
"strings" "strings"
"github.com/1Panel-dev/1Panel/backend/configs" "github.com/1Panel-dev/1Panel/backend/configs"
"github.com/1Panel-dev/1Panel/backend/global" "github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/backend/utils/cmd"
"github.com/1Panel-dev/1Panel/cmd/server/conf" "github.com/1Panel-dev/1Panel/cmd/server/conf"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
"github.com/spf13/viper" "github.com/spf13/viper"
) )
func Init() { func Init() {
stdout, err := cmd.Exec("grep '^BASE_DIR=' /usr/bin/1pctl | cut -d'=' -f2") //stdout, err := cmd.Exec("grep '^BASE_DIR=' /usr/bin/1pctl | cut -d'=' -f2")
stdout, err := cmd.Exec("grep '^BASE_DIR=' /Users/wangzhengkun/Downloads/1pctl | cut -d'=' -f2")
if err != nil { if err != nil {
panic(err) panic(err)
} }

View File

@ -1,12 +1,14 @@
<template> <template>
<el-drawer <el-drawer
v-model="open" v-model="open"
:title="title"
:destroy-on-close="true" :destroy-on-close="true"
:close-on-click-modal="false" :close-on-click-modal="false"
:before-close="handleClose" :before-close="handleClose"
size="50%" size="50%"
> >
<template #header>
<DrawerHeader :header="title" :back="handleClose" />
</template>
<el-row> <el-row>
<el-col :span="22" :offset="1"> <el-col :span="22" :offset="1">
<el-form <el-form
@ -56,6 +58,7 @@ import { Rules } from '@/global/form-rules';
import { CompressExtention, CompressType } from '@/enums/files'; import { CompressExtention, CompressType } from '@/enums/files';
import { CompressFile } from '@/api/modules/files'; import { CompressFile } from '@/api/modules/files';
import FileList from '@/components/file-list/index.vue'; import FileList from '@/components/file-list/index.vue';
import DrawerHeader from '@/components/drawer-header/index.vue';
interface CompressProps { interface CompressProps {
files: Array<any>; files: Array<any>;

View File

@ -1,12 +1,14 @@
<template> <template>
<el-drawer <el-drawer
v-model="open" v-model="open"
:title="$t('file.deCompress')"
:destroy-on-close="true" :destroy-on-close="true"
:close-on-click-modal="false" :close-on-click-modal="false"
:before-close="handleClose" :before-close="handleClose"
size="30%" size="30%"
> >
<template #header>
<DrawerHeader :header="$t('file.deCompress')" :back="handleClose" />
</template>
<el-form <el-form
ref="fileForm" ref="fileForm"
label-position="left" label-position="left"
@ -42,6 +44,7 @@ import { Rules } from '@/global/form-rules';
import { DeCompressFile } from '@/api/modules/files'; import { DeCompressFile } from '@/api/modules/files';
import { Mimetypes } from '@/global/mimetype'; import { Mimetypes } from '@/global/mimetype';
import FileList from '@/components/file-list/index.vue'; import FileList from '@/components/file-list/index.vue';
import DrawerHeader from '@/components/drawer-header/index.vue';
interface CompressProps { interface CompressProps {
files: Array<any>; files: Array<any>;

View File

@ -1,12 +1,17 @@
<template> <template>
<el-drawer v-model="open" :title="$t('file.info')" :column="1" width="30%"> <el-drawer v-model="open" width="30%">
<template #header>
<DrawerHeader :header="$t('file.info')" :back="handleClose" />
</template>
<el-row> <el-row>
<el-col> <el-col>
<el-descriptions :column="1" border> <el-descriptions :column="1" border>
<el-descriptions-item :label="$t('file.fileName')">{{ data.name }}</el-descriptions-item> <el-descriptions-item :label="$t('file.fileName')">{{ data.name }}</el-descriptions-item>
<!-- <el-descriptions-item :label="$t('file.type')">{{ data.type }}</el-descriptions-item> --> <!-- <el-descriptions-item :label="$t('file.type')">{{ data.type }}</el-descriptions-item> -->
<el-descriptions-item :label="$t('file.path')">{{ data.path }}</el-descriptions-item> <el-descriptions-item :label="$t('file.path')">{{ data.path }}</el-descriptions-item>
<el-descriptions-item :label="$t('file.size')">{{ computeSize(data.size) }}</el-descriptions-item> <el-descriptions-item :label="$t('file.size')">
{{ computeSize(data.size) }}
</el-descriptions-item>
<el-descriptions-item :label="$t('file.role')">{{ data.mode }}</el-descriptions-item> <el-descriptions-item :label="$t('file.role')">{{ data.mode }}</el-descriptions-item>
<el-descriptions-item :label="$t('file.user')">{{ data.user }}</el-descriptions-item> <el-descriptions-item :label="$t('file.user')">{{ data.user }}</el-descriptions-item>
<el-descriptions-item :label="$t('file.group')">{{ data.group }}</el-descriptions-item> <el-descriptions-item :label="$t('file.group')">{{ data.group }}</el-descriptions-item>
@ -24,6 +29,7 @@ import { GetFileContent } from '@/api/modules/files';
import { computeSize } from '@/utils/util'; import { computeSize } from '@/utils/util';
import { ref } from 'vue'; import { ref } from 'vue';
import { dateFormatSimple } from '@/utils/util'; import { dateFormatSimple } from '@/utils/util';
import DrawerHeader from '@/components/drawer-header/index.vue';
interface InfoProps { interface InfoProps {
path: string; path: string;
@ -35,6 +41,10 @@ const props = ref<InfoProps>({
let open = ref(false); let open = ref(false);
let data = ref(); let data = ref();
const handleClose = () => {
open.value = false;
};
const acceptParams = async (params: InfoProps): Promise<void> => { const acceptParams = async (params: InfoProps): Promise<void> => {
props.value = params; props.value = params;
GetFileContent({ path: params.path, expand: false, page: 1, pageSize: 1 }).then((res) => { GetFileContent({ path: params.path, expand: false, page: 1, pageSize: 1 }).then((res) => {

View File

@ -7,6 +7,9 @@
:before-close="handleClose" :before-close="handleClose"
size="30%" size="30%"
> >
<template #header>
<DrawerHeader :header="$t('file.download')" :back="handleClose" />
</template>
<el-row> <el-row>
<el-col :span="11" :offset="1"> <el-col :span="11" :offset="1">
<el-form <el-form
@ -46,6 +49,7 @@ import { computed, reactive, ref } from 'vue';
import { DownloadFile } from '@/api/modules/files'; import { DownloadFile } from '@/api/modules/files';
import { File } from '@/api/interface/file'; import { File } from '@/api/interface/file';
import { Rules } from '@/global/form-rules'; import { Rules } from '@/global/form-rules';
import DrawerHeader from '@/components/drawer-header/index.vue';
interface DownloadProps { interface DownloadProps {
paths: Array<string>; paths: Array<string>;

View File

@ -375,7 +375,7 @@ const openWget = () => {
wgetRef.value.acceptParams(fileWget); wgetRef.value.acceptParams(fileWget);
}; };
const closeWget = (submit: any) => { const closeWget = (submit: Boolean) => {
search(); search();
if (submit) { if (submit) {
openProcess(); openProcess();

View File

@ -1,12 +1,14 @@
<template> <template>
<el-drawer <el-drawer
v-model="open" v-model="open"
:title="title"
:destroy-on-close="true" :destroy-on-close="true"
:close-on-click-modal="false" :close-on-click-modal="false"
:before-close="handleClose" :before-close="handleClose"
size="30%" size="30%"
> >
<template #header>
<DrawerHeader :header="title" :back="handleClose" />
</template>
<el-form <el-form
ref="fileForm" ref="fileForm"
label-position="left" label-position="left"
@ -39,6 +41,7 @@ import i18n from '@/lang';
import { ElMessage, FormInstance, FormRules } from 'element-plus'; import { ElMessage, FormInstance, FormRules } from 'element-plus';
import { ref, reactive, computed } from 'vue'; import { ref, reactive, computed } from 'vue';
import FileList from '@/components/file-list/index.vue'; import FileList from '@/components/file-list/index.vue';
import DrawerHeader from '@/components/drawer-header/index.vue';
interface MoveProps { interface MoveProps {
oldPaths: Array<string>; oldPaths: Array<string>;

View File

@ -1,11 +1,8 @@
<template> <template>
<el-dialog <el-dialog width="30%" v-model="open" @open="onOpen" :before-close="handleClose">
width="30%" <template #header>
:title="$t('file.downloadProcess')" <DrawerHeader :header="$t('file.downloadProcess')" :back="handleClose" />
v-model="open" </template>
@open="onOpen"
:before-close="handleClose"
>
<div v-for="(value, index) in res" :key="index"> <div v-for="(value, index) in res" :key="index">
<span>{{ $t('file.downloading') }} {{ value['name'] }}</span> <span>{{ $t('file.downloading') }} {{ value['name'] }}</span>
<el-progress :text-inside="true" :stroke-width="15" :percentage="value['percent']"></el-progress> <el-progress :text-inside="true" :stroke-width="15" :percentage="value['percent']"></el-progress>
@ -18,6 +15,7 @@
import { FileKeys } from '@/api/modules/files'; import { FileKeys } from '@/api/modules/files';
import { computeSize } from '@/utils/util'; import { computeSize } from '@/utils/util';
import { onBeforeUnmount, ref, toRefs } from 'vue'; import { onBeforeUnmount, ref, toRefs } from 'vue';
import DrawerHeader from '@/components/drawer-header/index.vue';
const props = defineProps({ const props = defineProps({
open: { open: {

View File

@ -1,5 +1,8 @@
<template> <template>
<el-drawer v-model="open" :title="$t('file.upload')" :before-close="handleClose" size="40%" :file-list="files"> <el-drawer v-model="open" :before-close="handleClose" size="40%">
<template #header>
<DrawerHeader :header="$t('file.upload')" :back="handleClose" />
</template>
<el-upload <el-upload
action="#" action="#"
:auto-upload="false" :auto-upload="false"
@ -29,13 +32,13 @@ import { ref } from 'vue';
import { ElMessage, UploadFile, UploadFiles, UploadInstance } from 'element-plus'; import { ElMessage, UploadFile, UploadFiles, UploadInstance } from 'element-plus';
import { UploadFileData } from '@/api/modules/files'; import { UploadFileData } from '@/api/modules/files';
import i18n from '@/lang'; import i18n from '@/lang';
import DrawerHeader from '@/components/drawer-header/index.vue';
interface UploadProps { interface UploadProps {
path: string; path: string;
} }
const uploadRef = ref<UploadInstance>(); const uploadRef = ref<UploadInstance>();
const files = ref();
const loading = ref(false); const loading = ref(false);
let uploadPrecent = ref(0); let uploadPrecent = ref(0);
let open = ref(false); let open = ref(false);

View File

@ -1,5 +1,8 @@
<template> <template>
<el-drawer v-model="open" :before-close="handleClose" :title="$t('file.download')" size="50%"> <el-drawer v-model="open" :before-close="handleClose" size="50%">
<template #header>
<DrawerHeader :header="$t('file.download')" :back="handleClose" />
</template>
<el-row> <el-row>
<el-col :span="22" :offset="1"> <el-col :span="22" :offset="1">
<el-form <el-form
@ -42,6 +45,7 @@ import i18n from '@/lang';
import { ElMessage, FormInstance, FormRules } from 'element-plus'; import { ElMessage, FormInstance, FormRules } from 'element-plus';
import { reactive, ref } from 'vue'; import { reactive, ref } from 'vue';
import FileList from '@/components/file-list/index.vue'; import FileList from '@/components/file-list/index.vue';
import DrawerHeader from '@/components/drawer-header/index.vue';
interface WgetProps { interface WgetProps {
path: string; path: string;
@ -71,7 +75,7 @@ const handleClose = () => {
fileForm.value.resetFields(); fileForm.value.resetFields();
} }
open.value = false; open.value = false;
em('close', submitData); em('close', submitData.value);
}; };
const getPath = (path: string) => { const getPath = (path: string) => {