Skip to content

Commit

Permalink
style(SPA): ID -> Id
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Dec 13, 2018
1 parent 54bbb40 commit ab5af98
Show file tree
Hide file tree
Showing 19 changed files with 78 additions and 78 deletions.
4 changes: 2 additions & 2 deletions resources/spa/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const cb = amount => { console.log(amount); }
this.$bus.$emit("reward", {
type: "feed",
api,
payload: { feedID },
payload: { feedId },
callback:cb
});
```
Expand All @@ -124,7 +124,7 @@ const cb = () => { console.log("success"); }
this.$bus.$emit("applyTop", {
type: "",
api,
payload: { feedID },
payload: { feedId },
isOwner: true,
callback: cb
})
Expand Down
2 changes: 1 addition & 1 deletion resources/spa/src/components/ApplyForTop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default {
isOwner: false,
applyType: '', // 申请置顶的类型
applyApi: noop, // 申请置顶的api 类型是一个 Promise 对象
applyPayload: {}, // 申请置顶的负载数据,如feedID等
applyPayload: {}, // 申请置顶的负载数据,如feedId等
applyCallback: noop,
}
},
Expand Down
28 changes: 14 additions & 14 deletions resources/spa/src/components/FeedCard/FeedCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
</div>
<FeedImage
v-if="images.length > 0"
:id="feedID"
:id="feedId"
:pics="images"
/>
<FeedVideo
v-if="video"
:id="feedID"
:id="feedId"
:video="video"
/>
</article>
Expand Down Expand Up @@ -127,7 +127,7 @@ export default {
isMine () {
return this.feed.user_id === this.CURRENTUSER.id
},
feedID () {
feedId () {
return this.feed.id
},
comments: {
Expand Down Expand Up @@ -230,8 +230,8 @@ export default {
},
handleView (hash) {
const path = hash
? `/feeds/${this.feedID}#${hash}`
: `/feeds/${this.feedID}`
? `/feeds/${this.feedId}#${hash}`
: `/feeds/${this.feedId}`
const { paid_node: node } = this.feed
node && !node.paid
? this.$lstore.hasData('H5_ACCESS_TOKEN')
Expand All @@ -257,8 +257,8 @@ export default {
handleLike () {
const method = this.liked ? 'delete' : 'post'
const url = this.liked
? `/feeds/${this.feedID}/unlike`
: `/feeds/${this.feedID}/like`
? `/feeds/${this.feedId}/unlike`
: `/feeds/${this.feedId}/like`
if (this.fetching) return
this.fetching = true
this.$http({
Expand Down Expand Up @@ -293,7 +293,7 @@ export default {
actions.push({
text: '取消收藏',
method: () => {
api.uncollectFeed(this.feedID).then(() => {
api.uncollectFeed(this.feedId).then(() => {
this.$Message.success('取消收藏')
this.has_collect = false
})
Expand All @@ -303,7 +303,7 @@ export default {
actions.push({
text: '收藏',
method: () => {
api.collectionFeed(this.feedID).then(() => {
api.collectionFeed(this.feedId).then(() => {
this.$Message.success('收藏成功')
this.has_collect = true
})
Expand All @@ -327,7 +327,7 @@ export default {
text: '删除',
style: { color: '#f4504d' },
method: () => {
api.deleteFeed(this.feedID).then(() => {
api.deleteFeed(this.feedId).then(() => {
this.$Message.success('删除动态成功')
this.$nextTick(() => {
this.$el.remove()
Expand All @@ -347,7 +347,7 @@ export default {
method: () => {
this.$bus.$emit('report', {
type: 'feed',
payload: this.feedID,
payload: this.feedId,
username: this.user.name,
reference: this.body,
})
Expand All @@ -368,7 +368,7 @@ export default {
isOwner,
type: 'feedComment',
api: api.applyTopFeedComment,
payload: { feedId: this.feedID, commentId: comment.id },
payload: { feedId: this.feedId, commentId: comment.id },
})
},
})
Expand Down Expand Up @@ -408,7 +408,7 @@ export default {
reply_user: replyUser,
}
api
.postComment(this.feedID, params)
.postComment(this.feedId, params)
.then(comment => {
this.commentCount += 1
this.comments.unshift(comment)
Expand All @@ -421,7 +421,7 @@ export default {
})
},
deleteComment (commentId) {
api.deleteFeedComment(this.feedID, commentId).then(() => {
api.deleteFeedComment(this.feedId, commentId).then(() => {
this.feed.comments = this.feed.comments.filter(c => c.id !== commentId)
this.commentCount -= 1
this.$Message.success('删除评论成功')
Expand Down
6 changes: 3 additions & 3 deletions resources/spa/src/components/FeedCard/GroupFeedCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export default {
method: () => {
this.$bus.$emit('report', {
type: 'post',
payload: this.feedID,
payload: this.feedId,
username: this.user.name,
reference: this.title,
})
Expand All @@ -254,7 +254,7 @@ export default {
isOwner,
type: 'postComment',
api: api.applyTopPostComment,
payload: { postId: this.feedID, commentId: comment.id },
payload: { postId: this.feedId, commentId: comment.id },
})
},
})
Expand Down Expand Up @@ -289,7 +289,7 @@ export default {
deleteComment (commentId) {
this.$store
.dispatch('group/deletePostComment', {
postId: this.feedID,
postId: this.feedId,
commentId,
})
.then(() => {
Expand Down
2 changes: 1 addition & 1 deletion resources/spa/src/components/form/FormAvatarItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default {
/**
* 文件类型
* @param {string} type enum{id: FileID, blob: Blob}
* @param {string} type enum{id: FileId, blob: Blob}
*/
type: {
type: String,
Expand Down
14 changes: 7 additions & 7 deletions resources/spa/src/page/UserFans.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</div>
<ul class="m-box m-flex-grow1 m-aln-center m-justify-center m-flex-base0 m-head-nav">
<RouterLink
:to="`/users/${userID}/followers`"
:to="`/users/${userId}/followers`"
tag="li"
active-class="active"
exact
Expand All @@ -17,7 +17,7 @@
<a>粉丝</a>
</RouterLink>
<RouterLink
:to="`/users/${userID}/followings`"
:to="`/users/${userId}/followings`"
tag="li"
active-class="active"
exact
Expand Down Expand Up @@ -65,8 +65,8 @@ export default {
}
},
computed: {
userID () {
return ~~this.$route.params.userID
userId () {
return ~~this.$route.params.userId
},
type () {
return this.$route.params.type
Expand All @@ -75,7 +75,7 @@ export default {
return {
limit: 15,
type: this.type,
uid: this.userID,
uid: this.userId,
}
},
users: {
Expand All @@ -101,13 +101,13 @@ export default {
},
activated () {
// 判断是否清空上一次的数据
if (this.userID !== this.preUID) {
if (this.userId !== this.preUID) {
this.followers = []
this.followings = []
}
this.$refs.loadmore.beforeRefresh()
this.preUID = this.userID
this.preUID = this.userId
},
methods: {
onRefresh () {
Expand Down
20 changes: 10 additions & 10 deletions resources/spa/src/page/UserHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<li
v-for="feed in feeds"
v-if="feed.id"
:key="`ush-${userID}-feed${feed.id}`"
:key="`ush-${userId}-feed${feed.id}`"
>
<FeedCard
:feed="feed"
Expand Down Expand Up @@ -255,12 +255,12 @@ export default {
currentUser () {
return this.$store.state.CURRENTUSER
},
userID () {
userId () {
return ~~this.$route.params.userId
},
user: {
get () {
return this.$store.getters.getUserById(this.userID, true) || {}
return this.$store.getters.getUserById(this.userId, true) || {}
},
set (val) {
this.$store.commit('SAVE_USER', Object.assign(this.user, val))
Expand All @@ -273,7 +273,7 @@ export default {
return this.user.extra || {}
},
isMine () {
return this.userID === this.currentUser.id
return this.userId === this.currentUser.id
},
followersCount () {
return this.extra.followers_count || 0
Expand Down Expand Up @@ -369,7 +369,7 @@ export default {
}
},
activated () {
if (this.preUID !== this.userID) {
if (this.preUID !== this.userId) {
this.loading = true
this.feeds = []
this.tags = []
Expand Down Expand Up @@ -399,7 +399,7 @@ export default {
})
}
this.preUID = this.userID
this.preUID = this.userId
},
deactivated () {
this.loading = true
Expand Down Expand Up @@ -445,13 +445,13 @@ export default {
this.showFilter = false
},
fetchUserInfo () {
api.getUserInfoById(this.userID, true).then(user => {
api.getUserInfoById(this.userId, true).then(user => {
this.user = Object.assign(this.user, user)
this.loading = false
})
},
fetchUserTags () {
this.$http.get(`/users/${this.userID}/tags`).then(({ data = [] }) => {
this.$http.get(`/users/${this.userId}/tags`).then(({ data = [] }) => {
this.tags = data
})
},
Expand All @@ -461,7 +461,7 @@ export default {
const params = {
limit: 15,
type: 'users',
user: this.userID,
user: this.userId,
}
loadmore && (params.after = this.after)
Expand Down Expand Up @@ -536,7 +536,7 @@ export default {
method: () => {
this.$bus.$emit('report', {
type: 'user',
payload: this.userID,
payload: this.userId,
username: this.user.name,
reference: this.user.bio,
})
Expand Down
Loading

0 comments on commit ab5af98

Please sign in to comment.