From 118340fa33c93c46f1da14eee9849d2e494e4228 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 21 Oct 2019 15:58:25 +0800 Subject: [PATCH] =?UTF-8?q?SDK=E7=94=A8=E6=88=B7=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/SdkMenuController.class.php | 124 +++++++++++++ Application/Admin/View/SdkMenu/add.html | 144 +++++++++++++++ Application/Admin/View/SdkMenu/lists.html | 171 ++++++++++++++++++ 3 files changed, 439 insertions(+) create mode 100644 Application/Admin/Controller/SdkMenuController.class.php create mode 100644 Application/Admin/View/SdkMenu/add.html create mode 100644 Application/Admin/View/SdkMenu/lists.html diff --git a/Application/Admin/Controller/SdkMenuController.class.php b/Application/Admin/Controller/SdkMenuController.class.php new file mode 100644 index 000000000..fc50f758a --- /dev/null +++ b/Application/Admin/Controller/SdkMenuController.class.php @@ -0,0 +1,124 @@ +where(['name' => 'sdk_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + foreach($config as $k => $v) + { + $config[$k]['icon'] = is_https()?'https://':'http://' . $_SERVER['SERVER_NAME'] . $v['icon']; + } + $this->assign('list',$config); + $this->meta_title = 'SDk用户菜单'; + $this->display('lists'); + } + + public function add() + { + $sdkMenus = M('tool','tab_')->where(['name' => 'sdk_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + if(!empty($config)) + { + $config1 = $config; + $id = array_pop($config1); + $id = $id['id'] + 1; + }else + { + $config = []; + $id = 1; + } + + if(IS_POST) + { + $post = I('post.'); + $post['id'] = $id; + array_push($config,$post); + $sdkMenus['config'] = json_encode($config); + M('tool','tab_')->where(['name' => 'sdk_menu'])->data($sdkMenus)->save(); + $this->success('新增成功', U('lists')); + } + + $data['sort'] = $id; + $this->meta_title = 'SDk用户菜单'; + $this->assign('type','add'); + $this->assign('data',$data); + $this->display('add'); + } + + public function edit($id) + { + $sdkMenus = M('tool','tab_')->where(['name' => 'sdk_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + if(IS_POST) + { + foreach($config as $k => $v) + { + if($v['id'] == $id) + { + $post = I('post.'); + foreach($post as $key => $val) + { + if($key == 'icon') + { + $config[$k][$key] = strstr($val,'/Upload'); + }else + { + $config[$k][$key] = $val; + } + } + break; + } + } + $sdkMenus['config'] = json_encode($config); + M('tool','tab_')->where(['name' => 'sdk_menu'])->data($sdkMenus)->save(); + $this->success('修改成功', U('lists')); + } + $data = []; + foreach($config as $k => $v) + { + if($v['id'] == $id) + { + $v['icon'] = is_https()?'https://':'http://' . $_SERVER['SERVER_NAME'] . $v['icon']; + $data = $v; + break; + } + } + if(empty($data)) + { + $this->error('菜单不存在','lists'); + } + $this->meta_title = 'SDk用户菜单'; + $this->assign('type','edit'); + $this->assign('data',$data); + $this->display('add'); + } + + + public function del($id) + { + if(!is_array($id)) + { + $data[] = $id; + }else + { + $data = $id; + } + $sdkMenus = M('tool','tab_')->where(['name' => 'sdk_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + foreach($config as $k => $v) + { + if(in_array($v['id'], $data)) + { + unset($config[$k]); + } + } + $sdkMenus['config'] = json_encode($config); + M('tool','tab_')->where(['name' => 'sdk_menu'])->data($sdkMenus)->save(); + $this->success('删除成功', U('lists')); + } + +} \ No newline at end of file diff --git a/Application/Admin/View/SdkMenu/add.html b/Application/Admin/View/SdkMenu/add.html new file mode 100644 index 000000000..2bf853c25 --- /dev/null +++ b/Application/Admin/View/SdkMenu/add.html @@ -0,0 +1,144 @@ + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
菜单名称 + +
菜单标题 + +
菜单链接 + +
url类型 + + + +
跳转目标 + +
排序 + +
菜单图标 + + + +
+ +
+ +
+
+
+
+ 菜单图标 +
+ + + + + + +
+ + + 返回 + +
+ +
+ +
+ + + diff --git a/Application/Admin/View/SdkMenu/lists.html b/Application/Admin/View/SdkMenu/lists.html new file mode 100644 index 000000000..1dd693fee --- /dev/null +++ b/Application/Admin/View/SdkMenu/lists.html @@ -0,0 +1,171 @@ + + + + + + + +
+
+ 新增 + 删 除 +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + ID菜单名称菜单标题菜单图标菜单链接url类型跳转目标排序操作
{$channel.id}{$channel.name}{$channel.title}{$channel.url}原生H5页面{$channel.action} +
+ {$channel.sort} +
+
+ 编辑 + 删除 +
aOh! 暂时还没有内容!
+
+
+ {$_page|default=''} +
+ + + + +
+ + + + + + \ No newline at end of file