-
Notifications
You must be signed in to change notification settings - Fork 6
/
FnBoxModal.vue
107 lines (105 loc) · 3.64 KB
/
FnBoxModal.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<template>
<Drawer
:open="true"
placement="right"
title="内置工具箱"
:width="500"
:footer="null"
:getContainer="false"
:zIndex="2147483647"
@close="emits('handleChangeFnModalVisible', false)"
:style="{ position: 'absolute' }"
rootClassName="fnbox_modal"
>
<Collapse v-model:active-key="activeKey" accordion>
<CollapsePanel collapsible="header" :showArrow="false">
<template #header>
<div
style="width: 100%; display: flex; align-items: center; justify-content: space-between"
>
<div style="display: flex; align-items: center">
<CameraOutlined style="font-size: 24px"></CameraOutlined>
<span style="margin-left: 10px">截取全屏幕</span>
</div>
<div>
<Button type="link" @click="(e) => addBuiltInEvent(e, 'snapshotFullScreen')">
添加
</Button>
</div>
</div>
</template>
<div>截取整个网页的截图,包括网页主体滚动条可以滚动的地方。</div>
</CollapsePanel>
<CollapsePanel collapsible="header" :showArrow="false">
<template #header>
<div
style="width: 100%; display: flex; align-items: center; justify-content: space-between"
>
<div style="display: flex; align-items: center">
<CameraOutlined style="font-size: 24px"></CameraOutlined>
<span style="margin-left: 10px">截取当前屏幕</span>
</div>
<div>
<Button type="link" @click="(e) => addBuiltInEvent(e, 'snapshotCurrentScreen')">
添加
</Button>
</div>
</div>
</template>
<div>截取当前网页可视区的截图,及当前可以看到的地方,不包括滚动条。</div>
</CollapsePanel>
<CollapsePanel collapsible="header" :showArrow="false">
<template #header>
<div
style="width: 100%; display: flex; align-items: center; justify-content: space-between"
>
<div style="display: flex; align-items: center">
<CameraOutlined style="font-size: 24px"></CameraOutlined>
<span style="margin-left: 10px">添 加 等 待</span>
</div>
<div>
<Button type="link" @click="(e) => addBuiltInEvent(e, 'delay')">添加</Button>
</div>
</div>
</template>
<div>添加等待时长,一般用于执行某个操作后需要等待的情况。</div>
</CollapsePanel>
</Collapse>
</Drawer>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { Button, Drawer, Space, Collapse, CollapsePanel } from 'ant-design-vue';
import { CameraOutlined, ClockCircleOutlined } from '@ant-design/icons-vue';
const emits = defineEmits(['addUserDoData', 'handleChangeFnModalVisible']);
const activeKey = ref();
// 添加内置功能
const addBuiltInEvent = (e: any, name: string, data?: object) => {
e.stopPropagation();
if (name === 'snapshotFullScreen') {
emits('addUserDoData', {
type: 'snapshotFullScreen',
label: '',
slot: true,
data: {},
});
} else if (name === 'delay') {
emits('addUserDoData', {
type: 'delay',
slot: true,
delay: 1000,
});
} else if (name === 'snapshotCurrentScreen') {
emits('addUserDoData', {
type: 'snapshotCurrentScreen',
label: '',
slot: true,
data: {
scrollTop: document.documentElement.scrollTop,
width: window.innerWidth,
height: window.innerHeight,
},
});
}
};
</script>