Files
template-10582/src/pages/index/index.tsx
赵忠林 61025522aa refactor(style): 优化首页主要组件样式及布局实现
- 移除 BestSellers 组件中多余的 SCSS 样式,改用 TailwindCSS 工具类规范字体大小和颜色
- 替换 BestSellers.tsx 中对应元素的样式类为 TailwindCSS 实现,提升样式一致性和维护性
- 调整 CatalogShowcase 组件样式,删除不必要的 SCSS 样式,增加内边距并修改书本尺寸,整体优化布局
- CatalogShowcase.tsx 中相关文本和图形元素改为 TailwindCSS 实现,规范字体大小、颜色和间距
- ContactSection 组件部分样式移除过
2026-04-09 13:35:50 +08:00

138 lines
3.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Header from './Header';
import Taro from '@tarojs/taro';
import {useShareAppMessage, useShareTimeline} from "@tarojs/taro"
import {useEffect, useState} from "react";
import {getShopInfo} from "@/api/layout";
import {View, Text} from '@tarojs/components'
import Grid from "@/pages/index/Grid";
import Banner from "./Banner";
import PopUpAd from "@/pages/index/PopUpAd";
import TrustSection from "./TrustSection";
import ContactSection from "./ContactSection";
import CatalogShowcase from "./CatalogShowcase";
import {configWebsiteField} from "@/api/cms/cmsWebsiteField";
import type {Config} from "@/api/cms/cmsWebsiteField/model";
import './index.scss'
function Home() {
const [config, setConfig] = useState<Config>()
useShareTimeline(() => {
return {
title: '南南佐顿门窗 - 网宿软件',
path: `/pages/index/index`
};
});
useShareAppMessage(() => {
return {
title: '南南佐顿门窗 - 网宿软件',
path: `/pages/index/index`,
success: function () {
console.log('分享成功');
},
fail: function () {
console.log('分享失败');
}
};
});
const showAuthModal = () => {
Taro.showModal({
title: '授权提示',
content: '需要获取您的用户信息',
confirmText: '去授权',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
openSetting();
}
}
});
};
const openSetting = () => {
Taro.openSetting({
success: (res) => {
if (res.authSetting['scope.userInfo']) {
reload();
} else {
Taro.showToast({
title: '授权失败',
icon: 'none'
});
}
}
});
};
const reload = () => {
};
useEffect(() => {
getShopInfo().then(() => {})
configWebsiteField({}).then(data => {
setConfig(data)
})
Taro.getSetting({
success: (res) => {
if (res.authSetting['scope.userInfo']) {
console.log('用户已经授权过,可以直接获取用户信息')
reload();
} else {
console.log('用户未授权,需要弹出授权窗口')
showAuthModal();
}
}
});
Taro.getUserInfo({
success: (res) => {
const avatar = res.userInfo.avatarUrl;
console.log(avatar, 'avatarUrl')
}
});
}, []);
return (
<>
<Header/>
<View className={'home-page'}>
{/* ═══ Hero 区域Banner 融入头部渐变背景 ═══ */}
<View className={'hero-zone my-2'}>
<View className={'hero-banner-wrap'}>
<Banner />
</View>
{/* 功能菜单 — 直接铺在Banner下方无卡片包裹 */}
<View className={'hero-grid my-4'}>
<Grid />
</View>
</View>
{/* ═══ 滚动公告条 — 轻量嵌入 ═══ */}
{/*<View className={'notice-strip my-4'}>*/}
{/* <View className={'notice-strip__dot'} />*/}
{/* <Text className="text-15">*/}
{/* {config?.NoticeBar || '南南佐顿门窗专业门窗定制安装服务10年质保德国进口五金5000+家庭选择'}*/}
{/* </Text>*/}
{/*</View>*/}
{/* ═══ 品牌画册 — 沉浸式视觉卡片 ═══ */}
<CatalogShowcase />
{/* ═══ 品质信任区 — 横向滑动卡片 ═══ */}
<TrustSection />
{/* ═══ 联系我们 — 全宽底部 ═══ */}
<ContactSection />
</View>
<PopUpAd />
</>
)
}
export default Home