|
5 | 5 | use Illuminate\Events\Dispatcher; |
6 | 6 | use Illuminate\Support\ServiceProvider; |
7 | 7 | use ModStart\Admin\Config\AdminMenu; |
8 | | -use ModStart\Admin\Widget\DashboardItemA; |
| 8 | +use ModStart\Admin\Widget\DashboardItem; |
9 | 9 | use ModStart\Core\Dao\ModelUtil; |
10 | 10 | use ModStart\Core\Util\TreeUtil; |
11 | 11 | use ModStart\Layout\Row; |
12 | 12 | use ModStart\Module\ModuleClassLoader; |
13 | 13 | use Module\Banner\Biz\BannerPositionBiz; |
| 14 | +use Module\Cms\Model\CmsCat; |
| 15 | +use Module\Cms\Model\CmsContent; |
| 16 | +use Module\Cms\Model\CmsModel; |
14 | 17 | use Module\Cms\Provider\CmsHomePageProvider; |
15 | 18 | use Module\Cms\Provider\Theme\CmsThemeProvider; |
16 | 19 | use Module\Cms\Provider\Theme\DefaultThemeProvider; |
@@ -130,21 +133,34 @@ public function boot(Dispatcher $events) |
130 | 133 |
|
131 | 134 | AdminWidgetDashboard::registerIcon(function (Row $row) { |
132 | 135 | $models = CmsModelUtil::all(); |
| 136 | + $contents = []; |
133 | 137 | foreach ($models as $model) { |
134 | | - $row->column(3, DashboardItemA::makeIconNumberTitle( |
135 | | - 'iconfont icon-details', ModelUtil::count('cms_content', ['modelId' => $model['id']]), $model['title'], |
136 | | - modstart_admin_url('cms/content/' . $model['id']) |
137 | | - )); |
| 138 | + $contents[] = [ |
| 139 | + 'title' => $model['title'], |
| 140 | + 'value' => ModelUtil::count(CmsContent::class, ['modelId' => $model['id']]), |
| 141 | + 'url' => modstart_admin_url('cms/content/' . $model['id']) |
| 142 | + ]; |
138 | 143 | } |
139 | | - $row->column(3, DashboardItemA::makeIconNumberTitle( |
140 | | - 'iconfont icon-list-alt', ModelUtil::count('cms_cat'), '栏目数', |
141 | | - modstart_admin_url('cms/cat') |
| 144 | + $row->flexColumn(DashboardItem::makeTitleDataList( |
| 145 | + 'iconfont icon-description', |
| 146 | + 'CMS内容', |
| 147 | + $contents |
142 | 148 | )); |
143 | | - $row->column(3, DashboardItemA::makeIconNumberTitle( |
144 | | - 'iconfont icon-credit', |
145 | | - ModelUtil::count('cms_model'), |
146 | | - '模型数', |
147 | | - modstart_admin_url('cms/model') |
| 149 | + $row->flexColumn(DashboardItem::makeTitleDataList( |
| 150 | + 'iconfont icon-description', |
| 151 | + 'CMS管理', |
| 152 | + [ |
| 153 | + [ |
| 154 | + 'title' => '栏目数', |
| 155 | + 'value' => ModelUtil::count(CmsCat::class), |
| 156 | + 'url' => modstart_admin_url('cms/cat') |
| 157 | + ], |
| 158 | + [ |
| 159 | + 'title' => '模型数', |
| 160 | + 'value' => ModelUtil::count(CmsModel::class), |
| 161 | + 'url' => modstart_admin_url('cms/model') |
| 162 | + ], |
| 163 | + ] |
148 | 164 | )); |
149 | 165 | }); |
150 | 166 |
|
|
0 commit comments