TelegramTab.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <script setup>
  2. import { useI18n } from 'vue-i18n';
  3. import { LanguageManager } from '@/utils';
  4. import SettingListItem from '@/components/SettingListItem.vue';
  5. const { t } = useI18n();
  6. defineProps({
  7. allSetting: { type: Object, required: true },
  8. });
  9. </script>
  10. <template>
  11. <a-collapse default-active-key="1">
  12. <a-collapse-panel key="1" :header="t('pages.settings.panelSettings')">
  13. <SettingListItem paddings="small">
  14. <template #title>{{ t('pages.settings.telegramBotEnable') }}</template>
  15. <template #description>{{ t('pages.settings.telegramBotEnableDesc') }}</template>
  16. <template #control>
  17. <a-switch v-model:checked="allSetting.tgBotEnable" />
  18. </template>
  19. </SettingListItem>
  20. <SettingListItem paddings="small">
  21. <template #title>{{ t('pages.settings.telegramToken') }}</template>
  22. <template #description>
  23. {{ allSetting.hasTgBotToken ? 'Configured; leave blank to keep current token.' : t('pages.settings.telegramTokenDesc') }}
  24. </template>
  25. <template #control>
  26. <a-input-password v-model:value="allSetting.tgBotToken"
  27. :placeholder="allSetting.hasTgBotToken ? 'Configured - enter a new token to replace' : ''" />
  28. </template>
  29. </SettingListItem>
  30. <SettingListItem paddings="small">
  31. <template #title>{{ t('pages.settings.telegramChatId') }}</template>
  32. <template #description>{{ t('pages.settings.telegramChatIdDesc') }}</template>
  33. <template #control>
  34. <a-input v-model:value="allSetting.tgBotChatId" type="text" />
  35. </template>
  36. </SettingListItem>
  37. <SettingListItem paddings="small">
  38. <template #title>{{ t('pages.settings.telegramBotLanguage') }}</template>
  39. <template #control>
  40. <a-select v-model:value="allSetting.tgLang" :style="{ width: '100%' }">
  41. <a-select-option v-for="l in LanguageManager.supportedLanguages" :key="l.value" :value="l.value"
  42. :label="l.value">
  43. <span role="img" :aria-label="l.name">{{ l.icon }}</span>
  44. &nbsp;&nbsp;<span>{{ l.name }}</span>
  45. </a-select-option>
  46. </a-select>
  47. </template>
  48. </SettingListItem>
  49. </a-collapse-panel>
  50. <a-collapse-panel key="2" :header="t('pages.settings.notifications')">
  51. <SettingListItem paddings="small">
  52. <template #title>{{ t('pages.settings.telegramNotifyTime') }}</template>
  53. <template #description>{{ t('pages.settings.telegramNotifyTimeDesc') }}</template>
  54. <template #control>
  55. <a-input v-model:value="allSetting.tgRunTime" type="text" />
  56. </template>
  57. </SettingListItem>
  58. <SettingListItem paddings="small">
  59. <template #title>{{ t('pages.settings.tgNotifyBackup') }}</template>
  60. <template #description>{{ t('pages.settings.tgNotifyBackupDesc') }}</template>
  61. <template #control>
  62. <a-switch v-model:checked="allSetting.tgBotBackup" />
  63. </template>
  64. </SettingListItem>
  65. <SettingListItem paddings="small">
  66. <template #title>{{ t('pages.settings.tgNotifyLogin') }}</template>
  67. <template #description>{{ t('pages.settings.tgNotifyLoginDesc') }}</template>
  68. <template #control>
  69. <a-switch v-model:checked="allSetting.tgBotLoginNotify" />
  70. </template>
  71. </SettingListItem>
  72. <SettingListItem paddings="small">
  73. <template #title>{{ t('pages.settings.tgNotifyCpu') }}</template>
  74. <template #description>{{ t('pages.settings.tgNotifyCpuDesc') }}</template>
  75. <template #control>
  76. <a-input-number v-model:value="allSetting.tgCpu" :min="0" :max="100" :style="{ width: '100%' }" />
  77. </template>
  78. </SettingListItem>
  79. </a-collapse-panel>
  80. <a-collapse-panel key="3" :header="t('pages.settings.proxyAndServer')">
  81. <SettingListItem paddings="small">
  82. <template #title>{{ t('pages.settings.telegramProxy') }}</template>
  83. <template #description>{{ t('pages.settings.telegramProxyDesc') }}</template>
  84. <template #control>
  85. <a-input v-model:value="allSetting.tgBotProxy" type="text" placeholder="socks5://user:pass@host:port" />
  86. </template>
  87. </SettingListItem>
  88. <SettingListItem paddings="small">
  89. <template #title>{{ t('pages.settings.telegramAPIServer') }}</template>
  90. <template #description>{{ t('pages.settings.telegramAPIServerDesc') }}</template>
  91. <template #control>
  92. <a-input v-model:value="allSetting.tgBotAPIServer" type="text" placeholder="https://api.example.com" />
  93. </template>
  94. </SettingListItem>
  95. </a-collapse-panel>
  96. </a-collapse>
  97. </template>