CreationModeSwitch.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <div class="creation-mode-switch">
  3. <span class="mode-title">
  4. {{ currentModeLabel }}
  5. </span>
  6. <div class="mode-actions">
  7. <!-- 当前是 smart 模式时,显示 AI生成 和 手动创建 按钮 -->
  8. <template v-if="modelValue === 'smart'">
  9. <!-- AI生成按钮(暂时隐藏,保留以便后续启用)
  10. <button class="mode-btn" @click="$emit('update:modelValue', 'ai')">
  11. <svg class="mode-btn-icon sparkle" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
  12. <path d="M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8z" />
  13. </svg>
  14. <span>AI生成</span>
  15. </button>
  16. -->
  17. <button class="mode-btn" @click="$emit('update:modelValue', 'manual')">
  18. <svg class="mode-btn-icon clipboard" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
  19. <path d="M16 4h2a2 2 0 012 2v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2h2" />
  20. <rect x="8" y="2" width="8" height="4" rx="1" ry="1" />
  21. </svg>
  22. <span>手动创建</span>
  23. </button>
  24. </template>
  25. <!-- 当前是 ai 或 manual 模式时,显示 返回推荐 按钮 -->
  26. <template v-else>
  27. <button class="mode-btn mode-btn--active" @click="$emit('update:modelValue', 'smart')">
  28. <svg class="mode-btn-icon sparkle" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
  29. <path d="M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8z" />
  30. </svg>
  31. <span>{{ lang.ssBackToRecommend }}</span>
  32. </button>
  33. </template>
  34. </div>
  35. </div>
  36. </template>
  37. <script lang="ts" setup>
  38. import { computed } from 'vue'
  39. import { lang } from '@/main'
  40. import type { CreationMode } from '@/types/englishSpeaking'
  41. const props = defineProps<{
  42. modelValue: CreationMode
  43. }>()
  44. defineEmits<{
  45. (e: 'update:modelValue', value: CreationMode): void
  46. }>()
  47. const currentModeLabel = computed(() => {
  48. switch (props.modelValue) {
  49. case 'ai': return 'AI 生成'
  50. case 'manual': return lang.ssManualCreate
  51. default: return lang.ssSmartRecommend
  52. }
  53. })
  54. </script>
  55. <style lang="scss" scoped>
  56. .creation-mode-switch {
  57. display: flex;
  58. align-items: center;
  59. justify-content: space-between;
  60. }
  61. .mode-title {
  62. font-size: 14px;
  63. font-weight: 600;
  64. color: #1f2937;
  65. }
  66. .mode-actions {
  67. display: flex;
  68. align-items: center;
  69. gap: 8px;
  70. }
  71. .mode-btn {
  72. display: flex;
  73. align-items: center;
  74. gap: 6px;
  75. padding: 6px 14px;
  76. border-radius: 12px;
  77. border: 1px solid rgba(0, 0, 0, 0.08);
  78. background: transparent;
  79. font-size: 13px;
  80. color: #4b5563;
  81. cursor: pointer;
  82. transition: all 0.2s;
  83. &:hover {
  84. border-color: #d1d5db;
  85. background: #f9fafb;
  86. }
  87. &--active {
  88. border-color: #fb923c;
  89. background: #fff7ed;
  90. color: #ea580c;
  91. &:hover {
  92. opacity: 0.8;
  93. }
  94. .sparkle {
  95. color: #ea580c;
  96. }
  97. }
  98. }
  99. .mode-btn-icon {
  100. flex-shrink: 0;
  101. &.sparkle {
  102. color: #f97316;
  103. }
  104. &.clipboard {
  105. color: #f97316;
  106. }
  107. }
  108. </style>