Commit 4b48084612a2c58073be896cd310de35e20c8747
Merge branch 'local_dev_ft' into 'main_dev'
fix: DEFECT-1686 腾讯云发送时,红色提示修改为正确提示(阿里云和腾讯云各自参数提示) See merge request yunteng/thingskit-front!956
Showing
2 changed files
with
40 additions
and
2 deletions
| @@ -12,6 +12,8 @@ | @@ -12,6 +12,8 @@ | ||
| 12 | import { sendSms } from '/@/api/message/template'; | 12 | import { sendSms } from '/@/api/message/template'; |
| 13 | import { useMessage } from '/@/hooks/web/useMessage'; | 13 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 14 | import { phoneRule } from '/@/utils/rules'; | 14 | import { phoneRule } from '/@/utils/rules'; |
| 15 | + import { PlateFormTypeEnum } from './template.data'; | ||
| 16 | + | ||
| 15 | const schemas: FormSchema[] = [ | 17 | const schemas: FormSchema[] = [ |
| 16 | { | 18 | { |
| 17 | field: 'id', | 19 | field: 'id', |
| @@ -142,7 +144,38 @@ | @@ -142,7 +144,38 @@ | ||
| 142 | field: 'params', | 144 | field: 'params', |
| 143 | componentProps: { | 145 | componentProps: { |
| 144 | placeholder: | 146 | placeholder: |
| 145 | - platformType.value !== 'TENCENT_CLOUD' ? '示例:{"code":"1234"}' : '示例:["123456"]', | 147 | + platformType.value !== PlateFormTypeEnum.tencent_cound |
| 148 | + ? '示例:{"code":"1234"}' | ||
| 149 | + : '示例:["123456"]', | ||
| 150 | + }, | ||
| 151 | + dynamicRules: () => { | ||
| 152 | + return [ | ||
| 153 | + { | ||
| 154 | + required: true, | ||
| 155 | + validator: (_, value) => { | ||
| 156 | + try { | ||
| 157 | + if (typeof value == 'object') { | ||
| 158 | + return Promise.resolve(); | ||
| 159 | + } else { | ||
| 160 | + if (typeof JSON.parse(value) == 'object') { | ||
| 161 | + return Promise.resolve(); | ||
| 162 | + } | ||
| 163 | + return Promise.reject( | ||
| 164 | + platformType.value !== PlateFormTypeEnum.tencent_cound | ||
| 165 | + ? '请输入JSON格式例如{"code":"1234"}' | ||
| 166 | + : '请输入这种格式["123456"]' | ||
| 167 | + ); | ||
| 168 | + } | ||
| 169 | + } catch { | ||
| 170 | + return Promise.reject( | ||
| 171 | + platformType.value !== PlateFormTypeEnum.tencent_cound | ||
| 172 | + ? '请输入JSON格式例如{"code":"1234"}' | ||
| 173 | + : '请输入这种格式["123456"]' | ||
| 174 | + ); | ||
| 175 | + } | ||
| 176 | + }, | ||
| 177 | + }, | ||
| 178 | + ]; | ||
| 146 | }, | 179 | }, |
| 147 | }); | 180 | }); |
| 148 | await resetFields(); | 181 | await resetFields(); |
| @@ -154,7 +187,7 @@ | @@ -154,7 +187,7 @@ | ||
| 154 | async function handleOK() { | 187 | async function handleOK() { |
| 155 | let smsParams: any = null; | 188 | let smsParams: any = null; |
| 156 | const values = await validate(); | 189 | const values = await validate(); |
| 157 | - if (platformType.value === 'TENCENT_CLOUD') { | 190 | + if (platformType.value === PlateFormTypeEnum.tencent_cound) { |
| 158 | //腾讯云发送格式 将字符串转为数组 | 191 | //腾讯云发送格式 将字符串转为数组 |
| 159 | smsParams = { | 192 | smsParams = { |
| 160 | tencent_param: JSON.parse(Reflect.get(values, 'params')), | 193 | tencent_param: JSON.parse(Reflect.get(values, 'params')), |
| @@ -4,6 +4,11 @@ import { findDictItemByCode } from '/@/api/system/dict'; | @@ -4,6 +4,11 @@ import { findDictItemByCode } from '/@/api/system/dict'; | ||
| 4 | import { findMessageConfig } from '/@/api/message/config'; | 4 | import { findMessageConfig } from '/@/api/message/config'; |
| 5 | import { isMessage } from '/@/views/message/config/config.data'; | 5 | import { isMessage } from '/@/views/message/config/config.data'; |
| 6 | 6 | ||
| 7 | +export enum PlateFormTypeEnum { | ||
| 8 | + ali_cound = 'ALI_CLOUD', | ||
| 9 | + tencent_cound = 'TENCENT_CLOUD', | ||
| 10 | +} | ||
| 11 | + | ||
| 7 | export const columns: BasicColumn[] = [ | 12 | export const columns: BasicColumn[] = [ |
| 8 | { | 13 | { |
| 9 | title: '模板名称', | 14 | title: '模板名称', |