From 07eeb58d158449adf38d40f071da812990c206c7 Mon Sep 17 00:00:00 2001 From: zlwu <704541015@qq.com> Date: Tue, 11 Aug 2026 13:39:51 +0800 Subject: [PATCH] feat(mobile-oa-h5): implement oa-start page with form and flow preview Co-authored-by: Cursor --- .../src/oa/components/OaFlowPreview.vue | 364 ++++++++++++++++++ mobile-oa-h5/src/oa/schema-prep.js | 45 +++ mobile-oa-h5/src/router.js | 13 +- mobile-oa-h5/src/views/OaStart.vue | 346 +++++++++++++++++ 4 files changed, 761 insertions(+), 7 deletions(-) create mode 100644 mobile-oa-h5/src/oa/components/OaFlowPreview.vue create mode 100644 mobile-oa-h5/src/oa/schema-prep.js create mode 100644 mobile-oa-h5/src/views/OaStart.vue diff --git a/mobile-oa-h5/src/oa/components/OaFlowPreview.vue b/mobile-oa-h5/src/oa/components/OaFlowPreview.vue new file mode 100644 index 00000000..cad03b08 --- /dev/null +++ b/mobile-oa-h5/src/oa/components/OaFlowPreview.vue @@ -0,0 +1,364 @@ + + + + + diff --git a/mobile-oa-h5/src/oa/schema-prep.js b/mobile-oa-h5/src/oa/schema-prep.js new file mode 100644 index 00000000..44464865 --- /dev/null +++ b/mobile-oa-h5/src/oa/schema-prep.js @@ -0,0 +1,45 @@ +import { oaFormOption } from './form-option.js' + +function walkRules(rules, fn) { + const list = Array.isArray(rules) ? rules : [] + for (const r of list) { + if (!r || typeof r !== 'object') continue + fn(r) + if (Array.isArray(r.children)) walkRules(r.children, fn) + } +} + +/** 与 Web ensureOaUploadRuleProps 同思路的最小版 */ +export function ensureOaUploadRuleProps(rules) { + const next = JSON.parse(JSON.stringify(rules || [])) + walkRules(next, (r) => { + if (r.type === 'upload' || r.type === 'fcUpload') { + r.props = { ...(r.props || {}) } + if (r.props.limit == null) r.props.limit = 9 + } + }) + return next +} + +export function prepareMobileFormSchema(formSchemaJson) { + const schema = formSchemaJson || {} + const rawRule = Array.isArray(schema.rule) + ? schema.rule + : Array.isArray(schema) + ? schema + : [] + const rule = ensureOaUploadRuleProps(rawRule) + const option = { + ...oaFormOption, + ...(schema.option || {}), + form: { + ...(schema.option?.form || {}), + labelAlign: 'top', + inputAlign: 'left', + colon: false + }, + submitBtn: false, + resetBtn: false + } + return { rule, option } +} diff --git a/mobile-oa-h5/src/router.js b/mobile-oa-h5/src/router.js index 4d7108ee..faaf2f8f 100644 --- a/mobile-oa-h5/src/router.js +++ b/mobile-oa-h5/src/router.js @@ -1,16 +1,15 @@ import { createRouter, createWebHistory } from 'vue-router' import FormSink from './views/FormSink.vue' +import OaStart from './views/OaStart.vue' export default createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes: [ - { path: '/', redirect: '/oa-form-sink' }, - { path: '/oa-form-sink', component: FormSink }, { - path: '/oa-start', - component: { - template: '
oa-start 占位(阶段二)
' - } - } + path: '/', + redirect: (to) => ({ path: '/oa-form-sink', query: to.query, hash: to.hash }) + }, + { path: '/oa-form-sink', component: FormSink }, + { path: '/oa-start', component: OaStart } ] }) diff --git a/mobile-oa-h5/src/views/OaStart.vue b/mobile-oa-h5/src/views/OaStart.vue new file mode 100644 index 00000000..53219ae2 --- /dev/null +++ b/mobile-oa-h5/src/views/OaStart.vue @@ -0,0 +1,346 @@ + + + + +