Commit b7a8f93a authored by liujiangnan's avatar liujiangnan

feat: 测试

parent 47d743c4
......@@ -87,13 +87,14 @@ cc.Class({
async start() {
// anchor - 主播,audience - 观众
// this.roomId = await getRoomId();
// const res = await getLiveUserInfo();
// this.role = res.role;
// this.uid = res.uid;
this.roomId = await getRoomId();
const res = await getLiveUserInfo();
this.role = res.role;
this.uid = res.uid;
// 测试数据
this.role = 'anchor';
this.uid = 'teacher';
const nickObj = await drawOpenNickName(res.nickName);
......
......@@ -138,7 +138,7 @@ function getWebRecordInstanse() {
}
export function getRoomId() {
if (!tt) {
if (cc.sys.platform !== cc.sys.BYTEDANCE_GAME) {
return 'test-room-0001';
}
return new Promise((resolve) => {
......@@ -155,6 +155,9 @@ export function getRoomId() {
}
export function drawOpenNickName(str) {
if (cc.sys.platform !== cc.sys.BYTEDANCE_GAME) {
return {};
}
return new Promise((resolve) => {
tt.drawOpenNickName({
src: str,
......@@ -168,6 +171,13 @@ export function drawOpenNickName(str) {
}
export function getLiveUserInfo() {
if (cc.sys.platform !== cc.sys.BYTEDANCE_GAME) {
return {
role: 'audience',
uid: 'example',
nickName: '',
}
}
return new Promise((resolve) => {
tt.getLiveUserInfo({
complete(res){
......
......@@ -106,7 +106,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
if (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) {
this.showTips(res["msg"]);
return;
......@@ -250,5 +251,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
roomid: this.roomId,
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