Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
imzlh committed Nov 9, 2024
1 parent 4f27f51 commit c68e011
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 12 deletions.
Empty file removed .gitmodules
Empty file.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@imzlh/vlist",
"version": "5.8.1",
"version": "5.8.2",
"displayName": "vList",
"description": "一个全能的现代化的文件管理UI,使用vue3",
"license": "MIT",
Expand Down
Binary file removed public/font/GenJyuuGothic-Regular.woff2
Binary file not shown.
5 changes: 5 additions & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ interface FileAndDir {
*/
ctime: number,

/**
* 修改时间
*/
mtime: number,

/**
* 文件(夹)直链
*/
Expand Down
2 changes: 1 addition & 1 deletion src/module/message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<div class="body" :data-level="item.type">
<div>
<h3>{{ item.content.title }}</h3>
<span>{{ item.content.content }}</span>
<span v-html="item.content.content" />
</div>
</div>
</template>
Expand Down
7 changes: 1 addition & 6 deletions src/opener/txtreader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,6 @@
</template>

<style lang="scss" >
@font-face {
font-family: 'GenJyuuGothic';
src: url('/font/GenJyuuGothic-Regular.woff2') format('woff2');
}
.txt-wrapper {
position: relative;
height: 100%;
Expand All @@ -293,7 +288,7 @@
word-wrap: break-word;
line-height: 1.5;
color: #333;
font-family: 'GenJyuuGothic', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
padding: 1rem;
box-sizing: border-box;
Expand Down
15 changes: 11 additions & 4 deletions src/utils/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class APIError extends Error{
export const TREE = reactive<vDir>({
"type": "dir",
"ctime": 0,
"mtime": -1,
"name": "/",
"dispName": "此服务器",
"url": FILE_PROXY_SERVER,
Expand All @@ -54,6 +55,7 @@ export const TREE = reactive<vDir>({
"url": "",
"type": "dir",
"ctime": -1,
"mtime": -1,
"icon": "",
"parent": null,
"active": new Map()
Expand Down Expand Up @@ -371,6 +373,8 @@ namespace Tree{
obj.parent = parent;
obj.type == 'dir' && (obj.active = new Map());
obj.icon = getIcon(obj.name, obj.type == 'file');
obj.ctime || (obj.ctime = obj.mtime || Date.now());
obj.mtime || (obj.mtime = Date.now());
return isReactive(obj) ? obj : reactive(obj);
}

Expand Down Expand Up @@ -412,8 +416,9 @@ namespace Tree{
* @param parent 父节点
* @returns 文件或文件夹信息
*/
function stat(path: string, parent: vDir): Promise<vFile | vDir> {
return request('stat', { path }).then(res => compileObject(res, parent));
async function stat(path: string, parent: vDir): Promise<vFile | vDir> {
const res = await request('stat', { path });
return compileObject(res, parent);
}

/**
Expand All @@ -432,7 +437,8 @@ namespace Tree{
url = path ? FILE_PROXY_SERVER + encodePath(path) : '';
if(preset.type == 'dir'){
var node: FileOrDir = reactive<vDir>({
ctime: 0,
ctime: Date.now(),
mtime: Date.now(),
type: 'dir',
name: '',
parent: null,
Expand All @@ -444,7 +450,8 @@ namespace Tree{
}else if(preset.type == 'file'){
var node: FileOrDir = reactive<vFile>({
type: 'file',
ctime: 0,
ctime: Date.now(),
mtime: Date.now(),
name: '',
parent: null,
icon: preset.name ? getIcon(preset.name, true) : '',
Expand Down
5 changes: 5 additions & 0 deletions utils/vlist.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ interface FileAndDir {
* 显示的名称
*/
dispName?:string,

/**
* 修改时间
*/
mtime: number,

/**
* 创建时间
Expand Down

0 comments on commit c68e011

Please sign in to comment.