From 4b6a7d34e624290e078e42fb86f6872ec1921125 Mon Sep 17 00:00:00 2001 From: 3y Date: Wed, 30 Nov 2022 19:40:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=9C=8D=E5=8A=A1=E5=8F=B7?= =?UTF-8?q?=20=E6=A8=A1=E6=9D=BF=E6=B6=88=E6=81=AF=E6=8E=A5=E5=85=A5?= =?UTF-8?q?=E5=AE=8C=E6=88=90=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/crud-edit.json | 87 +++++++++- pages/crud-list.json | 391 +------------------------------------------ pages/crud-new.json | 63 ++++++- pages/crud-view.json | 80 ++++++++- 4 files changed, 229 insertions(+), 392 deletions(-) diff --git a/pages/crud-edit.json b/pages/crud-edit.json index aae38f2..0567340 100644 --- a/pages/crud-edit.json +++ b/pages/crud-edit.json @@ -185,7 +185,7 @@ "value": "40" }, { - "label": "服务号", + "label": "微信服务号(模板消息)", "value": "50" }, { @@ -251,6 +251,84 @@ "clearValueOnHidden": false, "placeholder": "可用占位符{$url}" }, + { + "type": "select", + "label": "服务号账号", + "name": "sendAccount", + "source": "http://localhost:8080/account/queryByChannelType?channelType=50", + "visibleOn": "this.sendChannel == 50", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "type": "select", + "label": "选择模板", + "name": "templateId", + "source": "http://localhost:8080/officialAccount/template/list?id=${sendAccount}", + "visibleOn": "this.sendChannel == 50", + "clearValueOnHidden": false, + "required": true, + "size": "lg", + "initFetchOn": "data.sendAccount" + }, + { + "type": "radios", + "name": "linkType", + "label": "跳转落地页", + "visibleOn": "this.sendChannel == 50", + "options": [ + { + "label": "HTTP链接", + "value": "10" + }, + { + "label": "小程序", + "value": "20" + } + ], + "required": true + }, + { + "type": "input-text", + "label": "发送链接", + "name": "url", + "required": true, + "visibleOn": "this.sendChannel == 50 && this.linkType==10", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "select", + "label": "小程序", + "name": "miniProgramId", + "required": true, + "visibleOn": "this.sendChannel == 50 && this.linkType==20", + "options": [ + { + "label": "暂无可用小程序", + "value": "10" + } + ], + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "发送链接", + "name": "path", + "required": true, + "visibleOn": "this.sendChannel == 50 && this.linkType==20", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "service", + "schemaApi": "http://localhost:8080/officialAccount/detailTemplate?id=${sendAccount}&wxTemplateId=${templateId}", + "visibleOn": "this.sendChannel == 50" + }, { "type": "select", "label": "飞书机器人", @@ -798,7 +876,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 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": "\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\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}", @@ -833,6 +911,11 @@ "dingDingOaTitle": "${dingDingOaTitle}", "dingDingOaContent": "${dingDingOaContent}", "dingDingOaAuthor": "${dingDingOaAuthor}", + "officialAccountParam": "${officialAccountParam}", + "templateId": "${templateId}", + "path": "${path}", + "miniProgramId": "${miniProgramId}", + "linkType": "${linkType}", "isDeleted": "${isDeleted}" } }, diff --git a/pages/crud-list.json b/pages/crud-list.json index bcc06ce..91d8349 100644 --- a/pages/crud-list.json +++ b/pages/crud-list.json @@ -127,30 +127,11 @@ "api": { "url": "http://localhost:8080/messageTemplate/test", "method": "post", - "requestAdaptor": "let jsonObj = {};\n\nlet content = JSON.parse(api.data.msgContent).content\nlet url = JSON.parse(api.data.msgContent).url\nlet title = JSON.parse(api.data.msgContent).title\nlet sendType = JSON.parse(api.data.msgContent).sendType\nlet picUrl = JSON.parse(api.data.msgContent).picUrl\n\n\n// 钉钉机器人\nif (api.data.sendChannel == '80') {\n // 图文类型(FeedCard)\n if (sendType == '40') {\n jsonObj.feedCards = JSON.stringify(api.data.feedCards)\n api.data.msgContent = JSON.stringify(jsonObj)\n }\n}\n\n\n\nreturn api;", + "requestAdaptor": "api.data.msgContent = JSON.stringify(api.data.testParam[0])\nreturn api;", "data": { "id": "${id}", - "name": "${name}", "receiver": "${receiver}", - "msgType": "${msgType}", - "templateType": "${templateType}", - "expectPushTime": "${expectPushTime}", - "proposer": "${proposer}", - "sendChannel": "${sendChannel}", - "sendAccount": "${sendAccount}", - "cronCrowdPath": "${cronCrowdPath}", - "shieldType": "${shieldType}", - "feedCards": "${feedCards}", - "btnOrientation": "${btnOrientation}", - "btns": "${btns}", - "mediaId": "${mediaId}", - "duration": "${duration}", - "dingDingOaHeadTitle": "${dingDingOaHeadTitle}", - "dingDingOaHeadBgColor": "${dingDingOaHeadBgColor}", - "dingDingOaTitle": "${dingDingOaTitle}", - "dingDingOaContent": "${dingDingOaContent}", - "dingDingOaAuthor": "${dingDingOaAuthor}", - "msgContent": "{\"content\":\"${content}\",\"url\":\"${url}\",\"title\":\"${title}\",\"sendType\":\"${sendType}\",\"picUrl\":\"${picUrl}\"}" + "testParam": "${testParam}" } }, "body": [ @@ -158,374 +139,12 @@ "type": "input-text", "name": "receiver", "label": "接收者", - "description": "存在占位符{$var}请替换占位符文案测试下发!" - }, - { - "type": "input-text", - "label": "飞书内容", - "name": "content", - "required": true, - "visibleOn": "this.sendChannel == 110", - "clearValueOnHidden": false - }, - { - "type": "input-text", - "label": "短信内容", - "name": "content", - "required": true, - "visibleOn": "this.sendChannel == 30", - "mode": "", - "clearValueOnHidden": false - }, - { - "type": "input-text", - "label": "短信链接", - "name": "url", - "visibleOn": "this.sendChannel == 30", - "clearValueOnHidden": false - }, - { - "type": "input-text", - "label": "邮件标题", - "name": "title", - "required": true, - "visibleOn": "this.sendChannel == 40", - "size": "lg", - "clearValueOnHidden": true - }, - { - "type": "input-text", - "label": "邮件内容", - "name": "content", - "required": true, - "visibleOn": "this.sendChannel == 40", - "size": "lg", - "clearValueOnHidden": true - }, - { - "type": "input-text", - "label": "推送标题", - "name": "title", - "required": true, - "visibleOn": "this.sendChannel == 20", - "size": "lg", - "clearValueOnHidden": true - }, - { - "type": "input-text", - "label": "推送内容", - "name": "content", - "required": true, - "visibleOn": "this.sendChannel == 20", - "size": "lg", - "clearValueOnHidden": true - }, - { - "type": "input-text", - "label": "推送链接", - "name": "url", - "required": true, - "visibleOn": "this.sendChannel == 20", - "size": "lg", - "clearValueOnHidden": true - }, - { - "name": "sendChannel", - "label": "发送渠道", - "type": "radios", - "options": [ - { - "label": "IM站内信", - "value": "10" - }, - { - "label": "PUSH通知栏", - "value": "20" - }, - { - "label": "短信", - "value": "30" - }, - { - "label": "邮箱", - "value": "40" - }, - { - "label": "服务号", - "value": "50" - }, - { - "label": "小程序", - "value": "60" - }, - { - "label": "企业微信", - "value": "70" - }, - { - "label": "钉钉群机器人", - "value": "80" - }, - { - "label": "钉钉应用消息", - "value": "90" - } - ], - "visibleOn": "this.sendChannel == 999999 ", - "required": true - }, - { - "name": "sendType", - "label": "发送类型", - "type": "radios", - "options": [ - { - "label": "文本", - "value": "10" - }, - { - "label": "语音", - "value": "20" - }, - { - "label": "视频", - "value": "30" - }, - { - "label": "图文", - "value": "40" - }, - { - "label": "文本卡片", - "value": "50" - }, - { - "label": "文件", - "value": "60" - }, - { - "label": "小程序通知", - "value": "70" - }, - { - "label": "markdown类型", - "value": "80" - }, - { - "label": "模板卡片", - "value": "90" - }, - { - "label": "图片", - "value": "100" - } - ], - "visibleOn": "this.sendChannel == 999999 ", - "clearValueOnHidden": false, - "required": true, - "size": "lg" - }, - { - "type": "input-text", - "label": "企业微信内容", - "name": "content", - "required": true, - "visibleOn": "this.sendChannel == 70", - "size": "lg", - "clearValueOnHidden": true - }, - { - "type": "input-text", - "label": "钉钉标题", - "name": "title", - "required": true, - "visibleOn": "this.sendChannel == 80 && (this.sendType == 80 || this.sendType == 110 || this.sendType == 120 )", - "size": "lg", - "clearValueOnHidden": false - }, - { - "type": "input-text", - "label": "钉钉发送内容", - "name": "content", "required": true, - "visibleOn": "this.sendChannel == 80 && (this.sendType == 10 || this.sendType == 80|| this.sendType == 110 || this.sendType == 120)", - "size": "lg", - "clearValueOnHidden": false + "description": "模板存在占位符。
请点击【新增】填入文案测试下发!
" }, { - "type": "input-text", - "label": "钉钉发送链接", - "name": "url", - "required": true, - "visibleOn": "this.sendChannel == 80 && ( this.sendType == 110)", - "size": "lg", - "clearValueOnHidden": false - }, - { - "type": "input-text", - "label": "钉钉图片链接", - "name": "picUrl", - "visibleOn": "this.sendChannel == 80 && ( this.sendType == 110)", - "size": "lg", - "clearValueOnHidden": false - }, - { - "type": "input-table", - "name": "feedCards", - "addable": true, - "editable": true, - "visibleOn": "this.sendChannel == 80 && ( this.sendType == 40)", - "columns": [ - { - "name": "title", - "label": "标题" - }, - { - "name": "messageURL", - "label": "跳转链接" - }, - { - "name": "picURL", - "label": "图片链接" - } - ] - }, - { - "type": "input-table", - "name": "btns", - "addable": true, - "editable": true, - "visibleOn": "this.sendChannel == 80 && ( this.sendType == 120)", - "columns": [ - { - "name": "title", - "label": "标题", - "placeholder": "可用占位符{$title}" - }, - { - "name": "actionURL", - "label": "跳转链接", - "placeholder": "可用占位符{$actionURL}" - } - ] - }, - { - "type": "input-text", - "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", - "visibleOn": "this.sendChannel == 90 && (this.sendType == 10 || this.sendType == 110 || this.sendType == 80 ||this.sendType == 120)", - "size": "lg", - "clearValueOnHidden": false - }, - { - "type": "input-text", - "label": "语音Id", - "name": "mediaId", - "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": "mediaId", - "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": "mediaId", - "visibleOn": "this.sendChannel == 90 && (this.sendType == 100 || this.sendType == 110|| this.sendType == 130)", - "size": "lg", - "placeholder": "可用占位符{$mediaId}", - "clearValueOnHidden": false - }, - { - "type": "input-text", - "label": "作者名称", - "name": "dingDingOaAuthor", - "visibleOn": "this.sendChannel == 90 && this.sendType == 130", - "size": "lg", - "clearValueOnHidden": false + "type": "service", + "schemaApi": "http://localhost:8080/messageTemplate/test/content?id=${id}" } ] } diff --git a/pages/crud-new.json b/pages/crud-new.json index 53d4b16..ad7b61b 100644 --- a/pages/crud-new.json +++ b/pages/crud-new.json @@ -201,7 +201,7 @@ "value": "40" }, { - "label": "服务号", + "label": "微信服务号(模板消息)", "value": "50" }, { @@ -330,10 +330,63 @@ "size": "lg", "initFetchOn": "data.sendAccount" }, + { + "type": "radios", + "name": "linkType", + "label": "跳转落地页", + "visibleOn": "this.sendChannel == 50", + "options": [ + { + "label": "HTTP链接", + "value": "10" + }, + { + "label": "小程序", + "value": "20" + } + ], + "required": true + }, + { + "type": "input-text", + "label": "发送链接", + "name": "url", + "required": true, + "visibleOn": "this.sendChannel == 50 && this.linkType==10", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "select", + "label": "小程序", + "name": "miniProgramId", + "required": true, + "visibleOn": "this.sendChannel == 50 && this.linkType==20", + "options": [ + { + "label": "暂无可用小程序", + "value": "10" + } + ], + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "发送链接", + "name": "path", + "required": true, + "visibleOn": "this.sendChannel == 50 && this.linkType==20", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, { "type": "service", "schemaApi": "http://localhost:8080/officialAccount/detailTemplate?id=${sendAccount}&wxTemplateId=${templateId}", - "visibleOn": "this.sendChannel == 50" + "visibleOn": "this.sendChannel == 50", + "description": "请点击【新增】填入文案" }, { "type": "select", @@ -854,7 +907,7 @@ "api": { "url": "http://localhost:8080/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 == '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": "\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\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}", @@ -877,6 +930,10 @@ "dingDingOaContent": "${dingDingOaContent}", "dingDingOaAuthor": "${dingDingOaAuthor}", "officialAccountParam": "${officialAccountParam}", + "templateId": "${templateId}", + "path": "${path}", + "miniProgramId": "${miniProgramId}", + "linkType": "${linkType}", "msgContent": "{\"content\":\"${content}\",\"url\":\"${url}\",\"title\":\"${title}\",\"sendType\":\"${sendType}\",\"picUrl\":\"${picUrl}\"}" } } diff --git a/pages/crud-view.json b/pages/crud-view.json index 567e7a9..0c0e6c9 100644 --- a/pages/crud-view.json +++ b/pages/crud-view.json @@ -179,7 +179,7 @@ "value": "40" }, { - "label": "服务号", + "label": "微信服务号(模板消息)", "value": "50" }, { @@ -239,6 +239,84 @@ "clearValueOnHidden": false, "placeholder": "可用占位符{$url}" }, + { + "type": "select", + "label": "服务号账号", + "name": "sendAccount", + "source": "http://localhost:8080/account/queryByChannelType?channelType=50", + "visibleOn": "this.sendChannel == 50", + "clearValueOnHidden": false, + "required": true, + "size": "lg" + }, + { + "type": "select", + "label": "选择模板", + "name": "templateId", + "source": "http://localhost:8080/officialAccount/template/list?id=${sendAccount}", + "visibleOn": "this.sendChannel == 50", + "clearValueOnHidden": false, + "required": true, + "size": "lg", + "initFetchOn": "data.sendAccount" + }, + { + "type": "radios", + "name": "linkType", + "label": "跳转落地页", + "visibleOn": "this.sendChannel == 50", + "options": [ + { + "label": "HTTP链接", + "value": "10" + }, + { + "label": "小程序", + "value": "20" + } + ], + "required": true + }, + { + "type": "input-text", + "label": "发送链接", + "name": "url", + "required": true, + "visibleOn": "this.sendChannel == 50 && this.linkType==10", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "select", + "label": "小程序", + "name": "miniProgramId", + "required": true, + "visibleOn": "this.sendChannel == 50 && this.linkType==20", + "options": [ + { + "label": "暂无可用小程序", + "value": "10" + } + ], + "size": "lg", + "clearValueOnHidden": false + }, + { + "type": "input-text", + "label": "发送链接", + "name": "path", + "required": true, + "visibleOn": "this.sendChannel == 50 && this.linkType==20", + "size": "lg", + "clearValueOnHidden": false, + "placeholder": "可用占位符{$url}" + }, + { + "type": "service", + "schemaApi": "http://localhost:8080/officialAccount/detailTemplate?id=${sendAccount}&wxTemplateId=${templateId}", + "visibleOn": "this.sendChannel == 50" + }, { "type": "select", "label": "飞书机器人",