2.2.10
This commit is contained in:
parent
599adb73d2
commit
a825153e2e
@ -74,27 +74,32 @@ class Tag extends AdminController
|
|||||||
$data = Request::only(['name','ename','id','keywords','description','title']);
|
$data = Request::only(['name','ename','id','keywords','description','title']);
|
||||||
// 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
|
// 把,转换为,并去空格->转为数组->去掉空数组->再转化为带,号的字符串
|
||||||
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace(',',',',$data['keywords'])))));
|
$data['keywords'] = implode(',',array_filter(explode(',',trim(str_replace(',',',',$data['keywords'])))));
|
||||||
|
try{
|
||||||
$res =$tagModel::update($data);
|
$tagModel::update($data);
|
||||||
if($res == true){
|
|
||||||
return json(['code'=>0,'msg'=>'设置成功']);
|
return json(['code'=>0,'msg'=>'设置成功']);
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
return json(['code'=>-1,'msg'=>$e->getMessage()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tag = $tagModel->getTag(input('id'));
|
$tag = $tagModel->getTag(input('id'));
|
||||||
|
|
||||||
View::assign('tag',$tag);
|
View::assign('tag',$tag);
|
||||||
return view();
|
return view();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
if(Request::isPost()) {
|
|
||||||
$tagModel = new TagModel;
|
$tagModel = new TagModel;
|
||||||
$res = $tagModel->delTag(input('id'));
|
$res = $tagModel->delTag(input('id'));
|
||||||
if($res == true){
|
if($res){
|
||||||
return json(['code'=>0,'msg'=>'删除成功']);
|
return json(['code'=>0,'msg'=>'删除成功']);
|
||||||
}
|
}
|
||||||
}
|
return json(['code'=>-1,'msg'=>'删除失败']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,8 +45,7 @@ class AuthRule extends AdminController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 无限极权限树
|
* 无限极权限树
|
||||||
*
|
* @return \think\response\Json
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function ruleTree()
|
public function ruleTree()
|
||||||
{
|
{
|
||||||
|
@ -102,16 +102,13 @@ class User extends AdminController
|
|||||||
$data = Request::only(['id','name','email','user_img','password','phone','sex']);
|
$data = Request::only(['id','name','email','user_img','password','phone','sex']);
|
||||||
$user = Db::name('user')->field('create_time')->find($data['id']);
|
$user = Db::name('user')->field('create_time')->find($data['id']);
|
||||||
$salt = substr(md5($user['create_time']),-6);
|
$salt = substr(md5($user['create_time']),-6);
|
||||||
// 密码
|
$data['password'] = md5(substr_replace(md5($data['password']),$salt,0,6)); // 密码
|
||||||
$data['password'] = md5(substr_replace(md5($data['password']),$salt,0,6));
|
try{
|
||||||
|
Db::name('user')->update($data);
|
||||||
$result = Db::name('user')->update($data);
|
return json(['code'=>0,'msg'=>'编辑成功']);
|
||||||
if($result){
|
} catch (\Exception $e) {
|
||||||
$res = ['code'=>0,'msg'=>'编辑成功'];
|
return json(['code'=> -1,'msg'=>$e->getMessage()]);
|
||||||
}else{
|
|
||||||
$res = ['code'=>-1,'msg'=>'编辑失败'];
|
|
||||||
}
|
}
|
||||||
return json($res);
|
|
||||||
}
|
}
|
||||||
$user = Db::name('user')->find(input('id'));
|
$user = Db::name('user')->find(input('id'));
|
||||||
View::assign('user',$user);
|
View::assign('user',$user);
|
||||||
|
@ -229,7 +229,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
form.on('submit(forum-save)', function(data) {
|
form.on('submit(forum-save)', function(data) {
|
||||||
console.log(data)
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{:url('content.forum/add')}",
|
url: "{:url('content.forum/add')}",
|
||||||
data: JSON.stringify(data.field),
|
data: JSON.stringify(data.field),
|
||||||
|
@ -56,7 +56,6 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<table id="forum-table" lay-filter="forum-table" ></table>
|
<table id="forum-table" lay-filter="forum-table" ></table>
|
||||||
@ -74,7 +73,6 @@
|
|||||||
</button>
|
</button>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/html" id="avatarTpl">
|
<script type="text/html" id="avatarTpl">
|
||||||
<div><img style="width: 25px; height: 25px;" src= "{{ d.avatar }}"></div>
|
<div><img style="width: 25px; height: 25px;" src= "{{ d.avatar }}"></div>
|
||||||
</script>
|
</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>
|
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="/static/component/layui/layui.js"></script>
|
<script src="/static/component/layui/layui.js"></script>
|
||||||
<script src="/static/component/pear/pear.js"></script>
|
<script src="/static/component/pear/pear.js"></script>
|
||||||
|
|
||||||
|
91
app/admin/view/content/tag/add.html
Normal file
91
app/admin/view/content/tag/add.html
Normal 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}
|
90
app/admin/view/content/tag/edit.html
Normal file
90
app/admin/view/content/tag/edit.html
Normal 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}
|
191
app/admin/view/content/tag/index.html
Normal file
191
app/admin/view/content/tag/index.html
Normal 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}
|
@ -90,8 +90,7 @@
|
|||||||
icon: 1,
|
icon: 1,
|
||||||
time: 1000
|
time: 1000
|
||||||
}, function() {
|
}, function() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window
|
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
|
||||||
.name)); //关闭当前页
|
|
||||||
parent.layui.table.reload("user-table");
|
parent.layui.table.reload("user-table");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -58,11 +58,6 @@ try {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据user area_id查询区域简称
|
|
||||||
function getAsing($area_id){
|
|
||||||
return Db::name('user_area')->where('id',$area_id)->cache(3600)->value('asing');
|
|
||||||
}
|
|
||||||
|
|
||||||
//根据用户主键ID,查询用户名称
|
//根据用户主键ID,查询用户名称
|
||||||
if(!function_exists('getUserName'))
|
if(!function_exists('getUserName'))
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,7 @@ class AdminController extends \app\BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取路由
|
* 把后台管理文章或帖子的路由转换为实际应用的路由
|
||||||
* @param int $aid
|
* @param int $aid
|
||||||
* @param string $appName
|
* @param string $appName
|
||||||
* @param string $ename
|
* @param string $ename
|
||||||
@ -203,6 +203,14 @@ class AdminController extends \app\BaseController
|
|||||||
return $this->getDomain() . str_replace($map_admin, $appName, $articleUrl);
|
return $this->getDomain() . str_replace($map_admin, $appName, $articleUrl);
|
||||||
}
|
}
|
||||||
//3.admin未绑定域名也未映射
|
//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);
|
return str_replace('admin', $appName, $articleUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ class BaseController extends BaseCtrl
|
|||||||
// 显示导航nav
|
// 显示导航nav
|
||||||
protected function showNav()
|
protected function showNav()
|
||||||
{
|
{
|
||||||
$appname = app('http')->getName();
|
|
||||||
//1.查询分类表获取所有分类
|
//1.查询分类表获取所有分类
|
||||||
$cate = new Cate();
|
$cate = new Cate();
|
||||||
$cateList = $cate->menu();
|
$cateList = $cate->menu();
|
||||||
|
@ -195,7 +195,7 @@ class Article extends Model
|
|||||||
{
|
{
|
||||||
return Cache::remember('article_'.$id, function() use($id){
|
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])
|
->where(['status'=>1])
|
||||||
->with([
|
->with([
|
||||||
'cate' => function($query){
|
'cate' => function($query){
|
||||||
|
@ -81,10 +81,9 @@ class Cate extends Model
|
|||||||
// 如果菜单下无内容,URl不能点击
|
// 如果菜单下无内容,URl不能点击
|
||||||
public function menu()
|
public function menu()
|
||||||
{
|
{
|
||||||
$appname = app('http')->getName();
|
|
||||||
try {
|
try {
|
||||||
return $this->where(['status' => 1, 'appname' => $appname])
|
return $this->where(['status' => 1])
|
||||||
->cache('catename' . $appname, 3600)
|
->cache('catename', 3600)
|
||||||
->append(['url'])
|
->append(['url'])
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
|
@ -42,20 +42,16 @@ class Tag extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除数据
|
* 删除数据
|
||||||
*
|
* @param $id
|
||||||
* @param [type] $id
|
* @return bool
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function delTag($id)
|
public function delTag($id)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
$res = $this::destroy($id);
|
$res = $this::destroy($id);
|
||||||
|
if($res) {
|
||||||
if($res == true) {
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -3,10 +3,12 @@
|
|||||||
namespace app\index\controller;
|
namespace app\index\controller;
|
||||||
|
|
||||||
use app\common\controller\BaseController;
|
use app\common\controller\BaseController;
|
||||||
|
use think\App;
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
use think\facade\Request;
|
use think\facade\Request;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
|
use think\facade\Session;
|
||||||
use think\facade\Config;
|
use think\facade\Config;
|
||||||
use app\common\model\Cate;
|
use app\common\model\Cate;
|
||||||
use app\common\model\Comment;
|
use app\common\model\Comment;
|
||||||
@ -23,6 +25,14 @@ class Article extends BaseController
|
|||||||
'logincheck' => ['except' => ['cate','detail','download'] ],
|
'logincheck' => ['except' => ['cate','detail','download'] ],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $model;
|
||||||
|
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
parent::__construct($app);
|
||||||
|
$this->model = new ArticleModel();
|
||||||
|
}
|
||||||
|
|
||||||
//文章分类
|
//文章分类
|
||||||
public function cate()
|
public function cate()
|
||||||
{
|
{
|
||||||
@ -75,13 +85,19 @@ class Article extends BaseController
|
|||||||
$page = input('page',1);
|
$page = input('page',1);
|
||||||
//输出内容
|
//输出内容
|
||||||
$article = new ArticleModel();
|
$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)){
|
if(is_null($artDetail)){
|
||||||
// 抛出 HTTP 异常
|
// 抛出 HTTP 异常
|
||||||
throw new \think\exception\HttpException(404, '无内容');
|
throw new \think\exception\HttpException(404, '无内容');
|
||||||
}
|
}
|
||||||
//用户个人tag标签
|
//用户个人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);
|
$tagStr = implode(",",$userTags);
|
||||||
//转换为数组并去重
|
//转换为数组并去重
|
||||||
@ -137,7 +153,6 @@ class Article extends BaseController
|
|||||||
|
|
||||||
//评论
|
//评论
|
||||||
$comments = $this->getComments($id, $page);
|
$comments = $this->getComments($id, $page);
|
||||||
//halt($comments);
|
|
||||||
//最新评论时间
|
//最新评论时间
|
||||||
$lrDate_time = Db::name('comment')->where('article_id', $id)->max('update_time',false) ?? time();
|
$lrDate_time = Db::name('comment')->where('article_id', $id)->max('update_time',false) ?? time();
|
||||||
// 热议文章
|
// 热议文章
|
||||||
@ -169,6 +184,7 @@ class Article extends BaseController
|
|||||||
'userZanList' => $userZanList,
|
'userZanList' => $userZanList,
|
||||||
'userTagCount'=> $userTagCount,
|
'userTagCount'=> $userTagCount,
|
||||||
'jspage' => 'jie',
|
'jspage' => 'jie',
|
||||||
|
'passJieMi' => session('art_pass_'.$id),
|
||||||
$download,
|
$download,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -242,7 +258,7 @@ class Article extends BaseController
|
|||||||
// 检验发帖是否开放
|
// 检验发帖是否开放
|
||||||
if(config('taoler.config.is_post') == 0 ) return json(['code'=>-1,'msg'=>'抱歉,系统维护中,暂时禁止发帖!']);
|
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;
|
$data['user_id'] = $this->uid;
|
||||||
$tagId = input('tagid');
|
$tagId = input('tagid');
|
||||||
|
|
||||||
@ -339,7 +355,7 @@ class Article extends BaseController
|
|||||||
$article = ArticleModel::find($id);
|
$article = ArticleModel::find($id);
|
||||||
|
|
||||||
if(Request::isAjax()){
|
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;
|
$data['user_id'] = $this->uid;
|
||||||
$tagId = input('tagid');
|
$tagId = input('tagid');
|
||||||
|
|
||||||
@ -393,6 +409,8 @@ class Article extends BaseController
|
|||||||
|
|
||||||
//删除原有缓存显示编辑后内容
|
//删除原有缓存显示编辑后内容
|
||||||
Cache::delete('article_'.$id);
|
Cache::delete('article_'.$id);
|
||||||
|
Session::delete('art_pass_'.$id);
|
||||||
|
|
||||||
$link = $this->getRouteUrl((int) $id, $article->cate->ename);
|
$link = $this->getRouteUrl((int) $id, $article->cate->ename);
|
||||||
|
|
||||||
hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口
|
hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口
|
||||||
@ -618,49 +636,32 @@ class Article extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分类树
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
public function getCateTree()
|
public function getCateTree()
|
||||||
{
|
{
|
||||||
//
|
$data = $this->showNav();
|
||||||
$cate = Db::name('cate')->order(['id' => 'ASC','sort' => 'ASC'])->where(['delete_time'=>0])->select()->toArray();
|
$count = count($data);
|
||||||
|
|
||||||
$cateTree = array2tree($cate);
|
|
||||||
|
|
||||||
$count = count($cateTree);
|
|
||||||
$tree = [];
|
$tree = [];
|
||||||
if($cateTree){
|
if($count){
|
||||||
$tree = ['code'=>0,'msg'=>'','count'=>$count];
|
$tree = ['code'=>0, 'msg'=>'ok','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;
|
$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' => '解密失败']);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,12 +2,15 @@
|
|||||||
namespace app\index\controller;
|
namespace app\index\controller;
|
||||||
|
|
||||||
use app\common\controller\BaseController;
|
use app\common\controller\BaseController;
|
||||||
|
use think\facade\View;
|
||||||
|
use think\facade\Request;
|
||||||
use think\facade\Session;
|
use think\facade\Session;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
use app\common\model\Comment as CommentModel;
|
use app\common\model\Comment as CommentModel;
|
||||||
use app\common\model\Article;
|
use app\common\model\Article;
|
||||||
use app\common\model\UserZan;
|
use app\common\model\UserZan;
|
||||||
|
|
||||||
|
|
||||||
class Comment extends BaseController
|
class Comment extends BaseController
|
||||||
{
|
{
|
||||||
//采纳评论
|
//采纳评论
|
||||||
@ -77,6 +80,24 @@ class Comment extends BaseController
|
|||||||
return json($res);
|
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()
|
public function jiedaZan()
|
||||||
{
|
{
|
||||||
|
@ -50,6 +50,9 @@ Route::group(function () {
|
|||||||
->middleware(\app\middleware\CheckRegister::class);
|
->middleware(\app\middleware\CheckRegister::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// comment
|
||||||
|
Route::rule('comment/edit/[:id]','comment/edit');
|
||||||
|
|
||||||
// article
|
// article
|
||||||
Route::group('art',function () use($detail_as,$cate_as){
|
Route::group('art',function () use($detail_as,$cate_as){
|
||||||
Route::rule('add/[:cate]','Article/add')->name('add_article');
|
Route::rule('add/[:cate]','Article/add')->name('add_article');
|
||||||
|
@ -16,7 +16,7 @@ return [
|
|||||||
// 应用名,此项不可更改
|
// 应用名,此项不可更改
|
||||||
'appname' => 'TaoLer',
|
'appname' => 'TaoLer',
|
||||||
// 版本配置
|
// 版本配置
|
||||||
'version' => '2.2.9',
|
'version' => '2.2.10',
|
||||||
// 加盐
|
// 加盐
|
||||||
'salt' => 'taoler',
|
'salt' => 'taoler',
|
||||||
// 数据库备份目录
|
// 数据库备份目录
|
||||||
|
@ -205,31 +205,28 @@ layui.define('fly', function(exports){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
,edit: function(li){ //编辑评论
|
,edit: function(li){ //编辑评论
|
||||||
|
if(taonystatus == 0) {
|
||||||
|
|
||||||
fly.json(commentGetDa, {
|
fly.json(commentGetDa, {
|
||||||
id: li.data('id')
|
id: li.data('id')
|
||||||
}, function(res){
|
}, function (res) {
|
||||||
var data = res.rows;
|
var data = res.rows;
|
||||||
layer.prompt({
|
layer.prompt({
|
||||||
formType: 2
|
formType: 2
|
||||||
,value: data.content
|
, value: data.content
|
||||||
,maxlength: 100000
|
, maxlength: 100000
|
||||||
,title: '编辑回帖'
|
, title: '编辑回帖'
|
||||||
,area: ['738px', '310px']
|
, area: ['738px', '310px']
|
||||||
,success: function(layero){
|
, success: function (layero) {
|
||||||
|
|
||||||
if(taonystatus == 0) {
|
|
||||||
fly.layEditor({
|
fly.layEditor({
|
||||||
elem: layero.find('textarea')
|
elem: layero.find('textarea')
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
// 编辑器
|
|
||||||
}
|
}
|
||||||
}
|
}, function (value, index) {
|
||||||
}, function(value, index){
|
|
||||||
fly.json(commentUpdateDa, {
|
fly.json(commentUpdateDa, {
|
||||||
id: li.data('id')
|
id: li.data('id')
|
||||||
,content: value
|
, content: value
|
||||||
}, function(res){
|
}, function (res) {
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
layer.msg(res.msg);
|
layer.msg(res.msg);
|
||||||
li.find('.detail-body').html(fly.content(value));
|
li.find('.detail-body').html(fly.content(value));
|
||||||
@ -237,6 +234,8 @@ layui.define('fly', function(exports){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
,del: function(li){ //删除评论
|
,del: function(li){ //删除评论
|
||||||
layer.confirm('确认删除该回答么?', function(index){
|
layer.confirm('确认删除该回答么?', function(index){
|
||||||
layer.close(index);
|
layer.close(index);
|
||||||
|
@ -39,33 +39,33 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</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">
|
<div class="layui-col-md3">
|
||||||
<label class="layui-form-label">所属产品</label>
|
<label class="layui-form-label">阅读权限</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<select name="project">
|
<select name="read_type">
|
||||||
<option></option>
|
<option value="0">开放阅读</option>
|
||||||
<option value="layui">layui</option>
|
<option value="1">密码加密</option>
|
||||||
<option value="独立版layer">独立版layer</option>
|
<option value="2">回帖阅读</option>
|
||||||
<option value="独立版layDate">独立版layDate</option>
|
<option value="3">购买阅读</option>
|
||||||
<option value="LayIM">LayIM</option>
|
|
||||||
<option value="Fly社区模板">Fly社区模板</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-col-md3">
|
<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">
|
<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>
|
</div>
|
||||||
<div class="layui-col-md6">
|
<div class="layui-col-md6 layui-hide">
|
||||||
<label class="layui-form-label" for="L_browser">浏览器</label>
|
<label class="layui-form-label" for="L_browser">浏览器</label>
|
||||||
<div class="layui-input-block">
|
<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> -->
|
</div>
|
||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
<div class="layui-form-item layui-form-text">
|
||||||
<div class="layui-input-block">
|
<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>
|
<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 src="/static/xm-select.js"></script>
|
||||||
<script>
|
<script>
|
||||||
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||||
|
|
||||||
layui.use(["fly"], function () {
|
layui.use(["fly"], function () {
|
||||||
var $ = layui.jquery,
|
var $ = layui.jquery,
|
||||||
fly = layui.fly,
|
fly = layui.fly,
|
||||||
@ -162,9 +163,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||||
|
|
||||||
// 编辑器插件启用状态
|
// 编辑器插件启用状态
|
||||||
|
|
||||||
if(taonystatus == 0) {
|
if(taonystatus == 0) {
|
||||||
$('.layui-textarea').each(function(){
|
$('.layui-textarea').each(function(){
|
||||||
var othis = $(this), html = othis.html();
|
var othis = $(this), html = othis.html();
|
||||||
@ -173,11 +172,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 分类选择
|
// 分类选择
|
||||||
$(function(){
|
|
||||||
//这里模拟ajax
|
|
||||||
$.get("{:url('article/getCateTree')}",function(res){
|
$.get("{:url('article/getCateTree')}",function(res){
|
||||||
var cid = "{$cid}";
|
var cid = "{$cid}";
|
||||||
var data = res.data;
|
|
||||||
// 渲染下拉树
|
// 渲染下拉树
|
||||||
xmSelect.render({
|
xmSelect.render({
|
||||||
el: '#CateId',
|
el: '#CateId',
|
||||||
@ -185,7 +181,7 @@
|
|||||||
height: '250px',
|
height: '250px',
|
||||||
layVerify: 'required',
|
layVerify: 'required',
|
||||||
layVerType: 'tips',
|
layVerType: 'tips',
|
||||||
data: data,
|
data: res.data,
|
||||||
initValue: [cid],
|
initValue: [cid],
|
||||||
model: {label: {type: 'text'}},
|
model: {label: {type: 'text'}},
|
||||||
prop: {
|
prop: {
|
||||||
@ -202,8 +198,6 @@
|
|||||||
},
|
},
|
||||||
tips: '请选择'
|
tips: '请选择'
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// tag标签
|
// tag标签
|
||||||
@ -220,7 +214,7 @@
|
|||||||
});
|
});
|
||||||
//2.动态标签赋值
|
//2.动态标签赋值
|
||||||
$.get("{:url('get_all_tag')}",function(res){
|
$.get("{:url('get_all_tag')}",function(res){
|
||||||
if(res.code == 0){
|
if(res.code === 0){
|
||||||
addTags.update({
|
addTags.update({
|
||||||
data: res.data,
|
data: res.data,
|
||||||
autoRow: true,
|
autoRow: true,
|
||||||
@ -256,7 +250,7 @@
|
|||||||
{
|
{
|
||||||
// console.log(flag,title,content)
|
// console.log(flag,title,content)
|
||||||
$.post("{:url('article/keywords')}",{ keywords: title, content:content, flag: flag }, function (res) {
|
$.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(','));
|
$("input[name='keywords']").val(res.data.join(','));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -273,7 +267,7 @@
|
|||||||
if(title.length > 0 ) {
|
if(title.length > 0 ) {
|
||||||
$.post("{:url('article/getWordList')}",{title:title},function(res){
|
$.post("{:url('article/getWordList')}",{title:title},function(res){
|
||||||
// 动态生成ur>li内容
|
// 动态生成ur>li内容
|
||||||
if (res.code == 0) {
|
if (res.code === 0) {
|
||||||
// 显示动态框
|
// 显示动态框
|
||||||
$(".bdsug").removeClass('layui-hide');
|
$(".bdsug").removeClass('layui-hide');
|
||||||
for (var i = 0; i < res.data.length; i++) {
|
for (var i = 0; i < res.data.length; i++) {
|
||||||
@ -321,8 +315,7 @@
|
|||||||
data: field,
|
data: field,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.code == 0) {
|
if (data.code === 0) {
|
||||||
|
|
||||||
notify.success(data.msg, function () {
|
notify.success(data.msg, function () {
|
||||||
location.href = data.url;
|
location.href = data.url;
|
||||||
});
|
});
|
||||||
|
@ -53,6 +53,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/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"}
|
{notempty name="tags"}
|
||||||
<div style="margin-top: 15px">标签
|
<div style="margin-top: 15px">标签
|
||||||
{volist name="tags" id="vo" }
|
{volist name="tags" id="vo" }
|
||||||
@ -94,7 +101,7 @@
|
|||||||
{//评论 编辑/删除/采纳/权限}
|
{//评论 编辑/删除/采纳/权限}
|
||||||
<div class="jieda-admin">
|
<div class="jieda-admin">
|
||||||
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
|
{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>
|
<span type="del">{:lang('delete')}</span>
|
||||||
{/if} {if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) && ($article.jie == 0)/}
|
{/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>
|
<span class="jieda-accept" type="accept">{:lang('accept')}</span>
|
||||||
@ -193,6 +200,7 @@
|
|||||||
{:hook('taoplayer')}
|
{:hook('taoplayer')}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var collectionFind = "{:url('Collection/find')}",
|
var collectionFind = "{:url('Collection/find')}",
|
||||||
collection = "{:url('collection/')}",
|
collection = "{:url('collection/')}",
|
||||||
articleJieset = "{:url('Article/jieset')}",
|
articleJieset = "{:url('Article/jieset')}",
|
||||||
@ -216,41 +224,43 @@
|
|||||||
laypage = layui.laypage;
|
laypage = layui.laypage;
|
||||||
|
|
||||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||||
|
|
||||||
// 编辑器插件禁用状态,用原方式解析网页
|
// 编辑器插件禁用状态,用原方式解析网页
|
||||||
if(taonystatus == 0) {
|
if(taonystatus == 0) {
|
||||||
$('.detail-body').each(function(){
|
$('.detail-body').each(function(){
|
||||||
var othis = $(this), html = othis.html();
|
var othis = $(this), html = othis.html();
|
||||||
othis.html(fly.content(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模板给发布时间赋值
|
//tpl模板给发布时间赋值
|
||||||
$("div.user-questions").children("span.user-post-time").each(function () {
|
$("div.user-questions").children("span.user-post-time").each(function () {
|
||||||
var othis = $(this),
|
var othis = $(this);
|
||||||
html = othis.html();
|
|
||||||
var string = laytpl("{{ d.time }}").render({
|
var string = laytpl("{{ d.time }}").render({
|
||||||
//time: html
|
|
||||||
time: othis.attr("data"),
|
time: othis.attr("data"),
|
||||||
});
|
});
|
||||||
|
|
||||||
var posttime = layui.util.timeAgo(string, 1);
|
var posttime = layui.util.timeAgo(string, 1);
|
||||||
othis.text(posttime);
|
othis.text(posttime);
|
||||||
//console.log(othis.attr('data'));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//tpl模板给发布时间赋值
|
//tpl模板给发布时间赋值
|
||||||
$("div.detail-hits").children("span.post-time").each(function () {
|
$("div.detail-hits").children("span.post-time").each(function () {
|
||||||
var othis = $(this),
|
var othis = $(this);
|
||||||
html = othis.html();
|
|
||||||
var string = laytpl("{{ d.time }}").render({
|
var string = laytpl("{{ d.time }}").render({
|
||||||
//time: html
|
|
||||||
time: othis.attr("data"),
|
time: othis.attr("data"),
|
||||||
});
|
});
|
||||||
|
|
||||||
var posttime = layui.util.timeAgo(string, 1);
|
var posttime = layui.util.timeAgo(string, 1);
|
||||||
othis.text(posttime);
|
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>
|
</script>
|
||||||
|
|
||||||
|
@ -61,6 +61,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/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"}
|
{notempty name="tags"}
|
||||||
<div style="margin-top: 15px">标签
|
<div style="margin-top: 15px">标签
|
||||||
{volist name="tags" id="vo" }
|
{volist name="tags" id="vo" }
|
||||||
@ -142,7 +149,7 @@
|
|||||||
{//评论 编辑/删除/采纳/权限}
|
{//评论 编辑/删除/采纳/权限}
|
||||||
<div class="jieda-admin">
|
<div class="jieda-admin">
|
||||||
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
|
{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>
|
<span type="del">{:lang('delete')}</span>
|
||||||
{/if} {if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) && ($article.jie == 0)/}
|
{/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>
|
<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();
|
var othis = $(this), html = othis.html();
|
||||||
othis.html(fly.content(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>
|
</script>
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@
|
|||||||
{//评论编辑删除采纳权限}
|
{//评论编辑删除采纳权限}
|
||||||
<div class="jieda-admin">
|
<div class="jieda-admin">
|
||||||
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
|
{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>
|
<span type="del">{:lang('delete')}</span>
|
||||||
{/if}
|
{/if}
|
||||||
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}<span class="jieda-accept" type="accept">{:lang('accept')}</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}
|
||||||
|
@ -38,33 +38,32 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</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">
|
<div class="layui-col-md3">
|
||||||
<label class="layui-form-label">所属产品</label>
|
<label class="layui-form-label">阅读权限</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<select name="project">
|
<select name="read_type">
|
||||||
<option></option>
|
<option value="0" {if($article.read_type == 0)} selected {/if}>开放阅读</option>
|
||||||
<option value="layui">layui</option>
|
<option value="1" {if($article.read_type == 1)} selected {/if}>密码加密</option>
|
||||||
<option value="独立版layer">独立版layer</option>
|
<option value="2" {if($article.read_type == 2)} selected {/if}>回帖阅读</option>
|
||||||
<option value="独立版layDate">独立版layDate</option>
|
<option value="3" {if($article.read_type == 3)} selected {/if}>购买阅读</option>
|
||||||
<option value="LayIM">LayIM</option>
|
|
||||||
<option value="Fly社区模板">Fly社区模板</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-col-md3">
|
<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">
|
<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>
|
</div>
|
||||||
<div class="layui-col-md6">
|
<div class="layui-col-md6 layui-hide">
|
||||||
<label class="layui-form-label" for="L_browser">浏览器</label>
|
<label class="layui-form-label" for="L_browser">浏览器</label>
|
||||||
<div class="layui-input-block">
|
<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>
|
||||||
</div-->
|
|
||||||
|
|
||||||
<div class="layui-form-item layui-form-text">
|
<div class="layui-form-item layui-form-text">
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
@ -145,6 +144,8 @@
|
|||||||
|
|
||||||
<script src="/static/xm-select.js"></script>
|
<script src="/static/xm-select.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
let taonystatus = "{:hook('taonystatus') ? 1 : 0} ";
|
||||||
|
|
||||||
layui.use(['fly'], function(){
|
layui.use(['fly'], function(){
|
||||||
var $ = layui.jquery
|
var $ = layui.jquery
|
||||||
,fly = layui.fly
|
,fly = layui.fly
|
||||||
@ -160,22 +161,16 @@
|
|||||||
|
|
||||||
|
|
||||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||||
var taonystatus = "{:hook('taonystatus')}";
|
|
||||||
// 编辑器插件启用状态
|
// 编辑器插件启用状态
|
||||||
var isShow = taonystatus ? false : true;
|
if(taonystatus == 0) {
|
||||||
if(isShow) {
|
|
||||||
$('.layui-textarea').each(function(){
|
$('.layui-textarea').each(function(){
|
||||||
var othis = $(this), html = othis.html();
|
var othis = $(this), html = othis.html();
|
||||||
othis.attr(fly.content(html));
|
othis.attr(fly.content(html));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 分类选择
|
||||||
// 分类选择
|
|
||||||
$(function(){
|
|
||||||
//这里模拟ajax
|
|
||||||
$.get("{:url('article/getCateTree')}",function(res){
|
$.get("{:url('article/getCateTree')}",function(res){
|
||||||
var data = res.data;
|
|
||||||
// 渲染下拉树
|
// 渲染下拉树
|
||||||
xmSelect.render({
|
xmSelect.render({
|
||||||
el: '#CateId',
|
el: '#CateId',
|
||||||
@ -183,7 +178,7 @@ $(function(){
|
|||||||
height: '250px',
|
height: '250px',
|
||||||
layVerify: 'required',
|
layVerify: 'required',
|
||||||
layVerType: 'tips',
|
layVerType: 'tips',
|
||||||
data: data,
|
data: res.data,
|
||||||
initValue: [cateId],
|
initValue: [cateId],
|
||||||
model: {label: {type: 'text'}},
|
model: {label: {type: 'text'}},
|
||||||
prop: {
|
prop: {
|
||||||
@ -200,8 +195,6 @@ $(function(){
|
|||||||
},
|
},
|
||||||
tips: '请选择'
|
tips: '请选择'
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// tag标签
|
// tag标签
|
||||||
@ -218,7 +211,7 @@ $(function(){
|
|||||||
});
|
});
|
||||||
//2.动态赋值
|
//2.动态赋值
|
||||||
$.get("{:url('get_art_tag')}",{id:artId},function(res){
|
$.get("{:url('get_art_tag')}",{id:artId},function(res){
|
||||||
if(res.code == 0){
|
if(res.code === 0){
|
||||||
addTags.setValue(
|
addTags.setValue(
|
||||||
res.data
|
res.data
|
||||||
)
|
)
|
||||||
@ -226,7 +219,7 @@ $(function(){
|
|||||||
});
|
});
|
||||||
//3.动态标签赋值
|
//3.动态标签赋值
|
||||||
$.get("{:url('get_all_tag')}",function(res){
|
$.get("{:url('get_all_tag')}",function(res){
|
||||||
if(res.code == 0){
|
if(res.code === 0){
|
||||||
addTags.update({
|
addTags.update({
|
||||||
data: res.data,
|
data: res.data,
|
||||||
autoRow: true,
|
autoRow: true,
|
||||||
@ -365,8 +358,8 @@ $(function(){
|
|||||||
notify.error(res.msg);
|
notify.error(res.msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{/block}
|
{/block}
|
@ -41,6 +41,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/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"}
|
{notempty name="tags"}
|
||||||
<div style="margin-top: 15px">标签
|
<div style="margin-top: 15px">标签
|
||||||
{volist name="tags" id="vo" }
|
{volist name="tags" id="vo" }
|
||||||
@ -102,6 +109,17 @@
|
|||||||
var othis = $(this), html = othis.html();
|
var othis = $(this), html = othis.html();
|
||||||
othis.html(fly.content(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模板给发布时间赋值
|
//tpl模板给发布时间赋值
|
||||||
@ -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>
|
</script>
|
||||||
|
|
||||||
|
@ -63,6 +63,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/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"}
|
{notempty name="tags"}
|
||||||
<div style="margin-top: 15px">标签
|
<div style="margin-top: 15px">标签
|
||||||
{volist name="tags" id="vo" }
|
{volist name="tags" id="vo" }
|
||||||
@ -113,7 +120,7 @@
|
|||||||
{//评论编辑删除采纳权限}
|
{//评论编辑删除采纳权限}
|
||||||
<div class="jieda-admin">
|
<div class="jieda-admin">
|
||||||
{if ((session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2)) OR ($user.auth ?? '')}
|
{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>
|
<span type="del">{:lang('delete')}</span>
|
||||||
{/if}
|
{/if}
|
||||||
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}
|
{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 id = "{$article.id}";
|
||||||
|
|
||||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
||||||
var taonystatus = "{:hook('taonystatus')}";
|
|
||||||
// 编辑器插件启用状态
|
// 编辑器插件启用状态
|
||||||
if(taonystatus == 0) {
|
if(taonystatus == 0) {
|
||||||
$('.detail-body').each(function(){
|
$('.detail-body').each(function(){
|
||||||
var othis = $(this), html = othis.html();
|
var othis = $(this), html = othis.html();
|
||||||
othis.html(fly.content(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模板给发布时间赋值
|
//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>
|
</script>
|
||||||
|
|
||||||
|
69
view/taoler/index/comment/edit.html
Normal file
69
view/taoler/index/comment/edit.html
Normal 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>
|
@ -48,6 +48,7 @@
|
|||||||
{//右栏}
|
{//右栏}
|
||||||
<div class="layui-col-md4">
|
<div class="layui-col-md4">
|
||||||
{:hook('live')}
|
{:hook('live')}
|
||||||
|
{:hook('ranking')}
|
||||||
{:hook('kankan')}
|
{:hook('kankan')}
|
||||||
{:hook('signhook', ['id'=>1])}
|
{:hook('signhook', ['id'=>1])}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
</li>
|
</li>
|
||||||
{volist name="subcatelist" id="vo"}
|
{volist name="subcatelist" id="vo"}
|
||||||
<li class="{if($vo.ename eq $Request.param.ename)}layui-this{/if}">
|
<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>
|
</li>
|
||||||
{/volist}
|
{/volist}
|
||||||
<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li>
|
<li class="layui-hide-xs layui-hide-sm layui-show-md-inline-block"><span class="fly-mid"></span></li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user