From ab5af98665f83314324b198595c08f8e5a4b2469 Mon Sep 17 00:00:00 2001 From: mutoe Date: Thu, 13 Dec 2018 14:14:39 +0800 Subject: [PATCH] style(SPA): ID -> Id --- resources/spa/CONTRIBUTING.md | 4 +-- resources/spa/src/components/ApplyForTop.vue | 2 +- .../spa/src/components/FeedCard/FeedCard.vue | 28 +++++++-------- .../src/components/FeedCard/GroupFeedCard.vue | 6 ++-- .../src/components/form/FormAvatarItem.vue | 2 +- resources/spa/src/page/UserFans.vue | 14 ++++---- resources/spa/src/page/UserHome.vue | 20 +++++------ resources/spa/src/page/feed/FeedDetail.vue | 34 +++++++++---------- .../message/children/comments/feedItem.vue | 4 +-- .../children/comments/groupPostItem.vue | 4 +-- .../message/children/comments/newsItem.vue | 4 +-- .../message/children/comments/productItem.vue | 4 +-- .../children/comments/questionAnswerItem.vue | 4 +-- .../children/comments/questionItem.vue | 4 +-- .../spa/src/page/message2/chat/chat-room.vue | 2 +- resources/spa/src/page/news/NewsDetail.vue | 14 ++++---- resources/spa/src/routers/base.js | 2 +- resources/spa/src/routers/feed.js | 2 +- resources/spa/src/routers/message.js | 2 +- 19 files changed, 78 insertions(+), 78 deletions(-) diff --git a/resources/spa/CONTRIBUTING.md b/resources/spa/CONTRIBUTING.md index a6fb7a3dd..5917ab05b 100644 --- a/resources/spa/CONTRIBUTING.md +++ b/resources/spa/CONTRIBUTING.md @@ -99,7 +99,7 @@ const cb = amount => { console.log(amount); } this.$bus.$emit("reward", { type: "feed", api, - payload: { feedID }, + payload: { feedId }, callback:cb }); ``` @@ -124,7 +124,7 @@ const cb = () => { console.log("success"); } this.$bus.$emit("applyTop", { type: "", api, - payload: { feedID }, + payload: { feedId }, isOwner: true, callback: cb }) diff --git a/resources/spa/src/components/ApplyForTop.vue b/resources/spa/src/components/ApplyForTop.vue index 7687db11a..fcc54640d 100644 --- a/resources/spa/src/components/ApplyForTop.vue +++ b/resources/spa/src/components/ApplyForTop.vue @@ -106,7 +106,7 @@ export default { isOwner: false, applyType: '', // 申请置顶的类型 applyApi: noop, // 申请置顶的api 类型是一个 Promise 对象 - applyPayload: {}, // 申请置顶的负载数据,如feedID等 + applyPayload: {}, // 申请置顶的负载数据,如feedId等 applyCallback: noop, } }, diff --git a/resources/spa/src/components/FeedCard/FeedCard.vue b/resources/spa/src/components/FeedCard/FeedCard.vue index 1722a77b7..af7a20585 100644 --- a/resources/spa/src/components/FeedCard/FeedCard.vue +++ b/resources/spa/src/components/FeedCard/FeedCard.vue @@ -26,12 +26,12 @@ @@ -127,7 +127,7 @@ export default { isMine () { return this.feed.user_id === this.CURRENTUSER.id }, - feedID () { + feedId () { return this.feed.id }, comments: { @@ -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') @@ -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({ @@ -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 }) @@ -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 }) @@ -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() @@ -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, }) @@ -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 }, }) }, }) @@ -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) @@ -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('删除评论成功') diff --git a/resources/spa/src/components/FeedCard/GroupFeedCard.vue b/resources/spa/src/components/FeedCard/GroupFeedCard.vue index e59e4455a..76e9252b0 100644 --- a/resources/spa/src/components/FeedCard/GroupFeedCard.vue +++ b/resources/spa/src/components/FeedCard/GroupFeedCard.vue @@ -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, }) @@ -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 }, }) }, }) @@ -289,7 +289,7 @@ export default { deleteComment (commentId) { this.$store .dispatch('group/deletePostComment', { - postId: this.feedID, + postId: this.feedId, commentId, }) .then(() => { diff --git a/resources/spa/src/components/form/FormAvatarItem.vue b/resources/spa/src/components/form/FormAvatarItem.vue index 8835dacaf..69dc1cd49 100644 --- a/resources/spa/src/components/form/FormAvatarItem.vue +++ b/resources/spa/src/components/form/FormAvatarItem.vue @@ -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, diff --git a/resources/spa/src/page/UserFans.vue b/resources/spa/src/page/UserFans.vue index 65c8fa5f3..6a2451ce0 100644 --- a/resources/spa/src/page/UserFans.vue +++ b/resources/spa/src/page/UserFans.vue @@ -8,7 +8,7 @@
    粉丝 { + 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 }) }, @@ -461,7 +461,7 @@ export default { const params = { limit: 15, type: 'users', - user: this.userID, + user: this.userId, } loadmore && (params.after = this.after) @@ -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, }) diff --git a/resources/spa/src/page/feed/FeedDetail.vue b/resources/spa/src/page/feed/FeedDetail.vue index a5cb73292..9ea294b70 100644 --- a/resources/spa/src/page/feed/FeedDetail.vue +++ b/resources/spa/src/page/feed/FeedDetail.vue @@ -150,8 +150,8 @@ export default { allowReward () { return this.$store.state.CONFIG.site.reward.status }, - feedID () { - return this.$route.params.feedID + feedId () { + return this.$route.params.feedId }, video () { return this.feed.video @@ -266,7 +266,7 @@ export default { } }, activated () { - if (this.feedID) { + if (this.feedId) { this.comments = [] this.feed = {} this.rewardList = [] @@ -315,7 +315,7 @@ export default { const signUrl = this.$store.state.BROWSER.OS === 'IOS' ? window.initUrl : shareUrl this.$http - .get(`/feeds/${this.feedID}`) + .get(`/feeds/${this.feedId}`) .then(({ data = {} }) => { this.feed = data this.fetching = false @@ -356,7 +356,7 @@ export default { if (this.fetchComing) return this.fetchComing = true api - .getFeedComments(this.feedID, { after }) + .getFeedComments(this.feedId, { after }) .then(({ data: { pinneds = [], comments = [] } }) => { if (!after) { this.pinnedCom = pinneds @@ -383,12 +383,12 @@ export default { }) }, async fetchFeedRewards () { - const { data: list } = await api.getRewards(this.feedID, { limit: 10 }) + const { data: list } = await api.getRewards(this.feedId, { limit: 10 }) this.rewardList = list this.$store.commit('SAVE_ARTICLE', { type: 'likers', list }) }, async fetchFeedLikers () { - const { data: list } = await api.getFeedLikers(this.feedID, { limit: 5 }) + const { data: list } = await api.getFeedLikers(this.feedId, { limit: 5 }) this.feed.likes = list this.$store.commit('SAVE_ARTICLE', { type: 'likers', list }) }, @@ -398,8 +398,8 @@ export default { likeFeed () { 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({ @@ -454,11 +454,11 @@ export default { if (this.has_collect) { txt = '取消收藏' method = 'delete' - url = `/feeds/${this.feedID}/uncollect` + url = `/feeds/${this.feedId}/uncollect` } else { txt = '已加入我的收藏' method = 'post' - url = `/feeds/${this.feedID}/collections` + url = `/feeds/${this.feedId}/collections` } this.$http({ @@ -481,7 +481,7 @@ export default { this.$bus.$emit('applyTop', { type: 'feed', api: api.applyTopFeed, - payload: this.feedID, + payload: this.feedId, }) }, }, @@ -494,7 +494,7 @@ export default { text: '删除', style: { color: '#f4504d' }, method: () => { - api.deleteFeed(this.feedID).then(() => { + api.deleteFeed(this.feedId).then(() => { this.$Message.success('删除动态成功') this.goBack() }) @@ -517,7 +517,7 @@ export default { method: () => { this.$bus.$emit('report', { type: 'feed', - payload: this.feedID, + payload: this.feedId, username: this.user.name, reference: this.feed.feed_content, }) @@ -539,7 +539,7 @@ export default { isOwner, type: 'feedComment', api: api.applyTopFeedComment, - payload: { feedId: this.feedID, commentId: comment.id }, + payload: { feedId: this.feedId, commentId: comment.id }, callback: this.fetchFeedComments, }) }, @@ -580,7 +580,7 @@ export default { params.body = body replyUser && (params['reply_user'] = replyUser) this.$http - .post(`/feeds/${this.feedID}/comments`, params, { + .post(`/feeds/${this.feedId}/comments`, params, { validateStatus: s => s === 201, }) .then(({ data: { comment } = { comment: {} } }) => { @@ -598,7 +598,7 @@ export default { } }, deleteComment (commentId) { - api.deleteFeedComment(this.feedID, commentId).then(() => { + api.deleteFeedComment(this.feedId, commentId).then(() => { this.fetchFeedComments() this.commentCount -= 1 this.$Message.success('删除评论成功') diff --git a/resources/spa/src/page/message/children/comments/feedItem.vue b/resources/spa/src/page/message/children/comments/feedItem.vue index c47c34d44..a39406616 100644 --- a/resources/spa/src/page/message/children/comments/feedItem.vue +++ b/resources/spa/src/page/message/children/comments/feedItem.vue @@ -155,12 +155,12 @@ export default { }, sendComment (comment) { - const { commentable_id: feedId = 0, user_id: userID = 0 } = this.comment + const { commentable_id: feedId = 0, user_id: userId = 0 } = this.comment this.$http .post( `/feeds/${feedId}/comments`, { - reply_user: userID, + reply_user: userId, body: comment, }, { diff --git a/resources/spa/src/page/message/children/comments/groupPostItem.vue b/resources/spa/src/page/message/children/comments/groupPostItem.vue index 16431c1e4..49364be79 100644 --- a/resources/spa/src/page/message/children/comments/groupPostItem.vue +++ b/resources/spa/src/page/message/children/comments/groupPostItem.vue @@ -108,12 +108,12 @@ export default { }, sendComment (comment) { - const { commentable_id: postId = 0, user_id: userID = 0 } = this.comment + const { commentable_id: postId = 0, user_id: userId = 0 } = this.comment this.$http .post( `/group-posts/${postId}/comments`, { - reply_user: userID, + reply_user: userId, body: comment, }, { diff --git a/resources/spa/src/page/message/children/comments/newsItem.vue b/resources/spa/src/page/message/children/comments/newsItem.vue index a91aafd00..7fb788dcb 100644 --- a/resources/spa/src/page/message/children/comments/newsItem.vue +++ b/resources/spa/src/page/message/children/comments/newsItem.vue @@ -123,12 +123,12 @@ export default { }, sendComment (comment) { - const { commentable_id: newsId = 0, user_id: userID = 0 } = this.comment + const { commentable_id: newsId = 0, user_id: userId = 0 } = this.comment this.$http .post( `/news/${newsId}/comments`, { - reply_user: userID, + reply_user: userId, body: comment, }, { diff --git a/resources/spa/src/page/message/children/comments/productItem.vue b/resources/spa/src/page/message/children/comments/productItem.vue index 8072a193e..aaf406619 100644 --- a/resources/spa/src/page/message/children/comments/productItem.vue +++ b/resources/spa/src/page/message/children/comments/productItem.vue @@ -114,12 +114,12 @@ export default { }, sendComment (comment) { - const { commentable_id: newsId = 0, user_id: userID = 0 } = this.comment + const { commentable_id: newsId = 0, user_id: userId = 0 } = this.comment this.$http .post( `/news/${newsId}/comments`, { - reply_user: userID, + reply_user: userId, body: comment, }, { diff --git a/resources/spa/src/page/message/children/comments/questionAnswerItem.vue b/resources/spa/src/page/message/children/comments/questionAnswerItem.vue index 791fc19db..00399f582 100644 --- a/resources/spa/src/page/message/children/comments/questionAnswerItem.vue +++ b/resources/spa/src/page/message/children/comments/questionAnswerItem.vue @@ -104,13 +104,13 @@ export default { sendComment (comment) { const { commentable_id: answerId = 0, - user_id: userID = 0, + user_id: userId = 0, } = this.comment this.$http .post( `/question-answers/${answerId}/comments`, { - reply_user: userID, + reply_user: userId, body: comment, }, { diff --git a/resources/spa/src/page/message/children/comments/questionItem.vue b/resources/spa/src/page/message/children/comments/questionItem.vue index e0cbba602..5f41dc3b7 100644 --- a/resources/spa/src/page/message/children/comments/questionItem.vue +++ b/resources/spa/src/page/message/children/comments/questionItem.vue @@ -103,13 +103,13 @@ export default { sendComment (comment) { const { commentable_id: questionId = 0, - user_id: userID = 0, + user_id: userId = 0, } = this.comment this.$http .post( `/questions/${questionId}/comments`, { - reply_user: userID, + reply_user: userId, body: comment, }, { diff --git a/resources/spa/src/page/message2/chat/chat-room.vue b/resources/spa/src/page/message2/chat/chat-room.vue index 16f0ec71b..f711dcac4 100644 --- a/resources/spa/src/page/message2/chat/chat-room.vue +++ b/resources/spa/src/page/message2/chat/chat-room.vue @@ -66,7 +66,7 @@ export default { return this.$store.state.CURRENTUSER }, roomId () { - return this.$route.params.chatID + return this.$route.params.chatId }, name () { return this.room.name diff --git a/resources/spa/src/page/news/NewsDetail.vue b/resources/spa/src/page/news/NewsDetail.vue index 3787a8717..e7db3a206 100644 --- a/resources/spa/src/page/news/NewsDetail.vue +++ b/resources/spa/src/page/news/NewsDetail.vue @@ -118,7 +118,7 @@ export default { }, data () { return { - oldID: 0, + oldId: 0, news: {}, loading: true, fetching: false, @@ -172,7 +172,7 @@ export default { newsId () { return this.$route.params.newsId }, - userID () { + userId () { return this.news.user_id || 0 }, isMine () { @@ -232,7 +232,7 @@ export default { }, activated () { if (this.newsId) { - if (this.newsId !== this.oldID) { + if (this.newsId !== this.oldId) { this.fetchNews() } else { setTimeout(() => { @@ -261,7 +261,7 @@ export default { this.loading = false this.fetching = false this.news = data - this.oldID = this.newsId + this.oldId = this.newsId this.share.title = data.title this.share.desc = data.subject this.getCorrelations() @@ -428,7 +428,7 @@ export default { method: () => { this.$bus.$emit('report', { type: 'news', - payload: this.newsID, + payload: this.newsId, username: this.news.user.name, reference: this.news.title, }) @@ -442,7 +442,7 @@ export default { // 是否是自己的评论 if (comment.user_id === this.CURRENTUSER.id) { // 是否是自己文章的评论 - const isOwner = comment.user_id === this.userID + const isOwner = comment.user_id === this.userId actions.push({ text: isOwner ? '评论置顶' : '申请评论置顶', method: () => { @@ -450,7 +450,7 @@ export default { isOwner, type: 'newsComment', api: api.applyTopNewsComment, - payload: { newsId: this.newsID, commentId: comment.id }, + payload: { newsId: this.newsId, commentId: comment.id }, callback: this.fetchNewsComments, }) }, diff --git a/resources/spa/src/routers/base.js b/resources/spa/src/routers/base.js index cd8ab9378..7eb2c6710 100644 --- a/resources/spa/src/routers/base.js +++ b/resources/spa/src/routers/base.js @@ -113,7 +113,7 @@ export default [ { name: 'userfans', component: UserFans, - path: '/users/:userID(\\d+)/:type(followers|followings)', + path: '/users/:userId(\\d+)/:type(followers|followings)', meta: { title: '粉丝', keepAlive: true, diff --git a/resources/spa/src/routers/feed.js b/resources/spa/src/routers/feed.js index 29863c392..27f2d2a0c 100644 --- a/resources/spa/src/routers/feed.js +++ b/resources/spa/src/routers/feed.js @@ -27,7 +27,7 @@ export default [ }, }, { - path: '/feeds/:feedID(\\d+)', + path: '/feeds/:feedId(\\d+)', component: FeedDetail, meta: { title: '动态详情', diff --git a/resources/spa/src/routers/message.js b/resources/spa/src/routers/message.js index 97ecf757c..4325a68ec 100644 --- a/resources/spa/src/routers/message.js +++ b/resources/spa/src/routers/message.js @@ -54,7 +54,7 @@ export default [ ], }, { - path: '/chats/:chatID(\\d+)', + path: '/chats/:chatId(\\d+)', component: ChatRoom, meta: { title: '对话',