From c1c60a5313b5f223a35256ff1ca0bc6e64d25cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?mac=C2=B7ufutx?= Date: Fri, 11 Jul 2025 14:51:12 +0800 Subject: [PATCH] feat: 20250711 --- .env.development | 4 +- package.json | 3 +- src/components/Marquee.vue | 42 +- src/router/index.ts | 4 +- src/utils/navigation.ts | 4 +- src/views/About/sections/CompanyValues.vue | 189 +++++---- .../About/sections/QualificationCarousel.vue | 94 +++-- src/views/App/sections/ApplicationScenes.vue | 36 +- src/views/App/sections/FeatureNav.vue | 6 +- src/views/App/sections/SpeechModule.vue | 4 +- src/views/Dating/sections/PainPoints.vue | 12 +- src/views/Home/sections/BannerCarousel.vue | 14 +- src/views/Home/sections/CoreValue.vue | 178 +++++--- src/views/Home/sections/CoreValueV2.vue | 385 +++++++----------- src/views/Home/sections/CustomerFeedback.vue | 16 +- src/views/Home/sections/GlobalService.vue | 2 +- src/views/Network/sections/AppPromotion.vue | 13 + src/views/Network/sections/UseCases.vue | 24 +- src/views/News/ArticleDetail.vue | 24 ++ src/views/News/News.vue | 18 +- vite.config.ts | 81 ++-- 21 files changed, 628 insertions(+), 525 deletions(-) diff --git a/.env.development b/.env.development index 47625a3..ba2b262 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,4 @@ # .env.development (开发环境) -VITE_API_BASE_URL = 'http://health.ufutx.net' +# VITE_API_BASE_URL = 'http://health.ufutx.net' + +VITE_API_BASE_URL = 'https://health.ufutx.com' \ No newline at end of file diff --git a/package.json b/package.json index b5d4a62..f02db92 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,7 @@ "axios": "^1.9.0", "echarts": "^5.6.0", "element-plus": "^2.10.1", - "motion-v": "^1.3.1", "pinia": "^2.1.7", - "postcss-px-to-viewport": "^1.1.1", "swiper": "^11.2.10", "vue": "^3.5.13", "vue-i18n": "^9.8.0", @@ -65,6 +63,7 @@ "postcss": "^8.4.24", "postcss-px-to-viewport-8-plugin": "^1.2.5", "prettier": "^3.5.3", + "rollup-plugin-visualizer": "^6.0.3", "sass": "^1.89.2", "tailwind-merge": "^3.3.1", "tw-animate-css": "^1.3.4", diff --git a/src/components/Marquee.vue b/src/components/Marquee.vue index 4a4139c..4bf1d23 100644 --- a/src/components/Marquee.vue +++ b/src/components/Marquee.vue @@ -64,22 +64,50 @@ const updateAnimation = () => { const style = document.createElement('style') style.id = 'marquee-keyframes' style.textContent = ` - @keyframes marquee { - 0% { transform: translateX(var(--initial-offset)); } - 100% { transform: translateX(calc(var(--initial-offset) - ${originalWidth.value}px)); } - } - ` + @keyframes marquee { + 0% { transform: translateX(var(--initial-offset)); } + /* 滚动距离 = 原始内容宽度,确保克隆内容衔接 */ + 100% { transform: translateX(calc(var(--initial-offset) - ${originalWidth.value}px)); } + } +` // 替换旧关键帧 const existingStyle = document.head.querySelector('#marquee-keyframes') if (existingStyle) document.head.removeChild(existingStyle) document.head.appendChild(style) } +// 图片加载完成后重新计算宽度 +const watchImagesLoad = () => { + if (!originalRef.value) return + // 获取插槽中的所有图片 + const images = originalRef.value.querySelectorAll('img') + if (images.length === 0) return + // 监听所有图片加载完成 + let loadedCount = 0 + images.forEach(img => { + // 图片已加载完成 + if (img.complete) { + loadedCount++ + } else { + // 图片加载完成后触发 + img.addEventListener('load', () => { + loadedCount++ + if (loadedCount === images.length) { + nextTick(calculateWidth) // 所有图片加载后重新计算宽度 + } + }) + } + }) +} // 初始化与监听 onMounted(() => { - calculateWidth() - updateAnimation() + nextTick(() => { + // 确保DOM渲染完成 + calculateWidth() + watchImagesLoad() // 监听图片加载 + updateAnimation() + }) }) watchEffect(() => { calculateWidth() diff --git a/src/router/index.ts b/src/router/index.ts index 4508c6c..cad8d52 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -6,8 +6,10 @@ import routes from './routes' // const history = isProduction // ? createWebHashHistory() // 线上:带# // : createWebHistory() // 本地:无# + +const routerBase = import.meta.env.MODE === 'production' ? '/web/' : '/' const router = createRouter({ - history: createWebHashHistory(), + history: createWebHashHistory(routerBase), routes, scrollBehavior(_to, _from, savedPosition) { // 添加下划线标记未使用参数 diff --git a/src/utils/navigation.ts b/src/utils/navigation.ts index 08ee5ba..70363d5 100644 --- a/src/utils/navigation.ts +++ b/src/utils/navigation.ts @@ -33,7 +33,9 @@ export const openNewWindow = (to: RouteLocationRaw) => { // 使用导入的 router 实例调用 resolve const routeLocation = router.resolve(to) // 拼接完整URL(当前域名 + 路由路径) - const fullUrl = `${window.location.origin}${routeLocation.href}` + const fullUrl = `${window.location.origin}/${import.meta.env.MODE === 'production' ? '/web/' : '/'}${routeLocation.href}` + console.log(window.location) + console.log(fullUrl) // 新窗口打开 window.open(fullUrl, '_blank', 'noopener,noreferrer') } catch (error) { diff --git a/src/views/About/sections/CompanyValues.vue b/src/views/About/sections/CompanyValues.vue index aa29070..f9eb035 100644 --- a/src/views/About/sections/CompanyValues.vue +++ b/src/views/About/sections/CompanyValues.vue @@ -1,15 +1,13 @@