diff --git a/app/admin/controller/content/Tag.php b/app/admin/controller/content/Tag.php index 1bc2c2c..a29a8df 100644 --- a/app/admin/controller/content/Tag.php +++ b/app/admin/controller/content/Tag.php @@ -74,27 +74,32 @@ class Tag extends AdminController $data = Request::only(['name','ename','id','keywords','description','title']); // 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串 $data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace(',',',',$data['keywords']))))); - - $res =$tagModel::update($data); - if($res == true){ + try{ + $tagModel::update($data); return json(['code'=>0,'msg'=>'设置成功']); + } catch(\Exception $e) { + return json(['code'=>-1,'msg'=>$e->getMessage()]); } } + $tag = $tagModel->getTag(input('id')); View::assign('tag',$tag); return view(); } + /** + * 删除 + * @return \think\response\Json + */ public function delete() { - if(Request::isPost()) { - $tagModel = new TagModel; - $res = $tagModel->delTag(input('id')); - if($res == true){ - return json(['code'=>0,'msg'=>'删除成功']); - } + $tagModel = new TagModel; + $res = $tagModel->delTag(input('id')); + if($res){ + return json(['code'=>0,'msg'=>'删除成功']); } + return json(['code'=>-1,'msg'=>'删除失败']); } /** diff --git a/app/admin/controller/system/AuthRule.php b/app/admin/controller/system/AuthRule.php index 1f52639..9ae66e9 100644 --- a/app/admin/controller/system/AuthRule.php +++ b/app/admin/controller/system/AuthRule.php @@ -42,12 +42,11 @@ class AuthRule extends AdminController { return $this->model->getAuthRuleArray(); } - - /** - * 无限极权限树 - * - * @return void - */ + + /** + * 无限极权限树 + * @return \think\response\Json + */ public function ruleTree() { $data = $this->getRoleMenu(1); diff --git a/app/admin/controller/user/User.php b/app/admin/controller/user/User.php index e4bcaca..1ade47f 100644 --- a/app/admin/controller/user/User.php +++ b/app/admin/controller/user/User.php @@ -102,16 +102,13 @@ class User extends AdminController $data = Request::only(['id','name','email','user_img','password','phone','sex']); $user = Db::name('user')->field('create_time')->find($data['id']); $salt = substr(md5($user['create_time']),-6); - // 密码 - $data['password'] = md5(substr_replace(md5($data['password']),$salt,0,6)); - - $result = Db::name('user')->update($data); - if($result){ - $res = ['code'=>0,'msg'=>'编辑成功']; - }else{ - $res = ['code'=>-1,'msg'=>'编辑失败']; - } - return json($res); + $data['password'] = md5(substr_replace(md5($data['password']),$salt,0,6)); // 密码 + try{ + Db::name('user')->update($data); + return json(['code'=>0,'msg'=>'编辑成功']); + } catch (\Exception $e) { + return json(['code'=> -1,'msg'=>$e->getMessage()]); + } } $user = Db::name('user')->find(input('id')); View::assign('user',$user); diff --git a/app/admin/view/content/forum/add.html b/app/admin/view/content/forum/add.html index 5c1d6bf..7f84fbc 100644 --- a/app/admin/view/content/forum/add.html +++ b/app/admin/view/content/forum/add.html @@ -229,7 +229,6 @@ }); form.on('submit(forum-save)', function(data) { - console.log(data) $.ajax({ url: "{:url('content.forum/add')}", data: JSON.stringify(data.field), diff --git a/app/admin/view/content/forum/index.html b/app/admin/view/content/forum/index.html index bf2a2a4..d6a584e 100644 --- a/app/admin/view/content/forum/index.html +++ b/app/admin/view/content/forum/index.html @@ -5,58 +5,57 @@ 用户管理 - -
-
-
-
-
- -
- + +
+
+ +
+
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- - -
+
+ + +
+
+
- -
-
- +
@@ -74,7 +73,6 @@ - @@ -96,9 +94,6 @@ -
-
- diff --git a/app/admin/view/content/tag/add.html b/app/admin/view/content/tag/add.html new file mode 100644 index 0000000..1d02b04 --- /dev/null +++ b/app/admin/view/content/tag/add.html @@ -0,0 +1,91 @@ + +{extend name="public/admin_form" /} + +{block name="body"} +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+ + +
+
+
+ +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/app/admin/view/content/tag/edit.html b/app/admin/view/content/tag/edit.html new file mode 100644 index 0000000..95c49fd --- /dev/null +++ b/app/admin/view/content/tag/edit.html @@ -0,0 +1,90 @@ +{extend name="public/admin_form" /} + +{block name="body"} +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+
+ + + +
+
+
+ +{/block} + +{block name="js"} + +{/block} \ No newline at end of file diff --git a/app/admin/view/content/tag/index.html b/app/admin/view/content/tag/index.html new file mode 100644 index 0000000..2f91489 --- /dev/null +++ b/app/admin/view/content/tag/index.html @@ -0,0 +1,191 @@ +{extend name="public/admin_base" /} + +{block name="body"} +
+
+
+
+
+ + + +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/app/admin/view/user/user/edit.html b/app/admin/view/user/user/edit.html index c9cab75..17b0ca4 100644 --- a/app/admin/view/user/user/edit.html +++ b/app/admin/view/user/user/edit.html @@ -90,8 +90,7 @@ icon: 1, time: 1000 }, function() { - parent.layer.close(parent.layer.getFrameIndex(window - .name)); //关闭当前页 + parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页 parent.layui.table.reload("user-table"); }); } else { diff --git a/app/common.php b/app/common.php index 922f1bc..b33329d 100644 --- a/app/common.php +++ b/app/common.php @@ -58,11 +58,6 @@ try { return 1; } -//根据user area_id查询区域简称 -function getAsing($area_id){ - return Db::name('user_area')->where('id',$area_id)->cache(3600)->value('asing'); -} - //根据用户主键ID,查询用户名称 if(!function_exists('getUserName')) { diff --git a/app/common/controller/AdminController.php b/app/common/controller/AdminController.php index 76e85b7..4aab919 100644 --- a/app/common/controller/AdminController.php +++ b/app/common/controller/AdminController.php @@ -148,7 +148,7 @@ class AdminController extends \app\BaseController } /** - * 获取路由 + * 把后台管理文章或帖子的路由转换为实际应用的路由 * @param int $aid * @param string $appName * @param string $ename @@ -203,6 +203,14 @@ class AdminController extends \app\BaseController return $this->getDomain() . str_replace($map_admin, $appName, $articleUrl); } //3.admin未绑定域名也未映射 + // 1.应用绑定了域名 + if($app_bind) { + return $this->getDomain() . $articleUrl; + } + // 2.应用进行了映射 + if($app_map){ + return $this->getDomain() . str_replace('admin', $app_map, $articleUrl); + } return str_replace('admin', $appName, $articleUrl); } diff --git a/app/common/controller/BaseController.php b/app/common/controller/BaseController.php index ba8f254..fdf4c6f 100644 --- a/app/common/controller/BaseController.php +++ b/app/common/controller/BaseController.php @@ -69,7 +69,6 @@ class BaseController extends BaseCtrl // 显示导航nav protected function showNav() { - $appname = app('http')->getName(); //1.查询分类表获取所有分类 $cate = new Cate(); $cateList = $cate->menu(); diff --git a/app/common/model/Article.php b/app/common/model/Article.php index ee61378..96980d3 100644 --- a/app/common/model/Article.php +++ b/app/common/model/Article.php @@ -195,7 +195,7 @@ class Article extends Model { return Cache::remember('article_'.$id, function() use($id){ //查询文章 - return $this::field('id,title,content,status,cate_id,user_id,goods_detail_id,is_top,is_hot,is_reply,pv,jie,upzip,downloads,keywords,description,title_color,create_time,update_time') + return $this::field('id,title,content,status,cate_id,user_id,goods_detail_id,is_top,is_hot,is_reply,pv,jie,upzip,downloads,keywords,description,read_type,art_pass,title_color,create_time,update_time') ->where(['status'=>1]) ->with([ 'cate' => function($query){ diff --git a/app/common/model/Cate.php b/app/common/model/Cate.php index 5f5372f..a029a59 100644 --- a/app/common/model/Cate.php +++ b/app/common/model/Cate.php @@ -81,10 +81,9 @@ class Cate extends Model // 如果菜单下无内容,URl不能点击 public function menu() { - $appname = app('http')->getName(); try { - return $this->where(['status' => 1, 'appname' => $appname]) - ->cache('catename' . $appname, 3600) + return $this->where(['status' => 1]) + ->cache('catename', 3600) ->append(['url']) ->select() ->toArray(); diff --git a/app/common/model/Tag.php b/app/common/model/Tag.php index a67ebec..3835936 100644 --- a/app/common/model/Tag.php +++ b/app/common/model/Tag.php @@ -42,20 +42,16 @@ class Tag extends Model /** * 删除数据 - * - * @param [type] $id - * @return void + * @param $id + * @return bool */ public function delTag($id) { - // $res = $this::destroy($id); - - if($res == true) { + if($res) { return true; - } else { - return false; } + return false; } } \ No newline at end of file diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index cec1c24..d6b6998 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -3,10 +3,12 @@ namespace app\index\controller; use app\common\controller\BaseController; +use think\App; use think\facade\View; use think\facade\Request; use think\facade\Db; use think\facade\Cache; +use think\facade\Session; use think\facade\Config; use app\common\model\Cate; use app\common\model\Comment; @@ -22,8 +24,16 @@ class Article extends BaseController protected $middleware = [ 'logincheck' => ['except' => ['cate','detail','download'] ], ]; - - //文章分类 + + protected $model; + + public function __construct(App $app) + { + parent::__construct($app); + $this->model = new ArticleModel(); + } + + //文章分类 public function cate() { $cate = new Cate(); @@ -75,13 +85,19 @@ class Article extends BaseController $page = input('page',1); //输出内容 $article = new ArticleModel(); - $artDetail = $article->getArtDetail($id); + $artDetail = $this->model->getArtDetail($id); + + if($artDetail['read_type'] == 1 && session('art_pass_'.$id) != $artDetail['art_pass']) + { + $artDetail['content'] = '加密文件!请正确输入密码查看!'; + } + if(is_null($artDetail)){ // 抛出 HTTP 异常 throw new \think\exception\HttpException(404, '无内容'); } //用户个人tag标签 - $userTags = $article->where(['user_id'=>$artDetail['user_id'],'status'=>1])->where('keywords','<>','')->column('keywords'); + $userTags = $this->model->where(['user_id'=>$artDetail['user_id'],'status'=>1])->where('keywords','<>','')->column('keywords'); //转换为字符串 $tagStr = implode(",",$userTags); //转换为数组并去重 @@ -137,7 +153,6 @@ class Article extends BaseController //评论 $comments = $this->getComments($id, $page); - //halt($comments); //最新评论时间 $lrDate_time = Db::name('comment')->where('article_id', $id)->max('update_time',false) ?? time(); // 热议文章 @@ -169,6 +184,7 @@ class Article extends BaseController 'userZanList' => $userZanList, 'userTagCount'=> $userTagCount, 'jspage' => 'jie', + 'passJieMi' => session('art_pass_'.$id), $download, ]); @@ -242,7 +258,7 @@ class Article extends BaseController // 检验发帖是否开放 if(config('taoler.config.is_post') == 0 ) return json(['code'=>-1,'msg'=>'抱歉,系统维护中,暂时禁止发帖!']); // 数据 - $data = Request::only(['cate_id', 'title', 'title_color', 'content', 'upzip', 'keywords', 'description', 'captcha']); + $data = Request::only(['cate_id', 'title', 'title_color','read_type','art_pass', 'content', 'upzip', 'keywords', 'description', 'captcha']); $data['user_id'] = $this->uid; $tagId = input('tagid'); @@ -339,7 +355,7 @@ class Article extends BaseController $article = ArticleModel::find($id); if(Request::isAjax()){ - $data = Request::only(['id','cate_id','title','title_color','user_id','content','upzip','keywords','description','captcha']); + $data = Request::only(['id','cate_id','title','title_color','read_type','art_pass','user_id','content','upzip','keywords','description','captcha']); $data['user_id'] = $this->uid; $tagId = input('tagid'); @@ -393,6 +409,8 @@ class Article extends BaseController //删除原有缓存显示编辑后内容 Cache::delete('article_'.$id); + Session::delete('art_pass_'.$id); + $link = $this->getRouteUrl((int) $id, $article->cate->ename); hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口 @@ -618,49 +636,32 @@ 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); + /** + * 分类树 + * @return \think\response\Json + */ + public function getCateTree() + { + $data = $this->showNav(); + $count = count($data); + $tree = []; + if($count){ + $tree = ['code'=>0, 'msg'=>'ok','count'=>$count]; + $tree['data'] = $data; + } - $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); - } - + return json($tree); + } + + public function jiemi() + { + $param = Request::param(); + $article = $this->model->find($param['id']); + if($article['art_pass'] == $param['art_pass']) { + session('art_pass_'.$param['id'], $param['art_pass']); + return json(['code' => 0, 'msg' => '解密成功']); + } + return json(['code' => -1, 'msg' => '解密失败']); + } } \ No newline at end of file diff --git a/app/index/controller/Comment.php b/app/index/controller/Comment.php index 6984d03..1a4c7c8 100644 --- a/app/index/controller/Comment.php +++ b/app/index/controller/Comment.php @@ -2,12 +2,15 @@ namespace app\index\controller; use app\common\controller\BaseController; +use think\facade\View; +use think\facade\Request; use think\facade\Session; use think\facade\Cache; use app\common\model\Comment as CommentModel; use app\common\model\Article; use app\common\model\UserZan; + class Comment extends BaseController { //采纳评论 @@ -76,6 +79,24 @@ class Comment extends BaseController } return json($res); } + + //更新评论 + public function edit() + { + if(Request::isAjax()) { + $param = Request::param(); +// halt($param); + $result = CommentModel::update($param); + if($result) { + return json(['code' => 0, 'msg' => '编辑成功']); + } + return json(['code' => 0, 'msg' => '编辑失败']); + } + $comms = CommentModel::find(input('id')); + View::assign(['comment' => $comms, 'jspage' => '']); + return View::fetch(); + + } //评论点赞 public function jiedaZan() diff --git a/app/index/route/route.php b/app/index/route/route.php index faf047b..7c18ee6 100644 --- a/app/index/route/route.php +++ b/app/index/route/route.php @@ -50,6 +50,9 @@ Route::group(function () { ->middleware(\app\middleware\CheckRegister::class); }); +// comment +Route::rule('comment/edit/[:id]','comment/edit'); + // article Route::group('art',function () use($detail_as,$cate_as){ Route::rule('add/[:cate]','Article/add')->name('add_article'); diff --git a/config/taoler.php b/config/taoler.php index 6ad2362..2f28173 100644 --- a/config/taoler.php +++ b/config/taoler.php @@ -16,7 +16,7 @@ return [ // 应用名,此项不可更改 'appname' => 'TaoLer', // 版本配置 - 'version' => '2.2.9', + 'version' => '2.2.10', // 加盐 'salt' => 'taoler', // 数据库备份目录 diff --git a/public/static/res/mods/jie.js b/public/static/res/mods/jie.js index 17fd17b..7c6d2b0 100644 --- a/public/static/res/mods/jie.js +++ b/public/static/res/mods/jie.js @@ -205,37 +205,36 @@ layui.define('fly', function(exports){ }); } ,edit: function(li){ //编辑评论 - fly.json(commentGetDa, { - id: li.data('id') - }, function(res){ - var data = res.rows; - layer.prompt({ - formType: 2 - ,value: data.content - ,maxlength: 100000 - ,title: '编辑回帖' - ,area: ['738px', '310px'] - ,success: function(layero){ + if(taonystatus == 0) { - if(taonystatus == 0) { - fly.layEditor({ - elem: layero.find('textarea') - }); - } else { - // 编辑器 + fly.json(commentGetDa, { + id: li.data('id') + }, function (res) { + var data = res.rows; + layer.prompt({ + formType: 2 + , value: data.content + , maxlength: 100000 + , title: '编辑回帖' + , area: ['738px', '310px'] + , success: function (layero) { + fly.layEditor({ + elem: layero.find('textarea') + }); } - } - }, function(value, index){ - fly.json(commentUpdateDa, { - id: li.data('id') - ,content: value - }, function(res){ - layer.close(index); - layer.msg(res.msg); - li.find('.detail-body').html(fly.content(value)); + }, function (value, index) { + fly.json(commentUpdateDa, { + id: li.data('id') + , content: value + }, function (res) { + layer.close(index); + layer.msg(res.msg); + li.find('.detail-body').html(fly.content(value)); + }); }); }); - }); + } + } ,del: function(li){ //删除评论 layer.confirm('确认删除该回答么?', function(index){ diff --git a/view/taoler/index/article/add.html b/view/taoler/index/article/add.html index 3026174..f8c175d 100644 --- a/view/taoler/index/article/add.html +++ b/view/taoler/index/article/add.html @@ -39,33 +39,33 @@
{/if}
- +
+
@@ -150,6 +150,7 @@ diff --git a/view/taoler/index/article/blog/detail.html b/view/taoler/index/article/blog/detail.html index 362aad2..e80a12b 100644 --- a/view/taoler/index/article/blog/detail.html +++ b/view/taoler/index/article/blog/detail.html @@ -61,6 +61,13 @@
{/if} + {//解密文件} + {empty name="passJieMi"} + {if($article.read_type == 1)} +
阅读请解密
+ {/if} + {/empty} + {notempty name="tags"}
标签 {volist name="tags" id="vo" } @@ -142,7 +149,7 @@ {//评论 编辑/删除/采纳/权限}
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')} - {:lang('edit')} + {:lang('edit')} {:lang('delete')} {/if} {if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) && ($article.jie == 0)/} {:lang('accept')} @@ -325,6 +332,17 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){ var othis = $(this), html = othis.html(); othis.html(fly.content(html)); }); + } else { + $("#comment-edit").on('click',function (){ + var id = $(this).data('id'); + layer.open({ + type: 2, + title: '修改', + shade: 0.1, + area: ['600px', '500px'], + content: "{:url('comment/edit')}" + '?id=' + id + }); + }); } //加载评论编辑器 @@ -448,6 +466,28 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){ }); }); + $("#jiemi").click(function (){ + //判断登陆 + if(uid == -1){ + layer.msg('请先登录再查看', {icon: 6}, function(){location.href = login}) + return false; + } + var id = "{$article.id}"; + layer.prompt(function(value, index, elem){ + // alert(value); //得到value + $.post("{:url('article/jiemi')}",{id:id, art_pass:value},function (res){ + if(res.code === 0){ + layer.msg(res.msg,{icon:6,time:2000},function () { + parent.location.reload(); //刷新父页面,注意一定要在关闭当前iframe层之前执行刷新 + }); + } else { + layer.msg(res.msg,{icon:5,adim:6}); + } + }); + layer.close(index); + }); + }); + }); diff --git a/view/taoler/index/article/detail.html b/view/taoler/index/article/detail.html index 36a96c0..781c140 100644 --- a/view/taoler/index/article/detail.html +++ b/view/taoler/index/article/detail.html @@ -110,7 +110,7 @@ {//评论编辑删除采纳权限}
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')} - {:lang('edit')} + {:lang('edit')} {:lang('delete')} {/if} {if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}{:lang('accept')}{/if} diff --git a/view/taoler/index/article/edit.html b/view/taoler/index/article/edit.html index 457cf1c..5f766d8 100644 --- a/view/taoler/index/article/edit.html +++ b/view/taoler/index/article/edit.html @@ -38,33 +38,32 @@
{/if}
- +
@@ -145,6 +144,8 @@ {/block} \ No newline at end of file diff --git a/view/taoler/index/article/news/detail.html b/view/taoler/index/article/news/detail.html index d003373..1c321d6 100644 --- a/view/taoler/index/article/news/detail.html +++ b/view/taoler/index/article/news/detail.html @@ -41,6 +41,13 @@
{/if} + {//解密文件} + {empty name="passJieMi"} + {if($article.read_type == 1)} +
阅读请解密
+ {/if} + {/empty} + {notempty name="tags"}
标签 {volist name="tags" id="vo" } @@ -98,11 +105,22 @@ // 编辑器插件启用状态 if(taonystatus == 0) { - $('.detail-body').each(function(){ - var othis = $(this), html = othis.html(); - othis.html(fly.content(html)); - }); - } + $('.detail-body').each(function(){ + var othis = $(this), html = othis.html(); + othis.html(fly.content(html)); + }); + } else { + $("#comment-edit").on('click',function (){ + var id = $(this).data('id'); + layer.open({ + type: 2, + title: '修改', + shade: 0.1, + area: ['600px', '500px'], + content: "{:url('comment/edit')}" + '?id=' + id + }); + }); + } //tpl模板给发布时间赋值 $('div.detail-hits').children('span.post-time').each(function(){ @@ -206,6 +224,29 @@ } }); }); + + $("#jiemi").click(function (){ + //判断登陆 + if(uid == -1){ + layer.msg('请先登录再查看', {icon: 6}, function(){location.href = login}) + return false; + } + var id = "{$article.id}"; + layer.prompt(function(value, index, elem){ + // alert(value); //得到value + $.post("{:url('article/jiemi')}",{id:id, art_pass:value},function (res){ + if(res.code === 0){ + layer.msg(res.msg,{icon:6,time:2000},function () { + parent.location.reload(); //刷新父页面,注意一定要在关闭当前iframe层之前执行刷新 + }); + } else { + layer.msg(res.msg,{icon:5,adim:6}); + } + }); + layer.close(index); + }); + }); + }); diff --git a/view/taoler/index/article/posts/detail.html b/view/taoler/index/article/posts/detail.html index 813810d..4dd06de 100644 --- a/view/taoler/index/article/posts/detail.html +++ b/view/taoler/index/article/posts/detail.html @@ -63,6 +63,13 @@
{/if} + {//解密文件} + {empty name="passJieMi"} + {if($article.read_type == 1)} +
阅读请解密
+ {/if} + {/empty} + {notempty name="tags"}
标签 {volist name="tags" id="vo" } @@ -110,10 +117,10 @@ {$vo.zan} {:lang('reply')} - {//评论编辑删除采纳权限} + {//评论编辑删除采纳权限}
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')} - {:lang('edit')} + {:lang('edit')} {:lang('delete')} {/if} {if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /} @@ -233,13 +240,23 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){ var id = "{$article.id}"; //如果你是采用模版自带的编辑器,你需要开启以下语句来解析。 - var taonystatus = "{:hook('taonystatus')}"; // 编辑器插件启用状态 if(taonystatus == 0) { $('.detail-body').each(function(){ var othis = $(this), html = othis.html(); othis.html(fly.content(html)); }); + } else { + $("#comment-edit").on('click',function (){ + var id = $(this).data('id'); + layer.open({ + type: 2, + title: '修改', + shade: 0.1, + area: ['600px', '500px'], + content: "{:url('comment/edit')}" + '?id=' + id + }); + }); } //tpl模板给发布时间赋值 @@ -357,6 +374,29 @@ layui.use(['fly', 'face','colorpicker', 'laypage'], function(){ } }); }); + + $("#jiemi").click(function (){ + //判断登陆 + if(uid == -1){ + layer.msg('请先登录再查看', {icon: 6}, function(){location.href = login}) + return false; + } + var id = "{$article.id}"; + layer.prompt(function(value, index, elem){ + // alert(value); //得到value + $.post("{:url('article/jiemi')}",{id:id, art_pass:value},function (res){ + if(res.code === 0){ + layer.msg(res.msg,{icon:6,time:2000},function () { + parent.location.reload(); //刷新父页面,注意一定要在关闭当前iframe层之前执行刷新 + }); + } else { + layer.msg(res.msg,{icon:5,adim:6}); + } + }); + layer.close(index); + }); + }); + }); diff --git a/view/taoler/index/comment/edit.html b/view/taoler/index/comment/edit.html new file mode 100644 index 0000000..ffe9aac --- /dev/null +++ b/view/taoler/index/comment/edit.html @@ -0,0 +1,69 @@ + + + + + 编辑评论 + + + +
+ +
+
+ + + +
+
+
+ + + + {:hook('taonyeditor')} + + + + diff --git a/view/taoler/index/index/index.html b/view/taoler/index/index/index.html index 87825d9..25a7738 100644 --- a/view/taoler/index/index/index.html +++ b/view/taoler/index/index/index.html @@ -48,6 +48,7 @@ {//右栏}
{:hook('live')} + {:hook('ranking')} {:hook('kankan')} {:hook('signhook', ['id'=>1])} diff --git a/view/taoler/index/public/column.html b/view/taoler/index/public/column.html index 8230818..088afd9 100644 --- a/view/taoler/index/public/column.html +++ b/view/taoler/index/public/column.html @@ -6,7 +6,7 @@ {volist name="subcatelist" id="vo"}
  • - {:cookie('think_lang') == 'en-us' ? $vo.ename : $vo.catename}{if($vo.is_hot eq 1)}{/if} + {:cookie('think_lang') == 'en-us' ? $vo.ename : $vo.catename}
  • {/volist}