修改功能
This commit is contained in:
@@ -13,6 +13,15 @@
|
||||
})(typeof globalThis !== 'undefined' ? globalThis : window, function (root) {
|
||||
'use strict';
|
||||
|
||||
function confirmAction(message) {
|
||||
if (root.ProfileUI && typeof root.ProfileUI.confirmAction === 'function') {
|
||||
return root.ProfileUI.confirmAction(message);
|
||||
}
|
||||
return Promise.resolve(!root['confirm'] || root['confirm'](message));
|
||||
}
|
||||
|
||||
var MediaDisplay = root.MediaDisplay || (typeof require === 'function' ? require('./media-display.js') : null);
|
||||
|
||||
var documentRef = root.document;
|
||||
var ceremoniesById = Object.create(null);
|
||||
var giftsById = Object.create(null);
|
||||
@@ -212,7 +221,7 @@
|
||||
var ceremonyId = normalizeId(item && item.ceremonyId);
|
||||
var genealogyId = normalizeId(item && item.genealogyId);
|
||||
var sponsorUserId = normalizeNullableId(item && item.sponsorUserId);
|
||||
var coverOssId = normalizeNullableId(item && item.coverOssId);
|
||||
var coverFile = MediaDisplay && MediaDisplay.normalizeFileAccess(item && item.coverFile);
|
||||
var ceremonyType = stringValue(item && item.ceremonyType).trim();
|
||||
var ceremonyTitle = stringValue(item && item.ceremonyTitle).trim();
|
||||
var longitude = optionalFiniteNumber(item && item.longitude);
|
||||
@@ -225,7 +234,7 @@
|
||||
|
||||
if (!ceremonyId || !genealogyId || !ceremonyType || !ceremonyTitle) return null;
|
||||
if (item.sponsorUserId !== undefined && item.sponsorUserId !== null && item.sponsorUserId !== '' && !sponsorUserId) return null;
|
||||
if (item.coverOssId !== undefined && item.coverOssId !== null && item.coverOssId !== '' && !coverOssId) return null;
|
||||
if (item.coverFile !== undefined && item.coverFile !== null && !coverFile) return null;
|
||||
if ((item.longitude !== undefined && item.longitude !== null && item.longitude !== '' && longitude === undefined) ||
|
||||
(item.latitude !== undefined && item.latitude !== null && item.latitude !== '' && latitude === undefined)) return null;
|
||||
if ((longitude === undefined) !== (latitude === undefined)) return null;
|
||||
@@ -251,7 +260,7 @@
|
||||
remark: stringValue(item.remark)
|
||||
};
|
||||
if (sponsorUserId) ceremony.sponsorUserId = sponsorUserId;
|
||||
if (coverOssId) ceremony.coverOssId = coverOssId;
|
||||
if (coverFile) ceremony.coverFile = coverFile;
|
||||
if (longitude !== undefined) ceremony.longitude = longitude;
|
||||
if (latitude !== undefined) ceremony.latitude = latitude;
|
||||
if (giftCount !== undefined) ceremony.giftCount = giftCount;
|
||||
@@ -399,10 +408,12 @@
|
||||
if (canEditContent) {
|
||||
actions = '<div class="bottom-actions"><a class="btn ghost" href="' +
|
||||
escapeHtml(buildEditUrl(ceremony.genealogyId, ceremony.ceremonyId)) + '">编辑活动</a>' +
|
||||
'<button class="btn ghost" type="button" data-ceremony-delete-id="' +
|
||||
'<button class="btn danger" type="button" data-ceremony-delete-id="' +
|
||||
escapeHtml(ceremony.ceremonyId) + '">删除活动</button></div>';
|
||||
}
|
||||
return '<div class="form-like ceremony-detail">' +
|
||||
return (MediaDisplay ? MediaDisplay.renderImage(ceremony.coverFile, {
|
||||
alt: ceremony.ceremonyTitle + '封面', className: 'ceremony-cover-media'
|
||||
}) : '') + '<div class="form-like ceremony-detail">' +
|
||||
detailValue('活动标题', ceremony.ceremonyTitle) +
|
||||
detailValue('活动类型', ceremony.ceremonyType) +
|
||||
detailValue('活动说明', ceremony.ceremonyDesc) +
|
||||
@@ -920,10 +931,18 @@
|
||||
var api = getApi();
|
||||
var genealogyId = requireGenealogyId();
|
||||
var ceremonyId = getCurrentCeremonyId();
|
||||
var availableInviteeInputs;
|
||||
var body;
|
||||
|
||||
if (writePending || !canEditContent || !genealogyId || !ceremonyId || redirectUnauthorized(api)) return;
|
||||
body = buildInviteesBody(queryAll('[data-invitee-user-id]:checked').map(function (input) {
|
||||
availableInviteeInputs = queryAll('[data-invitee-user-id]');
|
||||
if (!availableInviteeInputs.length) {
|
||||
setStatus('[data-ceremony-invitee-status]', '当前没有可邀请的家谱成员', 'empty');
|
||||
return;
|
||||
}
|
||||
body = buildInviteesBody(availableInviteeInputs.filter(function (input) {
|
||||
return input.checked;
|
||||
}).map(function (input) {
|
||||
return input.getAttribute('data-invitee-user-id');
|
||||
}));
|
||||
setWritePending(true);
|
||||
@@ -950,7 +969,7 @@
|
||||
var ceremony = ceremoniesById[ceremonyId] || currentCeremony;
|
||||
|
||||
if (writePending || !canEditContent || !genealogyId || !normalizeId(ceremonyId) || redirectUnauthorized(api)) return;
|
||||
if (root.confirm && !root.confirm('确认删除“' + (ceremony ? ceremony.ceremonyTitle : '该活动') + '”吗?删除后不可恢复。')) return;
|
||||
if (!await confirmAction('确认删除“' + (ceremony ? ceremony.ceremonyTitle : '该活动') + '”吗?删除后不可恢复。')) return;
|
||||
setWritePending(true);
|
||||
try {
|
||||
await api.deleteCeremony(genealogyId, ceremonyId);
|
||||
@@ -971,7 +990,7 @@
|
||||
var gift = giftsById[giftId];
|
||||
|
||||
if (writePending || !canEditContent || !genealogyId || !ceremonyId || !normalizeId(giftId) || redirectUnauthorized(api)) return;
|
||||
if (root.confirm && !root.confirm('确认删除“' + (gift && (gift.giverName || gift.giverNickName) || '该祭品') + '”的记录吗?')) return;
|
||||
if (!await confirmAction('确认删除“' + (gift && (gift.giverName || gift.giverNickName) || '该祭品') + '”的记录吗?')) return;
|
||||
setWritePending(true);
|
||||
try {
|
||||
await api.deleteCeremonyGift(genealogyId, ceremonyId, giftId);
|
||||
|
||||
Reference in New Issue
Block a user