This commit is contained in:
taoser 2023-05-05 12:03:45 +08:00
parent 599adb73d2
commit a825153e2e
30 changed files with 892 additions and 295 deletions

View File

@ -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'=>'删除失败']);
}
/**

View File

@ -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);

View File

@ -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);

View File

@ -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),

View File

@ -5,58 +5,57 @@
<title>用户管理</title>
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
</head>
<body class="pear-container">
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form" action="">
<div class="layui-form-item">
<div class="layui-form-item layui-inline">
<label class="layui-form-label">帖子ID</label>
<div class="layui-input-block">
<input type="text" name="id" placeholder="请输入" autocomplete="off" class="layui-input">
<body class="pear-container">
<div class="layui-card">
<div class="layui-card-body">
<form class="layui-form" action="">
<div class="layui-form-item">
<div class="layui-form-item layui-inline">
<label class="layui-form-label">帖子ID</label>
<div class="layui-input-block">
<input type="text" name="id" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">发帖人</label>
<div class="layui-input-block">
<input type="text" name="name" placeholder="请输入" autocomplete="off" class="layui-input">
<div class="layui-form-item layui-inline">
<label class="layui-form-label">发帖人</label>
<div class="layui-input-block">
<input type="text" name="name" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">标题</label>
<div class="layui-input-block">
<input type="text" name="title" placeholder="请输入" autocomplete="off" class="layui-input">
<div class="layui-form-item layui-inline">
<label class="layui-form-label">标题</label>
<div class="layui-input-block">
<input type="text" name="title" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">状态</label>
<div class="layui-input-block">
<select name="sec">
<option value="">选择状态</option>
<option value="1">正常</option>
<option value="5">禁止</option>
<option value="6">待审</option>
<option value="2">置顶</option>
<option value="3">加精</option>
<option value="4">禁评</option>
</select>
<div class="layui-form-item layui-inline">
<label class="layui-form-label">状态</label>
<div class="layui-input-block">
<select name="sec">
<option value="">选择状态</option>
<option value="1">正常</option>
<option value="5">禁止</option>
<option value="6">待审</option>
<option value="2">置顶</option>
<option value="3">加精</option>
<option value="4">禁评</option>
</select>
</div>
</div>
</div>
<div class="layui-form-item layui-inline">
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="forum-query">
<i class="layui-icon layui-icon-search"></i>
查询
</button>
<button type="reset" class="pear-btn pear-btn-md">
<i class="layui-icon layui-icon-refresh"></i>
重置
</button>
</div>
<div class="layui-form-item layui-inline">
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="forum-query">
<i class="layui-icon layui-icon-search"></i>
查询
</button>
<button type="reset" class="pear-btn pear-btn-md">
<i class="layui-icon layui-icon-refresh"></i>
重置
</button>
</div>
</div>
</form>
</div>
</form>
</div>
</div>
</div>
<div class="layui-card">
<div class="layui-card-body">
<table id="forum-table" lay-filter="forum-table" ></table>
@ -74,7 +73,6 @@
</button>
</script>
<script type="text/html" id="avatarTpl">
<div><img style="width: 25px; height: 25px;" src= "{{ d.avatar }}"></div>
</script>
@ -96,9 +94,6 @@
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
</script>
</div>
</div>
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>

View File

@ -0,0 +1,91 @@
{extend name="public/admin_form" /}
{block name="body"}
<form class="layui-form" action="">
<div class="mainBox">
<div class="main-container">
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-inline">
<input type="text" name="name" lay-verify="required" placeholder="tag名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">别名</label>
<div class="layui-input-inline">
<input type="text" name="ename" lay-verify="required" placeholder="英文或者拼音别名" autocomplete="off" class="layui-input" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">关键词</label>
<div class="layui-input-inline">
<input type="text" name="keywords" lay-verify="required" placeholder="关键词 多个以逗号,隔开" autocomplete="off" class="layui-input" >
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">摘要</label>
<div class="layui-input-block">
<textarea type="text" name="description" lay-verify="required" placeholder="请输入内容" autocomplete="off" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">seo标题</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="tag标题" autocomplete="off" class="layui-input" >
</div>
</div>
</div>
</div>
<div class="bottom">
<div class="button-container">
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="tag-save">
<i class="layui-icon layui-icon-ok"></i>
提交
</button>
<button type="reset" class="pear-btn pear-btn-sm">
<i class="layui-icon layui-icon-refresh"></i>
重置
</button>
</div>
</div>
</form>
{/block}
{block name="js"}
<script>
layui.use(['form', 'jquery', 'upload'], function() {
let form = layui.form;
let $ = layui.jquery;
let ADD_URL = "{:url('content.tag/add')}";
form.on('submit(tag-save)', function(data) {
$.ajax({
url: ADD_URL,
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function(result) {
if (result.code === 0) {
layer.msg(result.msg, {
icon: 1,
time: 1000
}, function() {
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
parent.layui.table.reload("tag-table");
});
} else {
layer.msg(result.msg, {
icon: 2,
time: 1000
});
}
}
})
return false;
});
})
</script>
{/block}

View File

@ -0,0 +1,90 @@
{extend name="public/admin_form" /}
{block name="body"}
<form class="layui-form" action="">
<div class="mainBox">
<div class="main-container">
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-inline">
<input type="text" name="name" lay-verify="required" placeholder="tag名" class="layui-input" value="{$tag.name}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">别名</label>
<div class="layui-input-inline">
<input type="text" name="ename" lay-verify="required" placeholder="英文或者拼音别名" class="layui-input" value="{$tag.ename}" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">关键词</label>
<div class="layui-input-inline">
<input type="text" name="keywords" lay-verify="required" placeholder="关键词 多个以逗号,隔开" autocomplete="off" class="layui-input" value="{$tag.keywords}">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">摘要</label>
<div class="layui-input-block">
<textarea type="text" name="description" lay-verify="required" placeholder="请输入内容" autocomplete="off" class="layui-textarea">{$tag.description}</textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">seo标题</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="tag标题" autocomplete="off" class="layui-input" value="{$tag.title}">
</div>
</div>
</div>
</div>
<div class="bottom">
<div class="button-container">
<input type="text" name="id" lay-verify="required" class="layui-input layui-hide" value="{$tag.id}">
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="tag-save">
<i class="layui-icon layui-icon-ok"></i>
提交
</button>
<button type="reset" class="pear-btn pear-btn-sm">
<i class="layui-icon layui-icon-refresh"></i>
重置
</button>
</div>
</div>
</form>
{/block}
{block name="js"}
<script>
layui.use(['form', 'jquery'], function() {
let form = layui.form;
let $ = layui.jquery;
form.on('submit(tag-save)', function(data) {
$.ajax({
url: "{:url('content.tag/edit')}",
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function(result) {
if (result.code === 0) {
layer.msg(result.msg, {
icon: 1,
time: 1000
}, function() {
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
parent.layui.table.reload("tag-table");
});
} else {
layer.msg(result.msg, {
icon: 2,
time: 1000
});
}
}
})
return false;
});
})
</script>
{/block}

View File

@ -0,0 +1,191 @@
{extend name="public/admin_base" /}
{block name="body"}
<div class="layui-card">
<div class="layui-card-body">
<table id="tag-table" lay-filter="tag-table" ></table>
</div>
</div>
<script type="text/html" id="tag-toolbar">
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
<i class="layui-icon layui-icon-add-1"></i>
新增
</button>
<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove">
<i class="layui-icon layui-icon-delete"></i>
删除
</button>
</script>
<script type="text/html" id="tag-table-bar">
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></button>
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
</script>
{/block}
{block name="js"}
<script>
layui.use(['toast', 'common'], function(){
var $ = layui.jquery
,layer = layui.layer
,table = layui.table
,form = layui.form;
let toast = layui.toast;
let common = layui.common;
//第一个实例
table.render({
elem: '#tag-table'
,url: "{:url('content.tag/list')}" //数据接口
,page: true //开启分页
,cols: [[ //表头
{type: 'numbers', fixed: 'left'}
,{field: 'name', title: '名称', width:100}
,{field: 'ename', title: '别名', width:100}
,{field: 'keywords', title: '关键词', width:150}
,{field: 'description', title: '摘要', minWidth:300}
,{field: 'title', title: 'seo标题', width:200}
,{field: 'time', title: '时间', width:120}
,{title:'操作', toolbar: '#tag-table-bar', width:100}
]],
skin: 'line',
toolbar: '#tag-toolbar',
limit: 100,
text: '对不起,加载出现异常!'
});
table.on('tool(tag-table)', function(obj) {
if (obj.event === 'remove') {
window.remove(obj);
} else if (obj.event === 'edit') {
window.edit(obj);
}
});
table.on('toolbar(tag-table)', function(obj) {
if (obj.event === 'add') {
window.add();
} else if (obj.event === 'refresh') {
window.refresh();
} else if (obj.event === 'batchRemove') {
window.batchRemove(obj);
}
});
form.on('submit(Tag-link-search)', function(data){
$.post("{:url('Tag/list')}", {"tag":data.value}, function (data){
if (data.code == -1){
layer.open({content:data.msg,icon:5,anim:6});
}
}
);
//执行重载
table.reload('tag-link', {
where: {tag: data.value}
,page: {
curr: 1 //重新从第 1 页开始
}
});
});
window.add = function() {
layer.open({
type: 2,
title: '新增',
shade: 0.1,
area: [common.isModile()?'100%':'450px', common.isModile()?'100%':'500px'],
content: 'add.html'
});
}
window.edit = function(obj) {
layer.open({
type: 2,
title: '修改',
shade: 0.1,
area: [common.isModile()?'100%':'450px', common.isModile()?'100%':'500px'],
content: 'edit.html?id=' + obj.data.id
});
}
window.remove = function(obj) {
layer.confirm('确定要删除该用户', {
icon: 3,
title: '提示'
}, function(index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: "{:url('content.tag/delete')}?id=" + obj.data['id'],
dataType: 'json',
type: 'delete',
success: function(result) {
layer.close(loading);
if (result.code === 0) {
layer.msg(result.msg, {
icon: 1,
time: 1000
}, function() {
obj.del();
});
} else {
layer.msg(result.msg, {
icon: 2,
time: 1000
});
}
}
})
});
}
window.batchRemove = function(obj) {
var checkIds = common.checkField(obj,'id');
if (checkIds === "") {
layer.msg("未选中数据", {
icon: 3,
time: 1000
});
return false;
}
layer.confirm('确定要删除这些用户', {
icon: 3,
title: '提示'
}, function(index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: "{:url('content.tag/delete')}",
dataType: 'json',
type: 'delete',
data:{"id":checkIds},
success: function(result) {
layer.close(loading);
if (result.success) {
layer.msg(result.msg, {
icon: 1,
time: 1000
}, function() {
table.reload('tag-table');
});
} else {
layer.msg(result.msg, {
icon: 2,
time: 1000
});
}
}
})
});
}
window.refresh = function(param) {
table.reload('tag-table');
}
});
</script>
{/block}

View File

@ -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 {

View File

@ -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'))
{

View File

@ -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);
}

View File

@ -69,7 +69,6 @@ class BaseController extends BaseCtrl
// 显示导航nav
protected function showNav()
{
$appname = app('http')->getName();
//1.查询分类表获取所有分类
$cate = new Cate();
$cateList = $cate->menu();

View File

@ -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){

View File

@ -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();

View File

@ -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;
}
}

View File

@ -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' => '解密失败']);
}
}

View File

@ -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()

View File

@ -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');

View File

@ -16,7 +16,7 @@ return [
// 应用名,此项不可更改
'appname' => 'TaoLer',
// 版本配置
'version' => '2.2.9',
'version' => '2.2.10',
// 加盐
'salt' => 'taoler',
// 数据库备份目录

View File

@ -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){

View File

@ -39,33 +39,33 @@
</div>
{/if}
</div>
<!-- <div class="layui-row layui-col-space15 layui-form-item layui-hide" id="LAY_quiz">
<div class="layui-row layui-col-space15 layui-form-item" id="LAY_quiz">
<div class="layui-col-md3">
<label class="layui-form-label">所属产品</label>
<label class="layui-form-label">阅读权限</label>
<div class="layui-input-block">
<select name="project">
<option></option>
<option value="layui">layui</option>
<option value="独立版layer">独立版layer</option>
<option value="独立版layDate">独立版layDate</option>
<option value="LayIM">LayIM</option>
<option value="Fly社区模板">Fly社区模板</option>
<select name="read_type">
<option value="0">开放阅读</option>
<option value="1">密码加密</option>
<option value="2">回帖阅读</option>
<option value="3">购买阅读</option>
</select>
</div>
</div>
<div class="layui-col-md3">
<label class="layui-form-label" for="L_version">版本号</label>
<label class="layui-form-label" for="L_version">密码</label>
<div class="layui-input-block">
<input type="text" id="L_version" value="" name="version" autocomplete="off" class="layui-input" />
<input type="text" id="L_version" value="" name="art_pass" autocomplete="off" class="layui-input" />
</div>
</div>
<div class="layui-col-md6">
<div class="layui-col-md6 layui-hide">
<label class="layui-form-label" for="L_browser">浏览器</label>
<div class="layui-input-block">
<input type="text" id="L_browser" value="" name="browser" placeholder="浏览器名称及版本IE 11" autocomplete="off" class="layui-input" />
</div>
</div>
</div> -->
</div>
<div class="layui-form-item layui-form-text">
<div class="layui-input-block">
<textarea id="L_content" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea fly-editor"></textarea>
@ -150,6 +150,7 @@
<script src="/static/xm-select.js"></script>
<script>
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
layui.use(["fly"], function () {
var $ = layui.jquery,
fly = layui.fly,
@ -162,9 +163,7 @@
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
// 编辑器插件启用状态
if(taonystatus == 0) {
$('.layui-textarea').each(function(){
var othis = $(this), html = othis.html();
@ -173,11 +172,8 @@
}
// 分类选择
$(function(){
//这里模拟ajax
$.get("{:url('article/getCateTree')}",function(res){
var cid = "{$cid}";
var data = res.data;
// 渲染下拉树
xmSelect.render({
el: '#CateId',
@ -185,7 +181,7 @@
height: '250px',
layVerify: 'required',
layVerType: 'tips',
data: data,
data: res.data,
initValue: [cid],
model: {label: {type: 'text'}},
prop: {
@ -202,9 +198,7 @@
},
tips: '请选择'
});
});
});
// tag标签
$(function(){
@ -220,7 +214,7 @@
});
//2.动态标签赋值
$.get("{:url('get_all_tag')}",function(res){
if(res.code == 0){
if(res.code === 0){
addTags.update({
data: res.data,
autoRow: true,
@ -256,7 +250,7 @@
{
// console.log(flag,title,content)
$.post("{:url('article/keywords')}",{ keywords: title, content:content, flag: flag }, function (res) {
if (res.code == 0) {
if (res.code === 0) {
$("input[name='keywords']").val(res.data.join(','));
}
},
@ -273,7 +267,7 @@
if(title.length > 0 ) {
$.post("{:url('article/getWordList')}",{title:title},function(res){
// 动态生成ur>li内容
if (res.code == 0) {
if (res.code === 0) {
// 显示动态框
$(".bdsug").removeClass('layui-hide');
for (var i = 0; i < res.data.length; i++) {
@ -321,8 +315,7 @@
data: field,
dataType: "json",
success: function (data) {
if (data.code == 0) {
if (data.code === 0) {
notify.success(data.msg, function () {
location.href = data.url;
});

View File

@ -53,6 +53,13 @@
</div>
{/if}
{//解密文件}
{empty name="passJieMi"}
{if($article.read_type == 1)}
<div id="jiemi"><i class="layui-icon layui-icon-password" style="font-size: 30px; color: #1E9FFF;"></i> 阅读请解密 </div>
{/if}
{/empty}
{notempty name="tags"}
<div style="margin-top: 15px">标签
{volist name="tags" id="vo" }
@ -94,7 +101,7 @@
{//评论 编辑/删除/采纳/权限}
<div class="jieda-admin">
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
<span type="edit">{:lang('edit')}</span>
<span type="edit" id="comment-edit" data-id="{$vo.id}">{:lang('edit')}</span>
<span type="del">{:lang('delete')}</span>
{/if} {if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) && ($article.jie == 0)/}
<span class="jieda-accept" type="accept">{:lang('accept')}</span>
@ -193,6 +200,7 @@
{:hook('taoplayer')}
<script>
var collectionFind = "{:url('Collection/find')}",
collection = "{:url('collection/')}",
articleJieset = "{:url('Article/jieset')}",
@ -216,41 +224,43 @@
laypage = layui.laypage;
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
// 编辑器插件禁用状态,用原方式解析网页
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模板给发布时间赋值
$("div.user-questions").children("span.user-post-time").each(function () {
var othis = $(this),
html = othis.html();
var othis = $(this);
var string = laytpl("{{ d.time }}").render({
//time: html
time: othis.attr("data"),
});
var posttime = layui.util.timeAgo(string, 1);
othis.text(posttime);
//console.log(othis.attr('data'));
});
//tpl模板给发布时间赋值
$("div.detail-hits").children("span.post-time").each(function () {
var othis = $(this),
html = othis.html();
var othis = $(this);
var string = laytpl("{{ d.time }}").render({
//time: html
time: othis.attr("data"),
});
var posttime = layui.util.timeAgo(string, 1);
othis.text(posttime);
//console.log(othis.attr('data'));
});
//预定义颜色项
@ -340,6 +350,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);
});
});
});
</script>

View File

@ -61,6 +61,13 @@
</div>
{/if}
{//解密文件}
{empty name="passJieMi"}
{if($article.read_type == 1)}
<div id="jiemi"><i class="layui-icon layui-icon-password" style="font-size: 30px; color: #1E9FFF;"></i> 阅读请解密 </div>
{/if}
{/empty}
{notempty name="tags"}
<div style="margin-top: 15px">标签
{volist name="tags" id="vo" }
@ -142,7 +149,7 @@
{//评论 编辑/删除/采纳/权限}
<div class="jieda-admin">
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
<span type="edit" id="comment-edit">{:lang('edit')}</span>
<span type="edit" id="comment-edit" data-id="{$vo.id}">{:lang('edit')}</span>
<span type="del">{:lang('delete')}</span>
{/if} {if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) && ($article.jie == 0)/}
<span class="jieda-accept" type="accept">{:lang('accept')}</span>
@ -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);
});
});
});
</script>

View File

@ -110,7 +110,7 @@
{//评论编辑删除采纳权限}
<div class="jieda-admin">
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
<span type="edit">{:lang('edit')}</span>
<span type="edit" id="comment-edit" data-id="{$vo.id}">{:lang('edit')}</span>
<span type="del">{:lang('delete')}</span>
{/if}
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}<span class="jieda-accept" type="accept">{:lang('accept')}</span>{/if}

View File

@ -38,33 +38,32 @@
</div>
{/if}
</div>
<!--div class="layui-row layui-col-space15 layui-form-item layui-hide" id="LAY_quiz">
<div class="layui-row layui-col-space15 layui-form-item" id="LAY_quiz">
<div class="layui-col-md3">
<label class="layui-form-label">所属产品</label>
<label class="layui-form-label">阅读权限</label>
<div class="layui-input-block">
<select name="project">
<option></option>
<option value="layui">layui</option>
<option value="独立版layer">独立版layer</option>
<option value="独立版layDate">独立版layDate</option>
<option value="LayIM">LayIM</option>
<option value="Fly社区模板">Fly社区模板</option>
<select name="read_type">
<option value="0" {if($article.read_type == 0)} selected {/if}>开放阅读</option>
<option value="1" {if($article.read_type == 1)} selected {/if}>密码加密</option>
<option value="2" {if($article.read_type == 2)} selected {/if}>回帖阅读</option>
<option value="3" {if($article.read_type == 3)} selected {/if}>购买阅读</option>
</select>
</div>
</div>
<div class="layui-col-md3">
<label class="layui-form-label" for="L_version">版本号</label>
<label class="layui-form-label" >密码</label>
<div class="layui-input-block">
<input type="text" id="L_version" value="" name="version" autocomplete="off" class="layui-input">
<input type="text" value="{$article.art_pass ?? ''}" name="art_pass" autocomplete="off" class="layui-input" />
</div>
</div>
<div class="layui-col-md6">
<div class="layui-col-md6 layui-hide">
<label class="layui-form-label" for="L_browser">浏览器</label>
<div class="layui-input-block">
<input type="text" id="L_browser" value="" name="browser" placeholder="浏览器名称及版本IE 11" autocomplete="off" class="layui-input">
<input type="text" id="L_browser" value="" name="browser" placeholder="浏览器名称及版本IE 11" autocomplete="off" class="layui-input" />
</div>
</div>
</div-->
</div>
<div class="layui-form-item layui-form-text">
<div class="layui-input-block">
@ -145,6 +144,8 @@
<script src="/static/xm-select.js"></script>
<script>
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
layui.use(['fly'], function(){
var $ = layui.jquery
,fly = layui.fly
@ -160,22 +161,16 @@
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
var taonystatus = "{:hook('taonystatus')}";
// 编辑器插件启用状态
var isShow = taonystatus ? false : true;
if(isShow) {
if(taonystatus == 0) {
$('.layui-textarea').each(function(){
var othis = $(this), html = othis.html();
othis.attr(fly.content(html));
})
}
// 分类选择
$(function(){
//这里模拟ajax
// 分类选择
$.get("{:url('article/getCateTree')}",function(res){
var data = res.data;
// 渲染下拉树
xmSelect.render({
el: '#CateId',
@ -183,7 +178,7 @@ $(function(){
height: '250px',
layVerify: 'required',
layVerType: 'tips',
data: data,
data: res.data,
initValue: [cateId],
model: {label: {type: 'text'}},
prop: {
@ -200,9 +195,7 @@ $(function(){
},
tips: '请选择'
});
});
});
// tag标签
$(function(){
@ -218,7 +211,7 @@ $(function(){
});
//2.动态赋值
$.get("{:url('get_art_tag')}",{id:artId},function(res){
if(res.code == 0){
if(res.code === 0){
addTags.setValue(
res.data
)
@ -226,7 +219,7 @@ $(function(){
});
//3.动态标签赋值
$.get("{:url('get_all_tag')}",function(res){
if(res.code == 0){
if(res.code === 0){
addTags.update({
data: res.data,
autoRow: true,
@ -236,37 +229,37 @@ $(function(){
})
// 通过标题内容自动获取tag的内容
// 通过标题内容自动获取tag的内容
var conf = "{:empty(config('taoler.baidu.client_id'))}";
if(conf !== '1'){
$("#L_title").on('blur', function(){
var title = $(this).val();
var content = $("#L_content").val();
getBdiduWords(flag,title,content);
})
}
if(conf !== '1'){
$("#L_title").on('blur', function(){
var title = $(this).val();
var content = $("#L_content").val();
getBdiduWords(flag,title,content);
})
}
// 从详情页自动调用端口过滤,获取描述信息
$("#L_content").bind('input propertychange', function(){
var content = $(this).val()
var title = $("#L_title").val();
$.post("{:url('article/getDescription')}", { content: content }, function(data){
if (data.code == 0) {
$('[name="description"]').val(data.data);
}
});
getBdiduWords(flag,title,content);
})
// 获取百度分词接口的关键词
function getBdiduWords(flag,title,content) {
$.post("{:url('article/keywords')}",{ keywords: title, content:content, flag: flag }, function (res) {
if (res.code == 0) {
$("input[name='keywords']").val(res.data.join(','));
// 从详情页自动调用端口过滤,获取描述信息
$("#L_content").bind('input propertychange', function(){
var content = $(this).val()
var title = $("#L_title").val();
$.post("{:url('article/getDescription')}", { content: content }, function(data){
if (data.code == 0) {
$('[name="description"]').val(data.data);
}
},
)
}
});
getBdiduWords(flag,title,content);
})
// 获取百度分词接口的关键词
function getBdiduWords(flag,title,content) {
$.post("{:url('article/keywords')}",{ keywords: title, content:content, flag: flag }, function (res) {
if (res.code == 0) {
$("input[name='keywords']").val(res.data.join(','));
}
},
)
}
// 百度词条
(function(){
@ -351,22 +344,22 @@ $(function(){
}
});
//指定允许上传的文件类型
upload.render({
elem: '#zip-button'
,url: "{:url('article/uploads')}" //改成您自己的上传接口
,data: {type:'zip'}
,accept: 'file' //普通文件
,done: function(res){
if(res.status == 0){
$('input[name="upzip"]').val(res.url);
notify.success(res.msg);
} else {
notify.error(res.msg);
//指定允许上传的文件类型
upload.render({
elem: '#zip-button'
,url: "{:url('article/uploads')}" //改成您自己的上传接口
,data: {type:'zip'}
,accept: 'file' //普通文件
,done: function(res){
if(res.status == 0){
$('input[name="upzip"]').val(res.url);
notify.success(res.msg);
} else {
notify.error(res.msg);
}
}
}
});
});
});
});
</script>
{/block}

View File

@ -41,6 +41,13 @@
</div>
{/if}
{//解密文件}
{empty name="passJieMi"}
{if($article.read_type == 1)}
<div id="jiemi"><i class="layui-icon layui-icon-password" style="font-size: 30px; color: #1E9FFF;"></i> 阅读请解密 </div>
{/if}
{/empty}
{notempty name="tags"}
<div style="margin-top: 15px">标签
{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);
});
});
});
</script>

View File

@ -63,6 +63,13 @@
</div>
{/if}
{//解密文件}
{empty name="passJieMi"}
{if($article.read_type == 1)}
<div id="jiemi"><i class="layui-icon layui-icon-password" style="font-size: 30px; color: #1E9FFF;"></i> 阅读请解密 </div>
{/if}
{/empty}
{notempty name="tags"}
<div style="margin-top: 15px">标签
{volist name="tags" id="vo" }
@ -110,10 +117,10 @@
<i class="iconfont icon-zan"></i><em>{$vo.zan}</em>
</span>
<span type="reply"><i class="iconfont icon-svgmoban53"></i>{:lang('reply')}</span>
{//评论编辑删除采纳权限}
{//评论编辑删除采纳权限}
<div class="jieda-admin">
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
<span type="edit">{:lang('edit')}</span>
<span type="edit" id="comment-edit" data-id="{$vo.id}">{:lang('edit')}</span>
<span type="del">{:lang('delete')}</span>
{/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);
});
});
});
</script>

View File

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>编辑评论</title>
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
</head>
<body>
<form class="layui-form" action="">
<textarea id="L_content" name="content" required lay-verify="required" placeholder="{:lang('please input the content')}" class="layui-textarea fly-editor">{$comment.content}</textarea>
<div class="bottom">
<div class="button-container">
<input type="text" name="id" value="{$comment.id}" class="layui-input layui-hide"/>
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="comment-save">
<i class="layui-icon layui-icon-ok"></i>
提交
</button>
<button type="reset" class="pear-btn pear-btn-sm">
<i class="layui-icon layui-icon-refresh"></i>
重置
</button>
</div>
</div>
</form>
<script src="/static/jquery-3.6.0.min.js"></script>
<script src="/static/layui/layui.js"></script>
{:hook('taonyeditor')}
<script>
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
layui.config({
version: "3.0.0"
,base: "/static/res/mods/"
}).use(function () {
var $ = layui.jquery,
form = layui.form;
// 发布文章
form.on("submit(comment-save)", function (data) {
var loading = layer.load(1);
$.ajax({
type: "post",
url: "{:url('comment/edit')}",
data: data.field,
dataType: "json",
success: function (res) {
layer.close(loading);
if (res.code === 0) {
layer.msg(res.msg, {
icon: 1,
time: 1000
}, function() {
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
parent.location.reload(); //刷新父页面注意一定要在关闭当前iframe层之前执行刷新
parent.layer.close(index); //再执行关闭
});
} else {
notify.error(data.msg);
}
},
});
return false;
});
});
</script>
</body>
</html>

View File

@ -48,6 +48,7 @@
{//右栏}
<div class="layui-col-md4">
{:hook('live')}
{:hook('ranking')}
{:hook('kankan')}
{:hook('signhook', ['id'=>1])}

View File

@ -6,7 +6,7 @@
</li>
{volist name="subcatelist" id="vo"}
<li class="{if($vo.ename eq $Request.param.ename)}layui-this{/if}">
<a href="{$Request.domain}{:url('cate',['ename' => $vo.ename])}">{:cookie('think_lang') == 'en-us' ? $vo.ename : $vo.catename}{if($vo.is_hot eq 1)}<span class="layui-badge-dot"></span>{/if}</a>
<a href="{$Request.domain}{:url('cate',['ename' => $vo.ename])}">{:cookie('think_lang') == 'en-us' ? $vo.ename : $vo.catename}</a>
</li>
{/volist}
<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li>