I. Network:
1. Network related API Description [1] Server domain name Configuration introduction 1 Each wechat applet needs to set a communication domain name in advance, and the applet can communicate with the designated domain name and network. Including ordinary HTTPS request, uploadFile, downloadFile, and WebSocket communication.
2 Configuration process Applet Background > Development Settings > Server domain name Configuration Note the following: • Domain names support only request, uploadFile, and downloadFile (HTTPS) and connectSocket (WSS) protocols. • The domain name cannot use an IP address or localhost. • Domain name must be registered by ICP; · For security reasons, api.weixin.qq.com cannot be configured as a server domain name and the related API cannot be called within the applets. ** Developers should save AppSecret in the background server, use appSecret to get Accesstoken through the server, and call the relevant API; • A maximum of 20 domain names can be configured for each interface. • 3 HTTPS certificate applets must use HTTPS requests. The mini-program verifies the HTTPS certificate used by the server domain name. If the verification fails, the request cannot be initiated. Due to system limitations, different platforms have different degree of strict requirements for certificates. To ensure the compatibility of small programs, you are advised to configure certificates according to the highest standards and use related tools to check whether the existing certificates meet requirements. Certificate configuration requirements: • The HTTPS certificate must be valid. The SSL certificate must be trusted by the system. The domain name of the website where the SSL certificate is deployed must be the same as the domain name issued by the certificate. The certificate must be within the validity period. • iOS does not support self-signed certificates; • The iOS certificate must meet the requirements of Apple App Transport Security (ATS); • TLS must support version 1.2 or later. Some older Android models do not support TLS 1.2. Ensure that the TLS version of the HTTPS server supports 1.2 or a later version. • Some cas may not be trusted by the operating system. Please pay attention to the applets and notices of each system when selecting certificates. • Skip domain name verification In wechat developer tools, you can temporarily enable the development environment not to verify the requested domain name, TLS version, and HTTPS certificate, skipping server domain name verification. In this case, the server domain name will not be verified in the wechat developer tool or when the mobile phone is in debug mode. After the server domain name is configured successfully, you are advised to disable this option and test the server domain name on each platform to ensure that the server domain name is correctly configured.
• The maximum concurrent limit for request, uploadFile and downloadFile is 10. • The Referer header of network requests cannot be set. The format is fixed to servicewechat.com/{appid}/{ve… {appID} is the appID of the applet. {version} is the version number of the applet. If the version number is 0, it indicates the development version, trial version, and review version. • After the small program runs in the background (non-top chat), if the network request does not end within 5 seconds, an error message fail interrupted will be returned. The network request interface call will not be called until it comes back to the foreground.
[3] Regarding the key encoding of server return value 1, it is recommended that the server return value use UTF-8 encoding. For non-UTF-8 codes, the applet will try to convert, but there is a chance that the conversion will fail. The applet will automatically filter the BOM header. Please judge the return value according to the business logic
Wx. request(OBJECT) : initiates a network request
Wx. uploadFile(OBJECT) : uploads local resources to the developer server. Wx. downloadFile(OBJECT) : downloads files and resources to the local PC
4, WebSocket wx.connectSocket(OBJECT) : WebSocket wx.onSocketOpen(CALLBACK) : Wx. onSocketError(CALLBACK) : listen for WebSocket error wx.sendSocketMessage(OBJECT) : Send data over WebSocket connection wx.onSocketMessage(CALLBACK) : listens for WebSocket to receive message events to the server wx.Closesocket (OBJECT) : Close WebSocket connection wx.onSocketClose(CALLBACK) : Listen for WebSocket to close SocketTask: WebSocket task, which can be created through the wx.connectSocket() interface
Ii. Media:
Wx.chooseimage (OBJECT) : select the image from the local album or use the camera to take a photo wx.previewImage(OBJECT) : Preview the image wx.getimageInfo (OBJECT) : Image information, and for network images, need to configure the download the domain to work to wx. SaveImageToPhotosAlbum (OBJECT) : save the photo albums to the system
2, recording wx.startRecord(OBJECT) : start recording wx.stopRecord() : active call stop recording Note: blank parentheses indicate that there is no parameter
Wx.getrecordermanager () : Obtain the globally unique recorderManager
Audio playback control Wx. playVoice(OBJECT) : starts playing voice wx.Pausevoice () : stops playing voice wx.stopVoice() : ends playing voice
5, music playback controls wx. GetBackgroundAudioPlayerState (OBJECT) : access to the background music playing. PauseBackgroundAudio () : Pauses playing music wx.seekbackgroundAudio (OBJECT) : Control music playback progress wx. StopBackgroundAudio () : stop playing music wx. OnBackgroundAudioPlay (the CALLBACK) : listening to music play wx. OnBackgroundAudioPause (the CALLBACK) : Listen on music pause wx.onBackgroundAudioStop(CALLBACK) : Listen on music stop
6, background audio playback management wx. GetBackgroundAudioManager () : to get the globally unique background audio manager backgroundAudioManager
Wx. createAudioContext(audioId, this) : Creates and returns an Audio context audioContext object. Under the custom components, the second parameter passed in this component instance, to operate within the component wx. CreateInnerAudioContext () : create innerAudioContext object and returns the internal audio context. This interface is an upgrade to wx.createAudioContext. Wx. GetAvailableAudioSources (OBJECT) : get the current support audio input source
Wx. ChooseVideo (OBJECT) : Shoot video or select video from the phone album, return to the temporary file path of the video. Wx. SaveVideoToPhotosAlbum (OBJECT) : save the video album to the system
Wx. createVideoContext(videoId, this) : Create and return the Video context videoContext object. Under a custom component, the second argument is passed to the component instance this to manipulate the <video/ component within the component.
10, Camera component control wx.createcameraconText (this) : Create and return the Camera context cameraContext object. The cameraContext is bound to the camera component of the page. A page can only have one camera, through which the corresponding component can be manipulated. Under a custom component, the first parameter is passed to the component instance This to operate on components within the component
11, real-time audio and video wx. CreateLivePlayerContext (domId, this) : operating the corresponding component. Create and return the Live-Player context LivePlayerContext object. Under the custom components, the second parameter passed in this component instance and to operate within the component wx. CreateLivePusherContext () : Create and return a LivePusherContext object. The LivePusherContext is bound to the components of a page. A page can only have one LivePusher, through which the corresponding components can be manipulated. Under a custom component, the first parameter is passed to the component instance This to operate on components within the component
12, dynamic loading font wx.loadFontFace(OBJECT) : dynamic loading network font, file address must be the download type. In IOS, only HTTPS file addresses are supported.
Iii. Documents:
Wx.savefile (OBJECT) : saves the file to the local wx.getFileInfo(OBJECT) : obtains file information wx.getSavedFilelist (OBJECT) : Wx.getsavedfileinfo (OBJECT) : Obtains file information about local files wx.removesavedFile (OBJECT) : deletes files stored locally wx.openDocument(OBJECT) : New page to open the document, support the format: DOC, XLS, PPT, PDF, DOCx, XLSX, PPTX
FileSystemManager wx.getFilesystemManager () : For globally unique file manager FileSystemManager. AppendFile (Object Object) : at the end of file additional contents FileSystemManager. Access (Object Object) : To determine whether a file/directory exists FileSystemManager. AccessSync (string path) : FileSystemManager. Access the synchronous version FileSystemManager. AppendFileSync (string filePath, string | ArrayBuffer data, Synchronized version of the string encoding) : FileSystemManager appendFile FileSystemManager. Used by copyFile (Object Object) : Copy the file FileSystemManager. CopyFileSync (string srcPath, string destPath) : FileSystemManager. Used by copyFile synchronous version FileSystemManager. GetSavedFileList Object (Object) : To get the small program saved under local cache file list FileSystemManager. GetFileInfo (Object Object) : Under this small program for a local file or a local cache file information FFileSystemManager. Mkdir (Object Object) : create the directory FileSystemManager. MkdirSync (string dirPath) : FileSystemManager. Mkdir synchronous version FileSystemManager. RemoveSavedFile (Object Object) : To remove the small program saved under local cache file FileSystemManager. ReadFileSync (string filePath, string encoding) : FileSystemManager. ReadFile synchronous version FileSystemManager. RenameSync (string oldPath, Synchronous version of the string newPath) : FileSystemManager. Rename FileSystemManager. RmdirSync (string dirPath) : FileSystemManager. Rmdir synchronous version FileSystemManager. Readdir (Object Object) : read directory file list FileSystemManager. Rename (Object Object) : rename files, You can move files from oldPath newPath FileSystemManager. ReadFile (Object Object) : read a local file contents FileSystemManager. Rmdir (Object Object) : delete the directory FileSystemManager readdirSync (string dirPath) : FileSystemManager. Readdir synchronous version FileSystemManager. SaveFile (Object Object) : save the temporary file to the local. This interface moves temporary files, so tempFilePath will not be available after a successful call. FileSystemManager.saveFileSync(string tempFilePath, String filePath) : FileSystemManager version saveFile synchronous FileSystemManager. Stat (Object Object) : get Stats Object file FileSystemManager. StatSync (string path) : FileSystemManager stat synchronous version Stats: describe the state of the file object Stats. IsDirectory () : to judge whether the current file to a directory FileSystemManager. Unlink (Object Object): deletes the file FileSystemManager. Unzip (Object Object): decompresses the file FileSystemManager. UnlinkSync (string filePath) : FileSystemManager. Unlink synchronization version FileSystemManager. WriteFile (Object Object) : write file FileSystemManager. WriteFileSync (string filePath, string | ArrayBuffer data, String encoding) : FileSystemManager writeFile synchronous version
Iv. Data cache:
1. Introduction Each wechat applet can have its own local cache. Can be achieved by Wx.setstorage (wx.setStoragesync), wx.getStorage (wx.getStoragesync), and wx.clearStorage (wx.clearStoragesync) can set, obtain, and clear the local cache. For the same wechat user, the upper limit of a small program storage is 10MB. LocalStorage is isolated by users. On the same device, user A cannot read user B’s data. Note: If the user runs out of storage space, we will clear the local cache of the most recent and unused applets. It is not recommended to store all key information in localStorage in case of insufficient storage space or users change devices.
2. Local cache Wx. setStorage(OBJECT) : It is an asynchronous interface that stores data in a specified key in the local cache and overwrites the content corresponding to the original key. Wx. setStorageSync(KEY,DATA) : Stores DATA in a specified KEY in the local cache, overwriting the content corresponding to the original KEY. This is a synchronization interface. Wx.getstorage (OBJECT) : asynchronously obtains the contents of the specified key from the local cache. Wx.getstoragesync (key) : synchronously obtains the contents of the specified key from the local cache. Wx.getstorageinfo (OBJECT) : Wx. getStorageInfoSync: Synchronizes information about the current storage. Wx. removeStorage(OBJECT) : synchronizes information about the current storage. Remove the specified key asynchronously from the local cache wx.removeStoragesync (key) : remove the specified key asynchronously from the local cache wx.clearStorage() : clear the local cache wx.clearStoragesync () : Note: the size of the local data store is limited to 10MB
Five, location:
Wx.getlocation (OBJECT) : get the current location and speed. ChooseLocation (OBJECT) : To open the map and select a location, the user must authorize scope.userLocation.
Wx. openLocation(OBJECT) : To use the built-in map of wechat to view the location, the user needs to authorize scope.userLocation
Wx. createMapContext(mapId, this) : Creates and returns a Map context mapContext object. Under a custom component, the second parameter is passed to the component instance this to operate on the component within the component
Vi. Equipment:
Wx.getsysteminfo (OBJECT) : Obtains system information wx.getSystemInfoSync() : obtains system information synchronization interface wx.caniUse (String) : obtains system information synchronization interface wx.caniUse (String) : Determines whether applets’ apis, callbacks, parameters, components, etc. are available in the current version.
Wx. onMemoryWarning(callback) : Listen to the events of insufficient memory. Android has alarm levels, and only LOW and CRITICAL will be called back to the developer. IOS has no hierarchy.
Wx. getNetworkType(OBJECT) : obtains the network type. Wx. onNetworkStatusChange(CALLBACK) : listens for network status changes
4, accelerometer Wx. onAccelerometerChange(CALLBACK) : listen to acceleration data, frequency: 5 times/second, the interface will automatically start to listen after the call, can use wX. stopAccelerometer stop listening. Wx. startAccelerometer(OBJECT) : starts to listen to acceleration data. Wx. stopAccelerometer(OBJECT) : stops listening to acceleration data
Wx.oncompasschange (CALLBACK) : listen to compass data, frequency: 5 times/second, the interface will automatically start listening, wx.stopCompass can be used to stop listening wx.startCompass(OBJECT) : Wx. stopCompass(OBJECT) : Stop listening for compass data
6. Make a call wx.makePhoneCall(OBJECT) : Make a call
7. Wx.scancode (OBJECT) : Invokes the code scanning interface on the client and returns the corresponding result after the code scanning is successful
Wx. setClipboardData(OBJECT) : Sets the content of the system clipboard. Wx. getClipboardData(OBJECT) : obtains the content of the system clipboard
OpenBluetoothAdapter (OBJECT) : Initializes the bluetooth module of the small program. The effective period is from the call of wx.openBluetoothAdapter to the call of wx.closeBluetoothAdapter or the small program is destroyed. Wx. closeBluetoothAdapter(OBJECT) : Disables the Bluetooth module and makes it enter the uninitialized state. Wx. GetBluetoothAdapterState (OBJECT) : access to the native state of bluetooth adapter wx. OnBluetoothAdapterStateChange (the CALLBACK) : Wx monitor bluetooth adapter state change events. StartBluetoothDevicesDiscovery (OBJECT) : started to search for nearby bluetooth peripherals wx. StopBluetoothDevicesDiscovery (OBJECT) : Stop searching for nearby Bluetooth peripherals wx.getBluetoothDevices(OBJECT) : Effective access to the bluetooth module in the small program during all bluetooth devices have been found, including have the machine in the connection state of equipment and wx. OnBluetoothDeviceFound (the CALLBACK) : Listen to find new equipment event wx. GetConnectedBluetoothDevices (OBJECT) : according to the uuid for wx in the connected state of the equipment. CreateBLEConnection (OBJECT) : Connect to low-power Bluetooth device Wx. closeBLEConnection(OBJECT) : Disconnect from low-power Bluetooth device Wx. getBLEDeviceServices(OBJECT) : Access to bluetooth devices all service (service) wx. GetBLEDeviceCharacteristics (OBJECT) : Get a bluetooth device in a service all characteristic (eigenvalues) wx. ReadBLECharacteristicValue (OBJECT) : Read the low-power bluetooth device wx. The value of the characteristic value of binary data writeBLECharacteristicValue (OBJECT) : To the bluetooth device features low power consumption value writing binary data in wx. NotifyBLECharacteristicValueChange (OBJECT) : Enable the bluetooth device features low power consumption value change notify function, subscribe to the eigenvalue wx. OnBLECharacteristicValueChange (the CALLBACK) : listening to the low power consumption characteristic value of bluetooth devices Bluetooth error code list: 10000: Uninitialized Bluetooth adapter 10001: The current Bluetooth adapter is unavailable 10002: the specified device was not found 10003: the connection failed 10004: the specified service was not found 10005: the specified feature value was not found 10006: The current connection is disconnected 10007: This operation is not supported by the current eigenvalue. 10008: Exceptions reported by all other systems. 10009: This anomaly is unique to the Android system
IBeacon wx.startBeaconDiscovery(OBJECT) : start to search for iBeacon device wx.stopBeaconDiscovery(OBJECT) : Stop searching nearby iBeacon devices wx.getBeacons(OBJECT) : Retrieve all searched iBeacon devices wx.onBeaconUpdate(CALLBACK) : Listen for iBeacon device update event wx.onBeaconServiceChange(CALLBACK) : Listen for iBeacon service status change
Wx. setScreenScreenon (OBJECT) : Set the brightness of the screen wx. getScreenScreenOn (OBJECT) : Set whether to keep the state steady on
12. User screenshot event wx.onUserCaptureScreen(CALLBACK) : Listens to the user’s active screenshot event. This event is triggered when the user uses the system screenshot button to capture the screen
Wx. VibrateLong (OBJECT) : Vibrate the phone for a longer time (400ms) WX. VibrateShort (OBJECT) : Vibrate the phone for a shorter time (15ms)
14. Mobile phone contact wx.addPhoneContact(OBJECT) : After the call, the user can choose to write the form into the mobile phone system address book in the way of “New Contact” or “Add to existing contact” to complete the addition of contacts and contact information in the mobile phone address book
NFC wx.getHCEState(OBJECT) : determines whether the current device supports the HCE capability. Wx. startHCE(OBJECT) : initializes the NFC module. Wx.onhcemessage (CALLBACK) : Listens for message callbacks from NFC devices and processes them in the CALLBACK. Wx. sendHCEMessage(OBJECT) : sends NFC messages. This parameter is valid only in Android.
WiFi wx.startwifi (OBJECT) : initializes the Wi-Fi module wx.Stopwifi (OBJECT) : disables the Wi-Fi module wx.Connectwifi (OBJECT) : initializes the Wi-Fi module wx.Stopwifi (OBJECT) : disables the Wi-Fi module wx.Connectwifi (OBJECT) : initializes the Wi-Fi module wx.Stopwifi (OBJECT) : disables the Wi-Fi module wx.Connectwifi (OBJECT) : Wx. getWifiList(OBJECT) : Request to get the Wi-Fi list, return wifiList data in the CALLBACK registered by onGetWifiList wx.onGetWifiList(CALLBACK) : WifiList wx.setwifilist (OBJECT) : wifiList wx.setwifilist (OBJECT) WifiList interface Wx.onWificonnected (CALLBACK) : Listen for wi-fi connection events wx.getConnectedWifi(OBJECT) : Obtains connected Wi-Fi information
Vii. Interface:
Wx.showtoast (OBJECT) : displays the message prompt box. Wx.showloading (OBJECT) : displays the loading prompt box. You need to actively call wx.hideloading to close the prompt box. Hide message prompt wx.hideLoading() : hides loading prompt wx.showModal(OBJECT) : displays the modal window wx.showActionSheet(OBJECT) : displays the operation menu
2, set up navigation wx. SetNavigationBarTitle (OBJECT) : dynamic Settings. The title of the current page wx showNavigationBarLoading () : In the current page displays the navigation bar loading animation wx. HideNavigationBarLoading () : hide the navigation bar loading animation wx. SetNavigationBarColor (OBJECT) : set the background color of the navigation bar
3, Set tabbar wx.setTabBarBadge(OBJECT) : Add text wx.removeTabBarBadge(OBJECT) to the upper right corner of a tabbar entry. Wx.showtabbarreddot (OBJECT) : Displays the red dot wx.hideTabBarreddot (OBJECT) in the upper right corner of a tabBar item: Wx.settabbarstyle (OBJECT) : Dynamically sets the entire tabBar style. Wx.settabbaritem (OBJECT) : Wx. showTabBar(OBJECT) : displays tabBar wx.showTabBar(OBJECT) : hides tabBar
4, setting window background backgroundColor: dynamic Settings window background color wx. SetBackgroundTextStyle (OBJECT) : dynamic set down the style of the font, loading diagram
Wx. setTopBarText(OBJECT) : Dynamic setting of the top bar text content, only when the current applet is set to the top, if the current applet is not set to the top, also can be called successfully, but does not take effect immediately, only after the user will set the small program to the top text content
NavigateBack wx. RedirectTo (OBJECT) : navigateBack wx. RedirectTo (OBJECT) : Wx. switchTab(OBJECT) : Switches to the tabBar page and closes all other non-Tabbar pages. Wx. navigateBack(OBJECT) : Wx. reLaunch(OBJECT) : Close all pages and open a page within the application
Wx.createanimation (OBJECT) : Creates an animation instance
8. Position wx.pagescrollto (OBJECT) : Scrolls the page to the target position
CreateCanvasContext: create canvas drawing context (specify canvasId) createContext(not recommended) : createCanvas drawing context drawCanvas(not recommended) : Draw canvasToTempFilePath: Export image
[2] List of methods of context object “1” Color, style, shadow “2” Gradient “3” line style “4” Rectangle “5” Path “6” Transform “7” text “8” picture “9” mix “10” other
[4] Step 1: Create a Canvas drawing context step 2: Use Canvas drawing context for drawing description Step 3: Draw wx.createcanvasContext (canvasId, this) : Wx.createcontext: Creates and returns a drawing context (not recommended) drawCanvas: Use the provided actions to draw on the canvas corresponding to the given Canvas-id (not recommended) wx.canvastotempFilepath (OBJECT, this) : Exports the contents of the specified area of the current canvas to generate a picture of the specified size, and returns the file path. Wx.canvasgetimagedata (OBJECT, this) : Returns an array describing the pixel data hidden in the Canvas area. The pixel data. The method of drawing to the canvas canvasContext setFillStyle: set the fill color canvasContext. SetStrokeStyle: set the border color canvasContext. SetShadow: Set the shadow style canvasContext. CreateLinearGradient: create a linear gradient color canvasContext. CreateCircularGradient: Create a circular gradient color canvasContext. AddColorStop: create a color gradient point canvasContext. SetLineWidth: set the line width canvasContext. SetLineCap: Set the endpoint of line style canvasContext. SetLineJoin: set the intersection of line style canvasContext. SetLineDash: set a dotted line style method canvasContext. SetMiterLimit: Set the maximum miter length. The miter length is the distance between the inner and outer angles at the intersection of two lines. This parameter is valid only when setLineJoin() is set to miter. FillRect: Creates a rectangle canvasContext. FillRect: fills a rectangle canvasContext. StrokeRect: Canvascontext. clearRect: Clears the canvas of the contents within the rectangle. Canvascontext. fill: fills the contents of the current path. The default fill color is black canvasContext.stroke: Draws the border of the current path. The default color is black. CanvasContext. BeginPath: To start creating a path, you need to call fill or stroke to fill or stroke the path. MoveTo: Moves the path to the specified point on the canvas without creating a line canvasContext.lineTo: Create lineTo method adds a new, since the last time and then create a specified point to the target point line canvasContext. Arc: draw a curve canvasContext. BezierCurveTo: . Create a cubic bezier path canvasContext quadraticCurveTo: create a quadratic bezier path canvasContext. Scale: after call scale method, created after the path of the horizontal ordinate scale. Multiple calls to scale will multiply the multiples. Canvascontext. rotate: The origin is the center. The origin can be modified using the Translate method. Rotate the current coordinate axis clockwise. If you call rotate multiple times, the rotation Angle will add up. Translate the origin (0, 0) of the current coordinate system. The default origin is the upper left corner of the page canvasContext.clip: Clip () method from the original canvas that any shape and size of the shear canvasContext. SetFontSize: set the font size canvasContext. FillText: On the canvas to draw text is populated canvasContext. SetTextAlign: used to set the text alignment canvasContext. SetTextBaseline: used to set the text of the horizontal alignment canvasContext. DrawImage: Draw the image to the canvas canvasContext. SetGlobalAlpha: set the global transparency canvasContext brush. Save: saves the current graphics context canvasContext. Restore: Restore the previously saved drawing context canvasContext.draw: Draw the description (path, deformation, style) from the previous drawing context to canvas canvasContext.getActions: Returns the graphics context drawing action (not recommended) canvasContext. ClearActions: empty drawing context drawing action (not recommended) canvasContext. MeasureText: Measure the text size information, at present only returns text width canvasContext. GlobalCompositeOperation: this attribute is set to create a new shape in application of the type of synthetic operation. CanvasContext. ArcTo: according to the control point and radius of circular arc path drawing canvasContext. StrokeText: a given position (x, y) draw text stroke methods canvasContext. LineDashOffset: Set the properties of the deviation of the dotted line canvasContext. CreatePattern: Method to create the specified image patterns, can be in the specified direction repeat. Yuan image canvasContext shadowBlur: set up the fuzzy level of shadows canvasContext. ShadowColor: Set the color of the shadow canvasContext. ShadowOffsetX: set shadow in relation to the direction of the shape in a horizontal offset canvasContext. ShadowOffsetY: set the shadow canvasContext in relation to the direction of the shape in the vertical migration. The font: Set the current font style attribute canvasContext. Transform: use canvasContext multiple superimposed current transform matrix. The transform: multiple superimposed current using matrix transformation method canvasContext. SetTransform: Method of resetting (overwriting) the current transformation using a matrix
OnPullDownRefresh () : Define the onPullDownRefresh handler in the Page and listen to the user pulldownRefresh event wx.startPulldownRefresh (OBJECT) : The drop-down refresh animation is triggered after the call. The effect is the same as that of the user’s manual drop-down refresh. Wx.stoppulldownrefresh () : Stops the drop-down refresh of the current page
Wx.createselectorquery () : Returns an instance of SelectorQuery. Selectorquery.in (Component) : Change the selector’s scope to selectorQuery.select(selector) within the custom component: selectorQuery.select(selector) Select the first node under the current page that matches the selector, and return an instance of the NodesRef object that can be used to get node information selectorQuery.selectAll(selector) : Select the node under the current page that matches the selector, returning an instance of the NodesRef object. Unlike selectorQuery.select(selector), it selects all the nodes that match the selector. SelectorQuery. SelectViewport () : choose the display area, can be used to obtain the information such as the size of the display area, rolling position, return a NodesRef object instances. NodesRef. BoundingClientRect ([callback]) : the layout of the add node location query request, relative to the display area, in pixels. The function is similar to the DOM’s getBoundingClientRect. The return value is the selectorQuery corresponding to nodesRef. Nodesref.scrolloffset ([callback]) : Adds a scrolling position query request for a node, in pixels. The node must be an scroll view or viewport. The return value is the selectorQuery corresponding to nodesRef. Nodesref. fields(fields, [callback]) : Obtains node information. The fields to be obtained are specified in fields. The return value is the selectorQuery corresponding to nodesRef. Selectorquery.exec ([callback]) : Executes all requests, and returns the results as an array in the order requested, in the first argument of the callback.
12. WXML node layout intersection state (The node layout intersection state API can be used to listen for the intersection state of two or more component nodes at the layout location. This set of apis is often used to infer whether and what percentage of nodes are visible to the user.)
Wx. CreateIntersectionObserver ([this], [options]) : Creates and returns a IntersectionObserver object instance IntersectionObserver. RelativeTo (selector, [margins]) : use the selector to specify a node, as one of the reference area. The margins of the reference node layout area are extended (or shrunk) to include left, right, top, and bottom. IntersectionObserver. RelativeToViewport ([margins]) : specify the page display area as a reference to one of the areas. The margins of the reference node layout area are extended (or shrunk) to include left, right, top, and bottom. IntersectionObserver. Observe (targetSelector callback) : specify the target node and to start listening to intersect a status changes. The callback function contains one parameter, result. IntersectionObserver. Disconnect () : stop listening. The callback function will no longer fire.
Viii. Third-party Platforms:
Wx.getextconfig (OBJECT) : Obtains data fields customized by third-party platforms. Wx.getextconfigsync () : Synchronization interface to obtain data fields customized by third-party platforms.
Ix. Open Interface:
Wx. login(OBJECT) : Invoke interface wx.login() to obtain temporary login credentials (Code) Signature verification and encryption and decryption of user data 1 Data signature verification 2 Encrypted data decryption algorithm 3 Session key session_Key Validity WX.checkSession (OBJECT) : Verify that the current session_key is valid
Authorization 1 Obtain authorization information. 2 Open the setting page. 3 Initiate authorization requests in advance
[1] interface wx.getUserInfo(OBJECT) : 1. If the user is not authorized, this interface will directly report an error. 2. If the developer has multiple mobile applications, website applications, and public accounts (including small programs), the uniqueness of the user can be distinguished by the UnionID. As long as it is a mobile application, website application and public account (including small program) under the same wechat open platform account, the user’s UnionID is unique. In other words, the same user, different applications under the same wechat open platform, unionID is the same. 2 How to obtain the UnionID 1. Call wx.getUserInfo to obtain the UnionID from the decrypted data. Notice This interface requires user authorization. The developer should properly handle the situation when the user refuses authorization. 2. If the developer account has a public account of the same subject and the user has followed the public account. The developer can directly obtain the UnionID of the user through wx.login without user re-authorization. 3. If the developer account has a public account or mobile application of the same subject, and the user has been authorized to log in to the public account or mobile application. The developer can also directly obtain the UnionID of the user through wx.login without user re-authorization. “3” wechat Open Platform binding small program process Logging in tO wechat Open Platform — account Center — Developer qualification Certification 4 “Binding process Logging in to wechat Open Platform — Management Center — Public Account — Binding public account
Wx. RequestPayment (OBJECT) : Initiate wechat payment
[1] Introduction Access_token is a globally unique interface call credential. Developers need to use the Access_token when invoking each interface. Please keep the access_token properly. The access_token must be stored with a minimum of 512 characters. The validity period of the Access_Token is two hours. The validity period of the access_token must be updated periodically. If the access_token is obtained repeatedly, the access_token obtained last time becomes invalid.
[2] Usage and generation of Access_token description: 1. In order to keep AppSecRect confidential, a third party needs a central control server for access_token acquisition and refresh. The access_token used by other business logic servers are all from the central control server, so they should not be refreshed separately. Otherwise, access_token will be overwritten and services will be affected. 2. Currently, the validity period of the access_token is expressed by the returned expires_in, which is within 7200 seconds. The central server needs to refresh the access_token in advance based on this validity period. In the process of refreshing, the central control server still outputs the old Access_token. At this time, the background of the public platform will ensure that both the new and old Access_token are available within a short period of refreshing, which ensures the smooth transition of third-party services. 3. The validity time of access_token may be adjusted in the future. Therefore, the central control server not only needs to refresh the access_token actively by internal timing, but also needs to provide an interface to refresh the Access_token passively, which is convenient for the service server when the API call is informed that the access_token has timed out. The access_token refresh process can be triggered.
Obtain the template ID. (1. Obtain the template ID through the template message management interface, 2. Manually configure the template ID on wechat public platform) Step 2: page
[2] Template message management 1 Obtain the title list of the applet template library 2 Obtain the keyword database under the title of a template library 3 Combine the template and add it to the personal template library under the account 4 Obtain the template list under the account 5 Delete a template under the account
[3] Send template message 1 to deliver description of conditions (1. Payment; 2. Form submission) 2 to review instructions (1. Title, 2. Key words, 3. Explanation of violation, 4.
7. Customer service message [1] Receiving message and event “1” text message “2” picture message “3” small program card message “4” Enter the conversation event [2] Send customer service message [3] forward message
[4] Temporary material Interface 1 Obtain temporary material 2 Add temporary material [5] Customer service input status [6] Access Guide 1 Fill in the server configuration 2 Verify that the message is indeed from the wechat server 3 Implement the business logic according to the interface document
8, Forwarding Page. OnShareAppMessage (Object) : customize the forwarding content of the Page wx.showShareMenu(Object) : display the forwarding button of the current Page wx.hideShareMenu(Object) : Hide the forward button. Wx. updateShareMenu(OBJECT) : updates the forward attribute. Wx. getShareInfo(OBJECT) : Obtains detailed information about forwarding
[1] Obtain small program code We recommend to generate and use small program code, it has better identification. There are currently two interfaces that can generate applets, and developers can choose the appropriate interface according to their own needs. A interface, generate small program code, acceptable path parameter is long, the number of generated limited. This interface is applicable to service scenario B that requires a small number of codes and generates small program codes. Short page parameters are acceptable and the number of generated codes is not limited. This method is applicable to service scenarios where a large number of codes are required
[2] Obtain the C interface of the small program TWO-DIMENSIONAL code and generate the small program two-dimensional code. The acceptable path parameter is long and the number of generated is limited. This method is applicable to service scenarios that require a small number of codes
[3] Note that 1 can only generate the TWO-DIMENSIONAL code of published small programs through this interface. 2 can generate the development version of the qr code with reference during the developer tools preview. 3. The total number of codes generated by interface A and interface C is limited to 100,000. 4. POST parameters need to be converted to JSON strings, and form submission is not supported. 5 The auto_color line_color parameter applies only to small program codes.
Wx.chooseaddress (OBJECT) : tune up the user to edit the delivery address native interface, and after the completion of editing back to the user selected address.
Wx. addCard(OBJECT) : addCard coupons in batches. Wx. openCard(OBJECT) : view the card coupons in the wechat card package and use the membership card component. The developer directly invokes the procedure as follows: 1. Create a wechat membership card and set it to one-button activation mode; 2. Set the card opening field. 3. Obtain card opening component parameters.
12, set wx.openSetting(OBJECT) : call up the client small program setting interface, return the operation result of user Settings. Wx.getsetting (OBJECT) : Gets the current Settings of the user
13. Wechat movement wx.getwerundata (OBJECT) : To obtain the number of wechat movement steps in the past 30 days, you need to call the wx.login interface first.
14. Current Account Information Wx.getAccountInfoSync () : access the account information of the current applet or plug-in
15, open the small program wx. NavigateToMiniProgram (OBJECT) : open under the same number of public relation wx. Another small program navigateBackMiniProgram (OBJECT) : Returns to the previous applet, which can only be called successfully if the current applet was opened by another applet
16, Open App In the life cycle of a small program, only under certain conditions, can have the ability to open the App. The ability to open APP can be understood as a state managed internally by the applets framework. If it is true, APP can be opened; if it is false, APP cannot be opened.
Wx. ChooseInvoiceTitle (OBJECT) : Select the invoice title of the user
18, biological certification wx. CheckIsSupportSoterAuthentication (OBJECT) : native support for SOTER biometric authentication way wx. StartSoterAuthentication (OBJECT) : Start SOTER biometrics wx. CheckIsSoterEnrolledInDevice (OBJECT) : obtain equipment whether the input interface of biological information such as a fingerprint
19, nearby “1” add location “2” view location list “3” delete location “4” show/cancel show nearby small program
20, plug-in management applets developers can manage plug-ins through the following interfaces, including: add, delete, query added plug-ins. Plug-in developers can also call the interface to manage plug-in usage requests. “1” Application for using plug-ins “2” Query added plug-ins “3” Delete added plug-ins “4” Obtain all current users of plug-ins (for plug-in developers to call) “5” Modify the status of plug-in application (for plug-in developers to call)
Wx.msgseccheck: Checks whether a piece of text contains illegal content
X. Data:
1. General Analysis [1] Introduction Detailed data of user access applets can be obtained from access analysis, and some index data such as cumulative number of users are provided in the overview
[2] Visit analysis 1 visit trend 2 Visit distribution 3 Visit retention 4 visit page
[3] User Portrait to obtain the portrait distribution data of new or active users of small programs. Time range The value can be yesterday, latest 7 days, or latest 30 days. Where, the number of newly added users is the number of dereused households that access the applet for the first time in the time range, and the number of active users is the number of dereused households that access the applet for the first time in the time range. Portrait attributes include user age, gender, province, city, terminal type, and model.
2. User-defined analysis wx.reportAnalytics(eventName, Data) : User-defined analysis data reporting interface
Xi. Update:
Wx.getupdatemanager () : Gets a globally unique version update manager for managing applets updates. For details on the update mechanism for applets, see the runtime mechanism documentation.
Twelve, multi-threading:
Wx.createworker (scriptPath) : Before using createWorker, please consult the multithreading documentation for the basics and configuration methods. Create a Worker thread and return the Worker instance. Currently, only one Worker can be created at most. Please call worker.terminate before creating the next Worker. ScriptPath is the entry file path of worker, which needs to be filled in as an absolute path.
Xiii. Monitoring
Wx. reportMonitor(Name, Value) : User-defined service data monitoring reporting interface Applet Management Background o&M Center Performance Monitoring Service Data Monitoring Creating monitoring events
Xiv. Debugging Interface:
Wx. setEnableDebug(OBJECT) : Sets whether to enable debugging. This switch is valid even for official versions.
Xv. Journal:
Wx. GetLogManager () : Access log manager that the logManager Object “1” that the logManager provide the log, info, warn, the debug method of four write logs to a file, the four method accepts any type of Object/Array/Number/String parameters, The total size of the parameters for each call does not exceed 100Kb. A maximum of 5M log content can be saved. When the log content exceeds 5M, old log content is deleted. “2” set the open-type of Button component to feedback to upload the printed log. You can log in to the mini program management background and access the Customer Service Feedback page in the left menu to obtain the uploaded logs. By default, the base library logs App, Page lifecycle functions, and function calls in the WX namespace.