同步小程序与管理端更新,完善抽烟记录和解绑冷静期
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
function photoForm(photo) {
|
||||
return { taken_at: String(photo.taken_at || '').slice(0, 10), location: photo.location || '', activity: photo.activity || '' };
|
||||
}
|
||||
function metadataRows(photos) {
|
||||
const rows = photos.map((photo, index) => ({ ...photoForm(photo), id: photo.id, photoIndex: index, label: photos.length > 1 ? '第 ' + (index + 1) + ' 张' : '' }));
|
||||
if (!rows.length) return [];
|
||||
const same = rows.every(row => row.taken_at === rows[0].taken_at && row.location === rows[0].location && row.activity === rows[0].activity);
|
||||
if (same) rows.splice(1);
|
||||
if (same) rows[0].label = '';
|
||||
return rows.filter(row => row.taken_at || row.location || row.activity);
|
||||
}
|
||||
module.exports = { photoForm, metadataRows };
|
||||
Reference in New Issue
Block a user