@@ -35,7 +35,8 @@
v-model="username"
type="text"
required
- :disabled="isRegistering"
+ autocomplete="username"
+ :disabled="isSubmitting"
class="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-black focus:ring-2 focus:ring-black/5 outline-none transition-all duration-300 disabled:opacity-50 disabled:cursor-not-allowed"
:placeholder="t('auth.usernamePlaceholder')"
/>
@@ -50,7 +51,8 @@
v-model="email"
type="email"
required
- :disabled="isRegistering"
+ autocomplete="email"
+ :disabled="isSubmitting"
class="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-black focus:ring-2 focus:ring-black/5 outline-none transition-all duration-300 disabled:opacity-50 disabled:cursor-not-allowed"
:placeholder="t('auth.emailPlaceholder')"
/>
@@ -64,7 +66,8 @@
id="reg-phone"
v-model="phone"
type="tel"
- :disabled="isRegistering"
+ autocomplete="tel"
+ :disabled="isSubmitting"
class="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-black focus:ring-2 focus:ring-black/5 outline-none transition-all duration-300 disabled:opacity-50 disabled:cursor-not-allowed"
:placeholder="t('auth.phonePlaceholder')"
/>
@@ -79,7 +82,8 @@
v-model="password"
type="password"
required
- :disabled="isRegistering"
+ autocomplete="new-password"
+ :disabled="isSubmitting"
class="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-black focus:ring-2 focus:ring-black/5 outline-none transition-all duration-300 disabled:opacity-50 disabled:cursor-not-allowed"
:placeholder="t('auth.passwordPlaceholder')"
/>
@@ -94,7 +98,8 @@
v-model="confirmPassword"
type="password"
required
- :disabled="isRegistering"
+ autocomplete="new-password"
+ :disabled="isSubmitting"
class="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-black focus:ring-2 focus:ring-black/5 outline-none transition-all duration-300 disabled:opacity-50 disabled:cursor-not-allowed"
:placeholder="t('auth.confirmPasswordPlaceholder')"
/>
@@ -113,21 +118,21 @@
{{ t('auth.alreadyHaveAccount') }}
-
@@ -142,122 +147,89 @@
import { ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { useUserStore } from '~/stores/user'
+import { useAuthModalStore } from '~/stores/authModal'
+import { useApiError } from '~/composables/useApiError'
const { t } = useI18n()
const userStore = useUserStore()
+const authModal = useAuthModalStore()
+const apiError = useApiError()
-interface Props {
- isOpen: boolean
-}
-
-const props = defineProps
()
-const emit = defineEmits<{
- close: []
- switchToLogin: []
-}>()
-
-const modalRef = ref(null)
const username = ref('')
const email = ref('')
const phone = ref('')
const password = ref('')
const confirmPassword = ref('')
-const isRegistering = ref(false)
+const isSubmitting = ref(false)
const errorMessage = ref('')
const successMessage = ref('')
-// 关闭模态框
const closeModal = () => {
- if (!isRegistering.value) {
- emit('close')
+ if (!isSubmitting.value) {
+ authModal.closeAll()
}
}
-// 切换到登录
-const switchToLogin = () => {
- emit('switchToLogin')
-}
-
-// 处理注册
-const handleRegister = async () => {
- if (isRegistering.value) return
-
- // 验证密码匹配
- if (password.value !== confirmPassword.value) {
- errorMessage.value = t('auth.passwordMismatch')
- return
- }
-
- // 验证手机号格式(如果填写了)
- if (phone.value && !/^1[3-9]\d{9}$/.test(phone.value)) {
- errorMessage.value = t('auth.invalidPhone')
- return
- }
-
- isRegistering.value = true
- errorMessage.value = ''
- successMessage.value = ''
-
- try {
- const result = await userStore.register({
- username: username.value,
- email: email.value,
- phone: phone.value,
- password: password.value
- })
-
- if (result.success) {
- // 注册成功
- successMessage.value = t('auth.registerSuccess')
-
- // 清空表单
+// 打开时重置表单
+watch(
+ () => authModal.isRegisterOpen,
+ (open) => {
+ if (open) {
username.value = ''
email.value = ''
phone.value = ''
password.value = ''
confirmPassword.value = ''
-
- // 2秒后关闭并自动登录
- setTimeout(() => {
- closeModal()
- }, 2000)
- } else {
- errorMessage.value = result.error || t('auth.registerError')
+ errorMessage.value = ''
+ successMessage.value = ''
}
- } catch (error) {
- console.error('Register error:', error)
- errorMessage.value = t('auth.registerError')
- } finally {
- isRegistering.value = false
- }
-}
+ },
+)
-// 监听打开状态,重置表单
-watch(() => props.isOpen, (isOpen) => {
- if (isOpen) {
+const handleRegister = async () => {
+ if (isSubmitting.value) return
+ errorMessage.value = ''
+ successMessage.value = ''
+
+ if (password.value !== confirmPassword.value) {
+ errorMessage.value = t('auth.passwordMismatch')
+ return
+ }
+ if (phone.value && !/^1[3-9]\d{9}$/.test(phone.value)) {
+ errorMessage.value = t('auth.invalidPhone')
+ return
+ }
+
+ isSubmitting.value = true
+ const result = await userStore.register({
+ username: username.value,
+ email: email.value,
+ phone: phone.value,
+ password: password.value,
+ })
+
+ if (result.success) {
+ successMessage.value = t('auth.registerSuccess')
username.value = ''
email.value = ''
phone.value = ''
password.value = ''
confirmPassword.value = ''
- errorMessage.value = ''
- successMessage.value = ''
- // 禁止背景滚动
- document.body.style.overflow = 'hidden'
+ setTimeout(() => {
+ authModal.closeAll()
+ }, 1500)
} else {
- // 恢复滚动
- document.body.style.overflow = ''
+ errorMessage.value = apiError({ data: { code: result.code } })
}
-})
+ isSubmitting.value = false
+}
-// ESC 键关闭
+// ESC 关闭
const handleKeydown = (e: KeyboardEvent) => {
- if (e.key === 'Escape' && props.isOpen) {
+ if (e.key === 'Escape' && authModal.isRegisterOpen) {
closeModal()
}
}
-
-// 添加键盘事件监听
if (typeof window !== 'undefined') {
window.addEventListener('keydown', handleKeydown)
}
diff --git a/app/components/home/HomePartnersWork.vue b/app/components/home/HomePartnersWork.vue
index ed9d80b..bf14abe 100755
--- a/app/components/home/HomePartnersWork.vue
+++ b/app/components/home/HomePartnersWork.vue
@@ -3,6 +3,7 @@ import { onMounted, onUnmounted, ref, nextTick } from 'vue'
import { useI18n } from 'vue-i18n'
import gsap from 'gsap'
import { ScrollTrigger } from 'gsap/ScrollTrigger'
+import { workItems } from '~/data/work'
gsap.registerPlugin(ScrollTrigger)
@@ -49,46 +50,6 @@ const partners = [
},
]
-const toImageUrl = (prompt: string, imageSize: string) => {
- const encoded = encodeURIComponent(prompt)
- return `https://coresg-normal.trae.ai/api/ide/v1/text_to_image?prompt=${encoded}&image_size=${imageSize}`
-}
-
-const workItems = [
- {
- titleKey: 'home.work.items.forma',
- year: '26',
- image: toImageUrl(
- 'high-end editorial product still life, minimal composition, matte ceramics and brushed aluminum on soft neutral background, studio lighting, shallow depth of field, premium, clean, realistic, 35mm photo',
- 'landscape_16_9'
- ),
- },
- {
- titleKey: 'home.work.items.oneStep',
- year: '24',
- image: toImageUrl(
- 'architectural close-up, modern brutalist concrete facade with sharp shadows, minimal, cinematic lighting, high contrast, ultra realistic, 35mm photography, no people',
- 'landscape_16_9'
- ),
- },
- {
- titleKey: 'home.work.items.neroVision',
- year: '25',
- image: toImageUrl(
- 'minimal graphic poster photographed in studio, black ink typography on off-white textured paper, premium editorial style, soft shadow, ultra realistic, no people',
- 'landscape_16_9'
- ),
- },
- {
- titleKey: 'home.work.items.boldMoves',
- year: '24',
- image: toImageUrl(
- 'moody nighttime city street still life, neon reflection on wet asphalt, abstract bokeh, premium cinematic photography, no people, high detail',
- 'landscape_16_9'
- ),
- },
-] as const
-
let ctx: gsap.Context | null = null
const refresh = () => {
@@ -140,12 +101,12 @@ onMounted(async () => {
tl.to(
next,
{ y: 0, duration: 1, ease: 'power2.out' },
- start
+ start,
)
tl.to(
prev,
{ scale: scaleTo, y: depthOffsetY, duration: 0.6, ease: 'power2.out' },
- start + 0.35
+ start + 0.35,
)
tl.set(prev, { scale: scaleTo, y: depthOffsetY }, start + 1)
}
@@ -235,29 +196,30 @@ onUnmounted(() => {
-
-
-
-
- {{ t(item.titleKey) }}
-
-
- {{ item.year }} ©
-
-
-
+
+
+
+
+ {{ t(`work.items.${item.slug}.title`) }}
+
+
+ {{ item.year }} ©
+
+
+
diff --git a/app/components/home/HomeTechStack.vue b/app/components/home/HomeTechStack.vue
index 617eea6..a7738b0 100644
--- a/app/components/home/HomeTechStack.vue
+++ b/app/components/home/HomeTechStack.vue
@@ -15,7 +15,7 @@
v-for="(tech, index) in technologies"
:key="tech.id"
:ref="el => setTechRef(el, index)"
- class="tech-tag absolute flex items-center gap-3 px-5 py-3 bg-white rounded-full shadow-lg border-2 cursor-pointer hover:scale-110 transition-transform duration-300"
+ class="tech-tag absolute flex items-center gap-3 px-5 py-3 bg-white rounded-full shadow-lg border-2 hover:scale-110 transition-transform duration-300"
:class="tech.borderColor"
:style="getTechStyle(index)"
>
diff --git a/app/components/home/HomeUpdates.vue b/app/components/home/HomeUpdates.vue
index 5dfe25d..ed3b57b 100644
--- a/app/components/home/HomeUpdates.vue
+++ b/app/components/home/HomeUpdates.vue
@@ -13,11 +13,12 @@
-
handleCardHover(index, true)"
@@ -31,27 +32,27 @@
- {{ t(`home.updates.categories.${item.category}`) }}
+ {{ t(`news.categories.${item.category}`) }}
- {{ t(`home.updates.items.${item.id}.title`) }}
+ {{ t(`news.items.${item.slug}.title`) }}
- {{ t(`home.updates.items.${item.id}.description`) }}
+ {{ t(`news.items.${item.slug}.excerpt`) }}
- {{ item.date }}
+ {{ formatNewsDate(item.date, locale) }}
-
+
@@ -73,10 +74,11 @@ import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import { useI18n } from 'vue-i18n'
import gsap from 'gsap'
import { ScrollTrigger } from 'gsap/ScrollTrigger'
+import { newsItems, formatNewsDate } from '~/data/news'
gsap.registerPlugin(ScrollTrigger)
-const { t } = useI18n()
+const { t, locale } = useI18n()
const rootRef = ref