新增分类排序

This commit is contained in:
augushong
2020-10-29 15:17:04 +08:00
parent 8f7f4c826a
commit 04d7bd0743
6 changed files with 23 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ class Common extends BaseController
$list_header_nav = Nav::where('type', 11)->order('sort asc')->where('status', 1)->select(); $list_header_nav = Nav::where('type', 11)->order('sort asc')->where('status', 1)->select();
View::assign('list_header_nav', $list_header_nav); View::assign('list_header_nav', $list_header_nav);
$list_category_first_level = Category::where('level', 1)->where('status', 1)->where('type',3)->select(); $list_category_first_level = Category::where('level', 1)->where('status', 1)->where('type',3)->order('sort asc')->select();
View::assign('list_category_first_level', $list_category_first_level); View::assign('list_category_first_level', $list_category_first_level);
$list_nav_more = Nav::where('type', 8)->order('sort asc')->where('status', 1)->select(); $list_nav_more = Nav::where('type', 8)->order('sort asc')->where('status', 1)->select();
View::assign('list_nav_more', $list_nav_more); View::assign('list_nav_more', $list_nav_more);

View File

@@ -22,7 +22,7 @@ class Index extends Common
$current_category = []; $current_category = [];
if (!empty($this->request->param('category_id'))) { if (!empty($this->request->param('category_id'))) {
$sub_category = Category::where('pid', $this->request->param('category_id'))->where('type', 3)->select(); $sub_category = Category::where('pid', $this->request->param('category_id'))->where('type', 3)->order('sort asc')->select();
$current_category = Category::find($this->request->param('category_id')); $current_category = Category::find($this->request->param('category_id'));
if (empty($this->request->param('sub_category_id'))) { if (empty($this->request->param('sub_category_id'))) {
$categorys = [$this->request->param('category_id')]; $categorys = [$this->request->param('category_id')];

View File

@@ -28,7 +28,7 @@ class Category extends Model
if(empty(self::$allCategory)){ if(empty(self::$allCategory)){
$model_list = Category::where('type',$type)->select(); $model_list = Category::where('type',$type)->order('sort asc')->select();
self::$allCategory = array2level($model_list,0,0); self::$allCategory = array2level($model_list,0,0);
} }

View File

@@ -91,6 +91,15 @@
<input type="radio" name="status" value="0" title="不显示"> <input type="radio" name="status" value="0" title="不显示">
</div> </div>
</div> </div>
<div class="layui-form-item">
<div class="layui-form-label">
排序
<p class="layui-word-aux">越小越靠前</p>
</div>
<div class="layui-input-block">
<input type="text" name="sort" value="0" required lay-verify="required" class="layui-input">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<button class="layui-btn layui-btn-fluid" submit lay-submit lay-filter="site-info">提交</button> <button class="layui-btn layui-btn-fluid" submit lay-submit lay-filter="site-info">提交</button>
</div> </div>

View File

@@ -92,6 +92,15 @@
<input type="radio" name="status" value="0" title="不显示"> <input type="radio" name="status" value="0" title="不显示">
</div> </div>
</div> </div>
<div class="layui-form-item">
<div class="layui-form-label">
排序
<p class="layui-word-aux">越小越靠前</p>
</div>
<div class="layui-input-block">
<input type="text" name="sort" value="{$category.sort}" required lay-verify="required" class="layui-input">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<button class="layui-btn layui-btn-fluid" submit lay-submit lay-filter="site-info">提交</button> <button class="layui-btn layui-btn-fluid" submit lay-submit lay-filter="site-info">提交</button>
</div> </div>

View File

@@ -43,6 +43,7 @@
<th>名称</th> <th>名称</th>
<th>介绍</th> <th>介绍</th>
<th>模板</th> <th>模板</th>
<th>排序</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
@@ -54,6 +55,7 @@
<td> {:str_repeat('|--',$vo.level)} {$vo.title}</td> <td> {:str_repeat('|--',$vo.level)} {$vo.title}</td>
<td>{$vo.desc}</td> <td>{$vo.desc}</td>
<td>{$vo.tpl_name}</td> <td>{$vo.tpl_name}</td>
<td>{$vo.sort}</td>
<td> <td>
<div class="layui-btn-container"> <div class="layui-btn-container">
<a class="layui-btn layui-btn-sm" href="{:url('index/Category/read',['id'=>$vo.id,'type'=>$Request.param.type])}">查看</a> <a class="layui-btn layui-btn-sm" href="{:url('index/Category/read',['id'=>$vo.id,'type'=>$Request.param.type])}">查看</a>