# Share Data to WeRun Campaign

From the base library 2.14.0 Start support

You can share the user's movement data in the mini program to the WeRun campaign.

# Application for opening

Mini Program management background,Development-Interface SettingsSelf - enable permissions for this component in. Only againstSports - Online FitnessThe Mini Program is open.

# Call process

Developers by callingwx.shareToWeRunThe user's movement data will trigger the pop-up window, and the user can show the movement data in the WeRun Sports Ranking List and Details page after clicking the button. avatar

# Note

  1. For development and experience Mini Programs, the interface can be invoked normally within the Mini Program, but it will not be displayed in the WeRun campaign. Developers in the development of the call interface can be successful as a basis for the success of the punch card.
  2. Every time the user clocked in will be recorded in the WeRun campaign, please developers properly handle the user clocked in the scene, to avoid repeated punch.
  3. In the ranking list of WeRun Campaign, the first record of the last time you clocked in is displayed.

# Type of exercise

Currently support the following sport types with different sport types supporting incoming units as follows:

Type of exercise typeId Support for incoming units
Physical exercise 1001 Time/calorie
Physical 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
Play 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

At most one unit is passed in when setting. Multiple units at the same time are not supported. The amount of incoming support for different units is limited as follows:

unit Introductions Valid value
number Number of movements, unit: Valid values 1-10000, need to be an integer
distance Movement Distance, Unit: Meters Valid values 1-100000, need to be an integer
Time Exercise Time, Unit: Minutes Valid values 1-1440, need to be an integer

# Code Examples

wx.shareToWeRun({
      recordList: [{
        typeId: 4001,
        number: 180
      }, {
        typeId: 3001,
        distance: 100000
      }],
      success(res) {
        wx.showToast({
          title: "Success,"
        })
      },
      fail(res) {
        wx.showToast({
          icon: "none",
          title: The failure, "
        })
      }
    })