Commit b7a8f93a authored by liujiangnan's avatar liujiangnan

feat: 测试

parent 47d743c4
...@@ -87,13 +87,14 @@ cc.Class({ ...@@ -87,13 +87,14 @@ cc.Class({
async start() { async start() {
// anchor - 主播,audience - 观众 // anchor - 主播,audience - 观众
// this.roomId = await getRoomId(); this.roomId = await getRoomId();
// const res = await getLiveUserInfo(); const res = await getLiveUserInfo();
// this.role = res.role; this.role = res.role;
// this.uid = res.uid; this.uid = res.uid;
// 测试数据 // 测试数据
this.role = 'anchor'; this.role = 'anchor';
this.uid = 'teacher';
const nickObj = await drawOpenNickName(res.nickName); const nickObj = await drawOpenNickName(res.nickName);
......
...@@ -138,7 +138,7 @@ function getWebRecordInstanse() { ...@@ -138,7 +138,7 @@ function getWebRecordInstanse() {
} }
export function getRoomId() { export function getRoomId() {
if (!tt) { if (cc.sys.platform !== cc.sys.BYTEDANCE_GAME) {
return 'test-room-0001'; return 'test-room-0001';
} }
return new Promise((resolve) => { return new Promise((resolve) => {
...@@ -155,6 +155,9 @@ export function getRoomId() { ...@@ -155,6 +155,9 @@ export function getRoomId() {
} }
export function drawOpenNickName(str) { export function drawOpenNickName(str) {
if (cc.sys.platform !== cc.sys.BYTEDANCE_GAME) {
return {};
}
return new Promise((resolve) => { return new Promise((resolve) => {
tt.drawOpenNickName({ tt.drawOpenNickName({
src: str, src: str,
...@@ -168,6 +171,13 @@ export function drawOpenNickName(str) { ...@@ -168,6 +171,13 @@ export function drawOpenNickName(str) {
} }
export function getLiveUserInfo() { export function getLiveUserInfo() {
if (cc.sys.platform !== cc.sys.BYTEDANCE_GAME) {
return {
role: 'audience',
uid: 'example',
nickName: '',
}
}
return new Promise((resolve) => { return new Promise((resolve) => {
tt.getLiveUserInfo({ tt.getLiveUserInfo({
complete(res){ complete(res){
......
...@@ -106,7 +106,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -106,7 +106,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (this.pid) { if (this.pid) {
queryObj['pid'] = this.pid; queryObj['pid'] = this.pid;
} }
const res = await asyncCallNetworkApiGet("/api/douyin/v1/list", queryObj); let res = await asyncCallNetworkApiGet("/api/douyin/v1/list", queryObj);
res = JSON.parse(res);
if (res["code"] !== 200) { if (res["code"] !== 200) {
this.showTips(res["msg"]); this.showTips(res["msg"]);
return; return;
...@@ -250,5 +251,11 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -250,5 +251,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
roomid: this.roomId, roomid: this.roomId,
data: keys.join(","), data: keys.join(","),
}); });
// 显示排行榜
cc.find(`Canvas/rankpage`).active = true;
this.runRankList();
this.canTouch = true;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment