Files
orico-official-website-old/app/mobile/view/article/detail.phtml
2024-10-29 14:04:59 +08:00

275 lines
11 KiB
PHTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/weben/css/cooperation.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/m_web/css/jquery.bxslider.css">
<script type="text/javascript" src="__PUBLIC__/m_web/js/jquery.bxslider.min.js"></script>
{include file="include/head-seo" /}
{include file="include/head" /}
<script type="text/javascript">
var navID = "1";
function shareCustomers(){
// 复制到粘贴板
const input = document.createElement('input')
input.setAttribute('readonly', 'readonly')
let url=window.location.href
input.setAttribute('value', url)
document.body.appendChild(input)
input.select()
if (document.execCommand('copy')) {
document.execCommand('copy')
alert('链接复制成功')
}
document.body.removeChild(input)
} </script>
</head>
<style>
.bx-wrapper {margin-bottom:2rem !important;}
.bx-wrapper .bx-pager, .bx-wrapper .bx-controls-auto {bottom: 0 !important;}
.bx-wrapper .bx-pager.bx-default-pager a {width:10px !important;height:10px !important;color: transparent;margin-right:0.5rem;border-radius: 7px !important;border:none !important;background: #c6ced6; display:inline-block;}
.bx-wrapper .bx-pager.bx-default-pager a.active { background: #004bfa;width: 20px;height: 10px;color: transparent;}
.bx-wrapper .bx-pager {text-align: center;font-size: .85em;font-family: Arial;font-weight: bold;color: #666;padding-top: 20px;}
.slide a {color: #333;}
.slide a:hover {color: #333;}
.slide p {height:32px; overflow: hidden;}
</style>
<body>
<div id="content">
<!--头部-->
{include file="include/top_back1" /}
<!--banner-->
<!-- 详情页 s -->
<div class="content" style="margin-top: 60px;">
<input type="hidden" class="b_id">
<div class="clearfix">
<div class="blog_detail">
<div class="blog_title">
<h2><?php echo $detail['name']; ?></h2>
<p><?php echo date("Y-m-d H:i:s", $detail['createtime']); ?> </p>
</div>
<div class="blog_content">
<?php echo $detail['content']; ?>
</div>
</div>
<div class="share_box">
<div class="blog_share">
<h3>分享</h3>
<ul class="share_list clearfix">
<li><a target="_blank" href="https://weibo.com/"><img src="/frontend/web/images/blog/share1.png"/></a></li>
<li class="wechat"><img src="/frontend/web/images/blog/share2.png"/><div class="wechat_code" ><img src="/frontend/web/images/erweima-blog.png"></div></li>
<li><a target="_blank" href="https://creator.xiaohongshu.com/login?redirectReason=401"><img src="/frontend/web/images/blog/share3.png"/></a></li>
<li><a href="javascript:shareCustomers();" title="submit to reddit"><img src="/frontend/web/images/blog/share4.png"></a></li>
</ul>
</div>
<div class="comment">
<h3>留言</h3>
<form class="comment_form clearfix">
<div style="margin-right: 0.625rem; margin-bottom: 0.5rem;">姓名:<br/>
<input class="form-control itinp new_name" type="text" name="name"/>
</div>
<div>电子邮件:<br/>
<input class="form-control itinp new_email" type="email" name="email" />
<p style="color: #C6C7C9; font-size: 0.75rem; margin-bottom: 0.5rem; ">您的电子邮件地址不会被公开</p>
</div>
<div class="comment_area">留言:<br/>
<textarea class="form-control itinp new_comment" style="height: 3rem;border: 1px solid #DBDBDB;" name="comment"></textarea>
</div>
</form>
<div class="comment_btn" style="color:#ffffff;">提交留言</div>
</div>
<div class="xq">
<div class="swt-Container">
<?php
$articles = getDifferentArticle('default', 3, ['cid' => $detail['cid'], 'id' => ['neq', $detail['id']]]);
if ($articles):
?>
<!-- 猜您喜欢 -->
<div class="love">
<div class="love1">
<p>你可能还喜欢</p>
<p><img src="/frontend/web/images/1line.png"></p>
</div>
<div class="love2 clearfix">
<!--图片滑动-->
<div class="loves">
<?php foreach ($articles as $article): ?>
<?php
if($article['jump_link'] == ''){
$rlink = "__ORICOROOT__/article/detail/".$article['id'].".html";
}
else{
$rlink = $article['jump_link'];
}
?>
<div class="slide">
<a href="<?php echo $rlink; ?>">
<img src="<?php echo getImage($article['picture']); ?>">
<p class="lvtit"><?php echo msubstr($article['name'], 0, 40); ?></p>
</a>
</div>
<?php endforeach; ?>
</div>
<!--图片滑动-->
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
<!--底部-->
{include file="include/bottom1" /}
</div>
</body>
</html>
<input type="hidden" name="content_id" value="<?php echo $detail['id']; ?>">
<script type="text/javascript">
$(function() {
// 提交表单
$('.comment_btn').click(function(){
var new_name = $('.new_name').val();
var new_email = $('.new_email').val();
var new_comment = $('.new_comment').val();
console.log('message');
if (new_name == '') {
//alert("The Name is Empty!");
$('.new_name').addClass('error');
$('.new_name').next('span').removeClass('hide');
return false;
}else{
$('.new_name').removeClass('error');
$('.new_name').next('span').addClass('hide');
}
if (new_comment == '') {
//alert("The Comment is Empty!");
$('.new_comment').addClass('error');
$('.new_comment').next('span').removeClass('hide');
return false;
}else{
$('.new_comment').removeClass('error');
$('.new_comment').next('span').addClass('hide');
}
if (new_email == '') {
$('.new_email').addClass('error');
$('.new_email').next('span').removeClass('hide');
}
else{
if (/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(new_email) == false) {
$('.new_email').addClass('error');
$('.new_email').next('span').removeClass('hide');
return false;
}
else{
$('.new_email').removeClass('error');
$('.new_email').next('span').addClass('hide');
}
}
var bid = "<?php echo $detail['id'];?>";
//点击创建申请块
if(new_name && new_email && new_comment && bid) {
$.ajax({
type: "POST",
url: "/index/article/addcomment",
data: {'name':new_name, 'email':new_email,'comment':new_comment,'article_id':bid},
dataType: "json",
success: function(data){
if(data.code == 200) {
alert("留言提交成功!");
$(".new_name").val("");
$(".new_email").val("");
$(".new_comment").val("");
}
else{
alert(data.msg);
}
}
});
}
})
$(".Release").click(function() {
if (user_data == null) {
alert('请先登录');
window.location.href = "__ORICOROOT__/customer/login";
}
// console.log(user_data);
var customer_id = user_data.user_info.id;
var time = user_data.curr_time;
var token = user_data.token;
var firstname = user_data.user_info.firstname;
var pid = 0; // 暂时是固定的
var cid = $("input[name = 'content_id']").val();
var content = $("#ccont").val();
$.ajax({
url: '__ORICOROOT__/pinglun/add',
type: 'post',
data: {id: customer_id, time: time, token: token, firstname: firstname, pid: pid, cid: cid, typeid: 'Article', content: content},
dataType: 'json',
success: function(res) {
if (res) {
if (res.code == 1) {
// 评论成功
alert(res.msg);
location.reload();
}else if (res.code == -101) {
// token 过期
}else if (res.code == -1) {
alert(res.msg);
}else if (res.code == -2) {
// 前一分钟内评论过
}else if (res.code == -3) {
// 未知错误
}else if (res.code == -4) {
// 表单格式错误
}else if (res.code == -5) {
// 插入数据库失败
}
}
},
});
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$('.loves').bxSlider({
slideWidth: 200,
minSlides: 2,
maxSlides: 2,
infiniteLoop: false,
slideMargin: 10
});
});
</script>