diff --git a/uni-app/publish.cjs b/uni-app/publish.cjs index 1d918b678..7a1fb8e5b 100644 --- a/uni-app/publish.cjs +++ b/uni-app/publish.cjs @@ -71,23 +71,17 @@ const solve = () => { } const handleWeappAddonComponents = (mode) => { - const files = [ - `./dist/${mode}/mp-weixin/addon/components/diy/group/index.json`, - `./dist/${mode}/mp-weixin/app/pages/index/tabbar.json` - ] + const src = `./dist/${mode}/mp-weixin/addon/components/diy/group/index.json` + try { + const data = JSON.parse(fs.readFileSync(src, 'utf8')); + data.componentPlaceholder = {}; - files.forEach(src => { - try { - const data = JSON.parse(fs.readFileSync(src, 'utf8')); - data.componentPlaceholder = {}; - - Object.keys(data.usingComponents).map(key => { - data.componentPlaceholder[key] = "view"; - }) - fs.writeFileSync(src, JSON.stringify(data)) - } catch (err) { - } - }) + Object.keys(data.usingComponents).map(key => { + data.componentPlaceholder[key] = "view"; + }) + fs.writeFileSync(src, JSON.stringify(data)) + } catch (err) { + } } const handleWeappLanguage = (mode) => { diff --git a/uni-app/src/App.vue b/uni-app/src/App.vue index 91e435c7d..3e70c07b3 100644 --- a/uni-app/src/App.vue +++ b/uni-app/src/App.vue @@ -12,9 +12,18 @@ onLaunch((data: any) => { // 添加初始化拦截器 launchInterceptor() + const systemStore = useSystemStore() + + // 初始化全局数据 + const initGlobalData = () => { + systemStore.systemInfo = uni.getSystemInfoSync(); + systemStore.getMenuButtonInfoFn() + } + + initGlobalData() // #ifdef H5 - uni.getSystemInfoSync().platform == 'ios' && (uni.setStorageSync('initUrl', location.href)) + systemStore.systemInfo.platform == 'ios' && (uni.setStorageSync('initUrl', location.href)) // 传输给后台数据 window.parent.postMessage(JSON.stringify({ @@ -38,6 +47,8 @@ onLaunch((data: any) => { type: 'appOnReady', message: '加载完成' }), '*'); + // 更新全局数据 + initGlobalData() } } catch (e) { console.log('uni-app App.vue 接受数据错误', e) @@ -82,7 +93,7 @@ onLaunch((data: any) => { // #endif // 获取初始化数据信息 - useSystemStore().getInitFn(async() => { + useSystemStore().getInitFn(async () => { const configStore = useConfigStore() diff --git a/uni-app/src/addon/components/diy-form-detail/index.vue b/uni-app/src/addon/components/diy-form-detail/index.vue index e0e902ea6..ffdd6df3d 100644 --- a/uni-app/src/addon/components/diy-form-detail/index.vue +++ b/uni-app/src/addon/components/diy-form-detail/index.vue @@ -9,6 +9,7 @@ import { ref, reactive, onMounted } from 'vue'; import diyGroup from '@/addon/components/diy/group/index.vue' import { getFormRecord } from '@/app/api/diy_form'; +import { deepClone } from '@/utils/common' const props = defineProps(['record_id', 'completeLayout']); const emits = defineEmits(['callback']) @@ -17,20 +18,21 @@ const diyFormData: any = reactive({ global: {}, value: [] }) - onMounted(() => { getFormRecord({ record_id: props.record_id }).then((res: any) => { diyFormData.global.completeLayout = props.completeLayout || 'style-1'; - if (res.data.recordsFieldList) { + let recordsFieldList = deepClone(res.data.recordsFieldList) + if (recordsFieldList) { - res.data.recordsFieldList.forEach((item: any) => { + recordsFieldList.forEach((item: any) => { let comp = { id: item.field_key, componentName: item.field_type, pageStyle: '', viewFormDetail: true, // 查看表单详情标识 + componentIsShow: true, field: { name: item.field_name, value: item.handle_field_value, @@ -47,7 +49,7 @@ onMounted(() => { diyFormData.value.push(comp); }) } - emits('callback', res.data.recordsFieldList) + emits('callback', recordsFieldList) loading.value = false; }).catch(() => { loading.value = false; diff --git a/uni-app/src/addon/components/diy-form/index.vue b/uni-app/src/addon/components/diy-form/index.vue index a32becf60..c7717262a 100644 --- a/uni-app/src/addon/components/diy-form/index.vue +++ b/uni-app/src/addon/components/diy-form/index.vue @@ -1,8 +1,20 @@ @@ -30,12 +42,12 @@ const diyFormData: any = reactive({}) onMounted(() => { diy.getData(() => { diyFormData.status = diy.data.status; - if (diyFormData.status) { + if (diyFormData.status && requestData.value.error.length == 0) { diyFormData.title = diy.data.title; diyFormData.global = diy.data.global; if (diyFormData.global) { diyFormData.global.topStatusBar.isShow = false; // 顶部导航栏强制隐藏 - diyFormData.global.bottomTabBarSwitch = false; // 底部导航强制隐藏 + diyFormData.global.bottomTabBar.isShow = false; // 底部导航强制隐藏 } let value: any = []; if (props.form_border == 'none') { @@ -47,7 +59,7 @@ onMounted(() => { value.push(item); } }) - diyFormData.value = value; + diyFormData.value = deepClone(value); diyFormData.componentRefs = null; diyGroupRef.value?.refresh(); watchFormData(); @@ -95,6 +107,7 @@ const watchFormData = () => { const verify = () => { if (!diyFormData.status) return true; if (!diyFormData.value) return true; + if (!requestData.value || requestData.value.error?.length > 0) return true; let allPass = true; // 是否全部通过验证 let componentRefs = diyGroupRef.value.getFormRef().componentRefs; diff --git a/uni-app/src/addon/components/diy/group/index.vue b/uni-app/src/addon/components/diy/group/index.vue index b3e393a80..b1504ea81 100644 --- a/uni-app/src/addon/components/diy/group/index.vue +++ b/uni-app/src/addon/components/diy/group/index.vue @@ -3,125 +3,129 @@ - - +