Commit 893f3989 by LiuJunYi

三级分类

parent d5a1ca4f
...@@ -61,6 +61,19 @@ class Region extends AuthBase ...@@ -61,6 +61,19 @@ class Region extends AuthBase
return json(['code' => 1, 'msg' => '删除失败']); return json(['code' => 1, 'msg' => '删除失败']);
} }
public function edit()
{
if (request()->isAjax()) {
$res = RegionModel::update(input('post.'));
if ($res) {
return json(['code' => 0, 'msg' => '修改成功']);
} else {
return json(['code' => 1, 'msg' => $res->getError() ?: '修改失败']);
}
}
return json(['code' => 1, 'msg' => '访问失败']);
}
public function select() public function select()
{ {
if(input('id')==0){ if(input('id')==0){
......
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
<li <?php if(CONTROLLER_NAME == 'Project'&&(ACTION_NAME=='tags'||ACTION_NAME=='edittag')){echo 'class="active"';}?>> <li <?php if(CONTROLLER_NAME == 'Project'&&(ACTION_NAME=='tags'||ACTION_NAME=='edittag')){echo 'class="active"';}?>>
<a href="<?php echo url("@admin/Project/tags")?>">标签管理</a> <a href="<?php echo url("@admin/Project/tags")?>">标签管理</a>
</li> </li>
<li <?php if(CONTROLLER_NAME == 'Project'&&(ACTION_NAME=='citys'||ACTION_NAME=='editcity')){echo 'class="active"';}?>> <li <?php if(CONTROLLER_NAME == 'Region'&&(ACTION_NAME=='citys'||ACTION_NAME=='index')){echo 'class="active"';}?>>
<a href="<?php echo url("@admin/Project/citys")?>">城市管理</a> <a href="<?php echo url("@admin/Region/index")?>">城市管理</a>
</li> </li>
</ul> </ul>
</li> </li>
......
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
var arr = [ var arr = [
'<input class="form-control" style="margin-right:15px;" type="text" name="title" id="title_' + row.id + '">', '<input class="form-control" style="margin-right:15px;" type="text" name="title" id="title_' + row.id + '">',
'<button type="button" class="RoleOfadd btn-small btn btn-success" style="margin-right:15px;"><i class="fa fa-plus" ></i>&nbsp;新增</button>', '<button type="button" class="RoleOfadd btn-small btn btn-success" style="margin-right:15px;"><i class="fa fa-plus" ></i>&nbsp;新增</button>',
// '<button type="button" class="RoleOfedit btn-small btn btn-primary" style="margin-right:15px;"><i class="fa fa-pencil-square-o" ></i>&nbsp;修改</button>', '<button type="button" class="RoleOfedit btn-small btn btn-primary" style="margin-right:15px;"><i class="fa fa-pencil-square-o" ></i>&nbsp;修改</button>',
'<button type="button" class="RoleOfdelete btn-small btn btn-danger" style="margin-right:15px;"><i class="fa fa-trash-o" ></i>&nbsp;删除</button>' '<button type="button" class="RoleOfdelete btn-small btn btn-danger" style="margin-right:15px;"><i class="fa fa-trash-o" ></i>&nbsp;删除</button>'
]; ];
if (row.level >= 3) { if (row.level >= 3) {
...@@ -147,9 +147,9 @@ ...@@ -147,9 +147,9 @@
'click .RoleOfdelete': function (e, value, row, index) { 'click .RoleOfdelete': function (e, value, row, index) {
del(row.id); del(row.id);
}, },
// 'click .RoleOfedit': function (e, value, row, index) { 'click .RoleOfedit': function (e, value, row, index) {
// update(row.id); update(row.id);
// } }
}; };
</script> </script>
<script> <script>
...@@ -177,7 +177,14 @@ ...@@ -177,7 +177,14 @@
}); });
} }
// function update(id) { function update(id) {
// alert("update 方法 , id = " + id); var title = $("#title_" + id).val();
// } $.post("{:url('edit')}", {title: title, id: id}, function (res) {
if (res.code === 0) {
location.reload();
} else {
layer.msg(res.msg, {icon: 2});
}
});
}
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment