diff --git a/pages/crud-edit.json b/pages/crud-edit.json index aaed32d..19e070d 100644 --- a/pages/crud-edit.json +++ b/pages/crud-edit.json @@ -322,7 +322,7 @@ }, { "type": "select", - "label": "企业微信应用", + "label": "企业微信(机器人)", "name": "sendAccount", "source": "${ls:backend_url}/account/queryByChannelType?channelType=100&creator=${ls:openId}", "visibleOn": "this.sendChannel == 100", @@ -500,22 +500,6 @@ { "label": "文本", "value": "10" - }, - { - "label": "图片", - "value": "100" - }, - { - "label": "跳转卡片", - "value": "120" - }, - { - "label": "富文本", - "value": "150" - }, - { - "label": "群卡片", - "value": "160" } ], "visibleOn": "this.sendChannel == 110", @@ -624,26 +608,6 @@ "required": true, "size": "lg" }, - { - "type": "select", - "label": "钉钉群机器人", - "name": "sendAccount", - "source": "${ls:backend_url}/account/queryByChannelType?channelType=80&creator=${ls:openId}", - "visibleOn": "this.sendChannel == 80", - "clearValueOnHidden": false, - "required": true, - "size": "lg" - }, - { - "type": "select", - "label": "钉钉应用", - "name": "sendAccount", - "source": "${ls:backend_url}/account/queryByChannelType?channelType=90&creator=${ls:openId}", - "visibleOn": "this.sendChannel == 90", - "clearValueOnHidden": false, - "required": true, - "size": "lg" - }, { "name": "sendType", "label": "发送类型", @@ -673,25 +637,13 @@ "label": "文件", "value": "60" }, - { - "label": "小程序通知", - "value": "70" - }, { "label": "markdown类型", "value": "80" }, - { - "label": "模板卡片", - "value": "90" - }, { "label": "图片", "value": "100" - }, - { - "label": "链接消息", - "value": "110" } ], "visibleOn": "this.sendChannel == 70 ", @@ -699,6 +651,145 @@ "required": true, "size": "lg" }, + { + "type": "input-text", + "label": "企业微信内容", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 10", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$content}" + }, + { + "type": "input-text", + "label": "图片Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 100", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, + { + "type": "input-text", + "label": "语音Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 20", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, + { + "type": "input-text", + "label": "视频Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 30", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, + { + "type": "input-text", + "label": "文件Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 60", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, + { + "type": "input-text", + "label": "标题", + "name": "title", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 50", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$title}" + }, + { + "type": "input-text", + "label": "描述详情", + "name": "description", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 50", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$description}" + }, + { + "type": "input-text", + "label": "跳转链接", + "name": "url", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 50", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "input-table", + "name": "articles", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 70 && ( 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": "markdown", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 80", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$content}" + }, + { + "type": "select", + "label": "钉钉群机器人", + "name": "sendAccount", + "source": "${ls:backend_url}/account/queryByChannelType?channelType=80&creator=${ls:openId}", + "visibleOn": "this.sendChannel == 80", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "type": "select", + "label": "钉钉应用", + "name": "sendAccount", + "source": "${ls:backend_url}/account/queryByChannelType?channelType=90&creator=${ls:openId}", + "visibleOn": "this.sendChannel == 90", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, { "name": "sendType", "label": "发送类型", @@ -1028,7 +1119,7 @@ "api": { "url": "${ls:backend_url}/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 == '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;", + "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 // 文本、markdown类型\n if (sendType == '10' || sendType =='80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 图片、视频、语音、文件类型\n if(sendType =='20' || sendType =='30' || sendType =='60' || sendType=='100'){\n jsonObj.sendType = sendType\n jsonObj.mediaId = api.data.mediaId\n }\n // 文本卡片类型\n if(sendType =='50'){\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.url= url \n jsonObj.description = api.data.description\n }\n // 图文类型\n if(sendType == '40'){\n jsonObj.sendType = sendType\n jsonObj.articles = JSON.stringify(api.data.articles)\n }\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}", @@ -1073,6 +1164,7 @@ "md5": "${md5}", "base64": "${base64}", "articles": "${articles}", + "description": "${description}", "isDeleted": "${isDeleted}" } }, diff --git a/pages/crud-new.json b/pages/crud-new.json index ac22a36..62bd029 100644 --- a/pages/crud-new.json +++ b/pages/crud-new.json @@ -469,22 +469,6 @@ { "label": "文本", "value": "10" - }, - { - "label": "图片", - "value": "100" - }, - { - "label": "跳转卡片", - "value": "120" - }, - { - "label": "富文本", - "value": "150" - }, - { - "label": "群卡片", - "value": "160" } ], "visibleOn": "this.sendChannel == 110", @@ -524,7 +508,7 @@ }, { "type": "select", - "label": "企业微信应用", + "label": "企业微信(机器人)", "name": "sendAccount", "source": "${ls:backend_url}/account/queryByChannelType?channelType=100&creator=${ls:openId}", "visibleOn": "this.sendChannel == 100", @@ -581,25 +565,13 @@ "label": "文件", "value": "60" }, - { - "label": "小程序通知", - "value": "70" - }, { "label": "markdown类型", "value": "80" }, - { - "label": "模板卡片", - "value": "90" - }, { "label": "图片", "value": "100" - }, - { - "label": "链接消息", - "value": "110" } ], "visibleOn": "this.sendChannel == 70 ", @@ -722,6 +694,115 @@ "clearValueOnHidden": false, "placeholder": "可用占位符{$content}" }, + { + "type": "input-text", + "label": "图片Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 100", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, + { + "type": "input-text", + "label": "语音Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 20", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, + { + "type": "input-text", + "label": "视频Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 30", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, + { + "type": "input-text", + "label": "文件Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 60", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, + { + "type": "input-text", + "label": "标题", + "name": "title", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 50", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$title}" + }, + { + "type": "input-text", + "label": "描述详情", + "name": "description", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 50", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$description}" + }, + { + "type": "input-text", + "label": "跳转链接", + "name": "url", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 50", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "input-table", + "name": "articles", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 70 && ( 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": "markdown", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 80", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$content}" + }, { "type": "input-text", "label": "文本内容", @@ -1059,7 +1140,7 @@ "api": { "url": "${ls:backend_url}/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 == '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;", + "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 // 文本、markdown类型\n if (sendType == '10' || sendType =='80') {\n jsonObj.content = content\n jsonObj.sendType = sendType\n }\n // 图片、视频、语音、文件类型\n if(sendType =='20' || sendType =='30' || sendType =='60' || sendType=='100'){\n jsonObj.sendType = sendType\n jsonObj.mediaId = api.data.mediaId\n }\n // 文本卡片类型\n if(sendType =='50'){\n jsonObj.sendType = sendType\n jsonObj.title = title\n jsonObj.url= url \n jsonObj.description = api.data.description\n }\n // 图文类型\n if(sendType == '40'){\n jsonObj.sendType = sendType\n jsonObj.articles = JSON.stringify(api.data.articles)\n }\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}", @@ -1092,6 +1173,7 @@ "md5": "${md5}", "base64": "${base64}", "articles": "${articles}", + "description": "${description}", "msgContent": "{\"content\":\"${content}\",\"url\":\"${url}\",\"title\":\"${title}\",\"sendType\":\"${sendType}\",\"picUrl\":\"${picUrl}\"}" } } diff --git a/pages/crud-view.json b/pages/crud-view.json index 0729990..181b453 100644 --- a/pages/crud-view.json +++ b/pages/crud-view.json @@ -247,7 +247,7 @@ }, { "type": "select", - "label": "企业微信应用", + "label": "企业微信(机器人)", "name": "sendAccount", "source": "${ls:backend_url}/account/queryByChannelType?channelType=100&creator=${ls:openId}", "visibleOn": "this.sendChannel == 100", @@ -488,22 +488,6 @@ { "label": "文本", "value": "10" - }, - { - "label": "图片", - "value": "100" - }, - { - "label": "跳转卡片", - "value": "120" - }, - { - "label": "富文本", - "value": "150" - }, - { - "label": "群卡片", - "value": "160" } ], "visibleOn": "this.sendChannel == 110", @@ -661,25 +645,13 @@ "label": "文件", "value": "60" }, - { - "label": "小程序通知", - "value": "70" - }, { "label": "markdown类型", "value": "80" }, - { - "label": "模板卡片", - "value": "90" - }, { "label": "图片", "value": "100" - }, - { - "label": "链接消息", - "value": "110" } ], "visibleOn": "this.sendChannel == 70 ", @@ -771,6 +743,115 @@ "clearValueOnHidden": false, "placeholder": "可用占位符{$content}" }, + { + "type": "input-text", + "label": "图片Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 100", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, + { + "type": "input-text", + "label": "语音Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 20", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, + { + "type": "input-text", + "label": "视频Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 30", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, + { + "type": "input-text", + "label": "文件Id", + "name": "mediaId", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 60", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$mediaId}" + }, + { + "type": "input-text", + "label": "标题", + "name": "title", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 50", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$title}" + }, + { + "type": "input-text", + "label": "描述详情", + "name": "description", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 50", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$description}" + }, + { + "type": "input-text", + "label": "跳转链接", + "name": "url", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 50", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "input-table", + "name": "articles", + "addable": true, + "editable": true, + "visibleOn": "this.sendChannel == 70 && ( 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": "markdown", + "name": "content", + "required": true, + "visibleOn": "this.sendChannel == 70 && this.sendType == 80", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$content}" + }, { "type": "input-text", "label": "钉钉标题", diff --git a/pages/material-upload.json b/pages/material-upload.json index 2480694..d8aec23 100644 --- a/pages/material-upload.json +++ b/pages/material-upload.json @@ -11,32 +11,30 @@ { "label": "钉钉(工作消息)", "value": "90" + }, + { + "label": "企业微信(机器人)", + "value": "100" + }, + { + "label": "企业微信(应用消息)", + "value": "70" } ] }, { "type": "select", - "label": "微信服务号账号", - "name": "sendAccount", - "source": "${ls:backend_url}/account/queryByChannelType?channelType=50&creator=${ls:openId}", - "visibleOn": "this.sendChannel == 50", - "clearValueOnHidden": false, - "required": true, - "size": "lg" - }, - { - "type": "select", - "label": "微信小程序账号", + "label": "企业微信机器人", "name": "sendAccount", - "source": "${ls:backend_url}/account/queryByChannelType?channelType=60&creator=${ls:openId}", - "visibleOn": "this.sendChannel == 60", + "source": "${ls:backend_url}/account/queryByChannelType?channelType=100&creator=${ls:openId}", + "visibleOn": "this.sendChannel == 100", "clearValueOnHidden": false, "required": true, "size": "lg" }, { "type": "select", - "label": "企业微信(工作消息)", + "label": "企业微信(应用消息)", "name": "sendAccount", "source": "${ls:backend_url}/account/queryByChannelType?channelType=70&creator=${ls:openId}", "visibleOn": "this.sendChannel == 70", @@ -76,7 +74,8 @@ "label": "视频", "value": "40" } - ] + ], + "visibleOn": "this.sendChannel == 90 || this.sendChannel == 70" }, { "type": "input-file",