This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
refactor(collection): 解决了 fieldType 原始类型为 string 导致问题类型判断不成功的问题 #49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
主要解决了两个问题
formItem['isRequired']
原始类型变为 Boolean 导致formItem['isRequired'] == 1
无法正确判断问题是否必填这会导致所有问题都被忽略
以及
formItem['fieldType']
原始类型为 String 导致if formItem['fieldType'] == 1 or formItem['fieldType'] == 5:
问题类型判断失效这会导致单选题被多选上传(未能正确进入对应代码块),非常严重
顺便,源代码在遍历 list 的同时修改了 list 的内容,这是十分危险的,因此顺便重构了一下,增强了鲁棒性