Wechat official account

Wechat public accounts are divided into subscription accounts, service accounts and enterprise accounts. Developers develop accounts for different types

Subscription number: mainly used to provide information and information for media and individuals to provide a new way of information dissemination. The function is similar to that of a newspaper or magazine, providing news, information and entertainment. (Shenzhen Health Commission….)

Service number: Provides service interaction for users. Functions similar to 12315, bank…

Enterprise account (enterprise wechat) : provides mobile application entrance for enterprises or organizations for internal employees to use.

The development tools

The development of preparation

  1. Add developer permission, without permission, wechat SDK permission verification will fail
  2. Configure the secure domain name, the domain name does not need to add the protocol header, only under the specified domain name wechat SDK ability can be aroused

Wechat web app

The communication ability is very strong, has a very good communication effect, is the enterprise business do brand promotion, product publicity weapon; Wechat H5 in doing page promotion, only a URL connection, two-dimensional code and traffic accounted for a small proportion of the installation package can be promoted. Comrate. Heka4. Tech/will/index. The…

Web development

  1. Web page authorization

    Silent authorization: When the network speed is slow, the user can sense the callback page, that is, the page is redirected. Web page authorization initiated by snsapi_base for scope to obtain user OpenID.

    Active authorization: Used to obtain user information and requires the user’s manual consent. Web page authorization initiated by scope with snsapi_userinfo.

  2. Authorization process: Enter the authorization page to approve authorization and obtain the code. Exchange web page authorization access_token with code (different from access_token in base support); If necessary, developers can refresh the web license access_token to avoid expiration; Obtain basic user information through web authorization access_token and OpenID (UnionID mechanism is supported).

  1. UnionId mechanism: If the developer has multiple mobile applications, website applications, and public accounts (including small programs), the uniqueness of the user can be distinguished by UnionID, because as long as it is the same wechat open platform account under the mobile application, website applications and public accounts (including small programs), the user’s UnionID is unique. That is, the same user, different applications under the same wechat open platform, UnionID is the same.

  2. OpenId mechanism: the unique identification of a user in an application. For example, the openId of the user in the mini program is different from that in the public account.

  3. Jsapi authorization (SDK permission verification) : it is the wechat public platform for web developers to provide a webpage development toolkit based on wechat, which can use wechat payment, sharing and other open functions.

  4. JSSDK use steps: the introduction of JS files, support network links; Verify the configuration through the config interface injection permission. The same URL only needs to be called once, which is usually called when the page is loaded. Verify the success of the ready interface processing, and the interface calls must be made after the result of the Config interface; Call the interface.

  5. Jsapi interface call description:

    Success: Callback function executed when the interface invocation succeeds.

    Fail: Callback function executed when an interface call fails.

    Complete: The callback function executed when the interface call completes, whether it succeeds or fails.

    Cancel: Callback function when the user clicks cancel. This function is used only by some apis that have user cancellations.

    Trigger: the method that is triggered when the button in Menu is clicked. This method only supports the relevant interface in Menu.

experience

  1. Address is wechat interception solution: the use of domain name batch resolution to generate N secondary domain name, domain name unlimited replacement jump, and the page entrance, landing page, forwarding to the circle of friends point domain name is not the same; Fake report page. (The page is sealed, and the landing page of H5 is sealed)

  2. Font adjustment: Prevents ios and Android from adjusting font size. Ios adds CSS properties and Android uses wechat properties to prevent font size adjustment.

if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") { handleFontSize(); } else { document.addEventListener("WeixinJSBridgeReady", handleFontSize, false); Invoke ('setFontSizeCallback', {'fontSize': 0}); invoke('setFontSizeCallback', {'fontSize': 0}); On ('menu:setfont', function () {weixinjsbridle.invoke ('setFontSizeCallback', { 'fontSize': 0 }); }); }Copy the code
  1. Soft keyboard pop-up page is compressed, forcing the page back.
Window.history. pushState({}, "title", "#"); if (isIOS) {// Add history to the page when it is first loaded. Document. The body. The addEventListener (' focusin '() = > {/ / soft keyboard pop-up event handling isReset = false; }); Document. The body. The addEventListener (' focusout '() = > {/ / pack up soft keyboard event handling isReset = true; If (isReset) {window.scroll(0, 0); if (isReset) {window.scroll(0, 0); }}, 300); })}Copy the code