mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-09-12 16:40:40 +08:00
feat: 接入小程序链接与审核配置公开接口
- 友链接入:friend-links 双 tab(站点/小程序)、小程序详情弹窗(太阳码长按保存/地址复制/预览图轮播/作者信息)、申请收录弹窗(POST /submissions) - 审核配置接入:新增 getAuditData,移除旧 mockJson,9 页审核模式改为真实数据按 name 过滤,友链站点 tab 按 LinkGroup 过滤、小程序 tab 隐藏 - 修复:补 uni.getLocale mock、pages.json vitest alias、getI18nText 无占位符容错、getPostList 参数类型 Co-Authored-By: AtomCode (deepseek-v4-flash) <noreply@atomgit.com>
This commit is contained in:
@@ -8,7 +8,6 @@ import { onLoad } from '@dcloudio/uni-app'
|
||||
import { getQRCodeInfo } from '@/api/uni-halo'
|
||||
import { useAppConfigStore } from '@/store/appConfig'
|
||||
import { usePluginAvailable } from '@/utils/plugin'
|
||||
import { checkJsonAndParse } from '@/utils/json'
|
||||
|
||||
definePage({
|
||||
// 使用 type: "home" 属性设置首页,其他页面不需要设置,默认为page
|
||||
@@ -28,7 +27,7 @@ const articleDetailPath = '/pages-blog/article-detail/article-detail'
|
||||
// 本地开发快速跳转页面,发布请置为 false
|
||||
const DEV_MODE = false
|
||||
const DEV_TO_TYPE = 'page' as 'page' | 'tabbar'
|
||||
const DEV_TO_PATH = articleDetailPath + '?name=01a057b2-3200-74af-8afe-28a054092e82'
|
||||
const DEV_TO_PATH = `${articleDetailPath}?name=01a057b2-3200-74af-8afe-28a054092e82`
|
||||
|
||||
/* ---------------- 状态 ---------------- */
|
||||
const appConfigStore = useAppConfigStore()
|
||||
@@ -56,23 +55,9 @@ async function getPostIdByQRCode(key: string): Promise<string | null> {
|
||||
return null
|
||||
}
|
||||
|
||||
/** 处理审计模式 mock 数据 */
|
||||
async function handleAuditMode(res: Record<string, unknown>) {
|
||||
const auditConfig = (res?.auditConfig ?? {}) as {
|
||||
auditModeEnabled?: boolean
|
||||
auditModeData?: { jsonUrl?: string, jsonData?: string }
|
||||
}
|
||||
if (!auditConfig.auditModeEnabled)
|
||||
return
|
||||
if (auditConfig.auditModeData?.jsonUrl) {
|
||||
await appConfigStore.fetchMockJson()
|
||||
}
|
||||
else {
|
||||
const mockJson = checkJsonAndParse(auditConfig.auditModeData?.jsonData || '')
|
||||
if (mockJson.ok) {
|
||||
appConfigStore.setMockJson(mockJson.jsonData as Record<string, unknown>)
|
||||
}
|
||||
}
|
||||
/** 获取审核模式数据(公开接口 /audit-data,enabled 联动设置页开关) */
|
||||
async function handleAuditMode() {
|
||||
await appConfigStore.fetchAuditData()
|
||||
}
|
||||
|
||||
/** 启动页/首页分流 */
|
||||
@@ -140,8 +125,8 @@ onLoad(async (options) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 审计模式 mock
|
||||
await handleAuditMode(res as Record<string, unknown>)
|
||||
// 审计模式数据(公开接口 /audit-data)
|
||||
await handleAuditMode()
|
||||
|
||||
// 启动页分流
|
||||
handleCheckShowStarted()
|
||||
|
||||
Reference in New Issue
Block a user