新增rss功能
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<div id="comment">
|
||||
<div id="comment">
|
||||
<section class="">
|
||||
<div class="">
|
||||
|
||||
@@ -70,14 +70,6 @@
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% if Model.Comments.HasPreviousPage %}
|
||||
<a class="enabled current" href="?page={{ Model.Comments.PreviousPage }}">上一页</a>
|
||||
{% endif %}
|
||||
|
||||
{% if Model.Comments.HasNextPage %}
|
||||
<a class="enabled current" href="?page={{ Model.Comments.NextPage }}">下一页</a>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
</section>
|
||||
@@ -91,31 +83,34 @@
|
||||
{% section scripts %}
|
||||
<script>
|
||||
document.getElementById("createComment").addEventListener("click", function(){
|
||||
var nickName = document.getElementsByName('nickName')[0].value;
|
||||
var email = document.getElementsByName('email')[0].value;
|
||||
var content = document.getElementsByName('content')[0].value;
|
||||
var url = document.getElementsByName('url')[0].value;
|
||||
var targetId = document.getElementsByName('targetId')[0].value;
|
||||
axios.post("/comments",{
|
||||
targetId:targetId,
|
||||
nickName:nickName,
|
||||
email: email,
|
||||
content: content,
|
||||
url: url
|
||||
}).catch(function (error) {
|
||||
var errorMessage = "";
|
||||
if (error.response) {
|
||||
if (error.response.status == 422) {
|
||||
const errors = Object.values(error.response.data.errors);
|
||||
const values = Array.from(new Set(errors.flat()));
|
||||
errorMessage = values.join(' ');
|
||||
} else {
|
||||
errorMessage = error.response.data.detail;
|
||||
}
|
||||
} else {
|
||||
errorMessage = "您的请求未能成功处理,可能是服务器开小差了!";
|
||||
}
|
||||
document.getElementById('comment-error').innerHTML = '<p>'+errorMessage+'</p>';
|
||||
var nickName = document.getElementsByName('nickName')[0].value;
|
||||
var email = document.getElementsByName('email').value;
|
||||
var content = document.getElementsByName('content').value;
|
||||
var url = document.getElementsByName('url').value;
|
||||
var targetId = document.getElementsByName('targetId').value;
|
||||
axios.post("/comments",{
|
||||
targetId:targetId,
|
||||
nickName:nickName,
|
||||
email: email,
|
||||
content: content,
|
||||
url: url
|
||||
}).catch(function (error) {
|
||||
var errorMessage = "";
|
||||
if (error.response) {
|
||||
if (error.response.status == 422) {
|
||||
const errors = Object.values(error.response.data.errors);
|
||||
console.log(errors);
|
||||
const values = Array.from(new Set(errors.flat()));
|
||||
console.log(values);
|
||||
errorMessage = values.join(' ');
|
||||
} else {
|
||||
errorMessage = error.response.data.detail;
|
||||
}
|
||||
} else {
|
||||
errorMessage = "您的请求未能成功处理,可能是服务器开小差了!";
|
||||
}
|
||||
document.getElementById('comment-error').innerHTML = '<p>'+errorMessage+'</p>';
|
||||
console.log(errorMessage);
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<span class="footer-item">
|
||||
© {{ "now" | format_date: "yyyy" }}
|
||||
|
||||
<a href="{{ Model.Blog.Url }}" title="{{ Model.Blog.Name }}">{{ Model.Blog.Name }}</a> Powered by <a href="https://blog.yescent.com">Hyrule</a>
|
||||
<a href="{{ Model.Blog.Url }}" title="{{ Model.Blog.Name }}">{{ Model.Blog.Name }}</a> Powered by .NET 8.0
|
||||
</span>
|
||||
<span class="footer-item">
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
{% partial '_SiteCategories' %}
|
||||
{% partial '_Tags' %}
|
||||
{% partial '_Archive' %}
|
||||
{% partial '_Rss' %}
|
||||
|
||||
</div>
|
||||
</main>
|
||||
{% partial '_Footer' %}
|
||||
|
||||
5
Yes.Blog/wwwroot/defaulttheme/_Rss.liquid
Normal file
5
Yes.Blog/wwwroot/defaulttheme/_Rss.liquid
Normal file
@@ -0,0 +1,5 @@
|
||||
<div class="side-tags">
|
||||
<a href="/feed.xml" target="_blank">
|
||||
<i class="i-rss"></i>RSS 订阅
|
||||
</a>
|
||||
</div>
|
||||
@@ -842,7 +842,6 @@ pre .copyCodeButton:hover {
|
||||
#comment-error p{
|
||||
color:#ff0000;
|
||||
font-size:12px;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
|
||||
@@ -875,4 +874,12 @@ pre .copyCodeButton:hover {
|
||||
text-decoration: none;
|
||||
color: var(--color-fg-hyperlink);
|
||||
padding-left:10px;
|
||||
}
|
||||
.i-rss {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: url("../rss.png") no-repeat;
|
||||
margin-right: 8px;
|
||||
vertical-align: sub;
|
||||
}
|
||||
BIN
Yes.Blog/wwwroot/defaulttheme/rss.png
Normal file
BIN
Yes.Blog/wwwroot/defaulttheme/rss.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 324 B |
Reference in New Issue
Block a user