diff --git a/src/shared/api/account.ts b/src/shared/api/account.ts index 3c24053..c8e6413 100644 --- a/src/shared/api/account.ts +++ b/src/shared/api/account.ts @@ -286,47 +286,6 @@ export const becomeDeveloper = async (teamName: string): Promise<{ success: bool } } -// 禁用账户 -export const disableAccount = async (totpCode?: string): Promise<{ success: boolean; message?: string }> => { - try { - const response = await axios.post( - `/api/action/jcloud.api.account.disable_account`, - { totp_code: totpCode || null }, - { - headers: get_session_api_headers(), - withCredentials: true - } - ) - - return { success: true, message: response.data?.message || '账户已禁用' } - } catch (error: any) { - return { - success: false, - message: error.response?.data?.detail || error.response?.data?.message || error.message || '禁用账户失败' - } - } -} - -// 启用账户 -export const enableAccount = async (): Promise<{ success: boolean; message?: string }> => { - try { - const response = await axios.post( - `/api/action/jcloud.api.account.enable_account`, - {}, - { - headers: get_session_api_headers(), - withCredentials: true - } - ) - - return { success: true, message: response.data?.message || '账户已启用' } - } catch (error: any) { - return { - success: false, - message: error.response?.data?.detail || error.response?.data?.message || error.message || '启用账户失败' - } - } -} // 更新密码 export const updatePassword = async (params: { @@ -553,29 +512,3 @@ export const disable2FA = async (totpCode: string): Promise<{ success: boolean; } } -// 提交反馈 -export const submitFeedback = async (team: string, message: string, note: string, rating: number, route?: string): Promise<{ success: boolean; message?: string }> => { - try { - const response = await axios.post( - `/api/action/jcloud.api.account.feedback`, - { - team, - message, - note, - rating, - route: route || null - }, - { - headers: get_session_api_headers(), - withCredentials: true - } - ) - - return { success: true, message: response.data?.message || '反馈已提交' } - } catch (error: any) { - return { - success: false, - message: error.response?.data?.detail || error.response?.data?.message || error.message || '提交反馈失败' - } - } -} diff --git a/src/views/settings/Settings.vue b/src/views/settings/Settings.vue index 6d878af..a17e39f 100644 --- a/src/views/settings/Settings.vue +++ b/src/views/settings/Settings.vue @@ -107,25 +107,6 @@ - - - - - - - - @@ -775,130 +756,6 @@

- - -
- - - -
-
- - - -
- - - -
-
- - - - -

- {{ t('By sharing your thoughts, help us improve your experience.') }} -

- - -
- - {{ t('Please rate your experience') }} - -
- - - - - -
-
- - - - - - - - - - - - - -
- - -
@@ -949,8 +806,6 @@ import { updateFeatureFlags, getUserAccountInfo, becomeDeveloper, - disableAccount, - enableAccount, updatePassword, testPasswordStrength, validatePartnerCode, @@ -959,8 +814,7 @@ import { getPartnerName, get2FAQRCodeUrl, enable2FA, - disable2FA, - submitFeedback + disable2FA } from '../../shared/api/account' import ClickToCopyField from '../../shared/components/ClickToCopyField.vue' @@ -1060,35 +914,6 @@ const twoFAError = ref('') // 重置密码 const showResetPasswordDialog = ref(false) -// 账户状态 -const teamEnabled = computed(() => teamInfo.value?.enabled || false) -const accountStatusTitle = computed(() => { - return teamEnabled.value ? t('Disable Account') : t('Enable Account') -}) -const accountStatusSubtitle = computed(() => { - return teamEnabled.value - ? t('Disable your account and stop billing') - : t('Enable your account and resume billing') -}) -const accountStatusButtonLabel = computed(() => { - return teamEnabled.value ? t('Disable') : t('Enable') -}) - -// 账户状态对话框 -const showDisableAccountDialog = ref(false) -const showEnableAccountDialog = ref(false) -const disableAccountLoading = ref(false) -const enableAccountLoading = ref(false) - -// 反馈对话框 -const showFeedbackDialog = ref(false) -const feedbackRating = ref(0) -const feedbackReason = ref('') -const feedbackNote = ref('') -const feedbackLoading = ref(false) -const feedbackError = ref('') -const hoveredRating = ref(0) - // API Secret 相关 const showCreateSecretDialog = ref(false) const createSecretData = ref<{ api_key: string; api_secret: string } | null>(null) @@ -1749,128 +1574,6 @@ watch(show2FADialog, (newVal) => { } }) -// 处理账户状态(禁用/启用) -const handleAccountStatus = () => { - if (teamEnabled.value) { - showDisableAccountDialog.value = true - } else { - showEnableAccountDialog.value = true - } -} - -// 确认禁用账户 -const handleDisableAccountConfirm = async () => { - disableAccountLoading.value = true - try { - const result = await disableAccount() - if (result.success) { - message.success(t('Your account has been disabled successfully')) - showDisableAccountDialog.value = false - await loadUserAccountInfo() - // 显示反馈对话框 - showFeedbackDialog.value = true - } else { - message.error(result.message || t('Failed to disable account')) - } - } finally { - disableAccountLoading.value = false - } -} - -// 反馈原因选项 -const feedbackReasons = [ - t('我要迁移到其他产品'), - t('我只是在探索这个产品'), - t('我更喜欢自己托管实例'), - t('已将站点迁移到另一个Jingrow账户'), - t('我不喜欢Jingrow的体验'), - t('Jingrow对我来说太贵了'), - t('支付问题'), - t('缺少功能'), - t('我的原因不在此列表中') -] - -// 提交反馈 -const handleSubmitFeedback = async () => { - // 验证 - if (!feedbackReason.value) { - feedbackError.value = t('请选择一个原因') - return - } - - if (feedbackRating.value === 0) { - feedbackError.value = t('请评价您的体验') - return - } - - const requiresNote = [ - t('支付问题'), - t('缺少功能'), - t('我的原因不在此列表中') - ].includes(feedbackReason.value) - - if (requiresNote && !feedbackNote.value) { - feedbackError.value = t('请简要说明原因') - return - } - - feedbackLoading.value = true - feedbackError.value = '' - - try { - const result = await submitFeedback( - teamInfo.value?.name || '', - feedbackReason.value, - feedbackNote.value, - feedbackRating.value - ) - - if (result.success) { - message.success(t('Your feedback has been submitted successfully')) - showFeedbackDialog.value = false - // 重置表单 - feedbackRating.value = 0 - feedbackReason.value = '' - feedbackNote.value = '' - // 延迟跳转 - setTimeout(() => { - window.location.href = '/' - }, 1000) - } else { - feedbackError.value = result.message || t('提交反馈失败') - } - } catch (error: any) { - feedbackError.value = error.message || t('提交反馈失败') - } finally { - feedbackLoading.value = false - } -} - -// 关闭反馈对话框 -const closeFeedbackDialog = () => { - showFeedbackDialog.value = false - feedbackRating.value = 0 - feedbackReason.value = '' - feedbackNote.value = '' - feedbackError.value = '' -} - -// 确认启用账户 -const handleEnableAccountConfirm = async () => { - enableAccountLoading.value = true - try { - const result = await enableAccount() - if (result.success) { - message.success(t('Your account has been enabled successfully')) - showEnableAccountDialog.value = false - await loadUserAccountInfo() - } else { - message.error(result.message || t('Failed to enable account')) - } - } finally { - enableAccountLoading.value = false - } -} // 创建 API Secret const handleCreateSecret = async () => { @@ -2302,58 +2005,6 @@ onMounted(async () => { border-color: transparent !important; } -/* 账户状态对话框样式 */ -.account-status-dialog-content { - padding: 16px 0; -} - -.account-status-dialog-title { - font-size: 16px; - margin-bottom: 16px; - margin-top: 0; -} - -.account-status-dialog-list { - list-style-type: disc; - list-style-position: inside; - margin: 0 0 16px 0; - padding-left: 0; - font-size: 14px; - color: #4b5563; - line-height: 1.6; -} - -.account-status-dialog-list li { - margin-bottom: 8px; -} - -.account-status-dialog-list li:last-child { - margin-bottom: 0; -} - -.account-status-dialog-text { - font-size: 16px; - margin-bottom: 0; - margin-top: 0; -} - -/* 星级评分样式 */ -.star-rating { - display: flex; - gap: 4px; - align-items: center; -} - -.star-rating-star { - display: inline-block; - cursor: pointer; - transition: transform 0.1s; -} - -.star-rating-star:hover { - transform: scale(1.1); -} - /* 响应式设计 */ @media (max-width: 1200px) { .settings-page :deep(.n-grid) {