Skip to content

Commit

Permalink
评论 update
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangjiu committed Jul 21, 2016
1 parent ab601e5 commit 341c48a
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 23 deletions.
20 changes: 13 additions & 7 deletions FE/src/components/Comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@

<p class="comment-item-content">{{item.content}}</p>
<div class="comment-item-reply-wrapper">
<a @click="reply" class="comment-item-reply" data-id="{{item.objectId}}">回复</a>
<a @click="reply(item.objectId, item.name)" class="comment-item-reply">回复</a>
</div>
</li>
</ul>
<a name="firstAnchor"></a>
<h1 id="comment-form-title">回复{{replyName}}</h1>
<div class="comment-form">
<input v-model="formName" class="comment-form-name" type="text" placeholder="昵称" maxlength="20">
Expand Down Expand Up @@ -64,10 +65,10 @@
finalCommentsList () {
return this.commentsList.map((item, index, arr) => {
if (item.reply) {
const objectId = item.reply
const replyToId = item.reply
let obj = {}
let reply = arr.find(data => data.objectId === objectId)
obj.objectId = objectId
let reply = arr.find(data => data.objectId === replyToId)
obj.objectId = item.objectId
obj.name = item.name
obj.createdAt = item.createdAt
obj.content = item.content
Expand All @@ -82,7 +83,7 @@
methods: {
submit () {
if (!this.formName || !this.formContent) {
console.log('昵称和内容不可为空')
window.alert('昵称和内容不可为空')
return
}
const data = {
Expand All @@ -94,9 +95,14 @@
this.submitComment(data)
this.formName = ''
this.formContent = ''
this.replyName = ''
this.formReply = ''
},
reply () {
reply (replyToId, replyToName) {
this.replyName = replyToName
window.location.hash = ''
window.location.hash = 'firstAnchor'
this.formReply = replyToId
}
}
}
Expand Down
10 changes: 6 additions & 4 deletions FE/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'
import FastClick from 'fastclick'

// 注册两个插件
Vue.use(VueResource)
Vue.use(VueRouter)
Vue.http.options.emulateJSON = true

FastClick.attach(window.document.body)

const router = new VueRouter()
const router = new VueRouter({
history: true,
hashbang: false
})

const FastClick = require('fastclick')
FastClick.attach(document.body)
// 路由map
router.map({
'/home': {
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=keywords content=将就,博客,前端,vue.js,北邮,健身><meta name=description content=将就的个人博客,byr/前端/健身><meta name=robots content=all><meta name=viewport content="width=device-width,initial-scale=1"><meta name=author content=将就,1021808625@qq.com><meta name=copyright content=将就><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><title>将就的博客</title><link rel="shortcut icon" href=/favicon.ico><link href=/static/css/app.432002a5bdded1c1ed08e28d7253f640.css rel=stylesheet></head><body><div id=app><app></app></div><script type=text/javascript src=/static/js/manifest.f1dce1281784aeff3fbe.js></script><script type=text/javascript src=/static/js/vendor.841e39b1278f82b1c77e.js></script><script type=text/javascript src=/static/js/app.afbf9e9cc0ec46c28212.js></script></body></html>
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=keywords content=将就,博客,前端,vue.js,北邮,健身><meta name=description content=将就的个人博客,byr/前端/健身><meta name=robots content=all><meta name=viewport content="width=device-width,initial-scale=1"><meta name=author content=将就,1021808625@qq.com><meta name=copyright content=将就><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><title>将就的博客</title><link rel="shortcut icon" href=/favicon.ico><link href=/static/css/app.432002a5bdded1c1ed08e28d7253f640.css rel=stylesheet></head><body><div id=app><app></app></div><script type=text/javascript src=/static/js/manifest.5891583e7a0d74a1faaf.js></script><script type=text/javascript src=/static/js/vendor.841e39b1278f82b1c77e.js></script><script type=text/javascript src=/static/js/app.aa72a998d7461116ba30.js></script></body></html>
3 changes: 0 additions & 3 deletions public/static/js/0.61c5b0a293fa9bf95376.js

This file was deleted.

1 change: 0 additions & 1 deletion public/static/js/0.61c5b0a293fa9bf95376.js.map

This file was deleted.

3 changes: 3 additions & 0 deletions public/static/js/0.a80975fe32ba187b194b.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/static/js/0.a80975fe32ba187b194b.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions public/static/js/app.aa72a998d7461116ba30.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/static/js/app.aa72a998d7461116ba30.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions public/static/js/app.afbf9e9cc0ec46c28212.js

This file was deleted.

1 change: 0 additions & 1 deletion public/static/js/app.afbf9e9cc0ec46c28212.js.map

This file was deleted.

Loading

0 comments on commit 341c48a

Please sign in to comment.