feat(backend): implement task creation and admin web

This commit is contained in:
QiuSW
2026-07-26 14:03:32 +08:00
parent 2b265c92fc
commit c5d3b215ff
58 changed files with 8773 additions and 83 deletions
+14 -3
View File
@@ -210,6 +210,12 @@
<input id="title" name="title" maxlength="120" placeholder="例如:演示用桌面收纳盒">
<p id="title-error" class="error"></p>
</div>
<div class="span-2">
<label class="required" for="sku">SKU</label>
<input id="sku" name="sku" maxlength="120" placeholder="例如:浅灰色 · 中号">
<p id="sku-error" class="error"></p>
<p class="help">SKU 是不可覆盖的原始采购要求。</p>
</div>
<div class="span-2">
<label for="description">商品描述</label>
<textarea id="description" name="description" placeholder="填写规格、颜色、材质等判断条件"></textarea>
@@ -221,7 +227,7 @@
<p id="quantity-error" class="error"></p>
</div>
<div>
<label for="budget">最高总预算(元)</label>
<label for="budget">最高商品总预算(元)</label>
<input id="budget" name="budget" type="number" min="0.01" step="0.01" inputmode="decimal" placeholder="不填写则不设上限">
<p id="budget-error" class="error"></p>
</div>
@@ -284,7 +290,7 @@
});
function clearFeedback() {
['title', 'quantity', 'budget', 'image'].forEach((name) => {
['title', 'sku', 'quantity', 'budget', 'image'].forEach((name) => {
document.querySelector(`#${name}-error`).textContent = '';
});
notice.style.display = 'none';
@@ -303,18 +309,23 @@
clearFeedback();
let firstInvalid = null;
const title = document.querySelector('#title');
const sku = document.querySelector('#sku');
const quantity = document.querySelector('#quantity');
const budget = document.querySelector('#budget');
if (!title.value.trim()) {
document.querySelector('#title-error').textContent = '请输入商品标题。';
firstInvalid ||= title;
}
if (!sku.value.trim()) {
document.querySelector('#sku-error').textContent = '请输入 SKU。';
firstInvalid ||= sku;
}
if (!Number.isInteger(Number(quantity.value)) || Number(quantity.value) < 1) {
document.querySelector('#quantity-error').textContent = '数量必须是大于 0 的整数。';
firstInvalid ||= quantity;
}
if (budget.value && Number(budget.value) <= 0) {
document.querySelector('#budget-error').textContent = '预算必须大于 0,或留空。';
document.querySelector('#budget-error').textContent = '商品总预算必须大于 0,或留空。';
firstInvalid ||= budget;
}
if (!image.files.length) {