TaoLer/view/taoler/index/article/ask/detail.html

440 lines
17 KiB
HTML
Raw Normal View History

2021-08-03 17:33:48 +08:00
{extend name="public/base" /}
{block name="title"}{$article.title}-{$sysInfo.webname}{/block}
2022-04-17 17:09:19 +08:00
{block name="keywords"}{$article.tags}{/block}
{block name="description"}{$article.title},{$article.description}{/block}
2022-08-02 20:47:28 +08:00
{block name="ogtitle"}<meta property="og:title" content="{$article.title}-{$sysInfo.webname}">{/block}
{block name="ogdescription"}<meta property="og:description" content="{$article.title},{$article.description}" />{/block}
{block name="link"}<link rel="stylesheet" href="{$Request.domain}/static/res/css/plyr.css" charset="utf-8">{/block}
2021-08-03 17:33:48 +08:00
{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">
2021-12-06 15:50:11 +08:00
<div class="layui-col-md9 content detail">
2021-08-03 17:33:48 +08:00
<div class="fly-panel detail-box">
2022-04-17 17:09:19 +08:00
{//标题}
<div class="title layui-clear"><h1 style="color:{$article.title_color};">{$article.title}</h1></div>
<div class="detail_qrcode layui-hide-xs" onclick="PhoneDown();" id="mobile"></div>
{//图标}
<div class="user-questions">
2022-08-02 20:47:28 +08:00
<a class="user-avatar" href="{$Request.domain}{:url('user/home',['id'=>$article.user.id])}">
<img src="{$Request.domain}{$article.user.user_img}" alt="{$article.user.name}">
2022-04-17 17:09:19 +08:00
<cite>{$article.user.nickname ?: $article.user.name} / </cite>
</a>
<span class="user-post-time" data="{$article.create_time}" style="padding-top: 5px;"></span>
/ <i class="iconfont" title="{:lang('reply')}">&#xe60c;</i> {$article.comments_count} / <i class="iconfont" title="浏览">&#xe60b;</i> {$pv}
{if ($article.jie == 0)}
2021-08-03 17:33:48 +08:00
<span class="layui-btn layui-btn-xs" style="background-color: #FF5722;">{:lang('no finished')}</span>
2022-04-17 17:09:19 +08:00
{else /}
2021-08-03 17:33:48 +08:00
<span class="layui-btn layui-btn-xs" style="background-color: #009688;">{:lang('finished')}</span>
2022-04-17 17:09:19 +08:00
{/if}
<span id="LAY_jieAdmin" data-id="{$article['id']}"></span>
</div>
2021-08-03 17:33:48 +08:00
2022-04-17 17:09:19 +08:00
{//管理}
{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 ?? ''))}
2022-08-02 20:47:28 +08:00
<span class="layui-btn layui-btn-xs jie-admin" type="edit"><a href="{$Request.domain}{:url('article/edit',['id'=>$article.id])}">{:lang('edit')}</a></span>
2021-08-03 17:33:48 +08:00
{/if}
</div>
2022-04-17 17:09:19 +08:00
</div>
{/if}
<hr class="layui-border-green">
{//问题内容}
<div style="margin-top: 15px; font-size: 18px; font-weight:bold; color: rgb(130, 125, 125);">问题描述:</div>
<hr>
<div class="detail-body-wenda photos" id="content">{$article.content}</div>
2022-08-02 20:47:28 +08:00
<div style="margin-top: 25px;">本文链接:<a href="{$Request.domain}{$Request.url}">{$Request.domain}{$Request.url}</div>
<div style="margin-top: 15px">
<h2>关键词</h2>
<div class="layui-btn-container" style="padding-top: 15px;">
{volist name="tags" id="vo" }
<button type="button" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-danger" value="{$vo}">{$vo}</button>
{/volist}
</div>
</div>
<div style="margin: 20px 0px 15px 0px; color: rgb(130, 125, 125);">
<p>{$sysInfo.state}</p>
</div>
2021-08-03 17:33:48 +08:00
</div>
2022-04-17 17:09:19 +08:00
{//评论区}
{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>
2021-08-03 17:33:48 +08:00
</div>
2022-04-17 17:09:19 +08:00
<div class="layui-form-item que-comments">
<input type="hidden" name="article_id" value="{$article.id}">
<input type="hidden" name="user_id" value="{:session('user_id')}">
<button class="layui-btn layui-btn-danger" 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}
{//评论内容}
2021-08-03 17:33:48 +08:00
<div class="fly-panel detail-box" id="flyReply">
2022-01-07 14:43:42 +08:00
<span style="font-size:18px;">评论 {$article.comments_count}</span>
2021-08-03 17:33:48 +08:00
<ul class="jieda" id="jieda">
2022-04-17 17:09:19 +08:00
{volist name="comments" id="vo" empty= ""}
2021-08-03 17:33:48 +08:00
<li data-id="{$vo.id}" class="jieda-daan">
<a name="item-1111111111"></a>
<div class="detail-about detail-about-reply">
2022-08-02 20:47:28 +08:00
<a class="fly-avatar" href="{$Request.domain}{:url('user/home',['id'=>$vo.user.id])}">
<img src="{$Request.domain}{$vo.user.user_img}" alt=" ">{if($vo.user.vip > 0)}<i class="iconfont icon-renzheng" title="认证信息"></i>{/if}
2021-08-03 17:33:48 +08:00
</a>
<div class="fly-detail-user">
2022-08-02 20:47:28 +08:00
<a href="{$Request.domain}{:url('user/home',['id'=>$vo.user.id])}" class="fly-link">
2021-08-03 17:33:48 +08:00
<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>
2022-04-17 17:09:19 +08:00
{if $vo.cai == 1}<i class="iconfont icon-caina" title="最佳答案"></i>{/if}
2021-08-03 17:33:48 +08:00
</div>
2021-10-12 16:52:51 +08:00
<div class="detail-body jieda-body photos">{$vo.content}</div>
2021-08-03 17:33:48 +08:00
<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>
2022-04-17 17:09:19 +08:00
{//评论编辑删除采纳权限}
2021-08-03 17:33:48 +08:00
<div class="jieda-admin">
2022-04-17 17:09:19 +08:00
{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}
{if ($vo.cai == 0) && ((session('user_id') == $article.user_id) OR ($user.auth ?? '')) /}
<span class="jieda-accept" type="accept">{:lang('accept')}</span>
{/if}
2021-08-03 17:33:48 +08:00
</div>
</div>
</li>
2022-04-17 17:09:19 +08:00
{/volist}
2021-08-03 17:33:48 +08:00
</ul>
2022-01-07 14:43:42 +08:00
<div style="text-align: center" id="pages"></div>
2021-08-03 17:33:48 +08:00
</div>
</div>
2022-04-17 17:09:19 +08:00
{// 右栏}
2021-12-06 15:50:11 +08:00
<div class="layui-col-md3">
2021-08-03 17:33:48 +08:00
2022-04-17 17:09:19 +08:00
<div class="fly-panel">
<div class="fly-panel-main wenda-user">
<div class="user-img">
2022-08-02 20:47:28 +08:00
<a href="{$Request.domain}{:url('user/home',['id'=>$article.user.id])}">
<img class="" src="{$Request.domain}{$article.user.user_img}" alt="{$article.user.name}">
2022-04-17 17:09:19 +08:00
{if($article.user.vip > 0)}<i class="iconfont icon-renzheng" title="认证信息"></i>{/if}
</a>
</div>
<div class="questions">
<span class="layui-badge layui-bg-green">回答 100</span> <span class="layui-badge layui-bg-green">提问 100</span> <span class="layui-badge layui-bg-green">+ 关注</span>
</div>
2021-08-03 17:33:48 +08:00
</div>
2022-04-17 17:09:19 +08:00
</div>
<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}
2021-08-03 17:33:48 +08:00
</div>
2022-04-17 17:09:19 +08:00
</div>
<dl class="fly-panel fly-list-one">
<dt class="fly-panel-title">{:lang('hot post list')}</dt>
{volist name="artHot" id="vo"}
<dd>
2022-08-02 20:47:28 +08:00
<a href="{$Request.domain}{:url('article/detail',['id' => $vo.id])}">{$vo.title}</a>
2022-04-17 17:09:19 +08:00
<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;">
2021-08-03 17:33:48 +08:00
{volist name="ad_art" id="vo"}
2022-08-02 20:47:28 +08:00
<a href="{$vo.slid_href}" target="_blank"><img src="{$Request.domain}{$vo.slid_img}" style="max-width: 100%;"></a>
2021-08-03 17:33:48 +08:00
{/volist}
2022-04-17 17:09:19 +08:00
</div>
2021-08-03 17:33:48 +08:00
</div>
2022-04-17 17:09:19 +08:00
2021-08-03 17:33:48 +08:00
</div>
2022-04-17 17:09:19 +08:00
<!--底部栏-->
2021-08-03 17:33:48 +08:00
<div class="site-tree-mobile-detail-bottom layui-hide-md">
2022-04-17 17:09:19 +08:00
<div id="LAY_jieAdmin1" data-id="{$article['id']}"></div>
</div>
2021-08-03 17:33:48 +08:00
</div>
{include file="public/menu" /}
{/block}
{block name="script"}
<script>
var collectionFind = "{:url('Collection/find')}",
2021-12-15 15:46:04 +08:00
collection = "{:url('collection/')}",
2021-08-03 17:33:48 +08:00
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')}",
2021-12-15 15:46:04 +08:00
langCollection = "{:lang('collection')}",
langCancelCollection = "{:lang('cancel collection')}";
2021-08-03 17:33:48 +08:00
2021-12-21 16:34:33 +08:00
layui.use(['fly', 'face','colorpicker','plyr', 'laypage'], function(){
2021-08-03 17:33:48 +08:00
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;
2021-12-21 16:34:33 +08:00
var laypage = layui.laypage;
2021-08-03 17:33:48 +08:00
//tpl模板给发布时间赋值
$('div.user-questions').children('span.user-post-time').each(function(){
var othis = $(this), html = othis.html();
2022-04-17 17:09:19 +08:00
var string = laytpl('{{ d.time }}').render({
2021-08-03 17:33:48 +08:00
//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();
2022-04-17 17:09:19 +08:00
var string = laytpl('{{ d.time }}').render({
2021-08-03 17:33:48 +08:00
//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);
2021-12-15 15:46:04 +08:00
var id = "{$article.id}";
2021-08-03 17:33:48 +08:00
$.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});
}
}
});
}
});
2021-12-15 15:46:04 +08:00
//评论需要登陆
form.on('submit(user-comment)',function (data){
var index = layer.load(1);
2021-08-03 17:33:48 +08:00
var filed = data.field;
2021-12-15 15:46:04 +08:00
if (uid == -1) {
2022-04-17 17:09:19 +08:00
layer.msg('请先登陆',{icon:5,time:2000},function(){location.href = "{:url('login/index')}"});
2021-12-15 15:46:04 +08:00
} else {
$.ajax({
type: "post",
url: "{:url('article/comment')}",
data: filed,
dataType: "json",
success:function (data) {
if (data.code == 0) {
2022-04-17 17:09:19 +08:00
layer.msg(data.msg,{icon:6,time:2000},function () {location.reload(true)});
2021-12-15 15:46:04 +08:00
} else {
layer.open({title:'评论失败',content:data.msg,icon:5,anim:6});
}
2021-08-03 17:33:48 +08:00
}
2021-12-15 15:46:04 +08:00
});
}
return false;
});
2021-12-21 16:34:33 +08:00
//执行一个laypage实例
laypage.render({
elem: 'pages' //注意,这里的 test1 是 ID不用加 # 号
2022-01-07 14:43:42 +08:00
,count: "{$article.comments_count}" //数据总数,从服务端得到
2021-12-21 16:34:33 +08:00
,limit: 10
,curr : {$page}
//获取起始页
,jump: function(obj, first){
//首次不执行
if(!first){
var page = obj.curr;
2022-04-17 17:09:19 +08:00
var url = "{:url('article/detail',['id'=>$article.id])}";
2022-01-07 14:43:42 +08:00
var id = "{$article.id}";
2022-01-07 14:45:35 +08:00
$.post("{:url('article/detail')}",{"id":id,"page":page},function(){
2021-12-21 16:34:33 +08:00
window.location.href = url + '?page=' + page + '#flyReply';
});
}
}
});
2021-08-03 17:33:48 +08:00
//下载
2021-12-15 15:46:04 +08:00
$('#zip-download').click(function (){
2021-08-03 17:33:48 +08:00
var id = "{$article.id}";
2021-12-15 15:46:04 +08:00
$.ajax({
type:"post",
url:"{:url('article/download')}",
data:{id:id},
success:function (data) {
location.href = "{:url('article/download',['id'=>$article.id])}";
}
2021-08-03 17:33:48 +08:00
});
2021-12-15 15:46:04 +08:00
});
2021-08-03 17:33:48 +08:00
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
$('.detail-body-wenda').each(function(){
var othis = $(this), html = othis.html();
othis.html(fly.content(html));
});
2021-10-12 16:52:51 +08:00
2021-08-03 17:33:48 +08:00
$('.detail-body').each(function(){
var othis = $(this), html = othis.html();
othis.html(fly.content(html));
});
2021-10-12 16:52:51 +08:00
2021-08-03 17:33:48 +08:00
//加载播放器
plyr.setup();
});
2021-10-12 16:52:51 +08:00
</script>
2022-04-17 17:09:19 +08:00
2022-04-17 17:05:20 +08:00
<script type="text/javascript">
2022-04-17 17:09:19 +08:00
// 点击图片放大
2022-04-17 17:05:20 +08:00
$(function(){
$(".photos").on("click","img",function(){
var _this = $(this);
console.log(_this);
imgShow("#outerdiv", "#innerdiv", "#bigimg", _this);
});
});
function imgShow(outerdiv, innerdiv, bigimg, _this){
var src = _this.attr("src");
$(bigimg).attr("src", src);
$("<img/>").attr("src", src).on("load",function(){
var windowW = $(window).width();
var windowH = $(window).height();
var realWidth = this.width;
var realHeight = this.height;
var imgWidth, imgHeight;
var scale = 0.8;
if(realHeight>windowH*scale) {
//判断图片高度
imgHeight = windowH*scale;
imgWidth = imgHeight/realHeight*realWidth;
if(imgWidth>windowW*scale) {
//如宽度扔大于窗口宽度
imgWidth = windowW*scale;
}
} else if(realWidth>windowW*scale) {
imgWidth = windowW*scale;
imgHeight = imgWidth/realWidth*realHeight;
} else {
//如果图片真实高度和宽度都符合要求,高宽不变
imgWidth = realWidth;
imgHeight = realHeight;
}
$(bigimg).css("width",imgWidth);
var w = (windowW-imgWidth)/2;
var h = (windowH-imgHeight)/2;
$(innerdiv).css({"top":h, "left":w});
$(outerdiv).fadeIn("fast");
});
$(outerdiv).click(function(){
//再次点击淡出消失弹出层
$(this).fadeOut("fast");
});
}
</script>
<div id="outerdiv" style="position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);z-index:2;width:100%;height:100%;display:none;">
<div id="innerdiv" style="position:absolute;">
<img id="bigimg" style="border:5px solid #fff;" src="" />
</div>
2021-10-12 16:52:51 +08:00
{:hook('markdownhook')}
2021-08-03 17:33:48 +08:00
2021-10-12 16:52:51 +08:00
<script>
2021-08-03 17:33:48 +08:00
//扫码阅读
$("#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'>"
});
}
</script>
2021-10-12 16:52:51 +08:00
2022-08-02 18:46:05 +08:00
{volist name="push_js" id="vo"}
{$vo.jscode|raw}
{/volist}
2021-08-03 17:33:48 +08:00
{/block}