1.发帖重复修复,2.升级移除多余文件,3.后台首页版本异步检测
This commit is contained in:
parent
184eb4ce30
commit
f0dcaf98fc
@ -7,8 +7,8 @@
|
|||||||
* 后台:http://adm.aieok.com:888
|
* 后台:http://adm.aieok.com:888
|
||||||
* 账号:test
|
* 账号:test
|
||||||
* 密码:test123
|
* 密码:test123
|
||||||
* 版本:TaoLer 1.8.10
|
* 版本:TaoLer 1.8.11
|
||||||
* 日期:2021.11.2
|
* 日期:2021.11.3
|
||||||
|
|
||||||
#### 项目地址
|
#### 项目地址
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class AuthRule extends AdminController
|
|||||||
/*
|
/*
|
||||||
支持获取三级菜单
|
支持获取三级菜单
|
||||||
*/
|
*/
|
||||||
$result = $this->getMenus();
|
$result = $this->getMenus(1);
|
||||||
|
|
||||||
$count = count($result);
|
$count = count($result);
|
||||||
$tree = [];
|
$tree = [];
|
||||||
|
@ -58,22 +58,13 @@ class Index extends AdminController
|
|||||||
|
|
||||||
public function home()
|
public function home()
|
||||||
{
|
{
|
||||||
//版本检测
|
// 评论、帖子状态
|
||||||
$verCheck = Api::urlPost($this->sys['upcheck_url'],['pn'=>$this->pn,'ver'=>$this->sys_version]);
|
|
||||||
if($verCheck->code !== -1){
|
|
||||||
$versions = $verCheck->code ? "有{$verCheck->up_num}个版本需更新,当前可更新至{$verCheck->version}" : $verCheck->msg;
|
|
||||||
View::assign('versions',$versions);
|
|
||||||
}else{
|
|
||||||
View::assign('versions','版本检测暂时不可服务');
|
|
||||||
}
|
|
||||||
|
|
||||||
//评论、帖子状态
|
|
||||||
$comm = Db::name('comment')->field('id')->where(['delete_time'=>0,'status'=>0])->select();
|
$comm = Db::name('comment')->field('id')->where(['delete_time'=>0,'status'=>0])->select();
|
||||||
$forum = Db::name('article')->field('id')->where(['delete_time'=>0,'status'=>0])->select();
|
$forum = Db::name('article')->field('id')->where(['delete_time'=>0,'status'=>0])->select();
|
||||||
$comms = count($comm);
|
$comms = count($comm);
|
||||||
$forums = count($forum);
|
$forums = count($forum);
|
||||||
|
|
||||||
//用户注册数据
|
// 用户注册数据
|
||||||
$monthTime = Cache::get('monthTime');
|
$monthTime = Cache::get('monthTime');
|
||||||
if(!$monthTime){
|
if(!$monthTime){
|
||||||
$time = Db::name('user')->where('delete_time',0)->whereMonth('create_time')->order('create_time','asc')->column('create_time');
|
$time = Db::name('user')->where('delete_time',0)->whereMonth('create_time')->order('create_time','asc')->column('create_time');
|
||||||
@ -101,6 +92,18 @@ class Index extends AdminController
|
|||||||
return View::fetch();
|
return View::fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//版本检测
|
||||||
|
public function getVersion(){
|
||||||
|
|
||||||
|
$verCheck = Api::urlPost($this->sys['upcheck_url'],['pn'=>$this->pn,'ver'=>$this->sys_version]);
|
||||||
|
if($verCheck->code !== -1){
|
||||||
|
$versions = $verCheck->code ? "<span style='color:red'>有{$verCheck->up_num}个版本需更新,当前可更新至{$verCheck->version}</span>" : $verCheck->msg;
|
||||||
|
return $versions;
|
||||||
|
} else {
|
||||||
|
return lang('No new messages');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//本周发帖
|
//本周发帖
|
||||||
public function forums()
|
public function forums()
|
||||||
{
|
{
|
||||||
@ -132,7 +135,7 @@ class Index extends AdminController
|
|||||||
//本周评论
|
//本周评论
|
||||||
public function replys()
|
public function replys()
|
||||||
{
|
{
|
||||||
if(Request::isAjax()) {
|
if(Request::isAjax()){
|
||||||
|
|
||||||
$replys = Db::name('comment')
|
$replys = Db::name('comment')
|
||||||
->alias('a')
|
->alias('a')
|
||||||
@ -155,7 +158,7 @@ class Index extends AdminController
|
|||||||
$res = ['code'=>-1,'msg'=>'本周还没评论'];
|
$res = ['code'=>-1,'msg'=>'本周还没评论'];
|
||||||
}
|
}
|
||||||
return json($res);
|
return json($res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//动态信息
|
//动态信息
|
||||||
@ -245,8 +248,7 @@ class Index extends AdminController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function layout(){
|
public function layout(){
|
||||||
|
|
||||||
return view();
|
return view();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -82,7 +82,7 @@ class Upgrade extends AdminController
|
|||||||
if(empty($data['key'])){
|
if(empty($data['key'])){
|
||||||
return json(['code'=>-1,'msg'=>'请正确填写申请到的key']);
|
return json(['code'=>-1,'msg'=>'请正确填写申请到的key']);
|
||||||
}
|
}
|
||||||
$res = Db::name('system')->update(['key'=>$data['key'],'upcheck_url'=>$data['upcheck_url'],'upgrade_url'=>$data['upgrade_url'],'id'=>1]);
|
$res = Db::name('system')->cache('system')->update(['key'=>$data['key'],'upcheck_url'=>$data['upcheck_url'],'upgrade_url'=>$data['upgrade_url'],'id'=>1]);
|
||||||
if($res){
|
if($res){
|
||||||
$res = ['code'=>0,'msg'=>'修改成功'];
|
$res = ['code'=>0,'msg'=>'修改成功'];
|
||||||
} else {
|
} else {
|
||||||
@ -187,6 +187,30 @@ class Upgrade extends AdminController
|
|||||||
return json(['code'=>-1,'msg'=>$upDate['msg']]);
|
return json(['code'=>-1,'msg'=>$upDate['msg']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//清除
|
||||||
|
Files::delDirAndFile($this->upload_dir);
|
||||||
|
Files::delDirAndFile($this->backup_dir);
|
||||||
|
|
||||||
|
//清除无用目录和文件
|
||||||
|
$delFiles = '../runtime/remove.txt';
|
||||||
|
if(file_exists($delFiles)){
|
||||||
|
$str = file_get_contents($delFiles); //将整个文件内容读入到一个字符串中
|
||||||
|
$str = str_replace("\r\n",",",$str);
|
||||||
|
$delArr = explode(',',$str);
|
||||||
|
foreach($delArr as $v){
|
||||||
|
if(is_dir($v)){
|
||||||
|
//删除文件夹
|
||||||
|
Files::delDirAndFile($v.'/');
|
||||||
|
} else {
|
||||||
|
//删除文件
|
||||||
|
if(file_exists($v)){
|
||||||
|
unlink($v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unlink($delFiles);
|
||||||
|
}
|
||||||
|
|
||||||
//清理缓存
|
//清理缓存
|
||||||
$this->clearSysCache();
|
$this->clearSysCache();
|
||||||
|
|
||||||
@ -267,9 +291,7 @@ class Upgrade extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'success','progress'=>'70%','msg'=>'升级文件执行成功!']);
|
Log::channel('update')->info('update:{type} {progress} {msg}',['type'=>'success','progress'=>'70%','msg'=>'升级文件执行成功!']);
|
||||||
//清除
|
|
||||||
Files::delDirAndFile($this->upload_dir);
|
|
||||||
Files::delDirAndFile($this->backup_dir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//升级sql操作
|
//升级sql操作
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<div class="layui-row layui-col-space15">
|
<div class="layui-row layui-col-space15">
|
||||||
<div class="layui-col-md12">
|
<div class="layui-col-md12">
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
<div class="layui-card-header"><span style="color:red">{$versions}</span></div>
|
<div class="layui-card-header"><i class="layui-icon layui-icon-voice"></i><a id="up_version" lay-href="{:url('Upgrade/index')}"></a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-col-md6">
|
<div class="layui-col-md6">
|
||||||
@ -431,6 +431,14 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//加载版本检测
|
||||||
|
(function(){
|
||||||
|
$.get("{:url('Index/getVersion')}",function(data){
|
||||||
|
$('#up_version').html(data);
|
||||||
|
})
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
$('.layui-btn.layuiadmin-btn-oiltank').on('click', function(){
|
$('.layui-btn.layuiadmin-btn-oiltank').on('click', function(){
|
||||||
var type = $(this).data('type');
|
var type = $(this).data('type');
|
||||||
|
@ -7,7 +7,7 @@ return [
|
|||||||
//应用名,此项不可更改
|
//应用名,此项不可更改
|
||||||
'appname' => 'TaoLer',
|
'appname' => 'TaoLer',
|
||||||
//版本配置
|
//版本配置
|
||||||
'version' => '1.8.10',
|
'version' => '1.8.11',
|
||||||
//加盐
|
//加盐
|
||||||
'salt' => 'taoler',
|
'salt' => 'taoler',
|
||||||
//数据库备份目录
|
//数据库备份目录
|
||||||
|
File diff suppressed because one or more lines are too long
@ -195,6 +195,7 @@
|
|||||||
numArr.push($(this).val());//添加至数组
|
numArr.push($(this).val());//添加至数组
|
||||||
});
|
});
|
||||||
tags = numArr.lenth ? '' : numArr.join(',');
|
tags = numArr.lenth ? '' : numArr.join(',');
|
||||||
|
var index = layer.load(1);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"post",
|
type:"post",
|
||||||
url:"{:url('article/add')}",
|
url:"{:url('article/add')}",
|
||||||
@ -209,6 +210,7 @@
|
|||||||
layer.open({title:'发布失败',content:data.msg,icon:5,anim:6});
|
layer.open({title:'发布失败',content:data.msg,icon:5,anim:6});
|
||||||
layui.jquery('#captcha').attr('src', '{:captcha_src()}?'+Math.random());
|
layui.jquery('#captcha').attr('src', '{:captcha_src()}?'+Math.random());
|
||||||
}
|
}
|
||||||
|
layer.close(index);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
@ -255,6 +255,7 @@ layui.use(['fly', 'face','colorpicker','plyr'], function(){
|
|||||||
|
|
||||||
//评论需要登陆
|
//评论需要登陆
|
||||||
form.on('submit(user-comment)',function (data){
|
form.on('submit(user-comment)',function (data){
|
||||||
|
var index = layer.load(1);
|
||||||
var filed = data.field;
|
var filed = data.field;
|
||||||
if (uid == -1) {
|
if (uid == -1) {
|
||||||
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
||||||
|
@ -240,6 +240,7 @@ layui.use(['fly', 'face','colorpicker','plyr'], function(){
|
|||||||
|
|
||||||
//评论需要登陆
|
//评论需要登陆
|
||||||
form.on('submit(user-comment)',function (data){
|
form.on('submit(user-comment)',function (data){
|
||||||
|
var index = layer.load(1);
|
||||||
var filed = data.field;
|
var filed = data.field;
|
||||||
if (uid == -1) {
|
if (uid == -1) {
|
||||||
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
||||||
|
@ -232,6 +232,7 @@ layui.use(['fly', 'face','colorpicker','plyr'], function(){
|
|||||||
|
|
||||||
//评论需要登陆
|
//评论需要登陆
|
||||||
form.on('submit(user-comment)',function (data){
|
form.on('submit(user-comment)',function (data){
|
||||||
|
var index = layer.load(1);
|
||||||
var filed = data.field;
|
var filed = data.field;
|
||||||
if (uid == -1) {
|
if (uid == -1) {
|
||||||
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
||||||
|
@ -1,315 +0,0 @@
|
|||||||
{extend name="public/base" /}
|
|
||||||
|
|
||||||
{block name="title"}{$article.title}-{$sysInfo.webname}{/block}
|
|
||||||
{block name="keywords"}{$article.title},{$article.tags}{/block}
|
|
||||||
{block name="description"}{$article.title},{:getArtContent($article.content)}{/block}
|
|
||||||
{block name="link"}<link rel="stylesheet" href="/static/res/css/plyr.css" charset="utf-8">{/block}
|
|
||||||
{block name="column"}<div class="layui-hide-xs">{include file="/public/column" /}</div>{/block}
|
|
||||||
{block name="content"}
|
|
||||||
<div class="layui-container">
|
|
||||||
<div class="layui-row layui-col-space15">
|
|
||||||
<div class="layui-col-md8 content detail">
|
|
||||||
<div class="fly-panel detail-box">
|
|
||||||
{//标题}
|
|
||||||
<h1 style="color:{$article.title_color};">{$article.title}
|
|
||||||
<span class="layui-hide-xs"><div onclick="PhoneDown();" style="" class="detail_qrcode" id="mobile"></div></span>
|
|
||||||
</h1>
|
|
||||||
{//图标}
|
|
||||||
<div class="fly-detail-info">
|
|
||||||
<span class="layui-badge layui-bg-green fly-detail-column">{:cookie('think_lang') == 'en-us' ? $article.cate.ename : $article.cate.catename}</span>
|
|
||||||
{if ($article.is_top == 1)}<span class="layui-badge layui-bg-black">{:lang('top')}</span>{/if}
|
|
||||||
{if ($article.is_hot == 1)}<span class="layui-badge layui-bg-red">{:lang('hot')}</span>{/if}
|
|
||||||
<span id="LAY_jieAdmin" data-id="{$article['id']}"></span>
|
|
||||||
<span class="fly-list-nums">
|
|
||||||
<a href="#comment"><i class="iconfont" title="{:lang('reply')}"></i>{$comments->count()}</a><i class="iconfont" title="浏览"></i>{$pv}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
{//作者}
|
|
||||||
<div class="detail-about">
|
|
||||||
<a class="fly-avatar" href="{:url('user/home',['id'=>$article.user.id])}">
|
|
||||||
<img src="{$article.user.user_img}" alt="{$article.user.name}">
|
|
||||||
<i class="iconfont icon-renzheng" title="认证信息"></i>
|
|
||||||
</a>
|
|
||||||
<div class="fly-detail-user">
|
|
||||||
<a href="{:url('user/home',['id'=>$article.user.id])}" class="fly-link">
|
|
||||||
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green " title="">{:getAsing($article.user.area_id) ?: '无'}</i>{/if}
|
|
||||||
<cite>{$article.user.nickname ?: $article.user.name}</cite>
|
|
||||||
</a>
|
|
||||||
<span class="layui-btn layui-btn-xs guanzhu" >关注</span>
|
|
||||||
</div>
|
|
||||||
<div class="detail-hits">
|
|
||||||
<!--span style="padding-right: 10px; color: #FF7200">悬赏:60飞吻</span-->
|
|
||||||
<span class="post-time" data="{$article.create_time}" style="padding-top: 5px;"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="detail-body photos">{$article.content|raw}</div>
|
|
||||||
{//管理}
|
|
||||||
{if (($article.upzip !== '') || (session('user_id')==$article.user_id) OR ($user.auth ?? ''))}
|
|
||||||
<div class="detail-assist">
|
|
||||||
{notempty name="$article.upzip"}
|
|
||||||
<button type="button" class="layui-btn layui-btn-xs" id="zip-download"><i class="layui-icon layui-icon-download-circle"></i>{:lang('download files')}: {$article.downloads}次</button>
|
|
||||||
{/notempty}
|
|
||||||
<div class="fly-admin-box" data-id="{$article.id}">
|
|
||||||
{if ($user.auth ?? '')}
|
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="del"><i class="layui-icon layui-icon-delete"></i></span>
|
|
||||||
{if($article.is_top == 0)}<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="1"><i class="layui-icon layui-icon-top"></i></span>
|
|
||||||
{else /}<span class="layui-btn layui-btn-xs jie-admin" type="set" field="top" rank="0" style="background-color:#ccc;">{:lang('cancel topping')}</span>{/if}
|
|
||||||
{if($article.is_hot == 0)}
|
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="1"><i class="layui-icon layui-icon-fire"></i></span>
|
|
||||||
{else /}
|
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="hot" rank="0" style="background-color:#ccc;">{:lang('cancel hoting')}</span>
|
|
||||||
{/if}
|
|
||||||
{if($article.is_reply == 1)}
|
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="0"><i class="layui-icon layui-icon-face-cry"></i></span>
|
|
||||||
{else /}
|
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="set" field="reply" rank="1" style="background-color:#ccc;">{:lang('enable reply')}</span>
|
|
||||||
{/if}
|
|
||||||
<span id="color">{:lang('title color')}</span>
|
|
||||||
{/if}
|
|
||||||
{if(session('user_name')==$article.user.name || ($user.auth ?? ''))}
|
|
||||||
<span class="layui-btn layui-btn-xs jie-admin" type="edit"><a href="{:url('article/edit',['id'=>$article.id])}">{:lang('edit')}</a></span>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{//评论}
|
|
||||||
<div class="fly-panel detail-box" id="flyReply">
|
|
||||||
<span style="font-size:18px;">评论 {$comments->count()}</span>
|
|
||||||
<ul class="jieda" id="jieda">
|
|
||||||
{volist name="comments" id="vo" empty= ""}
|
|
||||||
<li data-id="{$vo.id}" class="jieda-daan">
|
|
||||||
<a name="item-1111111111"></a>
|
|
||||||
<div class="detail-about detail-about-reply">
|
|
||||||
<a class="fly-avatar" href="{:url('user/home',['id'=>$vo.user.id])}">
|
|
||||||
<img src="{$vo.user.user_img}" alt=" "><i class="iconfont icon-renzheng" title="认证信息"></i>
|
|
||||||
</a>
|
|
||||||
<div class="fly-detail-user">
|
|
||||||
<a href="{:url('user/home',['id'=>$vo.user.id])}" class="fly-link">
|
|
||||||
{if config('taoler.config.area_show') == 1}<i class="layui-badge layui-bg-green " title="">{:getAsing($vo.user.area_id) ?: '无'}</i>{/if}
|
|
||||||
<cite>{$vo.user.nickname ?: $vo.user.name}</cite>
|
|
||||||
</a>
|
|
||||||
{if condition="$article.user.id eq $vo.user.id"}<span>({:lang('poster')})</span>{/if}
|
|
||||||
</div>
|
|
||||||
<div class="detail-hits"><span class="post-time" data="{$vo.create_time}"></span></div>
|
|
||||||
</div>
|
|
||||||
<div class="detail-body jieda-body photos">{$vo.content|raw|htmlspecialchars_decode}</div>
|
|
||||||
<div class="jieda-reply">
|
|
||||||
<span class="jieda-zan {if($vo.zan != 0)}zanok{/if}" type="zan">
|
|
||||||
<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="del">{:lang('delete')}</span>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{/volist}
|
|
||||||
</ul>
|
|
||||||
<div style="text-align: center">{$comments|raw}</div>
|
|
||||||
{if condition="$article.is_reply == 1"}
|
|
||||||
<div class="layui-form layui-form-pane">
|
|
||||||
<div class="layui-form-item layui-form-text">
|
|
||||||
<a name="comment"></a>
|
|
||||||
<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" style="height: 150px;"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-form-item">
|
|
||||||
<input type="hidden" name="article_id" value="{$article.id}">
|
|
||||||
<input type="hidden" name="user_id" value="{:session('user_id')}">
|
|
||||||
<button class="layui-btn" lay-filter="user-comment" lay-submit>{:lang('submit comments')}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{else /}
|
|
||||||
<blockquote class="layui-elem-quote layui-quote-nm layui-disabled" style="margin: 100px 0 20px; padding: 50px 20px; text-align: center; color: #999!important;">本帖已设置禁止回复</blockquote>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="layui-col-md4">
|
|
||||||
<div class="fly-panel">
|
|
||||||
<div class="fly-panel-title">{:lang('sponsor')}<span style="padding: 0 3px;">-</span>
|
|
||||||
<a href="" class="fly-link fly-joinad">{:lang('i want to join')}</a>
|
|
||||||
</div>
|
|
||||||
<div class="fly-panel-main">
|
|
||||||
{volist name="ad_comm" id="vo"}
|
|
||||||
<a href="{$vo.slid_href}" target="_blank" rel="nofollow" class="fly-zanzhu" style="background-color: {$vo.slid_color};">{$vo.slid_name}</a>
|
|
||||||
{/volist}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<dl class="fly-panel fly-list-one">
|
|
||||||
<dt class="fly-panel-title">{:lang('hot post list')}</dt>
|
|
||||||
{volist name="artHot" id="vo"}
|
|
||||||
<dd>
|
|
||||||
<a href="{:url('article/detail',['id' => $vo.id])}">{$vo.title}</a>
|
|
||||||
<span><i class="iconfont icon-pinglun1"></i> {$vo.comments_count}</span>
|
|
||||||
</dd>
|
|
||||||
{/volist}
|
|
||||||
</dl>
|
|
||||||
<div class="fly-panel" style="padding: 5px 0; text-align: center;">
|
|
||||||
{volist name="ad_art" id="vo"}
|
|
||||||
<a href="{$vo.slid_href}" target="_blank"><img src="{$vo.slid_img}" style="max-width: 100%;"></a>
|
|
||||||
{/volist}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!--底部栏-->
|
|
||||||
<div class="site-tree-mobile-detail-bottom layui-hide-md">
|
|
||||||
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{include file="public/menu" /}
|
|
||||||
{/block}
|
|
||||||
{block name="script"}
|
|
||||||
<script>
|
|
||||||
var collectionFind = "{:url('Collection/find')}",
|
|
||||||
articleJieset = "{:url('Article/jieset')}",
|
|
||||||
articleDelete = "{:url('Article/delete')}",
|
|
||||||
commentJiedaZan = "{:url('Comment/jiedaZan')}",
|
|
||||||
commentJiedaCai = "{:url('Comment/jiedaCai')}",
|
|
||||||
commentGetDa = "{:url('Comment/getDa')}",
|
|
||||||
commentUpdateDa = "{:url('Comment/updateDa')}",
|
|
||||||
commentJiedaDelete = "{:url('Comment/jiedaDelete')}",
|
|
||||||
langCollection = "{:lang('collection')}",
|
|
||||||
langCancelCollection = "{:lang('cancel collection')}";
|
|
||||||
var collection = "{:url('collection/')}";
|
|
||||||
|
|
||||||
layui.use(['fly', 'face','colorpicker','plyr'], function(){
|
|
||||||
var $ = layui.jquery
|
|
||||||
,form = layui.form
|
|
||||||
,fly = layui.fly
|
|
||||||
,colorpicker = layui.colorpicker
|
|
||||||
,plyr = layui.plyr;
|
|
||||||
var laytpl = layui.laytpl;
|
|
||||||
var uid = layui.cache.user.uid;
|
|
||||||
|
|
||||||
//tpl模板给发布时间赋值
|
|
||||||
$('div.detail-hits').children('span.post-time').each(function(){
|
|
||||||
var othis = $(this), html = othis.html();
|
|
||||||
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'));
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
//预定义颜色项
|
|
||||||
colorpicker.render({
|
|
||||||
elem: '#color'
|
|
||||||
,color: '#393d49'
|
|
||||||
,predefine: true // 开启预定义颜色
|
|
||||||
,size: 'xs'
|
|
||||||
,done: function(color){
|
|
||||||
//改变标题颜色
|
|
||||||
$('h1').css("color", color);
|
|
||||||
var id = {$article.id};
|
|
||||||
$.ajax({
|
|
||||||
type:'post',
|
|
||||||
url:"{:url('Article/titleColor')}",
|
|
||||||
data:{id: id,title_color: color},
|
|
||||||
dataType:'json',
|
|
||||||
success:function(data){
|
|
||||||
if(data.code == 0){
|
|
||||||
layer.msg(data.msg,{icon:6,time:2000
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
layer.open({content:data.msg,icon:5,adim:6});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//评论需要登陆
|
|
||||||
form.on('submit(user-comment)',function (data){
|
|
||||||
var filed = data.field;
|
|
||||||
if (uid == -1) {
|
|
||||||
layer.msg('请先登陆',{icon:5,time:2000},function(){
|
|
||||||
location.href = "{:url('login/index')}";
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: "{:url('article/comment')}",
|
|
||||||
data: filed,
|
|
||||||
dataType: "json",
|
|
||||||
success:function (data) {
|
|
||||||
if (data.code == 0) {
|
|
||||||
layer.msg(data.msg,{icon:6,time:2000},function () {
|
|
||||||
location.reload(true);
|
|
||||||
});
|
|
||||||
}else {
|
|
||||||
layer.open({title:'评论失败',content:data.msg,icon:5,anim:6});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
//下载
|
|
||||||
$('#zip-download').click(function (){
|
|
||||||
var id = "{$article.id}";
|
|
||||||
$.ajax({
|
|
||||||
type:"post",
|
|
||||||
url:"{:url('article/download')}",
|
|
||||||
data:{id:id},
|
|
||||||
success:function (data) {
|
|
||||||
location.href = "{:url('article/download',['id'=>$article.id])}";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
|
|
||||||
$('.detail-body').each(function(){
|
|
||||||
var othis = $(this), html = othis.html();
|
|
||||||
othis.html(fly.content(html));
|
|
||||||
});
|
|
||||||
//加载播放器
|
|
||||||
plyr.setup();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
//扫码阅读
|
|
||||||
$("#rdown").hover(function(){
|
|
||||||
$("#phonedl").show().stop();
|
|
||||||
},function(){
|
|
||||||
$("#phonedl").hide().stop();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#phonedl").hover(function(){
|
|
||||||
$("#phonedl").show().stop();
|
|
||||||
},function(){
|
|
||||||
$("#phonedl").hide().stop();
|
|
||||||
});
|
|
||||||
|
|
||||||
function PhoneDown(){
|
|
||||||
layer.open({
|
|
||||||
title: "扫码查阅",
|
|
||||||
skin: 'layui-layer',
|
|
||||||
content: "<img src='/qrcode/?text={$Request.domain}{:url('article/detail',['id' => $article.id])}&size=230'>"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//推送百度收录服务
|
|
||||||
(function(){
|
|
||||||
var bp = document.createElement('script');
|
|
||||||
var curProtocol = window.location.protocol.split(':')[0];
|
|
||||||
if (curProtocol === 'https') {
|
|
||||||
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
|
|
||||||
}
|
|
||||||
var s = document.getElementsByTagName("script")[0];
|
|
||||||
s.parentNode.insertBefore(bp, s);
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
{/block}
|
|
Loading…
Reference in New Issue
Block a user