/** * 配置接口模块 * Requirements: 2.1, 2.2, 3.2 */ import { get } from './request' /** * 获取首页配置(Banner和金刚位) * WHEN a user visits the home page, THE XiangYi_MiniApp SHALL display Banner images * WHEN a user visits the home page, THE XiangYi_MiniApp SHALL display KingKong navigation icons * Requirements: 2.1, 2.2 * * @returns {Promise} 首页配置,包含banners和kingKongs */ export async function getHomeConfig() { const response = await get('/config/home', {}, { needAuth: false }) return response } /** * 获取弹窗配置 * WHEN a user opens the XiangYi_MiniApp for the first time each day, * THE XiangYi_MiniApp SHALL display the daily popup * Requirements: 3.2 * * @param {number} popupType - 弹窗类型:1每日首次 2服务号关注 3会员广告 * @returns {Promise} 弹窗配置 */ export async function getPopupConfig(popupType = 1) { const response = await get('/config/popup', { popupType }) return response } /** * 获取所有弹窗配置 * * @returns {Promise} 弹窗配置列表 */ export async function getAllPopupConfigs() { const response = await get('/config/popups') return response } /** * 获取默认头像配置 * * @returns {Promise} 默认头像URL */ export async function getDefaultAvatarConfig() { const response = await get('/config/defaultAvatar', {}, { needAuth: false }) return response } export default { getHomeConfig, getPopupConfig, getAllPopupConfigs, getDefaultAvatarConfig }