From 7eb1e43e10e5aab83a945a37d588d30d19188e39 Mon Sep 17 00:00:00 2001 From: 3y Date: Tue, 7 Jun 2022 20:11:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=92=89=E9=92=89=E5=B7=A5=E4=BD=9C=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=94=AF=E6=8C=81=E5=90=84=E7=A7=8D=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/crud-edit.json | 194 ++++++++++++++++++++++++++++++++++++++++++- pages/crud-list.json | 117 +++++++++++++++++++++++++- pages/crud-new.json | 194 ++++++++++++++++++++++++++++++++++++++++++- pages/crud-view.json | 185 ++++++++++++++++++++++++++++++++++++++++- requestHandler.md | 55 ++++++++++++ 5 files changed, 730 insertions(+), 15 deletions(-) diff --git a/pages/crud-edit.json b/pages/crud-edit.json index 4333dff..dd1f6a9 100644 --- a/pages/crud-edit.json +++ b/pages/crud-edit.json @@ -432,7 +432,50 @@ "value": "110" } ], - "visibleOn": "this.sendChannel == 70 || this.sendChannel==90 ", + "visibleOn": "this.sendChannel == 70 ", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "name": "sendType", + "label": "发送类型", + "type": "radios", + "options": [ + { + "label": "文本(text)", + "value": "10" + }, + { + "label": "语音(voice)", + "value": "20" + }, + { + "label": "文件(file)", + "value": "60" + }, + { + "label": "markdown类型(markdown)", + "value": "80" + }, + { + "label": "图片(image)", + "value": "100" + }, + { + "label": "链接消息(link)", + "value": "110" + }, + { + "label": "卡片消息(action_card)", + "value": "120" + }, + { + "label": "OA消息(oa)", + "value": "130" + } + ], + "visibleOn": "this.sendChannel==90 ", "clearValueOnHidden": false, "required": true, "size": "lg" @@ -565,13 +608,149 @@ }, { "type": "input-text", - "label": "钉钉工作消息", + "label": "消息标题", + "name": "title", + "required": true, + "visibleOn": "this.sendChannel == 90 && (this.sendType == 110 || this.sendType == 80 ||this.sendType == 120 )", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$title}" + }, + { + "type": "input-text", + "label": "消息内容", "name": "content", "required": true, - "visibleOn": "this.sendChannel == 90 && this.sendType == 10", + "visibleOn": "this.sendChannel == 90 && (this.sendType == 10 || this.sendType == 110 || this.sendType == 80 ||this.sendType == 120)", "size": "lg", "clearValueOnHidden": false, "placeholder": "可用占位符{$content}" + }, + { + "type": "input-text", + "label": "语音Id", + "name": "media_id", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 20", + "size": "lg", + "placeholder": "可用占位符{$media_id}", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "语音时长", + "name": "duration", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 20", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "正整数,小于60,表示音频时长" + }, + { + "type": "input-text", + "label": "文件Id", + "name": "media_id", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 60", + "size": "lg", + "placeholder": "可用占位符{$media_id}", + "clearValueOnHidden": false + }, + { + "type": "radios", + "label": "按钮布局", + "name": "btnOrientation", + "visibleOn": "this.sendChannel == 90 && (this.sendType == 120)", + "options": [ + { + "label": "按钮竖直排列", + "value": "0" + }, + { + "label": "按钮横向排列", + "value": "1" + } + ] + }, + { + "type": "input-table", + "name": "btns", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 90 && ( this.sendType == 120)", + "columns": [ + { + "name": "title", + "label": "标题", + "placeholder": "可用占位符{$title}" + }, + { + "name": "action_url", + "label": "跳转链接", + "placeholder": "可用占位符{$action_url}" + } + ] + }, + { + "type": "input-text", + "label": "头部标题", + "name": "dingDingOaHeadTitle", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "头部标题颜色", + "name": "dingDingOaHeadBgColor", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "页面跳转链接", + "name": "url", + "required": true, + "visibleOn": "this.sendChannel == 90 && (this.sendType == 110 || this.sendType == 130)", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "input-text", + "label": "正文标题", + "name": "dingDingOaTitle", + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "正文内容", + "name": "dingDingOaContent", + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "图片Id", + "name": "media_id", + "visibleOn": "this.sendChannel == 90 && (this.sendType == 100 || this.sendType == 110|| this.sendType == 130)", + "size": "lg", + "placeholder": "可用占位符{$media_id}", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "作者名称", + "name": "dingDingOaAuthor", + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false } ], "className": "", @@ -587,7 +766,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;", + "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 if (sendType == '20') {\n jsonObj.sendType = sendType\n jsonObj.duration = api.data.duration\n jsonObj.media_id = api.data.media_id\n }\n // 文件类型 || 图片类型\n if (sendType == '60' || sendType == '100') {\n jsonObj.sendType = sendType\n jsonObj.media_id = api.data.media_id\n }\n // 链接类型\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.media_id = api.data.media_id\n jsonObj.url = url\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\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 // OA(actionCard)\n if (sendType == '130') {\n \n // 头部\n var head = {}\n head.bgcolor = api.data.dingDingOaHeadBgColor\n head.text = api.data.dingDingOaHeadTitle\n jsonObj.dingDingOaHead = head\n \n // body\n var body = {}\n body.title = api.data.dingDingOaTitle\n body.content = api.data.dingDingOaContent\n body.image = api.data.media_id\n body.author = api.data.dingDingOaAuthor\n jsonObj.dingDingOaBody = body\n \n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n }\n}\n\napi.data.msgContent = JSON.stringify(jsonObj)", "data": { "name": "${name}", "idType": "${idType}", @@ -615,6 +794,13 @@ "feedCards": "${feedCards}", "btnOrientation": "${btnOrientation}", "btns": "${btns}", + "media_id": "${media_id}", + "duration": "${duration}", + "dingDingOaHeadTitle": "${dingDingOaHeadTitle}", + "dingDingOaHeadBgColor": "${dingDingOaHeadBgColor}", + "dingDingOaTitle": "${dingDingOaTitle}", + "dingDingOaContent": "${dingDingOaContent}", + "dingDingOaAuthor": "${dingDingOaAuthor}", "isDeleted": "${isDeleted}" } }, diff --git a/pages/crud-list.json b/pages/crud-list.json index 279b16a..630e65b 100644 --- a/pages/crud-list.json +++ b/pages/crud-list.json @@ -384,12 +384,121 @@ }, { "type": "input-text", - "label": "钉钉工作消息内容", + "label": "消息标题", + "name": "title", + "visibleOn": "this.sendChannel == 90 && (this.sendType == 110 || this.sendType == 80 ||this.sendType == 120 )", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "消息内容", "name": "content", - "required": true, - "visibleOn": "this.sendChannel == 90", + "visibleOn": "this.sendChannel == 90 && (this.sendType == 10 || this.sendType == 110 || this.sendType == 80 ||this.sendType == 120)", "size": "lg", - "clearValueOnHidden": true + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "语音Id", + "name": "media_id", + "visibleOn": "this.sendChannel == 90 && this.sendType == 20", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "语音时长", + "name": "duration", + "visibleOn": "this.sendChannel == 90 && this.sendType == 20", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "文件Id", + "name": "media_id", + "visibleOn": "this.sendChannel == 90 && this.sendType == 60", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-table", + "name": "btns", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 90 && ( this.sendType == 120)", + "columns": [ + { + "name": "title", + "label": "标题" + }, + { + "name": "action_url", + "label": "跳转链接" + } + ] + }, + { + "type": "input-text", + "label": "头部标题", + "name": "dingDingOaHeadTitle", + + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "头部标题颜色", + "name": "dingDingOaHeadBgColor", + + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "页面跳转链接", + "name": "url", + + "visibleOn": "this.sendChannel == 90 && (this.sendType == 110 || this.sendType == 130)", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "input-text", + "label": "正文标题", + "name": "dingDingOaTitle", + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "正文内容", + "name": "dingDingOaContent", + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "图片Id", + "name": "media_id", + "visibleOn": "this.sendChannel == 90 && (this.sendType == 100 || this.sendType == 110|| this.sendType == 130)", + "size": "lg", + "placeholder": "可用占位符{$media_id}", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "作者名称", + "name": "dingDingOaAuthor", + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false } ] } diff --git a/pages/crud-new.json b/pages/crud-new.json index ba2e159..d1b8cb5 100644 --- a/pages/crud-new.json +++ b/pages/crud-new.json @@ -445,7 +445,50 @@ "value": "110" } ], - "visibleOn": "this.sendChannel == 70 || this.sendChannel==90 ", + "visibleOn": "this.sendChannel == 70 ", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "name": "sendType", + "label": "发送类型", + "type": "radios", + "options": [ + { + "label": "文本(text)", + "value": "10" + }, + { + "label": "语音(voice)", + "value": "20" + }, + { + "label": "文件(file)", + "value": "60" + }, + { + "label": "markdown类型(markdown)", + "value": "80" + }, + { + "label": "图片(image)", + "value": "100" + }, + { + "label": "链接消息(link)", + "value": "110" + }, + { + "label": "卡片消息(action_card)", + "value": "120" + }, + { + "label": "OA消息(oa)", + "value": "130" + } + ], + "visibleOn": "this.sendChannel==90 ", "clearValueOnHidden": false, "required": true, "size": "lg" @@ -591,13 +634,149 @@ }, { "type": "input-text", - "label": "钉钉工作消息", + "label": "消息标题", + "name": "title", + "required": true, + "visibleOn": "this.sendChannel == 90 && (this.sendType == 110 || this.sendType == 80 ||this.sendType == 120 )", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$title}" + }, + { + "type": "input-text", + "label": "消息内容", "name": "content", "required": true, - "visibleOn": "this.sendChannel == 90 && this.sendType == 10", + "visibleOn": "this.sendChannel == 90 && (this.sendType == 10 || this.sendType == 110 || this.sendType == 80 ||this.sendType == 120)", "size": "lg", "clearValueOnHidden": false, "placeholder": "可用占位符{$content}" + }, + { + "type": "input-text", + "label": "语音Id", + "name": "media_id", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 20", + "size": "lg", + "placeholder": "可用占位符{$media_id}", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "语音时长", + "name": "duration", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 20", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "正整数,小于60,表示音频时长" + }, + { + "type": "input-text", + "label": "文件Id", + "name": "media_id", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 60", + "size": "lg", + "placeholder": "可用占位符{$media_id}", + "clearValueOnHidden": false + }, + { + "type": "radios", + "label": "按钮布局", + "name": "btnOrientation", + "visibleOn": "this.sendChannel == 90 && (this.sendType == 120)", + "options": [ + { + "label": "按钮竖直排列", + "value": "0" + }, + { + "label": "按钮横向排列", + "value": "1" + } + ] + }, + { + "type": "input-table", + "name": "btns", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 90 && ( this.sendType == 120)", + "columns": [ + { + "name": "title", + "label": "标题", + "placeholder": "可用占位符{$title}" + }, + { + "name": "action_url", + "label": "跳转链接", + "placeholder": "可用占位符{$action_url}" + } + ] + }, + { + "type": "input-text", + "label": "头部标题", + "name": "dingDingOaHeadTitle", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "头部标题颜色", + "name": "dingDingOaHeadBgColor", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "页面跳转链接", + "name": "url", + "required": true, + "visibleOn": "this.sendChannel == 90 && (this.sendType == 110 || this.sendType == 130)", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "input-text", + "label": "正文标题", + "name": "dingDingOaTitle", + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "正文内容", + "name": "dingDingOaContent", + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "图片Id", + "name": "media_id", + "visibleOn": "this.sendChannel == 90 && (this.sendType == 100 || this.sendType == 110|| this.sendType == 130)", + "size": "lg", + "placeholder": "可用占位符{$media_id}", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "作者名称", + "name": "dingDingOaAuthor", + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false } ], "className": "", @@ -613,7 +792,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;", + "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 if (sendType == '20') {\n jsonObj.sendType = sendType\n jsonObj.duration = api.data.duration\n jsonObj.media_id = api.data.media_id\n }\n // 文件类型 || 图片类型\n if (sendType == '60' || sendType == '100') {\n jsonObj.sendType = sendType\n jsonObj.media_id = api.data.media_id\n }\n // 链接类型\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.media_id = api.data.media_id\n jsonObj.url = url\n }\n // markdown类型(markdown)\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\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 // OA(actionCard)\n if (sendType == '130') {\n \n // 头部\n var head = {}\n head.bgcolor = api.data.dingDingOaHeadBgColor\n head.text = api.data.dingDingOaHeadTitle\n jsonObj.dingDingOaHead = head\n \n // body\n var body = {}\n body.title = api.data.dingDingOaTitle\n body.content = api.data.dingDingOaContent\n body.image = api.data.media_id\n body.author = api.data.dingDingOaAuthor\n jsonObj.dingDingOaBody = body\n \n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n }\n}\n\napi.data.msgContent = JSON.stringify(jsonObj)", "data": { "name": "${name}", "idType": "${idType}", @@ -628,6 +807,13 @@ "feedCards": "${feedCards}", "btnOrientation": "${btnOrientation}", "btns": "${btns}", + "media_id": "${media_id}", + "duration": "${duration}", + "dingDingOaHeadTitle": "${dingDingOaHeadTitle}", + "dingDingOaHeadBgColor": "${dingDingOaHeadBgColor}", + "dingDingOaTitle": "${dingDingOaTitle}", + "dingDingOaContent": "${dingDingOaContent}", + "dingDingOaAuthor": "${dingDingOaAuthor}", "msgContent": "{\"content\":\"${content}\",\"url\":\"${url}\",\"title\":\"${title}\",\"sendType\":\"${sendType}\",\"picUrl\":\"${picUrl}\"}" } } diff --git a/pages/crud-view.json b/pages/crud-view.json index 993d169..22215fa 100644 --- a/pages/crud-view.json +++ b/pages/crud-view.json @@ -426,7 +426,50 @@ "value": "110" } ], - "visibleOn": "this.sendChannel == 70 || this.sendChannel==90 ", + "visibleOn": "this.sendChannel == 70 ", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "name": "sendType", + "label": "发送类型", + "type": "radios", + "options": [ + { + "label": "文本(text)", + "value": "10" + }, + { + "label": "语音(voice)", + "value": "20" + }, + { + "label": "文件(file)", + "value": "60" + }, + { + "label": "markdown类型(markdown)", + "value": "80" + }, + { + "label": "图片(image)", + "value": "100" + }, + { + "label": "链接消息(link)", + "value": "110" + }, + { + "label": "卡片消息(action_card)", + "value": "120" + }, + { + "label": "OA消息(oa)", + "value": "130" + } + ], + "visibleOn": "this.sendChannel==90 ", "clearValueOnHidden": false, "required": true, "size": "lg" @@ -569,13 +612,149 @@ }, { "type": "input-text", - "label": "工作消息内容", + "label": "消息标题", + "name": "title", + "required": true, + "visibleOn": "this.sendChannel == 90 && (this.sendType == 110 || this.sendType == 80 ||this.sendType == 120 )", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$title}" + }, + { + "type": "input-text", + "label": "消息内容", "name": "content", "required": true, - "visibleOn": "this.sendChannel == 90 && this.sendType == 10", + "visibleOn": "this.sendChannel == 90 && (this.sendType == 10 || this.sendType == 110 || this.sendType == 80 ||this.sendType == 120)", "size": "lg", "clearValueOnHidden": false, "placeholder": "可用占位符{$content}" + }, + { + "type": "input-text", + "label": "语音Id", + "name": "media_id", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 20", + "size": "lg", + "placeholder": "可用占位符{$media_id}", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "语音时长", + "name": "duration", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 20", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "正整数,小于60,表示音频时长" + }, + { + "type": "input-text", + "label": "文件Id", + "name": "media_id", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 60", + "size": "lg", + "placeholder": "可用占位符{$media_id}", + "clearValueOnHidden": false + }, + { + "type": "radios", + "label": "按钮布局", + "name": "btnOrientation", + "visibleOn": "this.sendChannel == 90 && (this.sendType == 120)", + "options": [ + { + "label": "按钮竖直排列", + "value": "0" + }, + { + "label": "按钮横向排列", + "value": "1" + } + ] + }, + { + "type": "input-table", + "name": "btns", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 90 && ( this.sendType == 120)", + "columns": [ + { + "name": "title", + "label": "标题", + "placeholder": "可用占位符{$title}" + }, + { + "name": "action_url", + "label": "跳转链接", + "placeholder": "可用占位符{$action_url}" + } + ] + }, + { + "type": "input-text", + "label": "头部标题", + "name": "dingDingOaHeadTitle", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "头部标题颜色", + "name": "dingDingOaHeadBgColor", + "required": true, + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "页面跳转链接", + "name": "url", + "required": true, + "visibleOn": "this.sendChannel == 90 && (this.sendType == 110 || this.sendType == 130)", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "input-text", + "label": "正文标题", + "name": "dingDingOaTitle", + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "正文内容", + "name": "dingDingOaContent", + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "图片Id", + "name": "media_id", + "visibleOn": "this.sendChannel == 90 && (this.sendType == 100 || this.sendType == 110|| this.sendType == 130)", + "size": "lg", + "placeholder": "可用占位符{$media_id}", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "作者名称", + "name": "dingDingOaAuthor", + "visibleOn": "this.sendChannel == 90 && this.sendType == 130", + "size": "lg", + "clearValueOnHidden": false } ], "className": "", diff --git a/requestHandler.md b/requestHandler.md index 5b828f8..6ae79e8 100644 --- a/requestHandler.md +++ b/requestHandler.md @@ -79,6 +79,61 @@ if (api.data.sendChannel == '90') { jsonObj.content = content jsonObj.sendType = sendType } + // 语音类型 + if (sendType == '20') { + jsonObj.sendType = sendType + jsonObj.duration = api.data.duration + jsonObj.media_id = api.data.media_id + } + // 文件类型 || 图片类型 + if (sendType == '60' || sendType == '100') { + jsonObj.sendType = sendType + jsonObj.media_id = api.data.media_id + } + // 链接类型 + if (sendType == '110') { + jsonObj.content = content + jsonObj.sendType = sendType + jsonObj.title = title + jsonObj.media_id = api.data.media_id + jsonObj.url = url + } + // markdown类型(markdown) + if (sendType == '80') { + jsonObj.content = content + jsonObj.sendType = sendType + jsonObj.title = title + } + // 卡片跳转(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 + } + + // OA(actionCard) + if (sendType == '130') { + + // 头部 + var head = {} + head.bgcolor = api.data.dingDingOaHeadBgColor + head.text = api.data.dingDingOaHeadTitle + jsonObj.dingDingOaHead = head + + // body + var body = {} + body.title = api.data.dingDingOaTitle + body.content = api.data.dingDingOaContent + body.image = api.data.media_id + body.author = api.data.dingDingOaAuthor + jsonObj.dingDingOaBody = body + + // 通用 + jsonObj.sendType = sendType + jsonObj.url = url + } } api.data.msgContent = JSON.stringify(jsonObj)