Skip to content

Commit

Permalink
fix: 修改json5 逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoxiaomumu committed Aug 9, 2018
1 parent d5adf87 commit 764de94
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -985,9 +985,9 @@ class InterfaceEditForm extends Component {
<span>JSON-SCHEMA:&nbsp;</span>
{getFieldDecorator('req_body_is_json_schema', {
valuePropName: 'checked',
initialValue: this.state.req_body_is_json_schema || projectMsg.is_json5
initialValue: this.state.req_body_is_json_schema || !projectMsg.is_json5
})(
<Switch checkedChildren="开" unCheckedChildren="关" disabled={projectMsg.is_json5} />
<Switch checkedChildren="开" unCheckedChildren="关" disabled={!projectMsg.is_json5} />
)}

<Col style={{ marginTop: '5px' }} className="interface-edit-json-info">
Expand Down Expand Up @@ -1054,12 +1054,12 @@ class InterfaceEditForm extends Component {
返回数据设置&nbsp;
{getFieldDecorator('res_body_is_json_schema', {
valuePropName: 'checked',
initialValue: this.state.res_body_is_json_schema || projectMsg.is_json5
initialValue: this.state.res_body_is_json_schema || !projectMsg.is_json5
})(
<Switch
checkedChildren="json-schema"
unCheckedChildren="json"
disabled={projectMsg.is_json5}
disabled={!projectMsg.is_json5}
/>
)}
</h2>
Expand Down
2 changes: 1 addition & 1 deletion server/controllers/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class projectController extends baseController {
color: params.color,
add_time: yapi.commons.time(),
up_time: yapi.commons.time(),
is_json5: true,
is_json5: false,
env: [{ name: 'local', domain: 'http://127.0.0.1' }]
};

Expand Down
2 changes: 1 addition & 1 deletion server/models/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class projectModel extends baseModel {
project_mock_script: String,
is_mock_open: { type: Boolean, default: false },
strice: { type: Boolean, default: false },
is_json5: { type: Boolean, default: false }
is_json5: { type: Boolean, default: true }
};
}

Expand Down

0 comments on commit 764de94

Please sign in to comment.