|
|
|
@ -196,7 +196,7 @@ |
|
|
|
<script type="module"> |
|
|
|
import { getLandingListApi, addLandingApi } from './src/api/member.js'; |
|
|
|
(function () { |
|
|
|
const FILE_UPLOAD_URL = 'http://tjapi.hlquant.com/hljwgo/api/file/upload'; |
|
|
|
const FILE_UPLOAD_URL = 'https://tjapi.hlquant.com/hljwgo/api/file/upload'; |
|
|
|
// 状态 |
|
|
|
let tableData = []; |
|
|
|
let currentPage = 1; |
|
|
|
@ -236,7 +236,6 @@ |
|
|
|
const popupPreviewContainer = document.getElementById('popupPreviewContainer'); |
|
|
|
const loadingIndicator = document.getElementById('loadingIndicator'); |
|
|
|
const noData = document.getElementById('noData'); |
|
|
|
|
|
|
|
// 工具:显示消息(简单替代 ElMessage) |
|
|
|
function showMessage(text, type = 'success', duration = 3000) { |
|
|
|
let el = document.getElementById('msgBoxTop'); |
|
|
|
@ -302,6 +301,13 @@ function showMessage(text, type = 'success', duration = 3000) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 更严格的判断(使用 Date) |
|
|
|
function isDialogTimeRangeValid() { |
|
|
|
if (!fldStart.value || !fldEnd.value) return true; // 有空值不强制 |
|
|
|
const s = new Date(fldStart.value); |
|
|
|
const e = new Date(fldEnd.value); |
|
|
|
return e >= s; |
|
|
|
} |
|
|
|
function renderTable() { |
|
|
|
tableBody.innerHTML = ''; |
|
|
|
if (!tableData || tableData.length === 0) { |
|
|
|
@ -330,7 +336,7 @@ function showMessage(text, type = 'success', duration = 3000) { |
|
|
|
|
|
|
|
const btnDetail = document.createElement('button'); btnDetail.className = 'btn'; btnDetail.textContent = '详情'; |
|
|
|
btnDetail.addEventListener('click', () => { |
|
|
|
window.location.href = `/adminDetail.html?id=${row.id}`; |
|
|
|
window.location.href = `/parkActivity/adminDetail.html?id=${row.id}`; |
|
|
|
}); |
|
|
|
tdOps.appendChild(btnDetail); |
|
|
|
|
|
|
|
@ -363,14 +369,6 @@ function showMessage(text, type = 'success', duration = 3000) { |
|
|
|
currentPage = 1; |
|
|
|
getLandingList(); |
|
|
|
}); |
|
|
|
// gotoBtn.addEventListener('click', () => { |
|
|
|
// const v = parseInt(gotoInput.value, 10); |
|
|
|
// if (!isNaN(v) && v >= 1) { |
|
|
|
// currentPage = v; |
|
|
|
// getLandingList(); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
|
|
|
|
// 打开新增弹窗 |
|
|
|
btnAdd.addEventListener('click', () => { |
|
|
|
openAddDialog(); |
|
|
|
@ -443,6 +441,13 @@ function showMessage(text, type = 'success', duration = 3000) { |
|
|
|
inputLanding.addEventListener('change', (e) => { |
|
|
|
const f = e.target.files[0]; |
|
|
|
if (!f) return; |
|
|
|
if (f.size > 2 * 1024 * 1024) { |
|
|
|
showMessage('图片大小不能超过 2MB', 'error'); |
|
|
|
e.target.value = ''; |
|
|
|
if (typeof landingFile !== 'undefined') landingFile = null; |
|
|
|
if (landingPreviewContainer) landingPreviewContainer.innerHTML = ''; |
|
|
|
return; |
|
|
|
} |
|
|
|
const reader = new FileReader(); |
|
|
|
reader.onload = function (ev) { |
|
|
|
const img = new Image(); |
|
|
|
@ -469,6 +474,13 @@ function showMessage(text, type = 'success', duration = 3000) { |
|
|
|
inputPopup.addEventListener('change', (e) => { |
|
|
|
const f = e.target.files[0]; |
|
|
|
if (!f) return; |
|
|
|
if (f.size > 2 * 1024 * 1024) { |
|
|
|
showMessage('图片大小不能超过 2MB', 'error'); |
|
|
|
e.target.value = ''; |
|
|
|
if (typeof popupFile !== 'undefined') popupFile = null; |
|
|
|
if (popupPreviewContainer) popupPreviewContainer.innerHTML = ''; |
|
|
|
return; |
|
|
|
} |
|
|
|
const reader = new FileReader(); |
|
|
|
reader.onload = function (ev) { |
|
|
|
popupFile = f; |
|
|
|
@ -491,6 +503,10 @@ function showMessage(text, type = 'success', duration = 3000) { |
|
|
|
if (!introduction) { showMessage('请输入活动简介', 'error'); return; } |
|
|
|
if (!startTime) { showMessage('请选择开始时间', 'error'); return; } |
|
|
|
if (!endTime) { showMessage('请选择结束时间', 'error'); return; } |
|
|
|
if (!isDialogTimeRangeValid()) { |
|
|
|
showMessage('结束时间不能早于开始时间,请调整后保存', 'error'); |
|
|
|
return; |
|
|
|
} |
|
|
|
// 如果既没有已上传的 url,也没有本地文件,则提示 |
|
|
|
if (!landingUploadedUrl && !landingFile) { showMessage('请上传活动落地页', 'error'); return; } |
|
|
|
if (!popupUploadedUrl && !popupFile) { showMessage('请上传落地页弹窗', 'error'); return; } |
|
|
|
|