From 0225ad68c3ec07cb4119d178af54cfaabbe8f4ea Mon Sep 17 00:00:00 2001 From: 3y Date: Mon, 26 Dec 2022 14:57:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1=20?= =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BA=E6=B6=88=E6=81=AF=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/account-new.json | 28 ++++---- pages/crud-edit.json | 136 ++++++++++++++++++++++++++++++++++-- pages/crud-list.json | 4 +- pages/crud-new.json | 138 ++++++++++++++++++++++++++++++++++--- pages/crud-view.json | 138 ++++++++++++++++++++++++++++++++++--- pages/material-upload.json | 22 ++---- 6 files changed, 405 insertions(+), 61 deletions(-) diff --git a/pages/account-new.json b/pages/account-new.json index 47ab6b5..1c08e0d 100644 --- a/pages/account-new.json +++ b/pages/account-new.json @@ -28,7 +28,6 @@ "label": "发送渠道", "type": "radios", "options": [ - { "label": "PUSH通知栏", "value": "20" @@ -50,9 +49,13 @@ "value": "60" }, { - "label": "企业微信", + "label": "企业微信(应用消息)", "value": "70" }, + { + "label": "企业微信(机器人)", + "value": "100" + }, { "label": "钉钉群机器人", "value": "80" @@ -61,10 +64,6 @@ "label": "钉钉工作消息", "value": "90" }, - { - "label": "企业微信机器人", - "value": "100" - }, { "label": "飞书机器人", "value": "110" @@ -147,32 +146,31 @@ "visibleOn": "this.sendChannel ==70", "mode": "normal", "inline": true, - "label": "企业微信账号样例:{\"corpId\":\"23423423\",\"corpSecret\":\"-234324234\",\"agentId\":1000002,\"token\":\"234234\",\"aesKey\":\"23423423\"}" + "label": "企业微信(应用消息)账号样例:{\"corpId\":\"23423423\",\"corpSecret\":\"-234324234\",\"agentId\":1000002,\"token\":\"234234\",\"aesKey\":\"23423423\"}" }, { "type": "static", "name": "id", - "visibleOn": "this.sendChannel ==80", + "visibleOn": "this.sendChannel ==100", "mode": "normal", "inline": true, - "label": "钉钉群机器人样例:{\"secret\":\"234324324324\",\"webhook\":\"https://oapi.dingtalk.com/robot/send?access_token=8d03b68d081f732343243242343247328b0c3003d164715d2c6c6e56\"}" + "label": "企业微信(机器人)消息样例:{\"webhook\":\"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5699eac1-b073-47da-9e97-xxxxxxxx\"}" }, { "type": "static", "name": "id", - "visibleOn": "this.sendChannel ==90", + "visibleOn": "this.sendChannel ==80", "mode": "normal", "inline": true, - "label": "钉钉工作消息样例:{\n \"appKey\": \"23423423\",\n \"appSecret\": \"tQpvmkR863dYcuKDVfM23432432432423Nlx_fYLLLlpPJWHvWKbTu\",\n \"agentId\": \"1523423423242\"\n}" - } - , + "label": "钉钉群机器人样例:{\"secret\":\"234324324324\",\"webhook\":\"https://oapi.dingtalk.com/robot/send?access_token=8d03b68d081f732343243242343247328b0c3003d164715d2c6c6e56\"}" + }, { "type": "static", "name": "id", - "visibleOn": "this.sendChannel ==100", + "visibleOn": "this.sendChannel ==90", "mode": "normal", "inline": true, - "label": "企业微信机器人消息样例:" + "label": "钉钉工作消息样例:{\n \"appKey\": \"23423423\",\n \"appSecret\": \"tQpvmkR863dYcuKDVfM23432432432423Nlx_fYLLLlpPJWHvWKbTu\",\n \"agentId\": \"1523423423242\"\n}" }, { "type": "static", diff --git a/pages/crud-edit.json b/pages/crud-edit.json index 1cead9d..aaed32d 100644 --- a/pages/crud-edit.json +++ b/pages/crud-edit.json @@ -189,9 +189,13 @@ "value": "60" }, { - "label": "企业微信", + "label": "企业微信(应用消息)", "value": "70" }, + { + "label": "企业微信(机器人)", + "value": "100" + }, { "label": "钉钉群机器人", "value": "80" @@ -200,10 +204,6 @@ "label": "钉钉工作消息", "value": "90" }, - { - "label": "企业微信机器人", - "value": "100" - }, { "label": "飞书机器人", "value": "110" @@ -320,6 +320,126 @@ "clearValueOnHidden": false, "placeholder": "可用占位符{$url}" }, + { + "type": "select", + "label": "企业微信应用", + "name": "sendAccount", + "source": "${ls:backend_url}/account/queryByChannelType?channelType=100&creator=${ls:openId}", + "visibleOn": "this.sendChannel == 100", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "name": "sendType", + "label": "发送类型", + "type": "radios", + "options": [ + { + "label": "文本", + "value": "10" + }, + { + "label": "图文", + "value": "40" + }, + { + "label": "文件", + "value": "60" + }, + { + "label": "markdown类型", + "value": "80" + }, + { + "label": "图片", + "value": "100" + } + ], + "visibleOn": "this.sendChannel == 100", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "type": "input-text", + "label": "发送内容", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 10", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$content}" + }, + { + "type": "input-text", + "label": "markdown", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 80", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$content}" + }, + { + "type": "input-text", + "label": "图片base64", + "name": "base64", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 100", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "图片内容的base64编码" + }, + { + "type": "input-text", + "label": "图片内容md5", + "name": "md5", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 100", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "在base64编码前的md5" + }, + { + "type": "input-text", + "label": "文件Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 60", + "size": "lg", + "placeholder": "可用占位符{$mediaId}", + "clearValueOnHidden": false + }, + { + "type": "input-table", + "name": "articles", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 100 && ( this.sendType == 40)", + "columns": [ + { + "name": "title", + "label": "标题", + "placeholder": "可用占位符{$title}" + }, + { + "name": "description", + "label": "描述", + "placeholder": "可用占位符{$description}" + }, + { + "name": "url", + "label": "跳转链接", + "placeholder": "可用占位符{$url}" + }, + { + "name": "picurl", + "label": "图片链接", + "placeholder": "可用占位符{$picurlURL}" + } + ] + }, { "type": "service", "schemaApi": "${ls:backend_url}/officialAccount/detailTemplate?id=${sendAccount}&wxTemplateId=${templateId}", @@ -381,7 +501,6 @@ "label": "文本", "value": "10" }, - { "label": "图片", "value": "100" @@ -909,7 +1028,7 @@ "api": { "url": "${ls:backend_url}/messageTemplate/save", "method": "post", - "requestAdaptor": "\nlet 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 == '50') {\n jsonObj.path = api.data.path\n jsonObj.miniProgramId = api.data.miniProgramId\n jsonObj.templateId = api.data.templateId\n jsonObj.url = url\n jsonObj.linkType = api.data.linkType\n\n // 模板参数\n jsonObj.officialAccountParam = JSON.stringify(api.data.officialAccountParam[0])\n}\n// 微信小程序\nif (api.data.sendChannel == '60') {\n jsonObj.page = api.data.page\n jsonObj.templateId = api.data.templateId\n // 模板参数\n jsonObj.miniProgramParam = JSON.stringify(api.data.miniProgramParam[0])\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.mediaId = api.data.mediaId\n }\n // 文件类型 || 图片类型\n if (sendType == '60' || sendType == '100') {\n jsonObj.sendType = sendType\n jsonObj.mediaId = api.data.mediaId\n }\n // 链接类型\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.mediaId = api.data.mediaId\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.mediaId\n body.author = api.data.dingDingOaAuthor\n jsonObj.dingDingOaBody = body\n \n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n }\n}\n\n// 飞书群机器人\nif (api.data.sendChannel == '110') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n\n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\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 == '100') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // markdown类型\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 图片类型\n if (sendType == '100') {\n jsonObj.md5 = api.data.md5\n jsonObj.base64 = api.data.base64\n jsonObj.sendType = sendType\n }\n // 文件类型\n if (sendType == '60') {\n jsonObj.sendType = sendType\n jsonObj.mediaId = api.data.mediaId\n }\n // 图文类型\n if(sendType == '40'){\n jsonObj.sendType = sendType\n jsonObj.articles = JSON.stringify(api.data.articles)\n }\n}\n// 微信服务号\nif (api.data.sendChannel == '50') {\n jsonObj.path = api.data.path\n jsonObj.miniProgramId = api.data.miniProgramId\n jsonObj.templateId = api.data.templateId\n jsonObj.url = url\n jsonObj.linkType = api.data.linkType\n\n // 模板参数\n jsonObj.officialAccountParam = JSON.stringify(api.data.officialAccountParam[0])\n}\n// 微信小程序\nif (api.data.sendChannel == '60') {\n jsonObj.page = api.data.page\n jsonObj.templateId = api.data.templateId\n // 模板参数\n jsonObj.miniProgramParam = JSON.stringify(api.data.miniProgramParam[0])\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.mediaId = api.data.mediaId\n }\n // 文件类型 || 图片类型\n if (sendType == '60' || sendType == '100') {\n jsonObj.sendType = sendType\n jsonObj.mediaId = api.data.mediaId\n }\n // 链接类型\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.mediaId = api.data.mediaId\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.mediaId\n body.author = api.data.dingDingOaAuthor\n jsonObj.dingDingOaBody = body\n \n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n }\n}\n\n// 飞书群机器人\nif (api.data.sendChannel == '110') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n\n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n}\n\napi.data.msgContent = JSON.stringify(jsonObj)\nreturn api;", "data": { "name": "${name}", "idType": "${idType}", @@ -951,6 +1070,9 @@ "linkType": "${linkType}", "page": "${page}", "miniProgramParam": "${miniProgramParam}", + "md5": "${md5}", + "base64": "${base64}", + "articles": "${articles}", "isDeleted": "${isDeleted}" } }, diff --git a/pages/crud-list.json b/pages/crud-list.json index 0bdeaa6..6f321cb 100644 --- a/pages/crud-list.json +++ b/pages/crud-list.json @@ -64,10 +64,10 @@ "40": "邮箱", "50": "微信服务号(模板消息)", "60": "微信小程序(订阅消息)", - "70": "企业微信应用消息", + "70": "企业微信(应用消息)", "80": "钉钉群机器人", "90": "钉钉工作消息", - "100": "企业微信机器人", + "100": "企业微信(机器人)", "110": "飞书机器人" } }, diff --git a/pages/crud-new.json b/pages/crud-new.json index a1efa3d..ac22a36 100644 --- a/pages/crud-new.json +++ b/pages/crud-new.json @@ -205,9 +205,13 @@ "value": "60" }, { - "label": "企业微信", + "label": "企业微信(应用消息)", "value": "70" }, + { + "label": "企业微信(机器人)", + "value": "100" + }, { "label": "钉钉群机器人", "value": "80" @@ -216,10 +220,6 @@ "label": "钉钉工作消息", "value": "90" }, - { - "label": "企业微信机器人", - "value": "100" - }, { "label": "飞书机器人", "value": "110" @@ -384,7 +384,6 @@ "visibleOn": "this.sendChannel == 50", "description": "请点击【新增】填入文案" }, - { "type": "select", "label": "小程序账号", @@ -422,7 +421,6 @@ "visibleOn": "this.sendChannel == 60", "description": "请点击【新增】填入文案" }, - { "type": "select", "label": "邮件账号", @@ -472,7 +470,6 @@ "label": "文本", "value": "10" }, - { "label": "图片", "value": "100" @@ -525,6 +522,16 @@ "required": true, "size": "lg" }, + { + "type": "select", + "label": "企业微信应用", + "name": "sendAccount", + "source": "${ls:backend_url}/account/queryByChannelType?channelType=100&creator=${ls:openId}", + "visibleOn": "this.sendChannel == 100", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, { "type": "select", "label": "钉钉群机器人", @@ -600,6 +607,37 @@ "required": true, "size": "lg" }, + { + "name": "sendType", + "label": "发送类型", + "type": "radios", + "options": [ + { + "label": "文本", + "value": "10" + }, + { + "label": "图文", + "value": "40" + }, + { + "label": "文件", + "value": "60" + }, + { + "label": "markdown类型", + "value": "80" + }, + { + "label": "图片", + "value": "100" + } + ], + "visibleOn": "this.sendChannel == 100 ", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, { "name": "sendType", "label": "发送类型", @@ -684,6 +722,85 @@ "clearValueOnHidden": false, "placeholder": "可用占位符{$content}" }, + { + "type": "input-text", + "label": "文本内容", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 10", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$content}" + }, + { + "type": "input-text", + "label": "markdown", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 80", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$content}" + }, + { + "type": "input-text", + "label": "图片base64", + "name": "base64", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 100", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "图片内容的base64编码" + }, + { + "type": "input-text", + "label": "图片内容md5", + "name": "md5", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 100", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "在base64编码前的md5" + }, + { + "type": "input-text", + "label": "文件Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 60", + "size": "lg", + "placeholder": "可用占位符{$mediaId}", + "clearValueOnHidden": false + }, + { + "type": "input-table", + "name": "articles", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 100 && ( this.sendType == 40)", + "columns": [ + { + "name": "title", + "label": "标题", + "placeholder": "可用占位符{$title}" + }, + { + "name": "description", + "label": "描述", + "placeholder": "可用占位符{$description}" + }, + { + "name": "url", + "label": "跳转链接", + "placeholder": "可用占位符{$url}" + }, + { + "name": "picurl", + "label": "图片链接", + "placeholder": "可用占位符{$picurlURL}" + } + ] + }, { "type": "input-text", "label": "钉钉标题", @@ -942,7 +1059,7 @@ "api": { "url": "${ls:backend_url}/messageTemplate/save", "method": "post", - "requestAdaptor": "\nlet 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 == '50') {\n jsonObj.path = api.data.path\n jsonObj.miniProgramId = api.data.miniProgramId\n jsonObj.templateId = api.data.templateId\n jsonObj.url = url\n jsonObj.linkType = api.data.linkType\n\n // 模板参数\n jsonObj.officialAccountParam = JSON.stringify(api.data.officialAccountParam[0])\n}\n// 微信小程序\nif (api.data.sendChannel == '60') {\n jsonObj.page = api.data.page\n jsonObj.templateId = api.data.templateId\n // 模板参数\n jsonObj.miniProgramParam = JSON.stringify(api.data.miniProgramParam[0])\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.mediaId = api.data.mediaId\n }\n // 文件类型 || 图片类型\n if (sendType == '60' || sendType == '100') {\n jsonObj.sendType = sendType\n jsonObj.mediaId = api.data.mediaId\n }\n // 链接类型\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.mediaId = api.data.mediaId\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.mediaId\n body.author = api.data.dingDingOaAuthor\n jsonObj.dingDingOaBody = body\n \n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n }\n}\n\n// 飞书群机器人\nif (api.data.sendChannel == '110') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n\n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\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 == '100') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // markdown类型\n if (sendType == '80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 图片类型\n if (sendType == '100') {\n jsonObj.md5 = api.data.md5\n jsonObj.base64 = api.data.base64\n jsonObj.sendType = sendType\n }\n // 文件类型\n if (sendType == '60') {\n jsonObj.sendType = sendType\n jsonObj.mediaId = api.data.mediaId\n }\n // 图文类型\n if(sendType == '40'){\n jsonObj.sendType = sendType\n jsonObj.articles = JSON.stringify(api.data.articles)\n }\n}\n// 微信服务号\nif (api.data.sendChannel == '50') {\n jsonObj.path = api.data.path\n jsonObj.miniProgramId = api.data.miniProgramId\n jsonObj.templateId = api.data.templateId\n jsonObj.url = url\n jsonObj.linkType = api.data.linkType\n\n // 模板参数\n jsonObj.officialAccountParam = JSON.stringify(api.data.officialAccountParam[0])\n}\n// 微信小程序\nif (api.data.sendChannel == '60') {\n jsonObj.page = api.data.page\n jsonObj.templateId = api.data.templateId\n // 模板参数\n jsonObj.miniProgramParam = JSON.stringify(api.data.miniProgramParam[0])\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.mediaId = api.data.mediaId\n }\n // 文件类型 || 图片类型\n if (sendType == '60' || sendType == '100') {\n jsonObj.sendType = sendType\n jsonObj.mediaId = api.data.mediaId\n }\n // 链接类型\n if (sendType == '110') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.mediaId = api.data.mediaId\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.mediaId\n body.author = api.data.dingDingOaAuthor\n jsonObj.dingDingOaBody = body\n \n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n }\n}\n\n// 飞书群机器人\nif (api.data.sendChannel == '110') {\n // 文本类型\n if (sendType == '10') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n\n // 通用\n jsonObj.sendType = sendType\n jsonObj.url = url\n}\n\napi.data.msgContent = JSON.stringify(jsonObj)\nreturn api;", "data": { "name": "${name}", "idType": "${idType}", @@ -972,6 +1089,9 @@ "linkType": "${linkType}", "page": "${page}", "miniProgramParam": "${miniProgramParam}", + "md5": "${md5}", + "base64": "${base64}", + "articles": "${articles}", "msgContent": "{\"content\":\"${content}\",\"url\":\"${url}\",\"title\":\"${title}\",\"sendType\":\"${sendType}\",\"picUrl\":\"${picUrl}\"}" } } diff --git a/pages/crud-view.json b/pages/crud-view.json index 16d219f..0729990 100644 --- a/pages/crud-view.json +++ b/pages/crud-view.json @@ -162,7 +162,6 @@ "label": "发送渠道", "type": "radios", "options": [ - { "label": "PUSH通知栏", "value": "20" @@ -184,9 +183,13 @@ "value": "60" }, { - "label": "企业微信", + "label": "企业微信(应用消息)", "value": "70" }, + { + "label": "企业微信(机器人)", + "value": "100" + }, { "label": "钉钉群机器人", "value": "80" @@ -195,10 +198,6 @@ "label": "钉钉应用消息", "value": "90" }, - { - "label": "企业微信机器人", - "value": "100" - }, { "label": "飞书机器人", "value": "110" @@ -246,6 +245,126 @@ "required": true, "size": "lg" }, + { + "type": "select", + "label": "企业微信应用", + "name": "sendAccount", + "source": "${ls:backend_url}/account/queryByChannelType?channelType=100&creator=${ls:openId}", + "visibleOn": "this.sendChannel == 100", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "name": "sendType", + "label": "发送类型", + "type": "radios", + "options": [ + { + "label": "文本", + "value": "10" + }, + { + "label": "图文", + "value": "40" + }, + { + "label": "文件", + "value": "60" + }, + { + "label": "markdown类型", + "value": "80" + }, + { + "label": "图片", + "value": "100" + } + ], + "visibleOn": "this.sendChannel == 100 ", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "type": "input-text", + "label": "发送内容", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 10", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$content}" + }, + { + "type": "input-text", + "label": "markdown", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 80", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$content}" + }, + { + "type": "input-text", + "label": "图片base64", + "name": "base64", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 100", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "图片内容的base64编码" + }, + { + "type": "input-text", + "label": "图片内容md5", + "name": "md5", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 100", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "在base64编码前的md5" + }, + { + "type": "input-text", + "label": "文件Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 100 && this.sendType == 60", + "size": "lg", + "placeholder": "可用占位符{$mediaId}", + "clearValueOnHidden": false + }, + { + "type": "input-table", + "name": "articles", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 100 && ( this.sendType == 40)", + "columns": [ + { + "name": "title", + "label": "标题", + "placeholder": "可用占位符{$title}" + }, + { + "name": "description", + "label": "描述", + "placeholder": "可用占位符{$description}" + }, + { + "name": "url", + "label": "跳转链接", + "placeholder": "可用占位符{$url}" + }, + { + "name": "picurl", + "label": "图片链接", + "placeholder": "可用占位符{$picurlURL}" + } + ] + }, { "type": "select", "label": "选择模板", @@ -351,7 +470,6 @@ "visibleOn": "this.sendChannel == 60", "description": "请点击【新增】填入文案" }, - { "type": "select", "label": "飞书机器人", @@ -371,7 +489,6 @@ "label": "文本", "value": "10" }, - { "label": "图片", "value": "100" @@ -445,7 +562,6 @@ "clearValueOnHidden": false, "placeholder": "可用占位符{$content}" }, - { "type": "input-text", "label": "推送链接", @@ -485,12 +601,12 @@ "size": "lg", "clearValueOnHidden": false, "placeholder": "可用占位符{$content},可输入HTML" - }, { + }, + { "type": "select", "label": "企业微信应用", "name": "sendAccount", "source": "${ls:backend_url}/account/queryByChannelType?channelType=70&creator=${ls:openId}", - "visibleOn": "this.sendChannel == 70", "clearValueOnHidden": false, "required": true, diff --git a/pages/material-upload.json b/pages/material-upload.json index ea6b184..2480694 100644 --- a/pages/material-upload.json +++ b/pages/material-upload.json @@ -9,26 +9,14 @@ "required": true, "options": [ { - "label": "服务号", - "value": "50" - }, - { - "label": "小程序", - "value": "60" - }, - { - "label": "企业微信", - "value": "70" - }, - { - "label": "钉钉工作消息", + "label": "钉钉(工作消息)", "value": "90" } ] }, { "type": "select", - "label": "服务号账号", + "label": "微信服务号账号", "name": "sendAccount", "source": "${ls:backend_url}/account/queryByChannelType?channelType=50&creator=${ls:openId}", "visibleOn": "this.sendChannel == 50", @@ -38,7 +26,7 @@ }, { "type": "select", - "label": "小程序账号", + "label": "微信小程序账号", "name": "sendAccount", "source": "${ls:backend_url}/account/queryByChannelType?channelType=60&creator=${ls:openId}", "visibleOn": "this.sendChannel == 60", @@ -48,7 +36,7 @@ }, { "type": "select", - "label": "企业微信账号", + "label": "企业微信(工作消息)", "name": "sendAccount", "source": "${ls:backend_url}/account/queryByChannelType?channelType=70&creator=${ls:openId}", "visibleOn": "this.sendChannel == 70", @@ -58,7 +46,7 @@ }, { "type": "select", - "label": "钉钉工作消息账号", + "label": "钉钉(工作消息)账号", "name": "sendAccount", "source": "${ls:backend_url}/account/queryByChannelType?channelType=90&creator=${ls:openId}", "visibleOn": "this.sendChannel == 90",