进行了一些优化
This commit is contained in:
1 parent
17dabca568
commit
ad128ef94e
1 file changed
+7
-10
@@ -252,10 +252,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===== 成功渲染 =====
|
// ===== 成功渲染 =====
|
||||||
function metaChip(icon, label) {
|
|
||||||
return '<span class="aksrt-dl-modal__chip"><i class="fa fas ' + icon + '" aria-hidden="true"></i>' + escapeHtml(label) + '</span>';
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderSuccess(payload, returnFocusEl) {
|
function renderSuccess(payload, returnFocusEl) {
|
||||||
payload = payload || {};
|
payload = payload || {};
|
||||||
const code = String(payload.extract_code || '').trim();
|
const code = String(payload.extract_code || '').trim();
|
||||||
@@ -266,6 +262,8 @@
|
|||||||
? Math.max(1, Math.round(payload.expires_in / 60))
|
? Math.max(1, Math.round(payload.expires_in / 60))
|
||||||
: 10;
|
: 10;
|
||||||
|
|
||||||
|
const hintMsg = '点击下方按钮开始下载,链接 ' + expiresIn + ' 分钟内有效。';
|
||||||
|
|
||||||
let body = '';
|
let body = '';
|
||||||
if (code !== '') {
|
if (code !== '') {
|
||||||
body +=
|
body +=
|
||||||
@@ -275,11 +273,12 @@
|
|||||||
' <code class="aksrt-dl-modal__code">' + safeCode + '</code>' +
|
' <code class="aksrt-dl-modal__code">' + safeCode + '</code>' +
|
||||||
' <button type="button" class="aksrt-dl-modal__copy" data-copy="' + safeCodeAttr + '"><span class="aksrt-dl-modal__copy-text">复制</span></button>' +
|
' <button type="button" class="aksrt-dl-modal__copy" data-copy="' + safeCodeAttr + '"><span class="aksrt-dl-modal__copy-text">复制</span></button>' +
|
||||||
' </div>' +
|
' </div>' +
|
||||||
'</div>';
|
'</div>' +
|
||||||
|
'<p class="aksrt-dl-modal__msg">' + escapeHtml(hintMsg) + '</p>';
|
||||||
} else if (has) {
|
} else if (has) {
|
||||||
body += '<p class="aksrt-dl-modal__alert aksrt-dl-modal__alert--warn">下载源标记了提取码,但接口未返回具体内容,请检查资源下载源的 extract_code 字段。</p>';
|
body += '<p class="aksrt-dl-modal__alert aksrt-dl-modal__alert--warn">下载源标记了提取码,但接口未返回具体内容,请检查资源下载源的 extract_code 字段。</p>';
|
||||||
} else {
|
} else {
|
||||||
body += '<p class="aksrt-dl-modal__msg">点击下方按钮开始下载,文件请及时保存到本地。</p>';
|
body += '<p class="aksrt-dl-modal__msg">' + escapeHtml(hintMsg) + '</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
const chips = [];
|
const chips = [];
|
||||||
@@ -287,11 +286,9 @@
|
|||||||
if (sourceLabel !== '') {
|
if (sourceLabel !== '') {
|
||||||
chips.push('<span class="aksrt-dl-modal__chip"><i class="fa fas fa-box" aria-hidden="true"></i>' + escapeHtml(sourceLabel) + '</span>');
|
chips.push('<span class="aksrt-dl-modal__chip"><i class="fa fas fa-box" aria-hidden="true"></i>' + escapeHtml(sourceLabel) + '</span>');
|
||||||
}
|
}
|
||||||
chips.push(metaChip('fa-clock', '链接 ' + expiresIn + ' 分钟内有效'));
|
if (chips.length) {
|
||||||
if (typeof payload.balance === 'number') {
|
body += '<div class="aksrt-dl-modal__meta">' + chips.join('') + '</div>';
|
||||||
chips.push(metaChip('fa-coins', '积分余额 ' + payload.balance));
|
|
||||||
}
|
}
|
||||||
body += '<div class="aksrt-dl-modal__meta">' + chips.join('') + '</div>';
|
|
||||||
|
|
||||||
open(
|
open(
|
||||||
dlView('success', {
|
dlView('success', {
|
||||||
|
|||||||
Reference in new issue
Block a user