diff --git a/uni-app/src/App.vue b/uni-app/src/App.vue index 352ffd556..cfc2b7fd1 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,12 +47,15 @@ onLaunch((data: any) => { type: 'appOnReady', message: '加载完成' }), '*'); + // 更新全局数据 + initGlobalData() } } catch (e) { console.log('uni-app App.vue 接受数据错误', e) } }, false); + try { uni.hideTabBar() // 隐藏tabbar } catch (e) { @@ -79,7 +91,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..05aa0fbd1 100644 --- a/uni-app/src/addon/components/diy-form/index.vue +++ b/uni-app/src/addon/components/diy-form/index.vue @@ -1,8 +1,21 @@ @@ -30,12 +43,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 +60,7 @@ onMounted(() => { value.push(item); } }) - diyFormData.value = value; + diyFormData.value = deepClone(value); diyFormData.componentRefs = null; diyGroupRef.value?.refresh(); watchFormData(); @@ -95,6 +108,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..c6f65ff74 100644 --- a/uni-app/src/addon/components/diy/group/index.vue +++ b/uni-app/src/addon/components/diy/group/index.vue @@ -1,127 +1,130 @@