diff --git a/src/api/cms/cmsAd/index.ts b/src/api/cms/cmsAd/index.ts index 9cd1dcc..a9b1ca7 100644 --- a/src/api/cms/cmsAd/index.ts +++ b/src/api/cms/cmsAd/index.ts @@ -100,3 +100,16 @@ export async function getCmsAd(id: number) { } return Promise.reject(new Error(res.message)); } + +/** + * 根据id查询广告位 + */ +export async function getCmsAdByCode(code: string) { + const res = await request.get>( + '/cms/cms-ad/getByCode/' + code + ); + if (res.code === 0 && res.data) { + return res.data; + } + return Promise.reject(new Error(res.message)); +} diff --git a/src/api/cms/cmsWebsiteField/model/index.ts b/src/api/cms/cmsWebsiteField/model/index.ts index 3a13b4a..d757a89 100644 --- a/src/api/cms/cmsWebsiteField/model/index.ts +++ b/src/api/cms/cmsWebsiteField/model/index.ts @@ -48,6 +48,7 @@ export interface Config { loginBgImg?: string; address?: string; tel?: string; + theme?: string; workDay?: string; kefu2?: string; kefu1?: string; diff --git a/src/api/shop/shopUserAddress/model/index.ts b/src/api/shop/shopUserAddress/model/index.ts index fff978c..9bf7f50 100644 --- a/src/api/shop/shopUserAddress/model/index.ts +++ b/src/api/shop/shopUserAddress/model/index.ts @@ -1,4 +1,4 @@ -import type { PageParam } from '@/api/index'; +import type { PageParam } from '@/api'; /** * 收货地址 diff --git a/src/app.ts b/src/app.ts index 9eba816..83dac88 100644 --- a/src/app.ts +++ b/src/app.ts @@ -6,7 +6,8 @@ import './app.scss' import {loginByOpenId} from "@/api/layout"; import {TenantId} from "@/config/app"; import {saveStorageByLoginUser} from "@/utils/server"; -import {parseInviteParams, saveInviteParams, trackInviteSource, handleInviteRelation, debugInviteInfo} from "@/utils/invite"; +import {parseInviteParams, saveInviteParams, trackInviteSource, handleInviteRelation} from "@/utils/invite"; +import {configWebsiteField} from "@/api/cms/cmsWebsiteField"; function App(props: { children: any; }) { const reload = () => { @@ -52,6 +53,7 @@ function App(props: { children: any; }) { // 处理小程序启动参数中的邀请信息 const options = Taro.getLaunchOptionsSync() handleLaunchOptions(options) + handleTheme() }) // 处理启动参数 @@ -80,10 +82,6 @@ function App(props: { children: any; }) { }) }, 1000) - // 打印调试信息 - setTimeout(() => { - debugInviteInfo() - }, 2000) } else { console.log('❌ 未检测到邀请参数') } @@ -94,6 +92,15 @@ 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(() => { })