Skip to content

Commit

Permalink
refactor: adjust remaining code
Browse files Browse the repository at this point in the history
  • Loading branch information
ikxin committed Aug 22, 2024
1 parent 995f95f commit 6a19fc4
Show file tree
Hide file tree
Showing 9 changed files with 245 additions and 284 deletions.
57 changes: 57 additions & 0 deletions src/assets/gvlks/office.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[
{
"version": "Office 2021 LTSC",
"edition": [
["FXYTK-NJJ8C-GB6DW-3DYQT-6F7TH", "Office LTSC Professional Plus 2021"],
["KDX7X-BNVR8-TXXGX-4Q7Y8-78VT3", "Office LTSC Standard 2021"],
["FTNWT-C6WBT-8HMGF-K9PRX-QV9H8", "Project Professional 2021"],
["J2JDC-NJCYY-9RGQ4-YXWMH-T3D4T", "Project Standard 2021"],
["KNH8D-FGHT4-T8RK3-CTDYJ-K2HT4", "Visio LTSC Professional 2021"],
["MJVNY-BYWPY-CWV6J-2RKRT-4M8QG", "Visio LTSC Standard 2021"],
["WM8YG-YNGDD-4JHDC-PG3F4-FC4T4", "Access LTSC 2021"],
["NWG3X-87C9K-TC7YY-BC2G7-G6RVC", "Excel LTSC 2021"],
["C9FM6-3N72F-HFJXB-TM3V9-T86R9", "Outlook LTSC 2021"],
["TY7XF-NFRBR-KJ44C-G83KF-GX27K", "PowerPoint LTSC 2021"],
["2MW9D-N4BXM-9VBPG-Q7W6M-KFBGQ", "Publisher LTSC 2021"],
["HWCXN-K3WBT-WJBKY-R8BD9-XK29P", "Skype for Business LTSC 2021"],
["TN8H9-M34D3-Y64V9-TR72V-X79KV", "Word LTSC 2021"]
]
},
{
"version": "Office 2019",
"edition": [
["NMMKJ-6RK4F-KMJVX-8D9MJ-6MWKP", "Office Professional Plus 2019"],
["6NWWJ-YQWMR-QKGCB-6TMB3-9D9HK", "Office Standard 2019"],
["B4NPR-3FKK7-T2MBV-FRQ4W-PKD2B", "Project Professional 2019"],
["C4F7P-NCP8C-6CQPT-MQHV9-JXD2M", "Project Standard 2019"],
["9BGNQ-K37YR-RQHF2-38RQ3-7VCBB", "Visio Professional 2019"],
["7TQNQ-K3YQQ-3PFH7-CCPPM-X4VQ2", "Visio Standard 2019"],
["9N9PT-27V4Y-VJ2PD-YXFMF-YTFQT", "Access 2019"],
["TMJWT-YYNMB-3BKTF-644FC-RVXBD", "Excel 2019"],
["7HD7K-N4PVK-BHBCQ-YWQRW-XW4VK", "Outlook 2019"],
["RRNCX-C64HY-W2MM7-MCH9G-TJHMQ", "PowerPoint 2019"],
["G2KWX-3NW6P-PY93R-JXK2T-C9Y9V", "Publisher 2019"],
["NCJ33-JHBBY-HTK98-MYCV8-HMKHJ", "Skype for Business 2019"],
["PBX3G-NWMT6-Q7XBW-PYJGG-WXD33", "Word 2019"]
]
},
{
"version": "Office 2016",
"edition": [
["XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99", "Office Professional Plus 2016"],
["JNRGM-WHDWX-FJJG3-K47QV-DRTFM", "Office Standard 2016"],
["YG9NW-3K39V-2T3HJ-93F3Q-G83KT", "Project Professional 2016"],
["GNFHQ-F6YQM-KQDGJ-327XX-KQBVC", "Project Standard 2016"],
["PD3PC-RHNGV-FXJ29-8JK7D-RJRJK", "Visio Professional 2016"],
["7WHWN-4T7MP-G96JF-G33KR-W8GF4", "Visio Standard 2016"],
["GNH9Y-D2J4T-FJHGG-QRVH7-QPFDW", "Access 2016"],
["9C2PK-NWTVB-JMPW8-BFT28-7FTBF", "Excel 2016"],
["DR92N-9HTF2-97XKM-XW2WJ-XW3J6", "OneNote 2016"],
["R69KK-NTPKF-7M3Q4-QYBHW-6MT9B", "Outlook 2016"],
["J7MQP-HNJ4Y-WJ7YM-PFYGF-BY6C6", "PowerPoint 2016"],
["F47MM-N3XJP-TQXJ9-BP99D-8K837", "Publisher 2016"],
["869NQ-FJ69K-466HW-QYCP2-DDBV6", "Skype for Business 2016"],
["WXY84-JN2Q9-RBCCQ-3Q3J3-3PFJ6", "Word 2016"]
]
}
]
120 changes: 120 additions & 0 deletions src/assets/gvlks/windows-server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
[
{
"version": "Windows Server 2022",
"edition": [
["WX4NM-KYWYW-QJJR4-XV3QB-6VM33", "Windows Server 2022 Datacenter"],
["NTBV8-9K7Q8-V27C6-M2BTV-KHMXV", "Windows Server 2022 Datacenter Azure Edition"],
["VDYBN-27WPP-V4HQT-9VMD4-VMK7H", "Windows Server 2022 Standard"]
]
},
{
"version": "Windows Server 20H2",
"edition": [
["6NMRW-2C8FM-D24W7-TQWMY-CWH2D", "Windows Server 20H2 Datacenter"],
["N2KJX-J94YW-TQVFB-DG9YT-724CC", "Windows Server 20H2 Standard"]
]
},
{
"version": "Windows Server 2004",
"edition": [
["6NMRW-2C8FM-D24W7-TQWMY-CWH2D", "Windows Server 2004 Datacenter"],
["N2KJX-J94YW-TQVFB-DG9YT-724CC", "Windows Server 2004 Standard"]
]
},
{
"version": "Windows Server 1909",
"edition": [
["6NMRW-2C8FM-D24W7-TQWMY-CWH2D", "Windows Server 1909 Datacenter"],
["N2KJX-J94YW-TQVFB-DG9YT-724CC", "Windows Server 1909 Standard"]
]
},
{
"version": "Windows Server 1903",
"edition": [
["6NMRW-2C8FM-D24W7-TQWMY-CWH2D", "Windows Server 1903 Datacenter"],
["N2KJX-J94YW-TQVFB-DG9YT-724CC", "Windows Server 1903 Standard"]
]
},
{
"version": "Windows Server 2019",
"edition": [
["WMDGN-G9PQG-XVVXX-R3X43-63DFG", "Windows Server 2019 Datacenter"],
["N69G4-B89J2-4G8F4-WWYCC-J464C", "Windows Server 2019 Standard"],
["WVDHN-86M7X-466P6-VHXV7-YY726", "Windows Server 2019 Essentials"]
]
},
{
"version": "Windows Server 2016",
"edition": [
["CB7KF-BWN84-R7R2Y-793K2-8XDDG", "Windows Server 2016 Datacenter"],
["WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY", "Windows Server 2016 Standard"],
["JCKRF-N37P4-C2D82-9YXRT-4M63B", "Windows Server 2016 Essentials"]
]
},
{
"version": "Windows Server 1809",
"edition": [
["6NMRW-2C8FM-D24W7-TQWMY-CWH2D", "Windows Server 1809 Datacenter"],
["N2KJX-J94YW-TQVFB-DG9YT-724CC", "Windows Server 1809 Standard"]
]
},
{
"version": "Windows Server 1803",
"edition": [
["2HXDN-KRXHB-GPYC7-YCKFJ-7FVDG", "Windows Server 1803 Datacenter"],
["PTXN8-JFHJM-4WC78-MPCBR-9W4KR", "Windows Server 1803 Standard"]
]
},
{
"version": "Windows Server 1709",
"edition": [
["6Y6KB-N82V8-D8CQV-23MJW-BWTG6", "Windows Server 1709 Datacenter"],
["DPCNP-XQFKJ-BJF7R-FRC8D-GF6G4", "Windows Server 1709 Standard"]
]
},
{
"version": "Windows Server 2012 R2",
"edition": [
["D2N9P-3P6X9-2R39C-7RTCD-MDVJX", "Windows Server 2012 R2 Standard"],
["W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9", "Windows Server 2012 R2 Datacenter"],
["KNC87-3J2TX-XB4WP-VCPJV-M4FWM", "Windows Server 2012 R2 Essentials"]
]
},
{
"version": "Windows Server 2012",
"edition": [
["BN3D2-R7TKB-3YPBD-8DRP2-27GG4", "Windows Server 2012"],
["8N2M2-HWPGY-7PGT9-HGDD8-GVGGY", "Windows Server 2012 N"],
["2WN2H-YGCQR-KFX6K-CD6TF-84YXQ", "Windows Server 2012 Single Language"],
["4K36P-JN4VD-GDC6V-KDT89-DYFKP", "Windows Server 2012 Country Specific"],
["XC9B7-NBPP2-83J2H-RHMBY-92BT4", "Windows Server 2012 Standard"],
["HM7DN-YVMH3-46JC3-XYTG7-CYQJJ", "Windows Server 2012 MultiPoint Standard"],
["XNH6W-2V9GX-RGJ4K-Y8X6F-QGJ2G", "Windows Server 2012 MultiPoint Premium"]
]
},
{
"version": "Windows Server 2008 R2",
"edition": [
["6TPJF-RBVHG-WBW2R-86QPH-6RTM4", "Windows Server 2008 R2 Web"],
["TT8MH-CG224-D3D7Q-498W2-9QCTX", "Windows Server 2008 R2 HPC edition"],
["YC6KT-GKW9T-YTKYR-T4X34-R7VHC", "Windows Server 2008 R2 Standard"],
["489J6-VHDMP-X63PK-3K798-CPX3Y", "Windows Server 2008 R2 Enterprise"],
["74YFP-3QFB3-KQT8W-PMXWJ-7M648", "Windows Server 2008 R2 Datacenter"],
["GT63C-RJFQ3-4GMB6-BRFB9-CB83V", "Windows Server 2008 R2 for Itanium-based Systems"]
]
},
{
"version": "Windows Server 2008",
"edition": [
["WYR28-R7TFJ-3X2YQ-YCY4H-M249D", "Windows Web Server 2008"],
["TM24T-X9RMF-VWXK6-X8JC9-BFGM2", "Windows Server 2008 Standard"],
["W7VD6-7JFBR-RX26B-YKQ3Y-6FFFJ", "Windows Server 2008 Standard without Hyper-V"],
["YQGMW-MPWTJ-34KDK-48M3W-X4Q6V", "Windows Server 2008 Enterprise"],
["39BXF-X8Q23-P2WWT-38T2F-G3FPG", "Windows Server 2008 Enterprise without Hyper-V"],
["RCTX3-KWVHP-BR6TB-RB6DM-6X7HP", "Windows Server 2008 HPC"],
["7M67G-PC374-GR742-YH8V4-TCBY3", "Windows Server 2008 Datacenter"],
["22XQ2-VRXRG-P8D42-K34TD-G3QQC", "Windows Server 2008 Datacenter without Hyper-V"],
["4DWFP-JF3DJ-B7DTH-78FJB-PDRHK", "Windows Server 2008 for Itanium-Based Systems"]
]
}
]
31 changes: 21 additions & 10 deletions src/components/common-activate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useMonitorStore } from '@/store/monitor'
const props = defineProps<{
editionData: EditionItem[]
title: string
generateScript: (host: string, license: string, arch?: string) => string
generateScript: (formData: ActivateFormData) => string
}>()
const { t } = useI18n()
Expand All @@ -15,25 +15,25 @@ const monitorStore = useMonitorStore()
const { monitors } = monitorStore
const formData = ref({
const formData = ref<ActivateFormData>({
edition: editionData[0].edition[0][1],
arch: '',
arch: 'x64',
host: monitors[0].host,
gvlk: '',
license: '',
})
watchEffect(() => {
for (const item of editionData) {
for (const [token, name] of item.edition) {
for (const [license, name] of item.edition) {
if (name === formData.value.edition) {
formData.value.gvlk = token
formData.value.license = license
}
}
}
})
const content = computed(() => {
return props.generateScript(formData.value.host, formData.value.gvlk)
return props.generateScript(formData.value)
})
const file = computed(() => {
Expand All @@ -53,7 +53,7 @@ const { copy, copied } = useClipboard({
<ACard>
<template #title>
<div class="flex items-center gap-2">
<i :class="`i-icons:${title.toLowerCase()}`" />
<i :class="`i-icons:${title.toLowerCase().replace(/ /g, '-')}`" />
<span>{{ title }}</span>
</div>
</template>
Expand All @@ -69,15 +69,26 @@ const { copy, copied } = useClipboard({
</template>
</ASelect>
</AFormItem>
<AFormItem
v-if="title.toLowerCase() === 'office'"
field="arch"
:label="t('label.arch')"
required
>
<ARadioGroup v-model="formData.arch" type="button">
<ARadio value="x64">{{ t('label.x64') }}</ARadio>
<ARadio value="x86">{{ t('label.x86') }}</ARadio>
</ARadioGroup>
</AFormItem>
<AFormItem :label="t('label.host')" 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.gvlk')" field="gvlk" required>
<AInput v-model="formData.gvlk" disabled />
<AFormItem :label="t('label.license')" field="license" required>
<AInput v-model="formData.license" disabled />
</AFormItem>
<AFormItem :label="t('label.script')" required>
<ATextarea v-model="content" auto-size />
Expand Down
7 changes: 5 additions & 2 deletions src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
"system": "系统",
"software": "软件",
"edition": "发行版本",
"host": "KMS 服务器",
"host": "服务器",
"port": "端口",
"gvlk": "许可证",
"arch": "系统架构",
"x64": "64 位",
"x86": "32 位",
"license": "许可证",
"script": "CMD 脚本",
"copy": "复制",
"copy-success": "复制成功",
Expand Down
4 changes: 4 additions & 0 deletions src/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ body {
.arco-layout-header span > i {
font-size: 1rem;
}

.arco-select-dropdown-list-wrapper {
max-height: 400px;
}
7 changes: 7 additions & 0 deletions src/typings/custom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ interface RecordItem {
updatedAt: Date
createdAt: Date
}

interface ActivateFormData {
edition: string
arch: string
host: string
license: string
}
Loading

0 comments on commit 6a19fc4

Please sign in to comment.