feat: 打通 HBuilderX CLI 构建 + 修复文章闭环静态盲区

构建:
- 新增 tools/build.js:junction HBuilderX 工具链,CLI 构建 h5/mp-weixin
- vue 指向补丁版 @dcloudio/uni-h5-vue(官方 npm vue 不导出 isInSSRComponentSetup)
- 设 HX_APP_ROOT 避免退化成 H5 空壳产物;产物完整性校验

校验工具:
- 新增 check-cloud-methods.js:acorn 解析云对象方法,比对 94 处调用点
- 新增 check-android-contract.js:Kotlin 侧云对象契约校验
- audit-project.js 修 downloadFile 误报(注释未剥离);tools/ 排除出扫描
- package.json 声明此前隐式依赖的 acorn

功能:
- 补 uni-cms-articles.getPublishedArticles(安卓端依赖但此前不存在)
- 修 u-parse <audio> 引用已移除组件导致 H5 构建失败
This commit is contained in:
2026-09-12 01:02:45 +08:00
parent 4f5893f87a
commit 3117146281
26 changed files with 2043 additions and 337 deletions
+50 -23
View File
@@ -37,13 +37,13 @@
</view>
</view>
<view class="">
<view class="" v-for="(item, index) in cms.cmsLst" :key="index">
<u-parse
:content="item.html"
v-if="item.type === 'image' || item.type === 'video'">
</u-parse>
<view class="" v-for="(item, index) in (cms.cmsLst || [])" :key="index">
<u-parse
:content="itemHtml(item)"
v-if="item.type === 'text' || item.type === 'title'">
</u-parse>
<view class="" v-if="item.type === 'image'"
style="width: 100wv;margin-top: 30rpx;margin-bottom: 30rpx;">
style="width: 100vw;margin-top: 30rpx;margin-bottom: 30rpx;">
<cloud-image
width="100%"
height="500rpx"
@@ -52,7 +52,7 @@
</cloud-image>
</view>
<view class="" v-if="item.type === 'video'"
style="width: 100wv;margin-top: 30rpx;margin-bottom: 30rpx;">
style="width: 100vw;margin-top: 30rpx;margin-bottom: 30rpx;">
<video
style="width: 100%; height: 500rpx;"
:src="item.video.src"
@@ -166,7 +166,7 @@
<media-list
:dataType="'template'"
:pageSize="12"
:currentTemplate="updateTemplateConfig"
:currentTemplate="currentTemplate"
@update="updateTemplate"
/>
</view>
@@ -175,7 +175,7 @@
<media-list
:dataType="'music'"
:pageSize="12"
:currentTemplate="updateTemplateConfig"
:currentTemplate="currentTemplate"
@update="updateTemplate"
/>
</view>
@@ -235,8 +235,30 @@
const maskClick = ref(true)
const popFrom = ref('bottom')
const list = ref(new Array(20).fill(0))
const currentTemplate = ref("")
const saving = ref(false)
const currentTemplate = ref("")
const saving = ref(false)
function itemHtml(item) {
return item && typeof item.html === 'string' ? item.html : ''
}
function cmsLstToDelta(list) {
const ops = []
for (const item of Array.isArray(list) ? list : []) {
if (item.type === 'text' || item.type === 'title') {
const itemOps = item.delta && Array.isArray(item.delta.ops) ? item.delta.ops : (item.text ? [{ insert: item.text }] : [])
ops.push(...itemOps)
if (!ops.length || !String(ops[ops.length - 1].insert || '').endsWith('\n')) ops.push({ insert: '\n' })
} else if (item.type === 'image' && item.image?.src) {
ops.push({ insert: { image: item.image.src } }, { insert: '\n' })
} else if (item.type === 'video' && item.video?.src) {
ops.push({ insert: { video: item.video.src } }, { insert: '\n' })
} else if (item.type === 'vote' && item.vote?.voteTitle) {
ops.push({ insert: `${item.vote.voteTitle}\n` })
}
}
return { ops }
}
const tabbarText = ref([
{ text: "模板" },
@@ -272,12 +294,13 @@
return `${temp.value.icon_color};`
})
onShow(async () => {
let storedCms = uni.getStorageSync("cms")
titleContent.value = storedCms.title_html
cms.value = storedCms
await getTemp()
})
onShow(async () => {
const storedCms = uni.getStorageSync("cms") || { cmsLst: [], title_html: '' }
titleContent.value = storedCms.title_html || ''
cms.value = storedCms
currentTemplate.value = storedCms.temp_id || ''
await getTemp()
})
async function getTemp() {
if (currentTemplate.value === "not_image") {
@@ -378,10 +401,14 @@
thumbnail: storedCms.thumbnail,
p_type: storedCms.p_type,
category_id: storedCms.category_id,
temp_id: currentTemplate.value,
edit_type: "mobile",
cmsLst: storedCms.cmsLst,
excerpt: storedCms.excerpt || "",
temp_id: currentTemplate.value || storedCms.temp_id || "",
music_url_id: storedCms.music_url_id || {},
edit_type: "mobile",
cmsLst: storedCms.cmsLst || [],
content: storedCms.content && Array.isArray(storedCms.content.ops)
? storedCms.content
: cmsLstToDelta(storedCms.cmsLst),
excerpt: storedCms.excerpt || "",
article_status: articleStatus,
}
@@ -559,8 +586,8 @@
padding: 20rpx;
.cms-body {
display: flex;
min-height: 60hv;
width: 100wv;
min-height: 60vh;
width: 100vw;
}
}