Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e95d310

Browse files
committed
📝 补充了留言接口
1 parent f06777b commit e95d310

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

‎src/components/Message.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
// console.log(this.form.content+','+this.form.name+","+Date.parse(new Date())/1000);}
5656
this.$http({
5757
method: 'post',
58-
url: 'http://www.bai3.xyz/comment/add',
58+
url: 'http://www.bai3.xyz/api/getlist/',
5959
data:{
6060
"name": this.form.name,
6161
"content": this.form.content

‎src/components/MessageList.vue‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</div>
88
<div class="info" style="display: inline-block">
99
<span style="font-size: 15px;color: #333;">{{todo.name}}</span><br/>
10-
<span style="font-size: 12px;color: #969696;">{{todo.id+"楼."}}{{todo.create_time|data}}</span>
10+
<span style="font-size: 12px;color: #969696;">{{todo.id+"楼."}}{{todo.create_time|date}}</span>
1111
</div>
1212
</div>
1313
{{todo.content}}
@@ -45,22 +45,20 @@ export default {
4545
},
4646
beforeMount: function () {
4747
this.$http("http://www.bai3.xyz/api/getlist/?format=json")
48-
.then(response => {this.comments = response.data.reverse()});
49-
this.$http("http://www.bai3.xyz/api/users/?format=json")
50-
.then(response => {this.result = response.data})
48+
.then(response => {this.comments = response.data});
5149
},
5250
5351
filters: {
5452
// 时间戳过滤器
55-
data: function (input){
56-
var d = new Date(input*1000);
53+
date: function (input){
54+
var d = new Date(Date.parse(input));
5755
var year = d.getFullYear();
5856
var month = d.getMonth() + 1;
5957
var day = d.getDate() <10 ? '0' + d.getDate() : '' + d.getDate();
6058
var hour = d.getHours() <10 ? '0' + d.getHours() : '' + d.getHours();
6159
var minutes = d.getMinutes()<10 ? '0' + d.getMinutes() : '' + d.getMinutes();
6260
var seconds = d.getSeconds()<10 ? '0' + d.getSeconds() : '' + d.getSeconds();
63-
return year+ '.' + month + '.' + day + ' ' + hour + ':' + minutes + ':' + seconds;
61+
return year+ '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds;
6462
}
6563
}
6664
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /