Small program development:
Environment: micro-channel Developer Tools
1. Download the micro-channel official website developer tools
https://developers.weixin.qq.com/miniprogram/dev/devtools/devtools.html
2. applets account, the official register and obtain other necessary information APPID
https://mp.weixin.qq.com/wxopen/waregister?action=step1
3. To understand the overall directory structure
a. app.js, app.json, app.wxss b. page other pages directory (js, wxml, json, wxss) c. Other
*** app.js: create a small program body
APP({ 。。。})
*** app.json: global configuration applet, the decision of the page file path, show window, set the network timeout, set up a multi-tab and so on.
{
“pages” :[ ],
"window":{ },
"tabBar":{
“list”:[
{ "PagePath": "pages / index / index", "text": "home"},
{ “pagePath”:“pages / logs / logs”,“text”:“日志” },...
]
},
。。。
}
4. The basic flow
Applet --------------- ----------------- own little micro-channel application server interface server
. A sign in:
----- user opens applet applet wx.login () Gets the temporary login credentials code ------- sends a request to the micro-channel code transmitted by the personal server wx.request server ------ ------- micro-channel interface server server back to the login user's unique identifier to an individual server openid ------ personal server openid and then back to the applet
Up: When an applet calls wx.login (), usually related to the rights issue, which is the user whether to allow this applet to access some user information or micro-channel mobile phones. wx.getSetting () - obtain permission request through to the user; wx.authorize () - initiated authorization request (a request to initiate specific authorization request as required to the user: https: //developers.weixin.qq.com/miniprogram/ dev / framework / open-ability / authorize.html # scope-% E5% 88% 97% E8% A1% A8)
. B custom applet other pages:
1. According to business needs, app.json add pages to the corresponding route entry list
2. Save refresh, page directory automatically creates a corresponding page directory and related documents
3. Customize these newly created files and directories, to the needs of the target
. C applet payment:
Premise: small programs submitted released
Payment interface: wx.requestPayment ()
Parameters: temeStamp, noncetr, package, signType, paySign
*** package: a unified call orders prepay_id returned interface