diff --git a/pages/dashboard/verify.vue b/pages/dashboard/verify.vue index 7c944bd..40c5400 100644 --- a/pages/dashboard/verify.vue +++ b/pages/dashboard/verify.vue @@ -21,11 +21,7 @@ {{ $t('verify.category1.toggle') }} -
+
@@ -41,7 +37,7 @@
- @@ -55,13 +51,15 @@
- - {{ $t('verify.modal.applied') }} + {{ $t('verify.modal.applied[0]') }} + {{ $t('verify.modal.applied[1]') }} + {{ $t('verify.modal.applied[2]') }} - - {{ $t('verify.modal.deleted') }} + {{ $t('verify.modal.deleted[0]') }} + {{ $t('verify.modal.applied[1]') }} + {{ $t('verify.modal.applied[2]') }}
@@ -88,6 +86,23 @@
+ + +

+ + {{ $t('verify.modal.notAllowed.title') }} +

+
+ + {{ $t('verify.modal.notAllowed.description') }} + +
+ + {{ $t('common.modal.closeInfo') }} +
+
+
@@ -96,9 +111,9 @@ definePageMeta({ middleware: ['auth', 'guild-id'], }) -const modalNames = ['success', 'failed'] as const +const modalNames = ['success', 'failed', 'notAllowed'] as const const MODAL = strArrToEnumObject(modalNames) -const { modalShow, modalClose, modalShowAndClose } = useModal(modalNames) +const { modalShowAndClose } = useModal(modalNames) const API = useAPI() const { loadingSuccess } = useLoadingState() @@ -106,6 +121,7 @@ const setting = useState('verifySetting', () => { return { cmdVerify: { enabled: false, + allowed: false, settings: { verifyRole: new createInputMenuComp([]).toObject(), }, @@ -130,6 +146,17 @@ const setting = useState('verifySetting', () => { // roleList: [], // Read-only // } +const asdf = useI18n() + +const clickEnableSwitch = () => { + if (!setting.value.cmdVerify.allowed) { + modalShowAndClose(MODAL.notAllowed, 3000) + return + } + + setting.value.cmdVerify.enabled = !setting.value.cmdVerify.enabled +} + const doinputInputMenu = (value: string) => { const Tlqkf = setting.value.cmdVerify.settings.verifyRole @@ -149,6 +176,10 @@ const saveSettings = async () => { try { const { cmdVerify } = setting.value + if (cmdVerify.settings.verifyRole.menuIndex.length > 0) { + return + } + await API.post.verify({ status: cmdVerify.enabled, role: cmdVerify.settings.verifyRole.selectedData, @@ -171,16 +202,23 @@ onMounted(async () => { return { index: role.id, name: role.name, data: role } }) - const createVerifyRole = new createInputMenuComp(tmp) + if (tmp.length > 0) { + cmdVerify.allowed = true + + const createVerifyRole = new createInputMenuComp(tmp) - if (res.settings) { - createVerifyRole.setIndex(res.settings.role.id) + if (res.settings) { + createVerifyRole.setIndex(res.settings.role.id) + } else { + createVerifyRole.setIndex(res.guild.roles[0].id) + } + + cmdVerify.enabled = true + cmdVerify.settings.verifyRole = createVerifyRole.toObject() } else { - createVerifyRole.setIndex(res.guild.roles[0].id) + cmdVerify.allowed = false + cmdVerify.enabled = false } - - cmdVerify.enabled = true - cmdVerify.settings.verifyRole = createVerifyRole.toObject() } // this.switch_.confirm = true