diff --git a/.env.development b/.env.development index fc0b994..770f9c1 100644 --- a/.env.development +++ b/.env.development @@ -3,5 +3,5 @@ NODE_ENV = 'development' # 应用配置 VITE_APP_TITLE = '美天科技 - 官网' -# VITE_APP_API_URL = 'http://localhost:8000' # 接口基础URL -VITE_APP_API_URL = 'http://backapi.yunzer.cn' \ No newline at end of file +# VITE_APP_API_URL = 'http://localhost:8000' +VITE_APP_API_URL = 'https://backend.yunzer.cn' \ No newline at end of file diff --git a/.env.production b/.env.production index d03f530..8979f10 100644 --- a/.env.production +++ b/.env.production @@ -3,4 +3,4 @@ NODE_ENV = 'production' # 应用配置 VITE_APP_TITLE = '美天科技 - 官网' -VITE_APP_API_URL = 'https://api.your-production-domain.com' # 生产环境接口基础URL \ No newline at end of file +VITE_APP_API_URL = 'https://backend.yunzer.cn' # 生产环境接口基础URL \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 01a1aec..90d5975 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "devDependencies": { "@babel/eslint-parser": "^7.28.5", "@eslint/js": "^9.39.2", + "@types/jquery": "^3.5.33", "@types/node": "^24.10.4", "@types/swiper": "^5.4.3", "@types/terser": "^3.8.1", @@ -2093,6 +2094,16 @@ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", "license": "MIT" }, + "node_modules/@types/jquery": { + "version": "3.5.33", + "resolved": "https://registry.npmmirror.com/@types/jquery/-/jquery-3.5.33.tgz", + "integrity": "sha512-SeyVJXlCZpEki5F0ghuYe+L+PprQta6nRZqhONt9F13dWBtR/ftoaIbdRQ7cis7womE+X2LKhsDdDtkkDhJS6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/sizzle": "*" + } + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmmirror.com/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -2132,6 +2143,13 @@ "undici-types": "~7.16.0" } }, + "node_modules/@types/sizzle": { + "version": "2.3.10", + "resolved": "https://registry.npmmirror.com/@types/sizzle/-/sizzle-2.3.10.tgz", + "integrity": "sha512-TC0dmN0K8YcWEAEfiPi5gJP14eJe30TTGjkvek3iM/1NdHHsdCA/Td6GvNndMOo/iSnIsZ4HuuhrYPDAmbxzww==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/svgo": { "version": "2.6.4", "resolved": "https://registry.npmmirror.com/@types/svgo/-/svgo-2.6.4.tgz", diff --git a/package.json b/package.json index 4581e83..8f55a05 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "devDependencies": { "@babel/eslint-parser": "^7.28.5", "@eslint/js": "^9.39.2", + "@types/jquery": "^3.5.33", "@types/node": "^24.10.4", "@types/swiper": "^5.4.3", "@types/terser": "^3.8.1", diff --git a/public/vite.svg b/public/vite.svg deleted file mode 100644 index e7b8dfb..0000000 --- a/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/env.d.ts b/src/env.d.ts new file mode 100644 index 0000000..94000c9 --- /dev/null +++ b/src/env.d.ts @@ -0,0 +1,9 @@ +/* src/env.d.ts */ +declare module '*.vue' { + import type { DefineComponent } from 'vue' + // 这里的 DefineComponent 会告诉 TS 所有 .vue 文件都是合法的 Vue 组件 + const component: DefineComponent<{}, {}, any> + export default component +} +declare module 'swiper/css' +declare module 'swiper/css/*' diff --git a/src/utils/pathResolver.ts b/src/utils/pathResolver.ts index 12c2823..9808250 100644 --- a/src/utils/pathResolver.ts +++ b/src/utils/pathResolver.ts @@ -15,26 +15,26 @@ Object.keys(viewsModules).forEach((relativePath) => { // 1. 别名格式: @/views/newsCenter/companyNews/index.vue const aliasPath = relativePath.replace('../views', '@/views') - pathMap.set(aliasPath, viewsModules[relativePath]) + pathMap.set(aliasPath, viewsModules[relativePath]!) // 2. 数据库格式: /views/newsCenter/companyNews/index.vue 或 /newsCenter/companyNews/index.vue const dbPath1 = relativePath.replace('../views', '/views') - pathMap.set(dbPath1, viewsModules[relativePath]) + pathMap.set(dbPath1, viewsModules[relativePath]!) const dbPath2 = relativePath.replace('../views/', '/') - pathMap.set(dbPath2, viewsModules[relativePath]) + pathMap.set(dbPath2, viewsModules[relativePath]!) // 3. 相对路径格式: newsCenter/companyNews/index.vue const relativePathFormat = relativePath.replace('../views/', '') - pathMap.set(relativePathFormat, viewsModules[relativePath]) + pathMap.set(relativePathFormat, viewsModules[relativePath]!) // 4. 原始相对路径也保留 - pathMap.set(relativePath, viewsModules[relativePath]) + pathMap.set(relativePath, viewsModules[relativePath]!) // 5. 如果路径包含 views/,也添加不带 views/ 的格式 if (relativePath.includes('views/')) { const withoutViews = relativePath.replace('../views/', '') if (withoutViews !== relativePathFormat) { - pathMap.set(withoutViews, viewsModules[relativePath]) + pathMap.set(withoutViews, viewsModules[relativePath]!) } } }) diff --git a/src/views/404/index.vue b/src/views/404/index.vue index 3dd4b52..9e93208 100644 --- a/src/views/404/index.vue +++ b/src/views/404/index.vue @@ -50,7 +50,8 @@ import darkImage from '@/assets/images/404/404-dark.png' import lightImage from '@/assets/images/404/404-light.gif' // 导入 jQuery 类型 -import type { JQueryStatic } from 'jquery' + +type JQueryStatic = any; // 声明 Modernizr 类型 interface ModernizrStatic { @@ -72,10 +73,6 @@ declare global { useRouter() const isDark = ref(false) -const toggleTheme = () => { - document.body.classList.toggle('dark-theme', isDark.value) -} - onMounted(() => { // Initialize theme document.body.classList.toggle('dark-theme', isDark.value) diff --git a/src/views/components/articleDetail.vue b/src/views/components/articleDetail.vue index d5b568f..dd0c739 100644 --- a/src/views/components/articleDetail.vue +++ b/src/views/components/articleDetail.vue @@ -139,14 +139,15 @@ import Footer from '@/views/components/footer.vue' import { getKingdeeNewsDetail, getCompanyNewsDetail } from '@/api/newscenter' const route = useRoute() -const article = ref({}) -const relatedArticles = ref([]) +const article = ref({}) +const relatedArticles = ref([]) const nextPreviousArticles = ref<{ previous?: { id: number; title: string } next?: { id: number; title: string } }>({}) const loading = ref(true) -const { proxy } = getCurrentInstance() +const instance = getCurrentInstance() +const proxy = instance?.proxy as any const router = useRouter() const contentRef = ref(null) const VITE_APP_API_URL = import.meta.env.VITE_APP_API_URL @@ -242,11 +243,11 @@ onMounted(async () => { const path = route.path if (path.includes('companyNews')) { - res = await getCompanyNewsDetail(id) + res = await getCompanyNewsDetail(id as string) } else if (path.includes('kingdeeNews')) { - res = await getKingdeeNewsDetail(id) + res = await getKingdeeNewsDetail(id as string) } else { - res = await getKingdeeNewsDetail(id) + res = await getKingdeeNewsDetail(id as string) } if (res.code === 200) { diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 29672da..1e8943e 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -150,7 +150,9 @@
行业解决方案 -   /  INDUSTRY SOLUTIONS + +   /  INDUSTRY SOLUTIONS +
@@ -215,18 +217,34 @@
-
-
-
-
+
+
+
+
- - {{ item.current }} - +{{ item.unit }} + + + {{ item.current }} + + + + {{ item.unit }}
- {{ item.label }} + {{ item.label }}
@@ -242,11 +260,10 @@
- +
-
@@ -305,18 +322,8 @@ const bannerSlides = [ }, ] -const swiperRef = ref() - -const onSwiper = (swiper: any) => { - swiperRef.value = swiper -} - -const onSlideChange = () => { - // console.log('slide change') -} - // 新闻数据 -const newsData = ref([]) +const newsData = ref([]) // 加载状态 const loading = ref(false) // 错误信息 @@ -385,7 +392,6 @@ const solutions = ref([ }, ]) - // 当前选中的新闻索引 const activeNewsIndex = ref(0) @@ -413,7 +419,6 @@ const stopAutoScroll = (): void => { } } onMounted(() => { - startAutoScroll() fetchNewsData() loadImagesWithOptions() @@ -424,21 +429,17 @@ const handleMoreNewsClick = () => { // console.log('more news clicked') } - -const partnerImages = ref([]) +const partnerImages = ref([]) // TODO 改为接口读取图片文件 const loadImagesWithOptions = async () => { try { // 如果需要过滤特定格式或处理 - const modules = import.meta.glob( - '/src/assets/images/indexImg/partner/*', - { - eager: true, - query: '?url', - import: 'default' - } - ) + const modules = import.meta.glob('/src/assets/images/indexImg/partner/*', { + eager: true, + query: '?url', + import: 'default', + }) const images = [] for (const path in modules) { @@ -468,8 +469,7 @@ const platformRef = ref(null) let observer: IntersectionObserver | null = null let hasAnimated = false - -const animateNumber = (item:object) => { +const animateNumber = (item: any) => { const step = Math.ceil(item.target / 40) const timer = setInterval(() => { item.current += step @@ -482,13 +482,13 @@ const animateNumber = (item:object) => { onMounted(() => { observer = new IntersectionObserver( - ([entry]) => { - if (entry.isIntersecting && !hasAnimated) { - hasAnimated = true - platformStats.value.forEach(animateNumber) - } - }, - { threshold: 0.3 } + ([entry]) => { + if (entry?.isIntersecting && !hasAnimated) { + hasAnimated = true + platformStats.value.forEach(animateNumber) + } + }, + { threshold: 0.3 }, ) if (platformRef.value) { @@ -499,7 +499,6 @@ onMounted(() => { onUnmounted(() => { observer?.disconnect() }) - diff --git a/src/views/newsCenter/components/detail.vue b/src/views/newsCenter/components/detail.vue index d1943a7..6003dcc 100644 --- a/src/views/newsCenter/components/detail.vue +++ b/src/views/newsCenter/components/detail.vue @@ -20,7 +20,7 @@ import Footer from '@/views/components/footer.vue' import { getKingdeeNewsDetail, getCompanyNewsDetail } from '@/api/newscenter' const route = useRoute() -const article = ref({}) +const article = ref({}) const loading = ref(true) onMounted(async () => { @@ -32,11 +32,11 @@ onMounted(async () => { const path = route.path if (path.includes('companyNews')) { - res = await getCompanyNewsDetail(id) + res = await getCompanyNewsDetail(id as string) } else if (path.includes('kingdeeNews')) { - res = await getKingdeeNewsDetail(id) + res = await getKingdeeNewsDetail(id as string) } else { - res = await getKingdeeNewsDetail(id) + res = await getKingdeeNewsDetail(id as string) } if (res.code === 200) { diff --git a/src/views/solution/index.vue b/src/views/solution/index.vue index c59e4b1..fbab230 100644 --- a/src/views/solution/index.vue +++ b/src/views/solution/index.vue @@ -1,74 +1,65 @@