@@ -95,6 +110,19 @@
var upload = layui.upload;
var element = layui.element;
+ // 页面加载时检查转载状态
+ var isTrans = '{$info.is_trans|default="否"}';
+ if(isTrans === '是') {
+ $('#transUrlItem').show();
+ } else {
+ $('#transUrlItem').hide();
+ }
+
+ // 监听转载开关
+ form.on('switch(isTrans)', function (data) {
+ $('#transUrlItem')[data.elem.checked ? 'show' : 'hide']();
+ });
+
// 图片上传
var uploadInst = upload.render({
elem: '#upload-btn',
@@ -202,7 +230,7 @@
{include file="component/foot" /}
\ No newline at end of file
diff --git a/public/static/css/style.css b/public/static/css/style.css
index 95afb49..c579466 100644
--- a/public/static/css/style.css
+++ b/public/static/css/style.css
@@ -211,7 +211,8 @@ pre code {
position: relative;
}
-.main-menu .container .main-menu__right .layui-btn-primary:hover,.sticky-nav .container .main-menu__right .layui-btn-primary:hover {
+.main-menu .container .main-menu__right .layui-btn-primary:hover,
+.sticky-nav .container .main-menu__right .layui-btn-primary:hover {
color: #3492ed;
}
@@ -326,7 +327,6 @@ pre code {
/* 轮播动画 */
@keyframes slide {
-
0%,
33% {
transform: translateX(0);
@@ -576,4 +576,66 @@ pre code {
.game-content img {
width: 100%;
margin: 20px auto;
-}
\ No newline at end of file
+}
+
+.article-detail-container {
+}
+
+.article-detail-container .article-header .trans {
+ margin-bottom: 10px;
+ color: #aaa;
+ font-size: 12px;
+}
+
+.article-detail-container .article-content h1,
+.article-detail-container .article-content h2,
+.article-detail-container .article-content h3,
+.article-detail-container .article-content h4,
+.article-detail-container .article-content h5 {
+ font-weight: 700;
+ margin-bottom: 20px;
+}
+
+.article-detail-container .article-content h1 {
+ font-size: 2rem;
+}
+
+.article-detail-container .article-content h2 {
+ font-size: 1.75rem;
+}
+
+.article-detail-container .article-content h3 {
+ font-size: 1.45rem;
+}
+
+.article-detail-container .article-content h4 {
+ font-size: 1.25rem;
+}
+
+.article-detail-container .article-content h5 {
+ font-size: 1rem;
+}
+
+.article-detail-container .article-content video {
+ width: 100%;
+ margin: 10px auto;
+}
+
+.article-detail-container .article-content span {
+ margin: 0 5px;
+ padding: 2px 6px;
+ border-radius: 4px;
+}
+
+.article-detail-container .article-content pre {
+ margin-bottom: 2.5rem;
+}
+
+.article-detail-container .article-content pre code {
+ white-space: pre-wrap;
+ word-wrap: break-word;
+}
+
+.article-detail-container .article-content hr {
+ margin: 40px auto;
+}
diff --git a/public/static/layui/css/layui.css b/public/static/layui/css/layui.css
index b0f7e66..b36a729 100644
--- a/public/static/layui/css/layui.css
+++ b/public/static/layui/css/layui.css
@@ -2095,7 +2095,7 @@ a cite {
margin-bottom: 10px;
padding: 15px;
line-height: 1.8;
- border-left: 5px solid #16b777;
+ border-left: 5px solid #0081ff;
border-radius: 0 2px 2px 0;
background-color: #fafafa
}
@@ -2150,7 +2150,7 @@ a cite {
height: 6px;
border-radius: 20px;
text-align: right;
- background-color: #16b777;
+ background-color: #0081ff;
transition: all .3s;
-webkit-transition: all .3s
}
@@ -2685,7 +2685,7 @@ hr.layui-border-red {
}
.layui-btn-checked {
- background-color: #16b777
+ background-color: #0081ff
}
.layui-btn-disabled,
@@ -2803,7 +2803,7 @@ hr.layui-border-red {
.layui-input:focus,
.layui-textarea:focus {
- border-color: #16b777 !important;
+ border-color: #0081ff !important;
box-shadow: 0 0 0 3px rgba(22, 183, 119, .08)
}
@@ -3020,7 +3020,7 @@ hr.layui-border-red {
}
.layui-input-wrap .layui-input:focus+.layui-input-split {
- border-color: #16b777
+ border-color: #0081ff
}
.layui-input-wrap .layui-input.layui-form-danger:focus+.layui-input-split {
@@ -3186,7 +3186,7 @@ hr.layui-border-red {
.layui-form-select dl dd.layui-this {
background-color: #f8f8f8;
- color: #16b777;
+ color: #0081ff;
font-weight: 700
}
@@ -3305,17 +3305,17 @@ hr.layui-border-red {
.layui-form-checked,
.layui-form-checked:hover {
- border-color: #16b777
+ border-color: #0081ff
}
.layui-form-checked:hover>div,
.layui-form-checked>div {
- background-color: #16b777
+ background-color: #0081ff
}
.layui-form-checked:hover>i,
.layui-form-checked>i {
- color: #16b777
+ color: #0081ff
}
.layui-form-item .layui-form-checkbox {
@@ -3366,13 +3366,13 @@ hr.layui-border-red {
}
.layui-form-checkbox[lay-skin=primary]:hover>i {
- border-color: #16b777;
+ border-color: #0081ff;
color: #fff
}
.layui-form-checked[lay-skin=primary]>i {
- border-color: #16b777 !important;
- background-color: #16b777;
+ border-color: #0081ff !important;
+ background-color: #0081ff;
color: #fff
}
@@ -3394,7 +3394,7 @@ hr.layui-border-red {
}
.layui-form-checkbox[lay-skin=primary]>.layui-icon-indeterminate {
- border-color: #16b777
+ border-color: #0081ff
}
.layui-form-checkbox[lay-skin=primary]>.layui-icon-indeterminate:before {
@@ -3405,7 +3405,7 @@ hr.layui-border-red {
width: 50%;
height: 1px;
margin: -1px auto 0;
- background-color: #16b777
+ background-color: #0081ff
}
.layui-form-switch {
@@ -3450,8 +3450,8 @@ hr.layui-border-red {
}
.layui-form-onswitch {
- border-color: #16b777;
- background-color: #16b777
+ border-color: #0081ff;
+ background-color: #0081ff
}
.layui-form-onswitch>i {
@@ -3551,7 +3551,7 @@ hr.layui-border-red {
.layui-form-radio:hover>*,
.layui-form-radioed,
.layui-form-radioed>i {
- color: #16b777
+ color: #0081ff
}
.layui-radio-disabled>i {
@@ -4083,7 +4083,7 @@ hr.layui-border-red {
width: 100%;
height: 100%;
box-sizing: border-box;
- border: 1px solid #16b777;
+ border: 1px solid #0081ff;
pointer-events: none;
content: ""
}
@@ -4517,7 +4517,7 @@ hr.layui-border-red {
}
.layui-table-edit:focus {
- border-color: #16b777 !important
+ border-color: #0081ff !important
}
input.layui-input.layui-table-edit {
@@ -4609,7 +4609,7 @@ select.layui-table-edit {
}
.layui-table-cell-c:hover {
- border-color: #16b777
+ border-color: #0081ff
}
.layui-table-expanded td:hover .layui-table-cell {
@@ -4874,12 +4874,12 @@ body .layui-table-tips .layui-layer-content {
.layui-menu .layui-menu-item-checked,
.layui-menu .layui-menu-item-checked2 {
background-color: #f8f8f8 !important;
- color: #16b777
+ color: #0081ff
}
.layui-menu .layui-menu-item-checked a,
.layui-menu .layui-menu-item-checked2 a {
- color: #16b777
+ color: #0081ff
}
.layui-menu .layui-menu-item-checked:after {
@@ -4887,7 +4887,7 @@ body .layui-table-tips .layui-layer-content {
right: -1px;
top: 0;
bottom: 0;
- border-right: 3px solid #16b777;
+ border-right: 3px solid #0081ff;
content: ""
}
@@ -4964,7 +4964,7 @@ body .layui-table-tips .layui-layer-content {
.layui-menu-lg .layui-menu-body-title a:hover,
.layui-menu-lg li:hover {
background: 0 0;
- color: #16b777
+ color: #0081ff
}
.layui-menu-lg li .layui-menu-body-panel {
@@ -5220,7 +5220,7 @@ body .layui-table-tips .layui-layer-content {
top: 0;
width: 0;
height: 3px;
- background-color: #16b777;
+ background-color: #0081ff;
transition: all .2s;
-webkit-transition: all .2s;
pointer-events: none
@@ -5434,7 +5434,7 @@ body .layui-table-tips .layui-layer-content {
}
.layui-nav.layui-bg-gray .layui-this a {
- color: #16b777
+ color: #0081ff
}
.layui-nav-tree.layui-bg-gray .layui-nav-child {
@@ -5447,12 +5447,12 @@ body .layui-table-tips .layui-layer-content {
.layui-nav-tree.layui-bg-gray .layui-this,
.layui-nav-tree.layui-bg-gray .layui-this>a {
background: 0 0 !important;
- color: #16b777 !important;
+ color: #0081ff !important;
font-weight: 700
}
.layui-nav-tree.layui-bg-gray .layui-nav-bar {
- background-color: #16b777
+ background-color: #0081ff
}
.layui-breadcrumb {
@@ -5469,7 +5469,7 @@ body .layui-table-tips .layui-layer-content {
}
.layui-breadcrumb a:hover {
- color: #16b777 !important
+ color: #0081ff !important
}
.layui-breadcrumb a cite {
@@ -5645,7 +5645,7 @@ body .layui-table-tips .layui-layer-content {
.layui-tab-brief>.layui-tab-title .layui-this:after {
border: none;
border-radius: 0;
- border-bottom: 2px solid #16b777
+ border-bottom: 2px solid #0081ff
}
.layui-tab-card {
@@ -5684,7 +5684,7 @@ body .layui-table-tips .layui-layer-content {
.layui-tab-card>.layui-tab-more .layui-this {
background: 0 0;
- color: #16b777
+ color: #0081ff
}
.layui-tab-card>.layui-tab-more .layui-this:after {
@@ -5709,7 +5709,7 @@ body .layui-table-tips .layui-layer-content {
height: 20px;
line-height: 20px;
background-color: #fff;
- color: #16b777;
+ color: #0081ff;
border-radius: 50%;
text-align: center;
cursor: pointer
@@ -6221,8 +6221,8 @@ body .layui-util-face .layui-layer-content {
display: block;
margin: 0;
padding: 0 15px;
- background-color: #16b777;
- border-color: #16b777;
+ background-color: #0081ff;
+ border-color: #0081ff;
color: #fff
}
@@ -7322,7 +7322,7 @@ html #layuicss-skincodecss {
}
.layui-code-fixbar>span:hover {
- color: #16b777
+ color: #0081ff
}
.layui-code-copy {
@@ -7412,7 +7412,7 @@ html #layuicss-skincodecss {
}
.layui-code-tools>i:hover {
- color: #16b777
+ color: #0081ff
}
.layui-code-full {
@@ -7699,7 +7699,7 @@ html #layuicss-laydate {
}
.layui-laydate-footer span:hover {
- color: #16b777
+ color: #0081ff
}
.layui-laydate-footer span.layui-laydate-preview {
@@ -7883,7 +7883,7 @@ html #layuicss-laydate {
.layui-laydate-header i:hover,
.layui-laydate-header span:hover {
- color: #16b777
+ color: #0081ff
}
.layui-laydate-content {
@@ -7900,7 +7900,7 @@ html #layuicss-laydate {
}
.layui-laydate-content td.laydate-day-now {
- color: #16b777
+ color: #0081ff
}
.layui-laydate-content td.laydate-day-now:after {
@@ -7910,7 +7910,7 @@ html #layuicss-laydate {
height: 30px;
left: 0;
top: 0;
- border: 1px solid #16b777;
+ border: 1px solid #0081ff;
box-sizing: border-box
}
@@ -7970,7 +7970,7 @@ html #layuicss-laydate {
}
.laydate-day-mark::after {
- background-color: #16b777
+ background-color: #0081ff
}
.layui-laydate-content td.layui-this .laydate-day-mark::after {
@@ -7978,12 +7978,12 @@ html #layuicss-laydate {
}
.layui-laydate-footer span[lay-type=date] {
- color: #16b777
+ color: #0081ff
}
.layui-laydate .layui-this,
.layui-laydate .layui-this>div {
- background-color: #16b777 !important;
+ background-color: #0081ff !important;
color: #fff !important
}
@@ -8832,7 +8832,7 @@ html #layuicss-layer {
}
.layui-layer-dialog .layui-layer-content .layui-icon-success {
- color: #16b777
+ color: #0081ff
}
.layui-layer-dialog .layui-layer-content .layui-icon-error {
@@ -8853,7 +8853,7 @@ html #layuicss-layer {
}
.layui-layer-dialog .layui-layer-content .layui-icon-face-smile {
- color: #16b777
+ color: #0081ff
}
.layui-layer-rim {
diff --git a/runtime/index/temp/745a6917c29d4d1aec94c5bc5dbce0b2.php b/runtime/index/temp/745a6917c29d4d1aec94c5bc5dbce0b2.php
index b43aead..dde5fd7 100644
--- a/runtime/index/temp/745a6917c29d4d1aec94c5bc5dbce0b2.php
+++ b/runtime/index/temp/745a6917c29d4d1aec94c5bc5dbce0b2.php
@@ -1,4 +1,4 @@
-
+
@@ -632,6 +632,7 @@ $loginStatus = [
+
转载至:
@@ -1205,6 +1206,22 @@ $loginStatus = [
} else {
relatedArticles.innerHTML = '
暂无相关文章
';
}
+
+ // 处理转载信息
+ if (data.article.is_trans === 1 && data.article.transurl) {
+ const transDiv = document.getElementById('transDiv');
+ const transUrlSpan = document.getElementById('transUrl');
+
+ transUrlSpan.textContent = data.article.transurl;
+ transDiv.style.display = 'block';
+
+ // 添加点击事件,在新窗口打开原文章
+ transUrlSpan.style.cursor = 'pointer';
+ transUrlSpan.style.color = '#007bff';
+ transUrlSpan.addEventListener('click', function() {
+ window.open(data.article.transurl, '_blank');
+ });
+ }
}
// 页面加载完成后执行
@@ -1222,13 +1239,8 @@ $loginStatus = [
'X-Requested-With': 'XMLHttpRequest'
}
})
- .then(response => {
- // console.log('Response status:', response.status);
- // console.log('Response headers:', response.headers);
- return response.json();
- })
+ .then(response => response.json())
.then(result => {
- // console.log('API response:', result);
if (result.code === 1) {
renderArticleDetail(result.data);
// 更新访问次数
@@ -1240,28 +1252,13 @@ $loginStatus = [
})
.catch(error => {
console.error('获取文章详情失败:', error);
- console.error('Error details:', {
- message: error.message,
- stack: error.stack
- });
alert('获取文章详情失败,请检查网络连接或刷新页面重试');
});
// 点赞功能
const likeBtn = document.getElementById('likeBtn');
if (likeBtn) {
- // 检查是否已经点赞
- if (likeBtn.classList.contains('liked')) {
- likeBtn.style.pointerEvents = 'none'; // 禁用点击
- likeBtn.style.cursor = 'default'; // 改变鼠标样式
- return;
- }
-
likeBtn.addEventListener('click', function () {
- // 立即禁用按钮,防止重复点击
- likeBtn.style.pointerEvents = 'none';
- likeBtn.style.cursor = 'default';
-
fetch('/index/articles/like?id=' + articleId, {
method: 'POST',
headers: {
@@ -1271,26 +1268,19 @@ $loginStatus = [
.then(response => response.json())
.then(data => {
if (data.code === 1) {
- const countElement = document.getElementById('articlesLikes');
+ const countElement = document.getElementById('articleLikes');
if (countElement) {
let count = parseInt(countElement.textContent) || 0;
countElement.textContent = count + 1;
}
- // 添加点赞状态
likeBtn.classList.add('liked');
likeBtn.querySelector('i').style.color = '#f57005';
layer.msg('点赞成功', { icon: 1 });
} else {
- // 如果请求失败,恢复按钮状态
- likeBtn.style.pointerEvents = 'auto';
- likeBtn.style.cursor = 'pointer';
layer.msg('点赞失败:' + data.msg, { icon: 2 });
}
})
.catch(error => {
- // 如果请求失败,恢复按钮状态
- likeBtn.style.pointerEvents = 'auto';
- likeBtn.style.cursor = 'pointer';
console.error('点赞请求失败:', error);
layer.msg('点赞失败,请稍后重试', { icon: 2 });
});
@@ -1299,8 +1289,6 @@ $loginStatus = [
// 返回顶部功能
const goToTop = document.getElementById('goToTop');
-
- // 监听滚动事件
window.addEventListener('scroll', function () {
if (window.pageYOffset > 300) {
goToTop.classList.add('show');
@@ -1309,13 +1297,27 @@ $loginStatus = [
}
});
- // 点击返回顶部
goToTop.addEventListener('click', function () {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
+
+ // 分享功能
+ const shareBtn = document.getElementById('shareBtn');
+ if (shareBtn) {
+ shareBtn.addEventListener('click', function () {
+ const currentUrl = window.location.href;
+ const tempInput = document.createElement('input');
+ tempInput.value = currentUrl;
+ document.body.appendChild(tempInput);
+ tempInput.select();
+ document.execCommand('copy');
+ document.body.removeChild(tempInput);
+ layer.msg('链接已复制到剪贴板', { icon: 1 });
+ });
+ }
});
// 更新文章访问次数
@@ -1332,7 +1334,6 @@ $loginStatus = [
.then(response => response.json())
.then(result => {
if (result.code === 1) {
- // 更新成功,更新页面上的访问次数显示
const viewsElement = document.getElementById('articleViews');
if (viewsElement) {
viewsElement.textContent = result.data.views;
@@ -1343,30 +1344,6 @@ $loginStatus = [
console.error('更新访问次数失败:', error);
});
}
-
- // 分享功能
- const shareBtn = document.getElementById('shareBtn');
- if (shareBtn) {
- shareBtn.addEventListener('click', function () {
- // 获取当前页面URL
- const currentUrl = window.location.href;
-
- // 创建临时输入框
- const tempInput = document.createElement('input');
- tempInput.value = currentUrl;
- document.body.appendChild(tempInput);
-
- // 选择并复制文本
- tempInput.select();
- document.execCommand('copy');
-
- // 移除临时输入框
- document.body.removeChild(tempInput);
-
- // 提示用户复制成功
- alert('链接已复制到剪贴板');
- });
- }
diff --git a/runtime/index/temp/cb3abdcb36407244b9b613766f30573b.php b/runtime/index/temp/cb3abdcb36407244b9b613766f30573b.php
index 420f9e8..1c23971 100644
--- a/runtime/index/temp/cb3abdcb36407244b9b613766f30573b.php
+++ b/runtime/index/temp/cb3abdcb36407244b9b613766f30573b.php
@@ -1,4 +1,4 @@
-
+
@@ -702,7 +702,7 @@ $loginStatus = [
-
更多
+
更多
@@ -723,7 +723,7 @@ $loginStatus = [