feat(config): 新增网站配置字段和自定义Hook

- 在cmsWebsiteField模型中新增deliveryText、guaranteeText和openComments三个字段
- 创建useConfig自定义Hook用于获取和管理网站配置数据
- 更新Banner组件中的默认轮播图高度从200px调整为300px- 修改Banner组件中热门商品列表项的右边距样式
- 在ArticleList组件中为map函数添加类型注解
- 移除IsDealer组件中旧的配置获取逻辑,改用新的useConfig Hook
- 删除src/pages/user_bak目录下的所有旧版用户相关组件文件
- 删除src/pages/user_bak目录下的配置文件和样式文件
This commit is contained in:
2025-09-29 17:07:48 +08:00
parent dd3d6b43a4
commit 5270cab7e9
22 changed files with 227 additions and 1061 deletions

View File

@@ -7,9 +7,11 @@ import {loginByOpenId} from "@/api/layout";
import {TenantId} from "@/config/app";
import {saveStorageByLoginUser} from "@/utils/server";
import {parseInviteParams, saveInviteParams, trackInviteSource, handleInviteRelation} from "@/utils/invite";
import {configWebsiteField} from "@/api/cms/cmsWebsiteField";
import { useConfig } from "@/hooks/useConfig"; // 引入新的自定义Hook
function App(props: { children: any; }) {
const { refetch: handleTheme } = useConfig(); // 使用新的Hook
const reload = () => {
Taro.login({
success: (res) => {
@@ -38,7 +40,7 @@ function App(props: { children: any; }) {
};
// 可以使用所有的 React Hooks
useEffect(() => {
// 设置主题
// 设置主题 (现在由useConfig Hook处理)
handleTheme()
// Taro.getSetting获取用户的当前设置。返回值中只会出现小程序已经向用户请求过的权限。
Taro.getSetting({
@@ -60,7 +62,7 @@ function App(props: { children: any; }) {
// 处理启动参数
const handleLaunchOptions = (options: any) => {
try {
console.log('=== 小程序启动参数处理开始 ===')
console.log('=== 小程 序启动参数处理开始 ===')
console.log('完整启动参数:', JSON.stringify(options, null, 2))
// 解析邀请参数
@@ -93,15 +95,6 @@ function App(props: { children: any; }) {
}
}
const handleTheme = () => {
configWebsiteField().then(data => {
// 设置主题
if(data.theme && !Taro.getStorageSync('user_theme')){
Taro.setStorageSync('user_theme', data.theme)
}
})
}
// 对应 onHide
useDidHide(() => {
})
@@ -109,4 +102,4 @@ function App(props: { children: any; }) {
return props.children
}
export default App
export default App