From 2b7aff67b7a2e8166daf6a7332c569a624502426 Mon Sep 17 00:00:00 2001 From: daihh Date: Sun, 23 Oct 2022 17:50:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A1=E7=8C=AE=E6=8E=92=E8=A1=8C=E7=9A=84?= =?UTF-8?q?=E6=9C=BA=E6=9E=84=E5=A4=84=E7=90=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/portal/article/Detail.vue | 23 +++++++++++++--------- src/views/portal/article/Index.vue | 23 +++++++++++++--------- src/views/portal/qa/Answer.vue | 30 ++++++++++++++++------------- src/views/portal/qa/Index.vue | 23 ++++++++++++---------- 4 files changed, 58 insertions(+), 41 deletions(-) diff --git a/src/views/portal/article/Detail.vue b/src/views/portal/article/Detail.vue index ef47643b..90c1a1cd 100644 --- a/src/views/portal/article/Detail.vue +++ b/src/views/portal/article/Detail.vue @@ -121,6 +121,7 @@ import apiPraises from '@/api/modules/praises.js'; import apiShares from '@/api/modules/shares.js'; import apiFavorites from '@/api/modules/favorites.js'; import editItems from '@/components/Article/editItems.vue'; +import {cutOrgNamePath} from "@/utils/tools.js"; import "quill/dist/quill.core.css"; import "quill/dist/quill.snow.css"; import "quill/dist/quill.bubble.css"; @@ -215,22 +216,26 @@ export default { this.diagSync=true }, getAnkingData() { + let $this=this; apiArticle.countsUsername(5).then(res => { if (res.status == 200) { - this.ankingList = res.result; let ids = []; - this.ankingList.forEach(item =>{ + res.result.forEach(item =>{ + item.orinfo=''; ids.push(item.sysCreateAid); }) - apiUser.getByIds(ids).then(res=>{ - res.result.forEach(item=>{ - this.ankIds.push(item.orgInfo); - this.ankingList.forEach((value, index) => { - value['orinfo'] = this.ankIds[index]; - }) + $this.ankingList = res.result; + apiUser.getByIds(ids).then(rs=>{ + rs.result.forEach(u=>{ + $this.ankingList.forEach((sub) => { + if(sub.sysCreateAid=u.aid){ + sub.orinfo=cutOrgNamePath(u.orgInfo); + } + }) }) // console.log(this.ankingList); - }) + }) + } }); }, diff --git a/src/views/portal/article/Index.vue b/src/views/portal/article/Index.vue index 4b88266b..838bbf5e 100644 --- a/src/views/portal/article/Index.vue +++ b/src/views/portal/article/Index.vue @@ -136,6 +136,7 @@ import apiSearchterm from '@/api/modules/searchterm.js'; import articleImage from '@/components/Article/articleImage.vue'; import editItems from '@/components/Article/editItems.vue'; import apiPlace from "@/api/phase2/place.js" +import {cutOrgNamePath} from "@/utils/tools.js"; export default { name: 'index', components: { editItems,portalHeader, portalFooter,articleImage, portalFloatTools, interactBar, timeShow, author }, @@ -389,22 +390,26 @@ export default { }); }, getAnkingData() { + let $this=this; apiArticle.countsUsername(5).then(res => { if (res.status == 200) { - this.ankingList = res.result; + let ids = []; - this.ankingList.forEach(item =>{ + res.result.forEach(item =>{ + item.orinfo=''; ids.push(item.sysCreateAid); }) - apiUser.getByIds(ids).then(res=>{ - res.result.forEach(item=>{ - this.ankIds.push(item.orgInfo); - this.ankingList.forEach((value, index) => { - value['orinfo'] = this.ankIds[index]; - }) + $this.ankingList = res.result; + apiUser.getByIds(ids).then(rs=>{ + rs.result.forEach(u=>{ + $this.ankingList.forEach((sub) => { + if(sub.sysCreateAid=u.aid){ + sub.orinfo=cutOrgNamePath(u.orgInfo); + } + }) }) // console.log(this.ankingList); - }) + }) } }); diff --git a/src/views/portal/qa/Answer.vue b/src/views/portal/qa/Answer.vue index bc124e06..889c5312 100644 --- a/src/views/portal/qa/Answer.vue +++ b/src/views/portal/qa/Answer.vue @@ -292,6 +292,7 @@ import apiPraise from "@/api/modules/praises.js"; import apiFavorites from "@/api/modules/favorites.js"; import apiMessage from "@/api/system/message.js"; import apiPlace from "@/api/phase2/place.js" +import {cutOrgNamePath} from "@/utils/tools.js"; export default { name: "answer", components: { @@ -409,22 +410,25 @@ export default { this.getAnswerList(false); }, getAnkingData() { + let $this=this; apiQa.queryList(5).then(res => { if (res.status == 200) { - this.ankingList = res.result; - let ids = []; - this.ankingList.forEach(item =>{ - ids.push(item.sysCreateAid); - }) - apiUser.getByIds(ids).then(res=>{ - res.result.forEach(item=>{ - this.ankIds.push(item.orgInfo); - this.ankingList.forEach((value, index) => { - value['orinfo'] = this.ankIds[index]; - }) - }) - // console.log(this.ankingList); + let ids = []; + res.result.forEach(item =>{ + item.orinfo=''; + ids.push(item.sysCreateAid); + }) + $this.ankingList = res.result; + apiUser.getByIds(ids).then(rs=>{ + rs.result.forEach(u=>{ + $this.ankingList.forEach((sub) => { + if(sub.sysCreateAid=u.aid){ + sub.orinfo=cutOrgNamePath(u.orgInfo); + } + }) }) + // console.log(this.ankingList); + }) } }); }, diff --git a/src/views/portal/qa/Index.vue b/src/views/portal/qa/Index.vue index 8f048380..64372a46 100644 --- a/src/views/portal/qa/Index.vue +++ b/src/views/portal/qa/Index.vue @@ -144,6 +144,7 @@ import apiQa from '@/api/modules/qa.js'; import apiUser from '@/api/system/user.js'; import apiSearchterm from '@/api/modules/searchterm.js'; import apiPlace from "@/api/phase2/place.js" +import {cutOrgNamePath} from "@/utils/tools.js"; export default { name: 'qaindex', components: { portalHeader, portalFooter, portalFloatTools, WxEditor, addQuestion, author, interactBar, timeShow }, @@ -419,23 +420,25 @@ export default { this.$router.push({ path: '/qa/answer', query: { id: data.id } }); }, getAnkingData() { + let $this=this; apiQa.queryList(5).then(res => { if (res.status == 200) { - this.ankingList = res.result; - this.ankingList = res.result; let ids = []; - this.ankingList.forEach(item =>{ + res.result.forEach(item =>{ + item.orinfo=''; ids.push(item.sysCreateAid); }) - apiUser.getByIds(ids).then(res=>{ - res.result.forEach(item=>{ - this.ankIds.push(item.orgInfo); - this.ankingList.forEach((value, index) => { - value['orinfo'] = this.ankIds[index]; - }) + $this.ankingList = res.result; + apiUser.getByIds(ids).then(rs=>{ + rs.result.forEach(u=>{ + $this.ankingList.forEach((sub) => { + if(sub.sysCreateAid=u.aid){ + sub.orinfo=cutOrgNamePath(u.orgInfo); + } + }) }) // console.log(this.ankingList); - }) + }) } }); }