| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <template>
- <div class="creation-mode-switch">
- <span class="mode-title">
- {{ currentModeLabel }}
- </span>
- <div class="mode-actions">
- <!-- 当前是 smart 模式时,显示 AI生成 和 手动创建 按钮 -->
- <template v-if="modelValue === 'smart'">
- <!-- AI生成按钮(暂时隐藏,保留以便后续启用)
- <button class="mode-btn" @click="$emit('update:modelValue', 'ai')">
- <svg class="mode-btn-icon sparkle" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
- <path d="M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8z" />
- </svg>
- <span>AI生成</span>
- </button>
- -->
- <button class="mode-btn" @click="$emit('update:modelValue', 'manual')">
- <svg class="mode-btn-icon clipboard" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
- <path d="M16 4h2a2 2 0 012 2v14a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2h2" />
- <rect x="8" y="2" width="8" height="4" rx="1" ry="1" />
- </svg>
- <span>手动创建</span>
- </button>
- </template>
- <!-- 当前是 ai 或 manual 模式时,显示 返回推荐 按钮 -->
- <template v-else>
- <button class="mode-btn mode-btn--active" @click="$emit('update:modelValue', 'smart')">
- <svg class="mode-btn-icon sparkle" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
- <path d="M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8z" />
- </svg>
- <span>{{ lang.ssBackToRecommend }}</span>
- </button>
- </template>
- </div>
- </div>
- </template>
- <script lang="ts" setup>
- import { computed } from 'vue'
- import { lang } from '@/main'
- import type { CreationMode } from '@/types/englishSpeaking'
- const props = defineProps<{
- modelValue: CreationMode
- }>()
- defineEmits<{
- (e: 'update:modelValue', value: CreationMode): void
- }>()
- const currentModeLabel = computed(() => {
- switch (props.modelValue) {
- case 'ai': return 'AI 生成'
- case 'manual': return lang.ssManualCreate
- default: return lang.ssSmartRecommend
- }
- })
- </script>
- <style lang="scss" scoped>
- .creation-mode-switch {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .mode-title {
- font-size: 14px;
- font-weight: 600;
- color: #1f2937;
- }
- .mode-actions {
- display: flex;
- align-items: center;
- gap: 8px;
- }
- .mode-btn {
- display: flex;
- align-items: center;
- gap: 6px;
- padding: 6px 14px;
- border-radius: 12px;
- border: 1px solid rgba(0, 0, 0, 0.08);
- background: transparent;
- font-size: 13px;
- color: #4b5563;
- cursor: pointer;
- transition: all 0.2s;
- &:hover {
- border-color: #d1d5db;
- background: #f9fafb;
- }
- &--active {
- border-color: #fb923c;
- background: #fff7ed;
- color: #ea580c;
- &:hover {
- opacity: 0.8;
- }
- .sparkle {
- color: #ea580c;
- }
- }
- }
- .mode-btn-icon {
- flex-shrink: 0;
- &.sparkle {
- color: #f97316;
- }
- &.clipboard {
- color: #f97316;
- }
- }
- </style>
|