Skip to content

Commit

Permalink
refactor: 改进各词条简介内容获取的方法
Browse files Browse the repository at this point in the history
  • Loading branch information
Liusiyuan-git committed Jan 28, 2023
1 parent 353e0ea commit fcaf0db
Show file tree
Hide file tree
Showing 27 changed files with 63 additions and 129 deletions.
4 changes: 1 addition & 3 deletions src/pages/article/component/collect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ function getIntroduce() {
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each, index) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/article/component/column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,8 @@ function getIntroduce() {
endpoints.push(article.value.baseUrl + item["uuid"] + "/" + item["id"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/article/component/creation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,8 @@ function getIntroduce() {
endpoints.push(article.value.baseUrl + item["uuid"] + "/" + item["id"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/article/component/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,8 @@ function getIntroduce() {
endpoints.push(article.value.baseUrl + item["uuid"] + "/" + item["id"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/article/component/user.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,8 @@ function getIntroduce() {
endpoints.push(article.value.baseUrl + item["uuid"] + "/" + item["id"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/collect/component/choose.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,8 @@ function getContent() {
endpoints.push(collections.value.baseUrl + uuid.value + "/" + item["id"] + "/content")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/collect/component/creation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,8 @@ function getContent() {
endpoints.push(collections.value.baseUrl + uuid.value + "/" + item["id"] + "/content")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/collect/component/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,8 @@ function getContent() {
endpoints.push(collections.value.baseUrl + userId.value + "/" + item["id"] + "/content")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/column/component/add.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,8 @@ function getIntroduce() {
endpoints.push(article.value.baseUrl + item["uuid"] + "/" + item["id"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
4 changes: 1 addition & 3 deletions src/pages/column/component/collect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ function getIntroduce() {
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each, index) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/column/component/creation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,8 @@ function getIntroduce() {
endpoints.push(column.value.baseUrl + item["uuid"] + "/" + item["id"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/column/component/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ function getIntroduce() {
endpoints.push(column.value.baseUrl + item["uuid"] + "/" + item["id"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/column/component/subscribe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,8 @@ function getIntroduce() {
endpoints.push(column.value.baseUrl + item["uuid"] + "/" + item["id"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/column/component/user.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,8 @@ function getIntroduce() {
endpoints.push(column.value.baseUrl + item["uuid"] + "/" + item["id"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/comment/comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,8 @@ function getContent() {
endpoints.push(comment.value.baseUrl + item["uuid"] + "/" + item["id"] + "/content")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
12 changes: 4 additions & 8 deletions src/pages/comment/component/message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,8 @@ function getCreationIntroduce() {
endpoints.push(baseUrlMap[item["creationType"]] + uuid.value + "/" + item["creationId"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["creationId"] && (list.value[index]["title"] = each.data["title"])
})
allData.forEach(function (each, index) {
list.value[index]["title"] = each.data["title"]
})
}, function () {
}, function () {
Expand All @@ -157,10 +155,8 @@ function getComment() {
endpoints.push(comment.value.baseUrl + item["uuid"] + "/" + item["id"] + "/content")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
12 changes: 4 additions & 8 deletions src/pages/comment/component/message_sub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,8 @@ function getCreationIntroduce() {
}
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["creationId"] && (list.value[index]["title"] = each.data["title"])
})
allData.forEach(function (each, index) {
list.value[index]["title"] = each.data["title"]
})
}, function () {
}, function () {
Expand All @@ -196,10 +194,8 @@ function getComment() {
endpoints.push(comment.value.baseUrl + item["uuid"] + "/" + item["id"] + "/content")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
12 changes: 4 additions & 8 deletions src/pages/comment/component/replied.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,8 @@ function getCreationIntroduce() {
endpoints.push(baseUrlMap[creation.value] + uuid.value + "/" + item["creationId"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["creationId"] && (list.value[index]["title"] = each.data["title"])
})
allData.forEach(function (each, index) {
list.value[index]["title"] = each.data["title"]
})
}, function () {
}, function () {
Expand All @@ -168,10 +166,8 @@ function getComment() {
endpoints.push(comment.value.baseUrl + item["uuid"] + "/" + item["id"] + "/content")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
12 changes: 4 additions & 8 deletions src/pages/comment/component/replied_sub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,8 @@ function getCreationIntroduce() {
}
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["creationId"] && (list.value[index]["title"] = each.data["title"])
})
allData.forEach(function (each, index) {
list.value[index]["title"] = each.data["title"]
})
}, function () {
}, function () {
Expand All @@ -206,10 +204,8 @@ function getComment() {
endpoints.push(comment.value.baseUrl + item["uuid"] + "/" + item["id"] + "/content")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
12 changes: 4 additions & 8 deletions src/pages/comment/component/reply.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,8 @@ function getCreationIntroduce() {
endpoints.push(baseUrlMap[creation.value] + item["creationAuthor"] + "/" + item["creationId"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["creationId"] && (list.value[index]["title"] = each.data["title"])
})
allData.forEach(function (each, index) {
list.value[index]["title"] = each.data["title"]
})
}, function () {
}, function () {
Expand All @@ -157,10 +155,8 @@ function getComment() {
endpoints.push(comment.value.baseUrl + uuid.value + "/" + item["id"] + "/content")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
12 changes: 4 additions & 8 deletions src/pages/comment/component/reply_sub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,8 @@ function getCreationIntroduce() {
}
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["creationId"] && (list.value[index]["title"] = each.data["title"])
})
allData.forEach(function (each, index) {
list.value[index]["title"] = each.data["title"]
})
}, function () {
}, function () {
Expand All @@ -196,10 +194,8 @@ function getComment() {
endpoints.push(comment.value.baseUrl + uuid.value + "/" + item["id"] + "/content")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/comment/sub-comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,8 @@ function getContent() {
endpoints.push(comment.value.baseUrl + item["uuid"] + "/" + item["id"] + "/content")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/news/news.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,8 @@ function getIntroduce() {
endpoints.push(news.value.baseUrl + item["id"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
4 changes: 1 addition & 3 deletions src/pages/talk/component/collect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ function getIntroduce() {
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each, index) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
6 changes: 2 additions & 4 deletions src/pages/talk/component/creation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,8 @@ function getIntroduce() {
endpoints.push(talk.value.baseUrl + item["uuid"] + "/" + item["id"] + "/introduce")
})
axiosGetAll(endpoints, function (allData) {
allData.forEach(function (each) {
list.value.forEach(function (item, index) {
each.data.id === item["id"] && (list.value[index] = Object.assign(item, each.data))
})
allData.forEach(function (each, index) {
list.value[index] = Object.assign(list.value[index], each.data)
})
}, function () {
}, function () {
Expand Down
Loading

0 comments on commit fcaf0db

Please sign in to comment.