From a8ae37284221406dd72bac54d319d11dfb902657 Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 19 Apr 2022 15:48:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E7=89=87=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/controller/base/Slider.php | 10 +++++++++- app/data/view/base/slider/index.html | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/data/controller/base/Slider.php b/app/data/controller/base/Slider.php index cff03c2e4..f51dadae9 100644 --- a/app/data/controller/base/Slider.php +++ b/app/data/controller/base/Slider.php @@ -42,6 +42,14 @@ class Slider extends Controller protected function initialize() { $this->types = SystemBase::mk()->items($this->type); + foreach ($this->types as &$type) { + if (preg_match('/^(.*?)#(\d+)$/', $type['name'], $matches)) { + $type['name'] = $matches[1]; + $type['number'] = $matches[2]; + } else { + $type['number'] = 0; + } + } } /** @@ -67,7 +75,7 @@ class Slider extends Controller $this->skey = input('get.type', ''); $this->base = $this->types[$this->skey] ?? []; if (empty($this->base)) $this->error('未配置基础数据!'); - $this->number = 10; + $this->number = $this->base['number']; $this->sysdata(); } diff --git a/app/data/view/base/slider/index.html b/app/data/view/base/slider/index.html index a69ede263..52339ab58 100644 --- a/app/data/view/base/slider/index.html +++ b/app/data/view/base/slider/index.html @@ -2,13 +2,13 @@ {block name='content'}
温馨提示:如需添加新内容,需要在系统管理的基础数据添加类型为 “{$type|default=''}” 的基础数据。
-
+
{foreach $types as $key=>$type}
-
编辑页面
+
编辑图片
{$type.name|default=''}
@@ -16,7 +16,7 @@
-
编辑页面
+
编辑图片
{$type.name|default=''}