# Share data to the WeChat campaign

Support from the base library 2.14.0

User movement data in Weixin Mini Program can be shared with WeChat movement.

# Request to open

Weixin Mini Program management background, "development" - "interface settings" in the self-opening of the component permissions. Only Weixin Mini Program is available for the "Sports - Online Fitness" category.

# Calling Process

By calling wx.shareToWeRun to incorporate the user's motion data, the developer triggers a pop-up that displays the motion data in the WeChat motion list and detail page when the user clicks OK. avatar

# Note

  1. For the development version and the experience version Weixin Mini Program, the interface can be called normally in the Mini Program, but it will not be displayed in the WeChat movement.At the time of development, a developer can use whether the interface is successfully invoked as a basis for whether a card is successful.
  2. Each time the user punch card will be recorded in the WeChat movement, please developers properly handle the successful user punch card scenario, to avoid repeated punching.
  3. WeChat The first record of the most recent punch is shown in the Sports List.

# Types of exercise

The units that currently support the following types of exercise and the different types of movement support induction are as follows:

Types of exercise typeId Supporting the incoming unit
Physical exercise 1001 time/calorie
Physical Fitness Training 1002 time/calorie
Functional Training 1003 time/calorie
yoga 2001 time/calorie
to fish 2002 time/calorie
Square dance 2003 time/calorie
Playing football 2004 time/calorie
Playing basketball 2005 time/calorie
Playing badminton 2006 time/calorie
Play table tennis 2007 time/calorie
Playing tennis 2008 time/calorie
Run 3001 time/distance/calorie
to climb a mountain 3002 time/distance/calorie
Cycling 3003 time/distance/calorie
swimming 3004 time/distance/calorie
ski 3005 time/distance/calorie
to jump rope 4001 number/calorie
Push-up 4002 number/calorie
squat 4003 number/calorie

Up to one unit is allowed to be entered at the time of the setup. Multiple units are not supported at the same time. The limits on the number of incomings supported by different units are as follows:

unit Introductions Valid values
number Number of exercises, in units: Valid value 1 - 10000, needs to be an integer
distance Distance of movement, in meters Valid value 1 - 100,000, needs to be an integer
time Time of exercise, in units: minutes Valid value 1 - 1440, needs to be an integer

# Code examples

wx.shareToWeRun({
      recordList: [{
        typeId: 4001,
        number: 180
      }, {
        typeId: 3001,
        distance: 100000
      }],
      success(res) {
        wx.showToast({
          title: '打卡成功',
        })
      },
      fail(res) {
        wx.showToast({
          icon: "none",
          title: '打卡失败',
        })
      }
    })