Commit f7880dd7ea98c8a0cdf992fc72c344ffbeca5e84

Authored by loveumiko
1 parent a50efc3d

fix: 修复短信发送支持json格式校验,如果没有校验则不能发送

... ... @@ -37,7 +37,6 @@
37 37 const getBindProps = computed<Recordable>(() => {
38 38 const { value, apiTreeSelectProps = {} } = props;
39 39 const { params = {} } = apiTreeSelectProps;
40   - console.log(props, 'props');
41 40 return {
42 41 replaceFields: { children: 'children', key: 'id', title: 'name', value: 'id' },
43 42 getPopupContainer: () => document.body,
... ...
... ... @@ -78,6 +78,27 @@
78 78 componentProps: {
79 79 placeholder: '示例:{"code":"3654"}',
80 80 },
  81 + dynamicRules: () => {
  82 + return [
  83 + {
  84 + required: true,
  85 + validator: (_, value) => {
  86 + try {
  87 + if (typeof value == 'object') {
  88 + return Promise.resolve();
  89 + } else {
  90 + if (typeof JSON.parse(value) == 'object') {
  91 + return Promise.resolve();
  92 + }
  93 + return Promise.reject('请输入JSON格式例如{"code":"123"}');
  94 + }
  95 + } catch {
  96 + return Promise.reject('请输入JSON格式例如{"code":"123"}');
  97 + }
  98 + },
  99 + },
  100 + ];
  101 + },
81 102 },
82 103 {
83 104 field: 'remark',
... ...