Files
2026-08-08 15:53:53 +08:00

31 lines
2.0 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
$v = function ($k, $d = '') use ($b) { return $b ? ($b[$k] ?? $d) : $d; };
$isEdit = !empty($b);
?>
<div class="page-head">
<div><h1><?php echo $isEdit ? '编辑轮播' : '新增轮播'; ?></h1><div class="desc">背景可填 CSS 渐变或图片地址</div></div>
<a class="btn-ghost" href="<?php echo site_url('admin/banners'); ?>">← 返回</a>
</div>
<div class="admin-card">
<form method="post" action="<?php echo site_url($isEdit ? 'admin/banners/update/' . $b['id'] : 'admin/banners/store'); ?>" enctype="multipart/form-data">
<?php echo csrf_field(); ?>
<div class="form-grid">
<div class="field"><label>标题 *</label><input name="title" value="<?php echo e($v('title')); ?>" required></div>
<div class="field"><label>副标题</label><input name="subtitle" value="<?php echo e($v('subtitle')); ?>"></div>
</div>
<div class="field"><label>链接地址(如 /products</label><input name="link" value="<?php echo e($v('link')); ?>"></div>
<div class="form-grid">
<div class="field"><label>背景图(上传,可选)</label><input type="file" name="image" accept="image/*"></div>
<div class="field"><label>或背景(图片地址 / CSS 渐变)</label><input name="image" value="<?php echo e($v('image')); ?>" placeholder="linear-gradient(135deg,#0ea5e9,#14b8a6)"></div>
</div>
<div class="field"><label>排序</label><input name="sort_order" type="number" value="<?php echo e($v('sort_order', 0)); ?>"></div>
<div class="field" style="display:flex;align-items:center;gap:8px">
<input type="checkbox" name="status" value="1" <?php echo $v('status', 1) ? 'checked' : ''; ?> id="st"> <label for="st" style="margin:0">显示</label>
</div>
<div class="form-actions">
<button class="btn-primary" type="submit">保存</button>
<a class="btn-ghost" href="<?php echo site_url('admin/banners'); ?>">取消</a>
</div>
</form>
</div>