Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion miniprogram/app.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ page {
background: var(--card-2);
border: 1rpx solid var(--border);
border-radius: 14rpx;
padding: 20rpx 24rpx;
/* 不要用垂直 padding:微信原生 input 的行高与内容区叠加会导致上下裁字 */
height: 88rpx;
line-height: 88rpx;
padding: 0 24rpx;
font-size: 28rpx;
color: var(--text);
box-sizing: border-box;
Expand All @@ -251,6 +254,7 @@ page {
border-radius: 14rpx;
padding: 20rpx 24rpx;
font-size: 28rpx;
line-height: 1.6;
color: var(--text);
width: 100%;
min-height: 160rpx;
Expand Down
21 changes: 17 additions & 4 deletions miniprogram/packages/contest/pages/arena/arena.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,32 @@ Page({
const prefix = `${this.contestName}/arena/`;
// 回放对象是「每个房间一个目录」:{赛事名}/arena/{room_id}/playback.thuaipb
// (与 web RecordPage 的 downloadFile 路径一致)
wx.showLoading({ title: "获取回放…" });
const key = `${this.contestName}/arena/${roomId}/playback.thuaipb`;
wx.showLoading({ title: "检查回放…" });
// 并非每个已结束对局都有回放文件:先 HEAD 探测,避免复制出 NoSuchKey 死链
cos
.getSignedUrl(prefix, `${this.contestName}/arena/${roomId}/playback.thuaipb`)
.headObject(prefix, key)
.then((exists) => {
if (!exists) return null;
return cos.getSignedUrl(prefix, key);
})
.then((url) => {
wx.hideLoading();
if (!url) {
wx.showToast({ title: "该对局暂无回放文件", icon: "none" });
return;
}
wx.setClipboardData({
data: url,
success: () => wx.showToast({ title: "回放下载链接已复制", icon: "none" })
});
})
.catch(() => {
.catch((err) => {
wx.hideLoading();
wx.showToast({ title: "回放不存在或无法获取", icon: "none" });
wx.showToast({
title: err && err.statusCode === 403 ? "无权限获取回放" : "回放不存在或无法获取",
icon: "none"
});
});
}
});
Loading