tt.openDouyinProfile
基础库 1.96.0 开始支持本接口。
提供从小程序跳转到抖音个人主页的能力。仅支持抖音 APP。
语法
tt.openDouyinProfile(options)
参数说明
options 为 Object 类型,属性如下:
属性名 | 类型 | 默认值 | 必填 | 说明 | 最低支持版本 |
---|---|---|---|---|---|
userId | string | -- | 是 | 期望打开的个人主页的 uid | 1.96.0 |
shopId | string | -- | 是 | 当前小程序绑定的抖音小店 id | 1.96.0 |
success | function | -- | 否 | 接口调用成功的回调函数 | 1.96.0 |
fail | function | -- | 否 | 接口调用失败的回调函数 | 1.96.0 |
complete | function | -- | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | 1.96.0 |
回调成功
参数为 Object 类型,属性如下:
参数 | 参数类型 | 说明 | 最低支持版本 |
---|---|---|---|
errMsg | string | 回调信息 | 1.96.0 |
回调失败
参数为 Object 类型,属性如下:
参数 | 参数类型 | 说明 | 最低支持版本 |
---|---|---|---|
errNo | number | 错误码 | 1.96.0 |
errMsg | string | 错误信息 | 1.96.0 |
错误码说明:
errNo | errMsg | 说明 | 最低支持版本 |
---|---|---|---|
10301 | feature is not supported in app | 当前 APP 不支持这个功能 | 1.96.0 |
20001 | param should be string, but got xxx | 参数校验错误 | 1.96.0 |
21500 | The session id is unavailable, please check login status | 获取宿主 sessionid 失败,用户未登录 | 1.96.0 |
21501 | server error | 网络错误 | 1.96.0 |
21502 | server data error | 服务端网关错误 | 1.96.0 |
21503 | has no bind relation | 当前小程序与传入的商铺无绑定关系 | 1.96.0 |
21100 | host open schema fail: %s, schema == %s | 宿主 openSchema 错误 | 1.96.0 |
代码示例
<button type="default" size="default" bindtap="openDouyinProfile">
跳转抖音个人主页
</button>
Page({
openDouyinProfile(e) {
tt.openDouyinProfile({
shopId: "1234354",
userId: "123423544355",
success(res) {
console.log("调用成功", res);
},
fail(res) {
console.log("调用失败", res);
},
});
},
});
Bug & Tip
- Tips:使用该接口时需要用户身份信息,请确保在调用接口前,用户已经登陆宿主 APP。
- Tips:目前该接口只支持抖音,所以请在抖音 APP 中调用。
点击纠错
评价此篇文档