-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: windows activate component
- Loading branch information
Showing
6 changed files
with
239 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
[ | ||
{ | ||
"version": "Windows 11", | ||
"edition": [ | ||
["W269N-WFGWX-YVC9B-4J6C9-T83GX", "Windows 11 Pro"], | ||
["MH37W-N47XK-V7XM9-C7227-GCQG9", "Windows 11 Pro N"], | ||
["NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J", "Windows 11 Pro for Workstations"], | ||
["9FNHH-K3HBT-3W4TD-6383H-6XYWF", "Windows 11 Pro for Workstations N"], | ||
["6TP4R-GNPTD-KYYHQ-7B7DP-J447Y", "Windows 11 Pro Education"], | ||
["YVWGF-BXNMC-HTQYQ-CPQ99-66QFC", "Windows 11 Pro Education N"], | ||
["NW6C2-QMPVW-D7KKK-3GKT6-VCFB2", "Windows 11 Education"], | ||
["2WH4N-8QGBV-H22JP-CT43Q-MDWWJ", "Windows 11 Education N"], | ||
["NPPR9-FWDCX-D2C8J-H872K-2YT43", "Windows 11 Enterprise"], | ||
["DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4", "Windows 11 Enterprise N"], | ||
["YYVX9-NTFWV-6MDM3-9PT4T-4M68B", "Windows 11 Enterprise G"], | ||
["44RPN-FTY23-9VTTB-MP9BX-T84FV", "Windows 11 Enterprise G N"] | ||
] | ||
}, | ||
{ | ||
"version": "Windows 10", | ||
"edition": [ | ||
["W269N-WFGWX-YVC9B-4J6C9-T83GX", "Windows 10 Pro"], | ||
["MH37W-N47XK-V7XM9-C7227-GCQG9", "Windows 10 Pro N"], | ||
["NRG8B-VKK3Q-CXVCJ-9G2XF-6Q84J", "Windows 10 Pro for Workstations"], | ||
["9FNHH-K3HBT-3W4TD-6383H-6XYWF", "Windows 10 Pro for Workstations N"], | ||
["6TP4R-GNPTD-KYYHQ-7B7DP-J447Y", "Windows 10 Pro Education"], | ||
["YVWGF-BXNMC-HTQYQ-CPQ99-66QFC", "Windows 10 Pro Education N"], | ||
["NW6C2-QMPVW-D7KKK-3GKT6-VCFB2", "Windows 10 Education"], | ||
["2WH4N-8QGBV-H22JP-CT43Q-MDWWJ", "Windows 10 Education N"], | ||
["NPPR9-FWDCX-D2C8J-H872K-2YT43", "Windows 10 Enterprise"], | ||
["DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4", "Windows 10 Enterprise N"], | ||
["YYVX9-NTFWV-6MDM3-9PT4T-4M68B", "Windows 10 Enterprise G"], | ||
["44RPN-FTY23-9VTTB-MP9BX-T84FV", "Windows 10 Enterprise G N"] | ||
] | ||
}, | ||
{ | ||
"version": "Windows 10 LTSC 2021", | ||
"edition": [ | ||
["M7XTQ-FN8P6-TTKYV-9D4CC-J462D", "Windows 10 Enterprise LTSC 2021"], | ||
["92NFX-8DJQP-P6BBQ-THF9C-7CG2H", "Windows 10 Enterprise N LTSC 2021"] | ||
] | ||
}, | ||
{ | ||
"version": "Windows 10 LTSC 2019", | ||
"edition": [ | ||
["M7XTQ-FN8P6-TTKYV-9D4CC-J462D", "Windows 10 Enterprise LTSC 2019"], | ||
["92NFX-8DJQP-P6BBQ-THF9C-7CG2H", "Windows 10 Enterprise N LTSC 2019"] | ||
] | ||
}, | ||
{ | ||
"version": "Windows 10 LTSB 2016", | ||
"edition": [ | ||
["DCPHK-NFMTC-H88MJ-PFHPY-QJ4BJ", "Windows 10 Enterprise LTSB 2016"], | ||
["QFFDN-GRT3P-VKWWX-X7T3R-8B639", "Windows 10 Enterprise N LTSB 2016"] | ||
] | ||
}, | ||
{ | ||
"version": "Windows 10 LTSB 2015", | ||
"edition": [ | ||
["WNMTR-4C88C-JK8YV-HQ7T2-76DF9", "Windows 10 Enterprise 2015 LTSB"], | ||
["2F77B-TNFGY-69QQF-B8YKP-D69TJ", "Windows 10 Enterprise 2015 LTSB N"] | ||
] | ||
}, | ||
{ | ||
"version": "Windows 8.1", | ||
"edition": [ | ||
["GCRJD-8NW9H-F2CDX-CCM8D-9D6T9", "Windows 8.1 Pro"], | ||
["HMCNV-VVBFX-7HMBH-CTY9B-B4FXY", "Windows 8.1 Pro N"], | ||
["MHF9N-XY6XB-WVXMC-BTDCT-MKKG7", "Windows 8.1 Enterprise"], | ||
["TT4HM-HN7YT-62K67-RGRQJ-JFFXW", "Windows 8.1 Enterprise N"] | ||
] | ||
}, | ||
{ | ||
"version": "Windows 8", | ||
"edition": [ | ||
["NG4HW-VH26C-733KW-K6F98-J8CK4", "Windows 8 Pro"], | ||
["XCVCF-2NXM9-723PB-MHCB7-2RYQQ", "Windows 8 Pro N"], | ||
["32JNW-9KQ84-P47T8-D8GGY-CWCK7", "Windows 8 Enterprise"], | ||
["JMNMF-RHW7P-DMY6X-RF3DR-X2BQT", "Windows 8 Enterprise N"] | ||
] | ||
}, | ||
{ | ||
"version": "Windows 7", | ||
"edition": [ | ||
["FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4", "Windows 7 Professional"], | ||
["MRPKT-YTG23-K7D7T-X2JMM-QY7MG", "Windows 7 Professional N"], | ||
["W82YF-2Q76Y-63HXB-FGJG9-GF7QX", "Windows 7 Professional E"], | ||
["33PXH-7Y6KF-2VJC9-XBBR8-HVTHH", "Windows 7 Enterprise"], | ||
["YDRBP-3D83W-TY26F-D46B2-XCKRJ", "Windows 7 Enterprise N"], | ||
["C29WB-22CC8-VJ326-GHFJW-H9DH4", "Windows 7 Enterprise E"] | ||
] | ||
}, | ||
{ | ||
"version": "Windows Vista", | ||
"edition": [ | ||
["YFKBB-PQJJV-G996G-VWGXY-2V3X8", "Windows Vista Business"], | ||
["HMBQG-8H2RH-C77VX-27R82-VMQBT", "Windows Vista Business N"], | ||
["VKK3X-68KWM-X2YGT-QR4M6-4BWMV", "Windows Vista Enterprise"], | ||
["VTC42-BM838-43QHV-84HX6-XJXKV", "Windows Vista Enterprise N"] | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<script lang="ts" setup> | ||
import { useMonitorStore } from '@/store/monitor' | ||
const props = defineProps<{ | ||
editionData: EditionItem[] | ||
title: string | ||
generateScript: (host: string, license: string, arch?: string) => string | ||
}>() | ||
const { t } = useI18n() | ||
const { title, editionData } = props | ||
const monitorStore = useMonitorStore() | ||
const { monitors } = monitorStore | ||
const formData = ref({ | ||
edition: editionData[0].edition[0][1], | ||
arch: '', | ||
host: monitors[0].host, | ||
gvlk: '', | ||
}) | ||
watchEffect(() => { | ||
for (const item of editionData) { | ||
for (const [token, name] of item.edition) { | ||
if (name === formData.value.edition) { | ||
formData.value.gvlk = token | ||
} | ||
} | ||
} | ||
}) | ||
const content = computed(() => { | ||
return props.generateScript(formData.value.host, formData.value.gvlk) | ||
}) | ||
const file = computed(() => { | ||
return new File([content.value], 'kms.bat', { type: 'application/txt' }) | ||
}) | ||
const fileUrl = useObjectUrl(file) | ||
const { copy, copied } = useClipboard({ | ||
source: content, | ||
legacy: true, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-col gap-4"> | ||
<ACard> | ||
<template #title> | ||
<div class="flex items-center gap-2"> | ||
<i :class="`i-icons:${title.toLowerCase()}`" /> | ||
<span>{{ title }}</span> | ||
</div> | ||
</template> | ||
<AForm :model="formData" auto-label-width> | ||
<AFormItem :label="t('label.version')" field="edition" required> | ||
<ASelect v-model="formData.edition"> | ||
<template v-for="item in editionData" :key="item.version"> | ||
<AOptgroup :label="item.version"> | ||
<template v-for="edition in item.edition" :key="edition[1]"> | ||
<AOption :label="edition[1]" /> | ||
</template> | ||
</AOptgroup> | ||
</template> | ||
</ASelect> | ||
</AFormItem> | ||
<AFormItem :label="t('label.service')" field="host" required> | ||
<ASelect v-model="formData.host"> | ||
<template v-for="item in monitors" :key="item.id"> | ||
<AOption :label="item.host" /> | ||
</template> | ||
</ASelect> | ||
</AFormItem> | ||
<AFormItem :label="t('label.license')" field="gvlk" required> | ||
<AInput v-model="formData.gvlk" disabled /> | ||
</AFormItem> | ||
<AFormItem label="CMD Script"> | ||
<ATextarea v-model="content" auto-size /> | ||
</AFormItem> | ||
<AFormItem> | ||
<ASpace size="small"> | ||
<a :href="fileUrl" :download="file.name"> | ||
<AButton type="primary"> | ||
{{ t('button.download-script') }} | ||
</AButton> | ||
</a> | ||
<AButton | ||
type="secondary" | ||
:status="copied ? 'success' : 'normal'" | ||
@click="copy()" | ||
> | ||
{{ copied ? t('button.copy-script') : t('button.copy-script') }} | ||
</AButton> | ||
</ASpace> | ||
</AFormItem> | ||
</AForm> | ||
</ACard> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.