页面树结构

版本比较

标识

  • 该行被添加。
  • 该行被删除。
  • 格式已经改变。

...

代码块
languagejs
linenumberstrue
collapsetrue
// appid
var appid = "1000005";

// 发送人,可以选人或者部门
var receiver = JSON.stringify({
    "user": "XiaoXi"
});

// 文本类型的信息
var msg = JSON.stringify({
    "msgType": "text",
    "msgContent": {
        "content": "测试发送信息"
    }
});

// 发送图片类型的信息
var msg = JSON.stringify({
    "msgType": "image",
    "msgContent": {
        "media_id": "3snBPC9exFWCdtZwFGRoTNKnN1ffTLYyQwwvkeqDg9pIfm-ZGE7yW1nK5uIEOW1TY"
    }
});

// 发送文本卡片
var msg = JSON.stringify({
    "msgType": "textcard",
    "msgContent": {
        "title": "测试文本卡片",
        "description": "看一看demo站点上的这个电子表格",
        "url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
        "btntxt": "打开报表"
    }
});


// 发送markdown信息
var msg = JSON.stringify({
    "msgType": "markdown",
    "msgContent": {
		"content": "#一级标题   \r\n##二级标题   \r\n**文字超链**:[简书](http://www.jianshu.com)"
    }
});


// 发送图文消息
var msg = JSON.stringify({
    "msgType": "news",
    "msgContent": { 
        "articles":[
            {
    		"title": "新闻1",	
            "description": "看一看demo站点上的这个电子表格",
            "url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
            "picurl": "https://pic.ntimg.cn/20110811/8029346_082444436000_2.jpg"
	        },{
		    "title": "新闻2",	
            "description": "11123格",
            "url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
            "picurl": "https://pic.quanjing.com/k6/67/QJ6278220913.jpg"
	        },{
		    "title": "新闻2",	
            "description": "3341212表格",
            "url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
            "picurl": "https://pic.quanjing.com/32/3g/QJ6107931496.jpg"
	        }
        ]
    }
});


// ----- 图片来源于Smartbi的报表导出-----
// 生成图片地址
var resId = "I402882ba01942a4e2a4e89e401942acbd7b7167c";   //报表ID,只支持【Web电子表格】、【电子表格】、【交互式仪表盘】
var reportParamSetting = [
    {id: "测试参数", value: "测试参数", displayValue: "测试参数"}     
];   //报表参数信息,参数只支持【Web电子表格】、【电子表格】
var picurl = connector.remoteInvoke("WeiXinModule", "uploadReportToWx", [resId, JSON.stringify(reportParamSetting)]).getResult(); //uploadReportToWx的接口方法,必须使用 2025-01-07 之后的War包之后的Smartbi.war包
 
// 发送图文消息
var msg = JSON.stringify({
    "msgType": "news",
    "msgContent": {
        "articles":[
            {
            "title": "测试标题",
            "description": "测试正文内容:XXXX表格数据",
            "url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402882ba01942a4e2a4e89e401942acbd7b7167c&user=demo&password=demo",
            "picurl": "" + picurl    // 这里必须使用 【"" + picurl】
            }
        ]
    }
});
// ----- 图片来源于Smartbi的报表导出-----


// 发送mpnews图文消息
var msg = JSON.stringify({
    "msgType": "mpnews",
    "msgContent": { 
        "articles":[
            {
    		"title": "新闻1",	
    		"thumb_media_id": "3snBPC9exFWCdtZwFGRoTNKnN1ffTLYyQwwvkeqDg9pIfm-ZGE7yW1nK5uIEOW1TY",
    		"author": "系统用户1",
            "content": "<html><body><b>看一看demo站点上的这个电子表格</b></body></html>",
            "content_source_url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
            },{
		    "title": "新闻2",	
            "thumb_media_id": "3snBPC9exFWCdtZwFGRoTNKnN1ffTLYyQwwvkeqDg9pIfm-ZGE7yW1nK5uIEOW1TY",
    		"author": "系统用户2",
            "content": "<html><body><b>看一看demo站点上的这个电子表格</b></body></html>",
            "content_source_url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
            },{
		    "title": "新闻3",	
            "thumb_media_id": "3snBPC9exFWCdtZwFGRoTNKnN1ffTLYyQwwvkeqDg9pIfm-ZGE7yW1nK5uIEOW1TY",
    		"author": "系统用户3",
            "content": "<html><body><b>看一看demo站点上的这个电子表格</b></body></html>",
            "content_source_url": "https://demo.smartbi.com.cn/smartbi/vision/openresource.jsp?resid=I402881ba7c65508101487ca738e500a2&user=demo&password=demo",
            }
        ]
    }
});

// 发送
connector.remoteInvoke("WeiXinModule", "sendAppMessage", [ appid, receiver, msg]);

...