diff --git a/Application/Admin/Controller/PersonalMenusController.class.php b/Application/Admin/Controller/PersonalMenusController.class.php new file mode 100644 index 000000000..c5ac9f2d9 --- /dev/null +++ b/Application/Admin/Controller/PersonalMenusController.class.php @@ -0,0 +1,137 @@ +where(['name' => 'personal_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + if(!empty($config)) + { + foreach($config as $k => $v) + { + $config[$k]['icon'] = is_https()?'https://':'http://' . $_SERVER['SERVER_NAME'] . $v['icon']; + } + } + $this->assign('list',$config); + $this->meta_title = '个人中心列表'; + $this->display('lists'); + } + + public function add() + { + $sdkMenus = M('tool','tab_')->where(['name' => 'personal_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); + if(empty($sdkMenus['name'])) + { + $sdkMenus['name'] = 'personal_menu'; + $sdkMenus['title'] = '个人中心列表'; + $sdkMenus['status'] = 1; + $sdkMenus['create_time'] = time(); + M('tool','tab_')->data($sdkMenus)->add(); + }else + { + M('tool','tab_')->where(['name' => 'personal_menu'])->data($sdkMenus)->save(); + } + $this->success('新增成功', U('lists')); + } + + $data['sort'] = $id; + $this->meta_title = '个人中心列表'; + $this->assign('type','add'); + $this->assign('data',$data); + $this->display('add'); + } + + public function edit($id) + { + $sdkMenus = M('tool','tab_')->where(['name' => 'personal_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' => 'personal_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 = '个人中心列表'; + $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' => 'personal_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' => 'personal_menu'])->data($sdkMenus)->save(); + $this->success('删除成功', U('lists')); + } + +} \ No newline at end of file diff --git a/Application/Admin/Controller/SdkMenuController.class.php b/Application/Admin/Controller/SdkMenuController.class.php index f7611245c..43c9d8c52 100644 --- a/Application/Admin/Controller/SdkMenuController.class.php +++ b/Application/Admin/Controller/SdkMenuController.class.php @@ -16,7 +16,7 @@ class SdkMenuController extends ThinkController{ } } $this->assign('list',$config); - $this->meta_title = 'SDk用户菜单'; + $this->meta_title = '悬浮球菜单'; $this->display('lists'); } @@ -44,7 +44,7 @@ class SdkMenuController extends ThinkController{ if(empty($sdkMenus['name'])) { $sdkMenus['name'] = 'sdk_menu'; - $sdkMenus['title'] = 'SDK用户菜单'; + $sdkMenus['title'] = '悬浮球菜单'; M('tool','tab_')->data($sdkMenus)->add(); }else { @@ -54,7 +54,7 @@ class SdkMenuController extends ThinkController{ } $data['sort'] = $id; - $this->meta_title = 'SDk用户菜单'; + $this->meta_title = '悬浮球菜单'; $this->assign('type','add'); $this->assign('data',$data); $this->display('add'); @@ -102,7 +102,7 @@ class SdkMenuController extends ThinkController{ { $this->error('菜单不存在','lists'); } - $this->meta_title = 'SDk用户菜单'; + $this->meta_title = '悬浮球菜单'; $this->assign('type','edit'); $this->assign('data',$data); $this->display('add'); diff --git a/Application/Admin/View/PersonalMenus/add.html b/Application/Admin/View/PersonalMenus/add.html new file mode 100644 index 000000000..04c6ca8da --- /dev/null +++ b/Application/Admin/View/PersonalMenus/add.html @@ -0,0 +1,152 @@ + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
菜单名称 + +
菜单标题 + +
菜单链接 + +
url类型 + + + +
跳转目标 + +
IOS链接 + +
排序 + +
菜单图标 + + + +
+ +
+ +
+
+
+
+ 菜单图标 +
+ + + + + + +
+ + + 返回 + +
+ +
+ +
+ + + diff --git a/Application/Admin/View/PersonalMenus/lists.html b/Application/Admin/View/PersonalMenus/lists.html new file mode 100644 index 000000000..8e5d9f1e8 --- /dev/null +++ b/Application/Admin/View/PersonalMenus/lists.html @@ -0,0 +1,177 @@ + + + + + + + +
+
+ 新增 + 删 除 +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + ID菜单名称菜单标题菜单图标菜单链接url类型跳转目标IOS链接排序操作
{$channel.id}{$channel.name}{$channel.title}{$channel.url}原生H5页面{$channel.act}{$channel.ios_url} +
+ {$channel.sort} +
+
+ 编辑 + 删除 +
aOh! 暂时还没有内容!
+
+
+ {$_page|default=''} +
+ + + + +
+ + + + + + \ No newline at end of file diff --git a/Application/Admin/View/SdkMenu/add.html b/Application/Admin/View/SdkMenu/add.html index b620bd46b..04c6ca8da 100644 --- a/Application/Admin/View/SdkMenu/add.html +++ b/Application/Admin/View/SdkMenu/add.html @@ -62,7 +62,7 @@ IOS链接 - + diff --git a/Application/Admin/View/SdkMenu/lists.html b/Application/Admin/View/SdkMenu/lists.html index 43ac7435a..f246a381c 100644 --- a/Application/Admin/View/SdkMenu/lists.html +++ b/Application/Admin/View/SdkMenu/lists.html @@ -6,9 +6,14 @@
+
新增 删 除 @@ -63,7 +68,7 @@ - aOh! 暂时还没有内容! + aOh! 暂时还没有内容! diff --git a/Public/Admin/js/common.js b/Public/Admin/js/common.js index 229172059..345467f11 100644 --- a/Public/Admin/js/common.js +++ b/Public/Admin/js/common.js @@ -447,6 +447,7 @@ function showBtn() { //导航高亮 function highlight_subnav(url){ + console.log(url) $('.side-sub-menu').find('a[href="'+url+'"]').closest('li').addClass('current'); /*显示选中的菜单*/ $('.side-sub-menu').find("a[href='" + url + "']").parent().parent().prev("h3").removeClass('no').find("i").removeClass("icon-fold");