微信开发系列之五 - 将SAP UI5应用嵌入到微信中

文章系列目录

If you have your UI5 application already running smoothly on some cloud platform like SCP or Heroku, it is then very easy to embed it in the Wechat app. The typical scenario is, when a Wechat user has subscribed your Wechat subscription account, he/she will see some available meu inside the Wechat app defined by you.
In example below, “UI5” is top level menu and “Jerry List” is sub menu item.

微信开发系列之五 - 将SAP UI5应用嵌入到微信中_第1张图片

You can define the logic to react to the menu item click, for example opening your UI5 application runnming on cloud platform.
When you click the “Jerry List” menu, the UI5 application is opened by a built-in browser inside the Wechat app.

微信开发系列之五 - 将SAP UI5应用嵌入到微信中_第2张图片

Here below is implementation detail.
(1) Create your custom Wechat menu via postman:

微信开发系列之五 - 将SAP UI5应用嵌入到微信中_第3张图片

{
                 "button":[
                     {
                       "name":"UI5",
                       "sub_button":[{
                            "type": "view",
                            "name": "Jerry List",
                            "url": "http://wechatjerry.herokuapp.com/ui5"
                       },{
                            "type": "click",
                            "name": "Other UI5 application",
                             "key": "dataQuery"
                       }]
                     }
                 ]
  }

The access token could be retrieved by http get via url: https://api.weixin.qq.com/cgi...&secret=.

(2) since in previous step the UI5 application url http://wechatjerry.herokuapp.... is configured to the button “Jerry List”, so you have to ensure this url works correctly. Deploy your UI5 application to a given cloud platform. You can refer to this blog Step by step to host your UI5 application in Heroku for detail step.

微信开发系列之五 - 将SAP UI5应用嵌入到微信中_第4张图片

In my example my UI5 application is located in a sub folder “webapp” under root folder wechat,

微信开发系列之五 - 将SAP UI5应用嵌入到微信中_第5张图片

And the mapping of url ui5 to this folder is done in my nodejs server:

var express = require('express');    
var app = express();

app.use('/ui5', express.static(process.cwd() + '/webapp'));

After that you could test the scenario in your Wechat app.

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

你可能感兴趣的:(微信,微信小程序,微信公众平台,sap,saprfc)