Skip to content

Commit a2ee25e

Browse files
committed
chore: 移除/更换部分三方插件示例
1 parent bf27f7f commit a2ee25e

8 files changed

Lines changed: 266 additions & 3138 deletions

File tree

apps/example/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
"lint": "vue-tsc -b"
1414
},
1515
"dependencies": {
16-
"@antv/g2plot": "catalog:",
17-
"@bytemd/plugin-gfm": "catalog:",
18-
"@bytemd/vue-next": "catalog:",
1916
"@fantastic-admin/components": "workspace:*",
2017
"@fantastic-admin/composables": "workspace:*",
2118
"@fantastic-admin/settings": "workspace:*",
@@ -28,7 +25,6 @@
2825
"@zumer/snapdom": "catalog:",
2926
"animate.css": "catalog:",
3027
"axios": "catalog:",
31-
"bytemd": "catalog:",
3228
"class-variance-authority": "catalog:",
3329
"clsx": "catalog:",
3430
"cropperjs": "catalog:",
@@ -49,6 +45,7 @@
4945
"qs": "catalog:",
5046
"reka-ui": "catalog:",
5147
"scule": "catalog:",
48+
"sign-canvas": "catalog:",
5249
"splitpanes": "catalog:",
5350
"swiper": "catalog:",
5451
"tailwind-merge": "catalog:",
@@ -60,7 +57,6 @@
6057
"vue": "catalog:",
6158
"vue-currency-input": "catalog:",
6259
"vue-data-ui": "catalog:",
63-
"vue-esign": "catalog:",
6460
"vue-hooks-plus": "catalog:",
6561
"vue-router": "catalog:",
6662
"vxe-pc-ui": "catalog:",

apps/example/src/router/modules/plugin.example.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,6 @@ const routes: RouteRecordRaw = {
8282
title: 'VChart',
8383
},
8484
},
85-
{
86-
path: 'g2plot',
87-
name: 'pluginExampleChartG2plot',
88-
component: () => import('@/views/plugin_example/g2plot.vue'),
89-
meta: {
90-
title: 'G2plot',
91-
},
92-
},
9385
{
9486
path: 'vue-data-ui',
9587
name: 'pluginExampleChartVueDataUi',
@@ -109,15 +101,6 @@ const routes: RouteRecordRaw = {
109101
icon: 'i-file-icons:tinymce',
110102
},
111103
},
112-
{
113-
path: 'markdown',
114-
name: 'pluginExampleMarkdown',
115-
component: () => import('@/views/plugin_example/markdown.vue'),
116-
meta: {
117-
title: 'Bytemd',
118-
icon: 'i-teenyicons:markdown-outline',
119-
},
120-
},
121104
{
122105
path: 'currencyinput',
123106
name: 'pluginExampleCurrencyInput',

apps/example/src/types/shims.d.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,3 @@ declare const __SYSTEM_INFO__: {
1515
declare module 'virtual:fantastic-admin/turbo-console' {
1616
export function warnKeepAliveComponentNameMissing(filePath: string): void
1717
}
18-
19-
declare module 'vue-esign'
20-
declare module '@bytemd/plugin-gfm/lib/locales/zh_Hans.json'

apps/example/src/views/plugin_example/esign.vue

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,41 @@
11
<script setup lang="ts">
2-
import VueEsign from 'vue-esign'
2+
import type { SignCanvasExpose, SignCanvasOptions } from 'sign-canvas'
3+
import SignCanvas from 'sign-canvas'
34
import Alert from './components/alert.vue'
45
import Command from './components/command.vue'
56
6-
const esignRef = useTemplateRef<any>('esignRef')
7-
const options = ref({
8-
lineWidth: 6,
9-
lineColor: '#000000',
7+
const signCanvasRef = useTemplateRef<SignCanvasExpose>('signCanvasRef')
8+
const signature = shallowRef<string | null>(null)
9+
const result = shallowRef<string | null>(null)
10+
const options = reactive<SignCanvasOptions>({
11+
canvasWidth: 600,
12+
canvasHeight: 360,
13+
isDpr: true,
14+
isSign: true,
15+
writeColor: '#101010',
1016
bgColor: '#f0f0f0',
11-
isCrop: false,
17+
isShowBorder: false,
18+
imgType: 'png',
1219
})
13-
const result = ref('')
1420
1521
function handleReset() {
16-
esignRef.value.reset()
17-
nextTick(() => {
18-
options.value.bgColor = '#f0f0f0'
19-
})
22+
signCanvasRef.value?.clear()
23+
signature.value = null
24+
result.value = null
2025
}
2126
function handleGenerate() {
22-
esignRef.value.generate().then((res: string) => {
23-
result.value = res
24-
}).catch(() => {
27+
const image = signCanvasRef.value?.toDataURL()
28+
if (!image) {
2529
useFaToast().warning('画板为空,无法生成图片')
26-
})
30+
return
31+
}
32+
result.value = image
2733
}
2834
function handleDownload() {
29-
esignRef.value.generate().then((res: string) => {
30-
const image = new Image()
31-
image.setAttribute('crossOrigin', 'anonymous')
32-
image.onload = () => {
33-
const a = document.createElement('a')
34-
const event = new MouseEvent('click')
35-
a.download = Date.parse(new Date().toString()).toString()
36-
a.href = image.src
37-
a.dispatchEvent(event)
38-
}
39-
image.src = res
40-
})
35+
const image = signCanvasRef.value?.downloadSignImg(Date.now().toString())
36+
if (!image) {
37+
useFaToast().warning('画板为空,无法下载图片')
38+
}
4139
}
4240
4341
function open(url: string) {
@@ -50,15 +48,15 @@ function open(url: string) {
5048
<Alert />
5149
<FaPageHeader title="电子签名">
5250
<template #description>
53-
<Command text="pnpm add vue-esign" />
51+
<Command text="pnpm add sign-canvas" />
5452
</template>
55-
<FaButton variant="outline" size="icon" @click="open('https://github.com/JaimeCheng/vue-esign')">
53+
<FaButton variant="outline" size="icon" @click="open('https://github.com/langyuxiansheng/vue-sign-canvas')">
5654
<FaIcon name="i-simple-icons:github" />
5755
</FaButton>
5856
</FaPageHeader>
5957
<FaPageMain>
6058
<div class="space-y-2">
61-
<VueEsign ref="esignRef" v-model:bg-color="options.bgColor" :width="500" :height="300" :is-crop="options.isCrop" :line-width="options.lineWidth" :line-color="options.lineColor" />
59+
<SignCanvas ref="signCanvasRef" v-model="signature" :options="options" />
6260
<div class="space-x-2">
6361
<FaButton @click="handleReset">
6462
清空画板
@@ -70,7 +68,7 @@ function open(url: string) {
7068
下载图片
7169
</FaButton>
7270
</div>
73-
<img v-if="result" :src="result" :width="500" :height="300">
71+
<img v-if="result" :src="result" :width="600" :height="360">
7472
</div>
7573
</FaPageMain>
7674
</div>

apps/example/src/views/plugin_example/g2plot.vue

Lines changed: 0 additions & 175 deletions
This file was deleted.

0 commit comments

Comments
 (0)