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
+39 -2
View File
@@ -82,7 +82,9 @@
</template>
<script>
import { ref, reactive } from 'vue'
import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
export default {
setup() {
@@ -102,13 +104,43 @@
]
const editorCtx = ref(null)
const editingIndex = ref(-1)
onLoad(() => {
const index = Number(uni.getStorageSync('selectIndex'))
editingIndex.value = Number.isInteger(index) ? index : -1
})
function isColor(color) {
return color === formats.color
}
async function toSuccess() {
// 保存逻辑
const cms = uni.getStorageSync('cms')
if (!cms || !Array.isArray(cms.cmsLst) || !editorCtx.value) return
editorCtx.value.getContents({
success: async ({ html = '', text = '', delta = { ops: [] } }) => {
if (!text.trim() && !html.trim()) {
uni.showToast({ title: '小标题不能为空', icon: 'none' })
return
}
const item = {
type: 'title',
text,
html,
delta
}
if (editingIndex.value >= 0 && cms.cmsLst[editingIndex.value]?.type === 'title') {
cms.cmsLst[editingIndex.value] = { ...cms.cmsLst[editingIndex.value], ...item }
} else {
const insertAt = Math.max(0, Number(uni.getStorageSync('selectIndex')) || 0)
cms.cmsLst.splice(insertAt, 0, item)
}
uni.setStorageSync('cms', cms)
await back()
},
fail: () => uni.showToast({ title: '读取编辑内容失败', icon: 'none' })
})
}
async function back() {
@@ -127,6 +159,11 @@
// #ifdef APP-PLUS || MP-WEIXIN || H5
uni.createSelectorQuery().select('#editor').context((res) => {
editorCtx.value = res.context
const cms = uni.getStorageSync('cms')
const item = editingIndex.value >= 0 ? cms?.cmsLst?.[editingIndex.value] : null
if (item?.type === 'title') {
editorCtx.value.setContents({ html: item.html || '', delta: item.delta || { ops: [] } })
}
}).exec()
// #endif
}