fix: 修复CheckboxField组件默认值处理和iframe传值openid逻辑
修复CheckboxField组件中未处理component_props为undefined的情况,确保默认值正确处理 调整iframe传值openid的获取位置,避免重复声明和逻辑错误
Showing
2 changed files
with
10 additions
and
9 deletions
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | * @Author: hookehuyr hookehuyr@gmail.com | 2 | * @Author: hookehuyr hookehuyr@gmail.com |
| 3 | * @Date: 2022-05-26 23:52:36 | 3 | * @Date: 2022-05-26 23:52:36 |
| 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 5 | - * @LastEditTime: 2025-06-04 16:34:33 | 5 | + * @LastEditTime: 2025-06-10 13:47:08 |
| 6 | * @FilePath: /data-table/src/App.vue | 6 | * @FilePath: /data-table/src/App.vue |
| 7 | * @Description: | 7 | * @Description: |
| 8 | --> | 8 | --> |
| ... | @@ -79,8 +79,10 @@ onMounted(async () => { | ... | @@ -79,8 +79,10 @@ onMounted(async () => { |
| 79 | const force_back = getUrlParams(location.href) ? getUrlParams(location.href).force_back : ''; // force_back=1 时,强制按照后台用户模式检查权限 | 79 | const force_back = getUrlParams(location.href) ? getUrlParams(location.href).force_back : ''; // force_back=1 时,强制按照后台用户模式检查权限 |
| 80 | const x_cycle = getUrlParams(location.href) ? getUrlParams(location.href).x_cycle : ''; // 周期ID标识 | 80 | const x_cycle = getUrlParams(location.href) ? getUrlParams(location.href).x_cycle : ''; // 周期ID标识 |
| 81 | const volunteer_source = getUrlParams(location.href) ? getUrlParams(location.href).volunteer_source : ''; // 义工来源 | 81 | const volunteer_source = getUrlParams(location.href) ? getUrlParams(location.href).volunteer_source : ''; // 义工来源 |
| 82 | + // iframe传值openid | ||
| 83 | + const iframe_openid = getUrlParams(location.href) ? getUrlParams(location.href).openid : ''; | ||
| 82 | // 数据收集设置 | 84 | // 数据收集设置 |
| 83 | - const { data } = await getFormSettingAPI({ form_code: code, page_type, data_id, flow_node_code, force_back, x_cycle, volunteer_source }); | 85 | + const { data } = await getFormSettingAPI({ form_code: code, page_type, data_id, flow_node_code, force_back, x_cycle, volunteer_source, openid: iframe_openid }); |
| 84 | const form_setting = {}; | 86 | const form_setting = {}; |
| 85 | if (data.length) { | 87 | if (data.length) { |
| 86 | Object.assign(form_setting, data[0]['property_list'], data[0]['extend']); | 88 | Object.assign(form_setting, data[0]['property_list'], data[0]['extend']); |
| ... | @@ -114,7 +116,6 @@ onMounted(async () => { | ... | @@ -114,7 +116,6 @@ onMounted(async () => { |
| 114 | // 没有授权判断 | 116 | // 没有授权判断 |
| 115 | let open_auth = form_setting.wxzq_enable && !form_setting.x_field_weixin_openid; | 117 | let open_auth = form_setting.wxzq_enable && !form_setting.x_field_weixin_openid; |
| 116 | // iframe传值openid | 118 | // iframe传值openid |
| 117 | - const iframe_openid = getUrlParams(location.href) ? getUrlParams(location.href).openid : ''; | ||
| 118 | if (iframe_openid) { // 如果获取到iframe传值openid 不再校验授权 | 119 | if (iframe_openid) { // 如果获取到iframe传值openid 不再校验授权 |
| 119 | open_auth = false; | 120 | open_auth = false; |
| 120 | } | 121 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-08-30 11:34:19 | 2 | * @Date: 2022-08-30 11:34:19 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-03-03 15:27:44 | 4 | + * @LastEditTime: 2025-06-10 14:21:45 |
| 5 | * @FilePath: /data-table/src/components/CheckboxField/index.vue | 5 | * @FilePath: /data-table/src/components/CheckboxField/index.vue |
| 6 | * @Description: 多项选择控件 | 6 | * @Description: 多项选择控件 |
| 7 | --> | 7 | --> |
| ... | @@ -35,7 +35,7 @@ | ... | @@ -35,7 +35,7 @@ |
| 35 | </template> | 35 | </template> |
| 36 | </van-checkbox> | 36 | </van-checkbox> |
| 37 | </van-config-provider> | 37 | </van-config-provider> |
| 38 | - <van-field v-if="checkbox_value.includes(x.value) && x.is_input" :name="'_' + item.key" @blur="onBlur(x)" v-model="x.affix" | 38 | + <van-field v-if="checkbox_value?.includes(x.value) && x.is_input" :name="'_' + item.key" @blur="onBlur(x)" v-model="x.affix" |
| 39 | label=" " label-width="5px" :placeholder="x.input_placeholder" :rules="x.input_required ? rules : ''" | 39 | label=" " label-width="5px" :placeholder="x.input_placeholder" :rules="x.input_required ? rules : ''" |
| 40 | :required="x.input_required" :readonly="item.component_props.readonly" class="affix-input" /> | 40 | :required="x.input_required" :readonly="item.component_props.readonly" class="affix-input" /> |
| 41 | </div> | 41 | </div> |
| ... | @@ -65,7 +65,7 @@ const themeVars = { | ... | @@ -65,7 +65,7 @@ const themeVars = { |
| 65 | }; | 65 | }; |
| 66 | onMounted(() => { | 66 | onMounted(() => { |
| 67 | // 默认值为数组 | 67 | // 默认值为数组 |
| 68 | - props.item.value = props.item.component_props.default; | 68 | + props.item.value = props.item.component_props?.default ? props.item.component_props.default : []; |
| 69 | }); | 69 | }); |
| 70 | // 隐藏显示 | 70 | // 隐藏显示 |
| 71 | const HideShow = computed(() => { | 71 | const HideShow = computed(() => { |
| ... | @@ -94,7 +94,7 @@ const validatorMessage = (val, rule) => { | ... | @@ -94,7 +94,7 @@ const validatorMessage = (val, rule) => { |
| 94 | const rules = [{ validator, message: validatorMessage }]; | 94 | const rules = [{ validator, message: validatorMessage }]; |
| 95 | 95 | ||
| 96 | const emit = defineEmits(["active"]); | 96 | const emit = defineEmits(["active"]); |
| 97 | -const checkbox_value = ref(props.item.component_props.default); | 97 | +const checkbox_value = ref(props.item.component_props?.default); |
| 98 | const affix_value = ref({}); | 98 | const affix_value = ref({}); |
| 99 | 99 | ||
| 100 | const onClick = (item) => { | 100 | const onClick = (item) => { |
| ... | @@ -139,8 +139,8 @@ const handleEmit = (item) => { | ... | @@ -139,8 +139,8 @@ const handleEmit = (item) => { |
| 139 | } | 139 | } |
| 140 | onMounted(() => { | 140 | onMounted(() => { |
| 141 | // TAG:默认值处理 | 141 | // TAG:默认值处理 |
| 142 | - let arr = props.item.component_props.default; | 142 | + let arr = props.item.component_props.default ? props.item.component_props.default : []; |
| 143 | - let hasColonSome = arr.some(item => item.includes(':')); // 检查是否有元素包含冒号 | 143 | + let hasColonSome = arr?.some(item => item.includes(':')); // 检查是否有元素包含冒号 |
| 144 | if (hasColonSome) { // 带补充信息输入框 | 144 | if (hasColonSome) { // 带补充信息输入框 |
| 145 | // 提取冒号前的部分生成新的数组 | 145 | // 提取冒号前的部分生成新的数组 |
| 146 | let titles = arr.map(item => { | 146 | let titles = arr.map(item => { | ... | ... |
-
Please register or login to post a comment