diff --git a/app/BaseController.php b/app/BaseController.php index c6cb3a7..68f0cd5 100644 --- a/app/BaseController.php +++ b/app/BaseController.php @@ -470,7 +470,7 @@ abstract class BaseController $uploads = new Uploads(); switch ($type){ case 'image': - $upRes = $uploads->put('file','article_pic',1024,'image'); + $upRes = $uploads->put('file','article_pic',2048,'image'); break; case 'zip': $upRes = $uploads->put('file','article_zip',1024,'application|image'); @@ -482,7 +482,7 @@ abstract class BaseController $upRes = $uploads->put('file','article_audio',102400,'audio'); break; default: - $upRes = $uploads->put('file','article_file',1024,'image'); + $upRes = $uploads->put('file','article_file',2048,'image'); break; } return $upRes; diff --git a/app/admin/controller/Forum.php b/app/admin/controller/Forum.php index 6176219..8a32864 100644 --- a/app/admin/controller/Forum.php +++ b/app/admin/controller/Forum.php @@ -145,7 +145,7 @@ class Forum extends AdminController $res['count']= count($list); $res['data'] = []; foreach($list as $k=>$v){ - $res['data'][] = ['sort'=>$v['sort'],'id' => $v['id'],'tags'=>$v['catename'],'ename'=>$v['ename'],'detpl'=>$v['detpl'],'icon'=>$v['icon'],'is_hot'=>$v['is_hot'],'desc'=>$v['desc']]; + $res['data'][] = ['sort'=>$v['sort'],'id' => $v['id'],'pid'=>$v['pid'],'tags'=>$v['catename'],'ename'=>$v['ename'],'detpl'=>$v['detpl'],'icon'=>$v['icon'],'is_hot'=>$v['is_hot'],'desc'=>$v['desc']]; } } return json($res); @@ -162,9 +162,9 @@ class Forum extends AdminController { $addOrEdit = !is_null(input('id'));//true是编辑false新增 $msg = $addOrEdit ? lang('edit') : lang('add'); - if(Request::isAjax()){ - $data = Request::param(); - $list = Db::name('cate')->cache('catename')->save($data); + if(Request::isAjax()) { + $data = Request::param(); + $list = Db::name('cate')->cache('catename')->save($data); if($list){ return json(['code'=>0,'msg'=> $msg.'分类成功']); @@ -172,11 +172,12 @@ class Forum extends AdminController return json(['code'=>-1,'msg'=> $msg.'分类失败']); } } - $tplname = $addOrEdit ? Db::name('cate')->where('id',input('id'))->value('detpl') : ''; //详情模板 $sys = $this->getSystem(); $template = Files::getDirName('../view/'.$sys['template'].'/index/article/'); - View::assign(['template'=>$template,'tplname'=>$tplname]); + // 如果是新增,pid=0,detpl默认第一个子模块,如果是编辑,查询出cate + $cate = $addOrEdit ? Db::name('cate')->field('detpl,pid')->find((int) input('id')) : ['pid'=>0,'detpl'=>$template[0]]; + View::assign(['template'=>$template,'cate'=>$cate]); return View::fetch(); } @@ -544,6 +545,49 @@ class Forum extends AdminController return $this->uploadFiles($type); } + public function getCateTree() + { + // + $cate = Db::name('cate')->order(['id' => 'ASC','sort' => 'ASC'])->where(['delete_time'=>0])->select()->toArray(); + + $cateTree = array2tree($cate); + + $count = count($cateTree); + $tree = []; + if($cateTree){ + $tree = ['code'=>0,'msg'=>'','count'=>$count]; + + $res = []; //auth_rule储存数据表中的表结构 + foreach($cateTree as $k => $v){ + //第一层子权限 + $children = []; + if(isset($v['children'])){ + + foreach($v['children'] as $m => $j){ + //第二层子权限 + $chichi = []; + if(isset($j['children'])){ + //第三层子权限 + foreach($j as $s){ + if(isset($s['children'])){ + $chichi[] = ['id'=>$s['id'],'catename'=>$s['catename'],'pid'=>$s['pid']]; //子数据的子数据 + } + } + } + + //if($j['level'] < 3){} + $children[] = ['id'=>$j['id'],'catename'=>$j['catename'],'pid'=>$j['pid'],'children'=>$chichi]; //子数据 + } + } + $data[] = ['id'=>$v['id'],'catename'=>$v['catename'],'pid'=>$v['pid'],'children'=>$children]; + } + + //构造一个顶级菜单pid=0的数组。把权限放入顶级菜单下子权限中 + $tree['data'][] = ['id'=>0,'catename'=>'顶级','pid'=>0,'children'=>$data]; + } + return json($tree); + } + } diff --git a/app/admin/view/auth_rule/add.html b/app/admin/view/auth_rule/add.html index 4e917ec..8ffb5d4 100644 --- a/app/admin/view/auth_rule/add.html +++ b/app/admin/view/auth_rule/add.html @@ -7,7 +7,7 @@
- +
diff --git a/app/admin/view/auth_rule/edit.html b/app/admin/view/auth_rule/edit.html index 0451cb4..ab1fc5e 100644 --- a/app/admin/view/auth_rule/edit.html +++ b/app/admin/view/auth_rule/edit.html @@ -39,9 +39,9 @@
- - - + + +
@@ -63,7 +63,7 @@ var admin = layui.admin; var xmSelect = layui.xmSelect; var iconPicker = layui.iconPicker; - + var initPid = "{$rules['pid']}"; //初始化图标选择 iconPicker.render({ @@ -93,7 +93,7 @@ layVerify: 'required', layVerType: 'tips', data: data, - initValue: [{$rules['pid']}], + initValue: [initPid], model: {label: {type: 'text'}}, prop: { name: 'title', diff --git a/app/admin/view/auth_rule/index.html b/app/admin/view/auth_rule/index.html index 5e6d5d8..8a0f078 100644 --- a/app/admin/view/auth_rule/index.html +++ b/app/admin/view/auth_rule/index.html @@ -7,7 +7,6 @@
-
diff --git a/app/admin/view/forum/add.html b/app/admin/view/forum/add.html index 3c437e2..ede6990 100644 --- a/app/admin/view/forum/add.html +++ b/app/admin/view/forum/add.html @@ -151,27 +151,31 @@ layui.config({ var keywords = this.content.join(','); $("input[name='keywords']").val(keywords); } - }) - + }) + + // tag标签 + $(function(){ //1.渲染标签 var addTags = xmSelect.render({ - el: '#tag', - name: 'tagid', - layVerify: 'required', - layVerType: 'msg', - paging: true, - pageSize: 5, - data: [] - }); - //2.动态标签赋值 - $.get("{:url('tag/getAllTag')}",function(res){ - if(res.code == 0){ - addTags.update({ - data: res.data, - autoRow: true, - }) - } - }); + el: '#tag', + name: 'tagid', + layVerify: 'required', + layVerType: 'msg', + paging: true, + pageSize: 5, + data: [] + }); + //2.动态标签赋值 + $.get("{:url('tag/getAllTag')}",function(res){ + if(res.code == 0){ + addTags.update({ + data: res.data, + autoRow: true, + }) + } + }); + }) + // 通过接口自动获取tag的内容 var conf = "{:empty(config('taoler.baidu.client_id'))}"; diff --git a/app/admin/view/forum/edit.html b/app/admin/view/forum/edit.html index a6940b3..b969051 100644 --- a/app/admin/view/forum/edit.html +++ b/app/admin/view/forum/edit.html @@ -86,7 +86,7 @@ - - +
@@ -60,29 +68,30 @@ overflow: visible; forumTags = "{:url('Forum/tags')}", forumTagsDelete = "{:url('Forum/tagsdelete')}", forumTagsForm = "{:url('Forum/tagsform')}"; + layui.config({ base: '/static/admin/' //静态资源所在路径 }).extend({ index: 'lib/index' //主入口模块 }).use(['index', 'forum', 'table','form'], function(){ - var table = layui.table, - form = layui.form; + var table = layui.table, form = layui.form; var $ = layui.$, active = { add: function(){ layer.open({ type: 2 ,title: '添加分类' ,content: 'tagsform.html' - ,area: ['400px', '450px'] + ,area: ['400px', '550px'] ,btn: ['确定', '取消'] ,yes: function(index, layero){ var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags") + ,pid = othis.find('input[name="pid"]').val() ,sort = othis.find('input[name="sort"]').val() ,tags = othis.find('input[name="tags"]').val() ,ename = othis.find('input[name="ename"]').val() - ,detpl = othis.find('select[name="detpl"]').val() - ,icon = othis.find('input[name="icon"]').val() + ,detpl = othis.find('select[name="detpl"]').val() + ,icon = othis.find('input[name="icon"]').val() ,desc = othis.find('input[name="desc"]').val(); if(!tags.replace(/\s/g, '')) return; @@ -90,7 +99,7 @@ overflow: visible; $.ajax({ type:"post", url:"{:url('Forum/tagsform')}", - data:{"sort":sort,"catename":tags,"ename":ename,"detpl":detpl,"icon":icon,"desc":desc}, + data:{pid:pid,"sort":sort,"catename":tags,"ename":ename,"detpl":detpl,"icon":icon,"desc":desc}, daType:"json", success:function (data){ if (data.code == 0) { diff --git a/app/admin/view/forum/tagsform.html b/app/admin/view/forum/tagsform.html index 682148d..ce13690 100644 --- a/app/admin/view/forum/tagsform.html +++ b/app/admin/view/forum/tagsform.html @@ -3,6 +3,12 @@ {block name="body"}
+
+ +
+ +
+
@@ -15,9 +21,9 @@
@@ -43,10 +49,13 @@ base: '/static/admin/' //静态资源所在路径 }).extend({ index: 'lib/index' //主入口模块 - }).use(['index', 'form', 'iconPicker'], function(){ + }).use(['index', 'form','admin', 'iconPicker', 'xmSelect',], function(){ var $ = layui.$ ,form = layui.form ; + var admin = layui.admin; var iconPicker = layui.iconPicker; + var xmSelect = layui.xmSelect; + var initPid = "{$cate.pid}"; //初始化图标选择 iconPicker.render({ @@ -59,6 +68,91 @@ //console.log(data); } }); + + //分类菜单结构 + admin.req({ + type: "post", + url: "{:url('Forum/getCateTree')}", + data:{}, + done:function(res){ + var data = res.data; + + // 渲染下拉树 + xmSelect.render({ + el: '#menuSelectBox', + name: 'pid', + height: '250px', + layVerify: 'required', + layVerType: 'tips', + data: data, + initValue: [initPid], + model: {label: {type: 'text'}}, + prop: { + name: 'catename', + value: 'id' + }, + radio: true, + clickClose: true, + tree: { + show: true, + indent: 15, + strict: false, + expandedKeys: true + }, + tips: '请选择上级菜单' + }); + + + // var demo4 = xmSelect.render({ + // el: '#menuSelectBox', + // model: { label: { type: 'text' } }, + // tree: { + // show: true, + // strict: false, + // expandedKeys: [ -1 ], + // }, + // on: function(data){ + // if(data.isAdd){ + // return data.change.slice(0, 1) + // } + // }, + // height: 'auto', + // }) + + // //这里模拟ajax + // setTimeout(function(){ + // demo4.update({ + // data: [ + // {name: '销售员', value: -1, children: [ + // {name: '张三', value: 100, children: []}, + // {name: '李四1', value: 2}, + // {name: '王五1', value: 3, disabled: true}, + // ]}, + // {name: '奖品', value: -2, children: [ + // {name: '奖品3', value: -3, children: [ + // {name: '苹果3', value: 14}, + // {name: '香蕉3', value: 15}, + // {name: '葡萄3', value: 16}, + // ]}, + // {name: '苹果2', value: 4, disabled: true}, + // {name: '香蕉2', value: 5}, + // {name: '葡萄2', value: 6}, + // ]}, + // ] + // }) + + // //设置默认值 + // demo4.setValue([ + // {name: '李四1', value: 2}, + // {name: '苹果3', value: 14}, + // ], null, true) + + // }, 300) + + } + + }); + }) {/block} \ No newline at end of file diff --git a/app/common/controller/AdminController.php b/app/common/controller/AdminController.php index dfcaf95..85fd856 100644 --- a/app/common/controller/AdminController.php +++ b/app/common/controller/AdminController.php @@ -70,6 +70,7 @@ class AdminController extends \app\BaseController /** * 获取角色菜单 + * $type 1 admin后端权限,2 index前端权限 */ protected function getMenus($type) { diff --git a/app/common/controller/BaseController.php b/app/common/controller/BaseController.php index 32f7116..142b362 100644 --- a/app/common/controller/BaseController.php +++ b/app/common/controller/BaseController.php @@ -60,8 +60,10 @@ class BaseController extends BaseCtrl protected function showNav() { //1.查询分类表获取所有分类 - $cateList = Db::name('cate')->where(['status'=>1,'delete_time'=>0])->order('sort','asc')->cache('catename',3600)->select(); - + $cateList = Db::name('cate')->where(['status'=>1,'delete_time'=>0])->order('sort','asc')->cache('catename',3600)->select()->toArray(); + $cateList = array2tree($cateList); + // $cateList = getTree($cateList); + // dump($cateList); //2.将catelist变量赋给模板 公共模板nav.html View::assign('cateList',$cateList); return $cateList; diff --git a/app/common/model/Article.php b/app/common/model/Article.php index eb21d9d..ab335cf 100644 --- a/app/common/model/Article.php +++ b/app/common/model/Article.php @@ -364,7 +364,7 @@ class Article extends Model $query->where('delete_time',0)->field('id,catename,ename'); }]) ->where(['status'=>1]) - // ->where('article.id', '<>', $id) + // ->where('article.id', '<>', $id) ->order('pv desc') ->limit($limit) ->append(['url']) diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index bc6c957..c2b061f 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -307,14 +307,24 @@ class Article extends BaseController // 子模块自定义自适应add.html模板 - $tpl = Db::name('cate')->where('ename', input('cate'))->value('detpl'); + $cate = Db::name('cate')->field('id,detpl')->where('ename', input('cate'))->find(); + // 子模块下有add.html模板 + if(!empty($cate)) { + $cid = $cate['id']; + } else { + $cate['detpl'] = ''; + $cid = ''; + } + // 模板路径 $appName = $this->app->http->getName(); $viewRoot = root_path() . config('view.view_dir_name') . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR; - $view = 'article' . DIRECTORY_SEPARATOR . $tpl . DIRECTORY_SEPARATOR . 'add.html'; + $view = 'article' . DIRECTORY_SEPARATOR . $cate['detpl'] . DIRECTORY_SEPARATOR . 'add.html'; $vfile = $viewRoot . $view; + + //子模块下存在add模板则调用,否则调用article/add.html $addTpl = is_file($vfile) ? $vfile : 'add'; - View::assign(['jspage'=>'jie']); + View::assign(['jspage'=>'jie','cid'=>$cid]); return View::fetch($addTpl); } @@ -577,8 +587,10 @@ class Article extends BaseController // $pats = '/(?)/'; //$pats = '/'.$key.'(?!<\/a>)/'; - // 不匹配 $key已经存在链接的情况 - $pats = '/' . $value['name'] . '\s?(?!<\/a>|")/is'; + + //1.不匹配 $key已经存在链接的情况 + //2.或不匹配 alt="$key等等等" $key后面有"这种情况 + $pats = '/' . $value['name'] . '\s?(?!<\/a>|\s?\S*")/is'; preg_match($pats,$content,$arr); @@ -610,6 +622,50 @@ class Article extends BaseController } } + + public function getCateTree() + { + // + $cate = Db::name('cate')->order(['id' => 'ASC','sort' => 'ASC'])->where(['delete_time'=>0])->select()->toArray(); + + $cateTree = array2tree($cate); + + $count = count($cateTree); + $tree = []; + if($cateTree){ + $tree = ['code'=>0,'msg'=>'','count'=>$count]; + + $res = []; //auth_rule储存数据表中的表结构 + foreach($cateTree as $k => $v){ + //第一层子权限 + $children = []; + if(isset($v['children'])){ + + foreach($v['children'] as $m => $j){ + //第二层子权限 + $chichi = []; + if(isset($j['children'])){ + //第三层子权限 + foreach($j as $s){ + if(isset($s['children'])){ + $chichi[] = ['id'=>$s['id'],'catename'=>$s['catename'],'pid'=>$s['pid']]; //子数据的子数据 + } + } + } + + //if($j['level'] < 3){} + $children[] = ['id'=>$j['id'],'catename'=>$j['catename'],'pid'=>$j['pid'],'children'=>$chichi]; //子数据 + } + } + $data[] = ['id'=>$v['id'],'catename'=>$v['catename'],'pid'=>$v['pid'],'children'=>$children]; + } + + //构造一个顶级菜单pid=0的数组。把权限放入顶级菜单下子权限中 + //$tree['data'][] = ['id'=>0,'catename'=>'顶级','pid'=>0,'children'=>$data]; + $tree['data'] = $data; + } + return json($tree); + } } \ No newline at end of file diff --git a/app/index/route/route.php b/app/index/route/route.php index 9baa4bd..aa38514 100644 --- a/app/index/route/route.php +++ b/app/index/route/route.php @@ -56,6 +56,7 @@ Route::group('art',function () use($detail_as,$cate_as){ Route::rule('delete/[:id]','Article/delete'); Route::rule('tags','Article/tags')->allowCrossDomain(); Route::rule('edit/[:id]','Article/edit'); + Route::get('article/catetree','Article/getCateTree'); }); //tag diff --git a/public/static/admin/modules/forum.js b/public/static/admin/modules/forum.js index 5a02456..f459225 100644 --- a/public/static/admin/modules/forum.js +++ b/public/static/admin/modules/forum.js @@ -1,8 +1,9 @@  -layui.define(['table', 'form'], function(exports){ +layui.define(['table', 'form', 'treeTable'], function(exports){ var $ = layui.$ ,table = layui.table ,form = layui.form; + var treeTable = layui.treeTable; //帖子管理 var forms = table.render({ @@ -189,26 +190,39 @@ var forms = table.render({ } }); - //帖子分类管理 - table.render({ - elem: '#LAY-app-content-tags' - ,url: forumTags //帖子分类接口 - ,cols: [[ - {field: 'sort', title: '排序', width: 80, sort: true} - ,{field: 'id', title: 'ID',width: 60} - ,{field: 'tags', title: '分类名', width: 100} - ,{field: 'ename', title: 'EN别名', width: 100} - ,{field: 'detpl',title: '模板', align: 'center',width: 100,templet: '#inputSel'} - ,{title: '图标', align: 'center',width: 50,templet: '

'} - ,{field: 'is_hot', title: '热门', align: 'center',width: 50, templet: '#buttonHot'} - ,{field: 'desc', title: '描述', minWidth: 200} - ,{title: '操作', width: 100, align: 'center', toolbar: '#layuiadmin-app-cont-tagsbar'} - ]] - ,text: '对不起,加载出现异常!' - }); + // 渲染分类表格 + var insTb = treeTable.render({ + elem: '#Article-cate-list', + url: forumTags, + //toolbar: 'default', + //height: 'full-200', + tree: { + iconIndex: 2, + isPidData: true, + idName: 'id', + pidName: 'pid' + }, + defaultToolbar: ['filter', 'print', 'exports'], + cols: [ + [ + {type: 'numbers'}, + {type: 'checkbox'} + ,{field: 'tags', title: '分类名', minWidth: 200} + ,{field: 'ename', title: 'EN别名', width: 100} + ,{field: 'detpl',title: '模板', align: 'center',width: 100,templet: '#inputSel'} + ,{title: '图标', align: 'center',width: 50,templet: '

'} + ,{field: 'is_hot', title: '热门', align: 'center',width: 50, templet: '#buttonHot'} + ,{field: 'desc', title: '描述', minWidth: 200} + ,{field: 'id', title: 'ID',width: 60} + ,{field: 'sort', title: '排序', width: 80, sort: true} + ,{title: '操作', width: 120, align: 'center', toolbar: '#layuiadmin-app-cont-tagsbar'} + ] + ], + style: 'margin-top:0;' + }); //监听工具条 - table.on('tool(LAY-app-content-tags)', function(obj){ + treeTable.on('tool(Article-cate-list)', function(obj){ var data = obj.data; if(obj.event === 'del'){ layer.confirm('确定删除此分类?', function(index){ @@ -249,6 +263,7 @@ var forms = table.render({ ,yes: function(index, layero){ //获取iframe元素的值 var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags") + ,pid = othis.find('input[name="pid"]').val() ,sort = othis.find('input[name="sort"]').val() ,tags = othis.find('input[name="tags"]').val() ,ename = othis.find('input[name="ename"]').val() @@ -261,7 +276,7 @@ var forms = table.render({ $.ajax({ type:"post", url:forumTagsForm, - data:{"id":data.id,"sort":sort,"catename":tags,"ename":ename,"detpl":detpl,"icon":icon,"desc":desc}, + data:{"id":data.id,"pid":pid,"sort":sort,"catename":tags,"ename":ename,"detpl":detpl,"icon":icon,"desc":desc}, daType:"json", success:function (data){ if (data.code == 0) { @@ -288,15 +303,17 @@ var forms = table.render({ ,sort: sort }); */ + treeTable.reload('Article-cate-list'); //数据刷新 layer.close(index); } ,success: function(layero, index){ //给iframe元素赋值 var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags").click(); - othis.find('input[name="sort"]').val(data.sort) + othis.find('input[name="pid"]').val(data.pid) + ,othis.find('input[name="sort"]').val(data.sort) ,othis.find('input[name="tags"]').val(data.tags) ,othis.find('input[name="ename"]').val(data.ename) - ,othis.find('input[name="icon"]').val(data.icon) + ,othis.find('input[name="icon"]').val(data.icon) ,othis.find('input[name="desc"]').val(data.desc); } }); diff --git a/public/static/res/css/global.css b/public/static/res/css/global.css index d7efc18..4fc6319 100644 --- a/public/static/res/css/global.css +++ b/public/static/res/css/global.css @@ -195,12 +195,12 @@ pre{position: relative; margin: 10px 0; padding: 15px; line-height: 20px; border .fly-nav-msg:hover{color:#fff;} .fly-header .layui-nav{padding: 0; background: none;} -.fly-header .fly-nav a{padding: 0 25px 0 60px;} +.fly-header .fly-nav a{padding: 0 25px 0 40px;} .fly-header .fly-nav-user li a{padding: 0 10px;} .fly-header .fly-nav-user li .fly-nav-avatar{padding-right: 0;} .fly-header .fly-nav-user a.iconfont{color: #A9B7B7;} .fly-header>.layui-nav-item a{color: rgba(255,255,255,0.5);} -.fly-header .layui-this a{color: #fff;} +.fly-header .layui-this>a{color: #00AF83;} .fly-header .layui-nav .layui-this:after, .fly-header .layui-nav .layui-nav-bar, .fly-header .fly-nav-user .layui-nav-more{display: none !important;} @@ -536,7 +536,7 @@ body .layui-edit-face .layui-layer-content{padding:0; background-color:#fff; co /*标题颜色展示方式*/ .layui-colorpicker.layui-colorpicker-xs {width: 30px;height: 20px;line-height: 16px;border: 0px solid #e6e6e6;padding: 0;vertical-align: top;border-radius: 0;} .layui-colorpicker-trigger-span {display: block;height: 100%;box-sizing: border-box;border: 1px solid rgba(2, 0, 0, 0.24);border-radius: 2px;text-align: center;} -.layui-icon-down:before {font-size: 12px;content: "高亮";} +/* .layui-icon-down:before {font-size: 12px;content: "高亮";} */ /*扫码阅读*/ .detail_qrcode{position: absolute;top: 7px;right: 7px;width: 30px;height: 30px;background: url("/static/res/images/detail_qrcode.png") no-repeat;background-size: 30px 30px;} diff --git a/view/taoler/index/article/add.html b/view/taoler/index/article/add.html index d636374..6edaae6 100644 --- a/view/taoler/index/article/add.html +++ b/view/taoler/index/article/add.html @@ -18,12 +18,7 @@
- +
@@ -175,26 +170,63 @@ var othis = $(this), html = othis.html(); othis.attr(fly.content(html)); }) - } - - //1.渲染标签 - var addTags = xmSelect.render({ - el: '#tag', - name: 'tagid', - layVerify: '', - layVerType: 'msg', - paging: true, - pageSize: 5, - data: [] + } + + // 分类选择 + $(function(){ + //这里模拟ajax + $.get("{:url('article/getCateTree')}",function(res){ + var cid = "{$cid}"; + var data = res.data; + // 渲染下拉树 + xmSelect.render({ + el: '#CateId', + name: 'cate_id', + height: '250px', + layVerify: 'required', + layVerType: 'tips', + data: data, + initValue: [cid], + model: {label: {type: 'text'}}, + prop: { + name: 'catename', + value: 'id' + }, + radio: true, + clickClose: true, + tree: { + show: true, + indent: 15, + strict: false, + expandedKeys: true + }, + tips: '请选择' + }); + + }); }); - //2.动态标签赋值 - $.get("{:url('get_all_tag')}",function(res){ - if(res.code == 0){ - addTags.update({ - data: res.data, - autoRow: true, - }) - } + + // tag标签 + $(function(){ + //1.渲染标签 + var addTags = xmSelect.render({ + el: '#tag', + name: 'tagid', + layVerify: '', + layVerType: 'msg', + paging: true, + pageSize: 5, + data: [] + }); + //2.动态标签赋值 + $.get("{:url('get_all_tag')}",function(res){ + if(res.code == 0){ + addTags.update({ + data: res.data, + autoRow: true, + }) + } + }); }); // 通过标题内容自动获取tag的内容 diff --git a/view/taoler/index/article/edit.html b/view/taoler/index/article/edit.html index 4ebc8f6..cbc9f3e 100644 --- a/view/taoler/index/article/edit.html +++ b/view/taoler/index/article/edit.html @@ -20,12 +20,7 @@
- +
@@ -148,35 +143,71 @@ {:hook('taonyeditor')} {block name="script"} {/block} diff --git a/view/taoler/index/public/header.html b/view/taoler/index/public/header.html index 0179c0d..db95ebd 100644 --- a/view/taoler/index/public/header.html +++ b/view/taoler/index/public/header.html @@ -7,12 +7,29 @@ {//移动端LOGO} + + {//头部右栏}
    {if session('?user_id')}