Skip to content

Commit 6c1461b

Browse files
committed
feat: 添加文件快照入口
1 parent 834c291 commit 6c1461b

4 files changed

Lines changed: 49 additions & 0 deletions

File tree

frontend/src/App.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
<DialogLike />
88
<DialogOpen />
9+
<DialogCamera />
910
</template>
1011
</template>
1112

@@ -17,6 +18,7 @@ import ViewLeft from '@/layout/ViewLeft/LeftBox.vue'
1718
import ViewRight from '@/layout/ViewRight/RightBox.vue'
1819
import DialogLike from '@/layout/DialogLike.vue'
1920
import DialogOpen from '@/layout/DialogOpen.vue'
21+
import DialogCamera from '@/layout/DialogCamera.vue'
2022
2123
import { useUserStore } from '@/store/user'
2224

frontend/src/components/MonacoEditor.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414
</div>
1515

1616
<div class="footer">
17+
<el-tooltip content="文件快照" placement="bottom">
18+
<el-icon class="icon" @click="camera.open(code.path)"><Camera /></el-icon>
19+
</el-tooltip>
20+
1721
<div class="info" v-if="code.date">修改时间:{{ code.date.format('YYYY/MM/DD HH:mm:ss') }}</div>
22+
1823
<div class="info" v-if="code.byte !== undefined">文件大小:{{ getSize(code.byte) }}</div>
1924

2025
<div style="flex: 1"></div>
@@ -36,11 +41,13 @@
3641
<script setup lang="ts">
3742
import { computed, onMounted, ref, watch } from 'vue'
3843
import MonacoEditor from 'monaco-editor-vue3'
44+
import { Camera } from '@element-plus/icons-vue'
3945
import * as iconv from 'iconv-lite'
4046
4147
import MdView from '@/components/MdView.vue'
4248
4349
import { useUserStore } from '@/store/user'
50+
import { useCameraStore } from '@/store/camera2'
4451
4552
import { LANG_OPTIONS, ENCODING_OPTIONS } from '@/utils/option'
4653
import { getSize } from '@/utils/file'
@@ -52,6 +59,7 @@ const $props = defineProps<{ path: string }>()
5259
const $emit = defineEmits<{ diff: [v: boolean]; error: [v?: string] }>()
5360
5461
const user = useUserStore()
62+
const camera = useCameraStore()
5563
5664
const mdView = ref(user.cfg.fileMdView)
5765
@@ -112,6 +120,11 @@ onMounted(() => {
112120
margin: 0;
113121
}
114122
123+
> .icon {
124+
color: var(--el-text-color-regular);
125+
cursor: pointer;
126+
}
127+
115128
> .info {
116129
font-size: 12px;
117130
line-height: 32px;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<el-dialog v-model="camera.show" :title="`文件快照:${camera.path}`" width="600">
3+
<div class="camera-dialog">
4+
<div>111</div>
5+
</div>
6+
</el-dialog>
7+
</template>
8+
9+
<script lang="ts" setup>
10+
import { useCameraStore } from '@/store/camera2'
11+
12+
const camera = useCameraStore()
13+
</script>
14+
15+
<style lang="scss" scoped></style>

frontend/src/store/camera2.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { ref } from 'vue'
2+
import { defineStore } from 'pinia'
3+
4+
export const useCameraStore = defineStore('camera', () => {
5+
const show = ref(false)
6+
7+
const path = ref('')
8+
9+
return {
10+
show,
11+
12+
path,
13+
14+
open: (v: string) => {
15+
show.value = true
16+
path.value = v
17+
},
18+
}
19+
})

0 commit comments

Comments
 (0)