From 15af5077b2977d56b60460e61128759440a1760d Mon Sep 17 00:00:00 2001 From: 3y Date: Wed, 1 Jun 2022 20:36:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=92=89=E9=92=89=E7=BE=A4?= =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BA=E7=9B=AE=E5=89=8D=E6=89=80=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=9A=84=E6=89=80=E6=9C=89=E6=B6=88=E6=81=AF=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 +- pages/crud-edit.json | 140 +++++++++++++++++++++++++++++++--- pages/crud-list.json | 176 +++++++++++++++++++++++++++++++++++++++++-- pages/crud-new.json | 137 +++++++++++++++++++++++++++++++-- pages/crud-view.json | 126 ++++++++++++++++++++++++++++++- requestHandler.md | 117 ++++++++++++++++++++++++++++ 6 files changed, 677 insertions(+), 26 deletions(-) create mode 100644 requestHandler.md diff --git a/README.md b/README.md index 19680ef..c670927 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ ## austin项目前端 -austin后端:[austin](https://gitee.com/zhongfucheng/austin) +austin后端Gitee:[austin](https://gitee.com/zhongfucheng/austin) +austin后端GitHub:[austin](https://gitee.com/zhongfucheng/austin) ## 快速开始 @@ -17,4 +18,6 @@ npm start ## 部署上线 -这个例子中的 amis 等依赖使用外部 cdn,为了稳定请在自己部署的时候将文件下载到本地。 \ No newline at end of file +这个例子中的 amis 等依赖使用外部 cdn,为了稳定请在自己部署的时候将文件下载到本地。 + + diff --git a/pages/crud-edit.json b/pages/crud-edit.json index 13a544d..4333dff 100644 --- a/pages/crud-edit.json +++ b/pages/crud-edit.json @@ -127,7 +127,6 @@ ], "required": true }, - { "type": "input-text", "label": "cron表达式", @@ -277,7 +276,6 @@ "clearValueOnHidden": false, "placeholder": "可用占位符{$content}" }, - { "type": "input-text", "label": "推送链接", @@ -326,7 +324,8 @@ "size": "lg", "clearValueOnHidden": false, "placeholder": "可用占位符{$content},可输入HTML" - }, { + }, + { "type": "select", "label": "企业微信应用", "name": "sendAccount", @@ -427,24 +426,143 @@ { "label": "图片", "value": "100" + }, + { + "label": "链接消息", + "value": "110" } ], - "visibleOn": "this.sendChannel == 70 ||this.sendChannel == 80 || this.sendChannel == 90 ", + "visibleOn": "this.sendChannel == 70 || this.sendChannel==90 ", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "name": "sendType", + "label": "发送类型", + "type": "radios", + "options": [ + { + "label": "文本(text)", + "value": "10" + }, + { + "label": "图文(FeedCard)", + "value": "40" + }, + { + "label": "markdown类型(markdown)", + "value": "80" + }, + { + "label": "链接消息(links)", + "value": "110" + }, + { + "label": "卡片消息(actionCard)", + "value": "120" + } + ], + "visibleOn": "this.sendChannel == 80", "clearValueOnHidden": false, "required": true, "size": "lg" }, { "type": "input-text", - "label": "群机器人内容", + "label": "钉钉标题", + "name": "title", + "required": true, + "visibleOn": "this.sendChannel == 80 && (this.sendType == 80 || this.sendType == 110 || this.sendType == 120 )", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$title}" + }, + { + "type": "input-text", + "label": "钉钉发送内容", "name": "content", "required": true, - "visibleOn": "this.sendChannel == 80 && this.sendType == 10", + "visibleOn": "this.sendChannel == 80 && (this.sendType == 10 || this.sendType == 80|| this.sendType == 110 || this.sendType == 120)", "size": "lg", "clearValueOnHidden": false, "placeholder": "可用占位符{$content}" - } - , + }, + { + "type": "radios", + "label": "按钮布局", + "name": "btnOrientation", + "visibleOn": "this.sendChannel == 80 && (this.sendType == 120)", + "options": [ + { + "label": "按钮竖直排列", + "value": "0" + }, + { + "label": "按钮横向排列", + "value": "1" + } + ] + }, + { + "type": "input-table", + "name": "btns", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 120)", + "columns": [ + { + "name": "title", + "label": "标题", + "placeholder": "可用占位符{$title}" + }, + { + "name": "actionURL", + "label": "跳转链接", + "placeholder": "可用占位符{$actionURL}" + } + ] + }, + { + "type": "input-text", + "label": "钉钉发送链接", + "name": "url", + "required": true, + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 110)", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "input-text", + "label": "钉钉图片链接", + "name": "picUrl", + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 110)", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$picUrl}" + }, + { + "type": "input-table", + "name": "feedCards", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 40)", + "columns": [ + { + "name": "title", + "label": "标题" + }, + { + "name": "messageURL", + "label": "跳转链接" + }, + { + "name": "picURL", + "label": "图片链接" + } + ] + }, { "type": "input-text", "label": "钉钉工作消息", @@ -469,6 +587,7 @@ "api": { "url": "http://localhost:8080/messageTemplate/save", "method": "post", + "requestAdaptor": "let jsonObj = {};\n\nlet content = JSON.parse(api.data.msgContent).content\nlet url = JSON.parse(api.data.msgContent).url\nlet title = JSON.parse(api.data.msgContent).title\nlet sendType = JSON.parse(api.data.msgContent).sendType\nlet picUrl = JSON.parse(api.data.msgContent).picUrl\n\n\n// push通知栏\nif(api.data.sendChannel == '20'){\n jsonObj.content = content\n jsonObj.url = url\n jsonObj.title = title\n}\n// 短信\nif(api.data.sendChannel == '30'){\n jsonObj.url = url\n jsonObj.content = content\n}\n// 邮件\nif(api.data.sendChannel == '40'){\n jsonObj.content = content\n jsonObj.title = title\n}\n// 企业微信\nif (api.data.sendChannel == '70') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n}\n// 钉钉机器人\nif (api.data.sendChannel == '80') {\n // 文本类型(text)\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 图文类型(FeedCard)\n if (sendType == '40') {\n jsonObj.sendType = sendType\n jsonObj.feedCards = JSON.stringify(api.data.feedCards)\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n }\n // 链接类型(link)\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.picUrl = picUrl\n jsonObj.url = url\n }\n // 卡片跳转(actionCard)\n if (sendType == '120') {\n jsonObj.title = title\n jsonObj.content = content\n jsonObj.btnOrientation = api.data.btnOrientation\n jsonObj.btns = JSON.stringify(api.data.btns)\n jsonObj.sendType = sendType\n }\n}\n// 钉钉工作消息\nif (api.data.sendChannel == '90') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n}\n\napi.data.msgContent = JSON.stringify(jsonObj)\nreturn api;", "data": { "name": "${name}", "idType": "${idType}", @@ -480,7 +599,7 @@ "sendAccount": "${sendAccount}", "cronCrowdPath": "${cronCrowdPath}", "shieldType": "${shieldType}", - "msgContent": "{\"content\":\"${content}\",\"url\":\"${url}\",\"title\":\"${title}\",\"sendType\":\"${sendType}\"}", + "msgContent": "{\"content\":\"${content}\",\"url\":\"${url}\",\"title\":\"${title}\",\"sendType\":\"${sendType}\",\"picUrl\":\"${picUrl}\"}", "id": "${id}", "flowId": "${flowId}", "msgStatus": "${msgStatus}", @@ -493,6 +612,9 @@ "isNightShield": "${isNightShield}", "created": "${created}", "updated": "${updated}", + "feedCards": "${feedCards}", + "btnOrientation": "${btnOrientation}", + "btns": "${btns}", "isDeleted": "${isDeleted}" } }, diff --git a/pages/crud-list.json b/pages/crud-list.json index 0c307df..279b16a 100644 --- a/pages/crud-list.json +++ b/pages/crud-list.json @@ -124,11 +124,14 @@ "api": { "url": "http://localhost:8080/messageTemplate/test", "method": "post", + "requestAdaptor": "let jsonObj = {};\n\nlet content = JSON.parse(api.data.msgContent).content\nlet url = JSON.parse(api.data.msgContent).url\nlet title = JSON.parse(api.data.msgContent).title\nlet sendType = JSON.parse(api.data.msgContent).sendType\nlet picUrl = JSON.parse(api.data.msgContent).picUrl\n\n\n// 钉钉机器人\nif (api.data.sendChannel == '80') {\n // 图文类型(FeedCard)\n if (sendType == '40') {\n jsonObj.feedCards = JSON.stringify(api.data.feedCards)\n api.data.msgContent = JSON.stringify(jsonObj)\n }\n}\n\n\nreturn api;", "data": { "id": "${id}", "name": "${name}", "receiver": "${receiver}", - "msgContent": "{\"content\":\"${content}\",\"url\":\"${url}\",\"title\":\"${title}\"}" + "sendChannel": "${sendChannel}", + "feedCards": "${feedCards}", + "msgContent": "{\"content\":\"${content}\",\"url\":\"${url}\",\"title\":\"${title}\",\"sendType\":\"${sendType}\",\"picUrl\":\"${picUrl}\"}" } }, "body": [ @@ -198,8 +201,103 @@ "visibleOn": "this.sendChannel == 20", "size": "lg", "clearValueOnHidden": true - } - , + }, + { + "name": "sendChannel", + "label": "发送渠道", + "type": "radios", + "options": [ + { + "label": "IM站内信", + "value": "10" + }, + { + "label": "PUSH通知栏", + "value": "20" + }, + { + "label": "短信", + "value": "30" + }, + { + "label": "邮箱", + "value": "40" + }, + { + "label": "服务号", + "value": "50" + }, + { + "label": "小程序", + "value": "60" + }, + { + "label": "企业微信", + "value": "70" + }, + { + "label": "钉钉群机器人", + "value": "80" + }, + { + "label": "钉钉应用消息", + "value": "90" + } + ], + "visibleOn": "this.sendChannel == 999999 ", + "required": true + }, + { + "name": "sendType", + "label": "发送类型", + "type": "radios", + "options": [ + { + "label": "文本", + "value": "10" + }, + { + "label": "语音", + "value": "20" + }, + { + "label": "视频", + "value": "30" + }, + { + "label": "图文", + "value": "40" + }, + { + "label": "文本卡片", + "value": "50" + }, + { + "label": "文件", + "value": "60" + }, + { + "label": "小程序通知", + "value": "70" + }, + { + "label": "markdown类型", + "value": "80" + }, + { + "label": "模板卡片", + "value": "90" + }, + { + "label": "图片", + "value": "100" + } + ], + "visibleOn": "this.sendChannel == 999999 ", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, { "type": "input-text", "label": "企业微信内容", @@ -211,12 +309,78 @@ }, { "type": "input-text", - "label": "钉钉机器人内容", + "label": "钉钉标题", + "name": "title", + "required": true, + "visibleOn": "this.sendChannel == 80 && (this.sendType == 80 || this.sendType == 110 || this.sendType == 120 )", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "钉钉发送内容", "name": "content", "required": true, - "visibleOn": "this.sendChannel == 80", + "visibleOn": "this.sendChannel == 80 && (this.sendType == 10 || this.sendType == 80|| this.sendType == 110 || this.sendType == 120)", "size": "lg", - "clearValueOnHidden": true + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "钉钉发送链接", + "name": "url", + "required": true, + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 110)", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "钉钉图片链接", + "name": "picUrl", + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 110)", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-table", + "name": "feedCards", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 40)", + "columns": [ + { + "name": "title", + "label": "标题" + }, + { + "name": "messageURL", + "label": "跳转链接" + }, + { + "name": "picURL", + "label": "图片链接" + } + ] + }, + { + "type": "input-table", + "name": "btns", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 120)", + "columns": [ + { + "name": "title", + "label": "标题", + "placeholder": "可用占位符{$title}" + }, + { + "name": "actionURL", + "label": "跳转链接", + "placeholder": "可用占位符{$actionURL}" + } + ] }, { "type": "input-text", diff --git a/pages/crud-new.json b/pages/crud-new.json index d7248cd..ba2e159 100644 --- a/pages/crud-new.json +++ b/pages/crud-new.json @@ -127,7 +127,6 @@ ], "required": true }, - { "type": "input-text", "label": "cron表达式", @@ -440,9 +439,44 @@ { "label": "图片", "value": "100" + }, + { + "label": "链接消息", + "value": "110" + } + ], + "visibleOn": "this.sendChannel == 70 || this.sendChannel==90 ", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "name": "sendType", + "label": "发送类型", + "type": "radios", + "options": [ + { + "label": "文本(text)", + "value": "10" + }, + { + "label": "图文(FeedCard)", + "value": "40" + }, + { + "label": "markdown类型(markdown)", + "value": "80" + }, + { + "label": "链接消息(links)", + "value": "110" + }, + { + "label": "卡片消息(actionCard)", + "value": "120" } ], - "visibleOn": "this.sendChannel == 70 ||this.sendChannel == 80 || this.sendChannel==90 ", + "visibleOn": "this.sendChannel == 80", "clearValueOnHidden": false, "required": true, "size": "lg" @@ -457,17 +491,104 @@ "clearValueOnHidden": false, "placeholder": "可用占位符{$content}" }, + { + "type": "input-text", + "label": "钉钉标题", + "name": "title", + "required": true, + "visibleOn": "this.sendChannel == 80 && (this.sendType == 80 || this.sendType == 110 || this.sendType == 120 )", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$title}" + }, { "type": "input-text", "label": "钉钉发送内容", "name": "content", "required": true, - "visibleOn": "this.sendChannel == 80 && this.sendType == 10", + "visibleOn": "this.sendChannel == 80 && (this.sendType == 10 || this.sendType == 80|| this.sendType == 110 || this.sendType == 120)", "size": "lg", "clearValueOnHidden": false, "placeholder": "可用占位符{$content}" - } - , + }, + { + "type": "radios", + "label": "按钮布局", + "name": "btnOrientation", + "visibleOn": "this.sendChannel == 80 && (this.sendType == 120)", + "options": [ + { + "label": "按钮竖直排列", + "value": "0" + }, + { + "label": "按钮横向排列", + "value": "1" + } + ] + }, + { + "type": "input-table", + "name": "btns", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 120)", + "columns": [ + { + "name": "title", + "label": "标题", + "placeholder": "可用占位符{$title}" + }, + { + "name": "actionURL", + "label": "跳转链接", + "placeholder": "可用占位符{$actionURL}" + } + ] + }, + { + "type": "input-text", + "label": "钉钉发送链接", + "name": "url", + "required": true, + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 110)", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "input-text", + "label": "钉钉图片链接", + "name": "picUrl", + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 110)", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$picUrl}" + }, + { + "type": "input-table", + "name": "feedCards", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 40)", + "columns": [ + { + "name": "title", + "label": "标题", + "placeholder": "可用占位符{$content}" + }, + { + "name": "messageURL", + "label": "跳转链接", + "placeholder": "可用占位符{$messageURL}" + }, + { + "name": "picURL", + "label": "图片链接", + "placeholder": "可用占位符{$picURL}" + } + ] + }, { "type": "input-text", "label": "钉钉工作消息", @@ -492,6 +613,7 @@ "api": { "url": "http://localhost:8080/messageTemplate/save", "method": "post", + "requestAdaptor":"let jsonObj = {};\n\nlet content = JSON.parse(api.data.msgContent).content\nlet url = JSON.parse(api.data.msgContent).url\nlet title = JSON.parse(api.data.msgContent).title\nlet sendType = JSON.parse(api.data.msgContent).sendType\nlet picUrl = JSON.parse(api.data.msgContent).picUrl\n\n\n// push通知栏\nif(api.data.sendChannel == '20'){\n jsonObj.content = content\n jsonObj.url = url\n jsonObj.title = title\n}\n// 短信\nif(api.data.sendChannel == '30'){\n jsonObj.url = url\n jsonObj.content = content\n}\n// 邮件\nif(api.data.sendChannel == '40'){\n jsonObj.content = content\n jsonObj.title = title\n}\n// 企业微信\nif (api.data.sendChannel == '70') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n}\n// 钉钉机器人\nif (api.data.sendChannel == '80') {\n // 文本类型(text)\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 图文类型(FeedCard)\n if (sendType == '40') {\n jsonObj.sendType = sendType\n jsonObj.feedCards = JSON.stringify(api.data.feedCards)\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n }\n // 链接类型(link)\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.picUrl = picUrl\n jsonObj.url = url\n }\n // 卡片跳转(actionCard)\n if (sendType == '120') {\n jsonObj.title = title\n jsonObj.content = content\n jsonObj.btnOrientation = api.data.btnOrientation\n jsonObj.btns = JSON.stringify(api.data.btns)\n jsonObj.sendType = sendType\n }\n}\n// 钉钉工作消息\nif (api.data.sendChannel == '90') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n}\n\napi.data.msgContent = JSON.stringify(jsonObj)\nreturn api;", "data": { "name": "${name}", "idType": "${idType}", @@ -503,7 +625,10 @@ "sendAccount": "${sendAccount}", "cronCrowdPath": "${cronCrowdPath}", "shieldType": "${shieldType}", - "msgContent": "{\"content\":\"${content}\",\"url\":\"${url}\",\"title\":\"${title}\",\"sendType\":\"${sendType}\"}" + "feedCards": "${feedCards}", + "btnOrientation": "${btnOrientation}", + "btns": "${btns}", + "msgContent": "{\"content\":\"${content}\",\"url\":\"${url}\",\"title\":\"${title}\",\"sendType\":\"${sendType}\",\"picUrl\":\"${picUrl}\"}" } } } diff --git a/pages/crud-view.json b/pages/crud-view.json index dfe6c3e..993d169 100644 --- a/pages/crud-view.json +++ b/pages/crud-view.json @@ -420,9 +420,44 @@ { "label": "图片", "value": "100" + }, + { + "label": "链接消息", + "value": "110" } ], - "visibleOn": "this.sendChannel == 70 ||this.sendChannel == 80 ||this.sendChannel == 90 ", + "visibleOn": "this.sendChannel == 70 || this.sendChannel==90 ", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "name": "sendType", + "label": "发送类型", + "type": "radios", + "options": [ + { + "label": "文本(text)", + "value": "10" + }, + { + "label": "图文(FeedCard)", + "value": "40" + }, + { + "label": "markdown类型(markdown)", + "value": "80" + }, + { + "label": "链接消息(links)", + "value": "110" + }, + { + "label": "卡片消息(actionCard)", + "value": "120" + } + ], + "visibleOn": "this.sendChannel == 80", "clearValueOnHidden": false, "required": true, "size": "lg" @@ -439,14 +474,99 @@ }, { "type": "input-text", - "label": "群机器人内容", + "label": "钉钉标题", + "name": "title", + "required": true, + "visibleOn": "this.sendChannel == 80 && (this.sendType == 80 || this.sendType == 110 || this.sendType == 120 )", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$title}" + }, + { + "type": "input-text", + "label": "钉钉发送内容", "name": "content", "required": true, - "visibleOn": "this.sendChannel == 80 && this.sendType == 10", + "visibleOn": "this.sendChannel == 80 && (this.sendType == 10 || this.sendType == 80|| this.sendType == 110 || this.sendType == 120)", "size": "lg", "clearValueOnHidden": false, "placeholder": "可用占位符{$content}" }, + { + "type": "radios", + "label": "按钮布局", + "name": "btnOrientation", + "visibleOn": "this.sendChannel == 80 && (this.sendType == 120)", + "options": [ + { + "label": "按钮竖直排列", + "value": "0" + }, + { + "label": "按钮横向排列", + "value": "1" + } + ] + }, + { + "type": "input-table", + "name": "btns", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 120)", + "columns": [ + { + "name": "title", + "label": "标题", + "placeholder": "可用占位符{$title}" + }, + { + "name": "actionURL", + "label": "跳转链接", + "placeholder": "可用占位符{$actionURL}" + } + ] + }, + { + "type": "input-text", + "label": "钉钉发送链接", + "name": "url", + "required": true, + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 110)", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "input-text", + "label": "钉钉图片链接", + "name": "picUrl", + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 110)", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$picUrl}" + }, + { + "type": "input-table", + "name": "feedCards", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 80 && ( this.sendType == 40)", + "columns": [ + { + "name": "title", + "label": "标题" + }, + { + "name": "messageURL", + "label": "跳转链接" + }, + { + "name": "picURL", + "label": "图片链接" + } + ] + }, { "type": "input-text", "label": "工作消息内容", diff --git a/requestHandler.md b/requestHandler.md new file mode 100644 index 0000000..5b828f8 --- /dev/null +++ b/requestHandler.md @@ -0,0 +1,117 @@ +## requestAdaptor + + +crud-edit.json 和 crud-new.json 所使用的适配器 +```javascript + +let jsonObj = {}; + +let content = JSON.parse(api.data.msgContent).content +let url = JSON.parse(api.data.msgContent).url +let title = JSON.parse(api.data.msgContent).title +let sendType = JSON.parse(api.data.msgContent).sendType +let picUrl = JSON.parse(api.data.msgContent).picUrl + + +// push通知栏 +if(api.data.sendChannel == '20'){ + jsonObj.content = content + jsonObj.url = url + jsonObj.title = title +} +// 短信 +if(api.data.sendChannel == '30'){ + jsonObj.url = url + jsonObj.content = content +} +// 邮件 +if(api.data.sendChannel == '40'){ + jsonObj.content = content + jsonObj.title = title +} +// 企业微信 +if (api.data.sendChannel == '70') { + // 文本类型 + if (sendType == '10') { + jsonObj.content = content + jsonObj.sendType = sendType + } +} +// 钉钉机器人 +if (api.data.sendChannel == '80') { + // 文本类型(text) + if (sendType == '10') { + jsonObj.content = content + jsonObj.sendType = sendType + } + // 图文类型(FeedCard) + if (sendType == '40') { + jsonObj.sendType = sendType + jsonObj.feedCards = JSON.stringify(api.data.feedCards) + } + // markdown类型(markdown) + if (sendType == '80') { + jsonObj.content = content + jsonObj.sendType = sendType + jsonObj.title = title + } + // 链接类型(link) + if (sendType == '110') { + jsonObj.content = content + jsonObj.sendType = sendType + jsonObj.title = title + jsonObj.picUrl = picUrl + jsonObj.url = url + } + // 卡片跳转(actionCard) + if (sendType == '120') { + jsonObj.title = title + jsonObj.content = content + jsonObj.btnOrientation = api.data.btnOrientation + jsonObj.btns = JSON.stringify(api.data.btns) + jsonObj.sendType = sendType + } +} +// 钉钉工作消息 +if (api.data.sendChannel == '90') { + // 文本类型 + if (sendType == '10') { + jsonObj.content = content + jsonObj.sendType = sendType + } +} + +api.data.msgContent = JSON.stringify(jsonObj) +return api; + +``` + + +crud-list.json 所使用的适配器 + +```javascript + +let jsonObj = {}; + +let content = JSON.parse(api.data.msgContent).content +let url = JSON.parse(api.data.msgContent).url +let title = JSON.parse(api.data.msgContent).title +let sendType = JSON.parse(api.data.msgContent).sendType +let picUrl = JSON.parse(api.data.msgContent).picUrl + + +// 钉钉机器人 +if (api.data.sendChannel == '80') { + // 图文类型(FeedCard) + if (sendType == '40') { + jsonObj.feedCards = JSON.stringify(api.data.feedCards) + api.data.msgContent = JSON.stringify(jsonObj) + } +} + + +return api; + + +``` +