首页头像

This commit is contained in:
zhaofang
2022-06-08 13:55:48 +08:00
parent 17a6ab7785
commit 214207eb22
2 changed files with 281 additions and 271 deletions

View File

@@ -122,9 +122,9 @@
<div class="casetwo" :body-style="{ padding: '0px' }"> <div class="casetwo" :body-style="{ padding: '0px' }">
<!-- <div class="case-top"></div> --> <!-- <div class="case-top"></div> -->
<div class="case-conent"> <div class="case-conent">
<div class="case-time"> <!-- <div class="case-time">
{{ca.sysCreateTime.substring(0,10)}} {{ca.sysCreateTime.substring(0,10)}}
</div> </div> -->
<a :href="'case/detail?id='+ca.id" > <a :href="'case/detail?id='+ca.id" >
<span class="case-title one-line-ellipsis"> <span class="case-title one-line-ellipsis">
{{ca.title}} {{ca.title}}
@@ -135,17 +135,13 @@
</a> </a>
<div class="case-inter"> <div class="case-inter">
<interactBar style="width:180px" :type="3" :readonly="true" :data="ca" :shares="false" :views="false"></interactBar> <interactBar style="width:180px" :type="3" :readonly="true" :data="ca" :shares="false" :views="false"></interactBar>
</div> </div>
<div style="height:40px"> <div style="height:40px;margin-top:10px">
<authorInfo :avatar="ca.authorInfo.avatar" :name="ca.authorInfo.name" :info="ca.authorInfo.orgInfo" :sex="ca.authorInfo.sex"></authorInfo></div> <authorInfo :avatar="ca.authorInfo.avatar" :name="ca.authorInfo.name" :info="ca.authorInfo.orgInfo" :sex="ca.authorInfo.sex"></authorInfo></div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- 推荐案例 --> <!-- 推荐案例 -->
<!-- <div class="modules"> <!-- <div class="modules">
@@ -478,14 +474,38 @@ export default {
} }
}); });
this.caseList.list = res.result; this.caseList.list = res.result;
this.loadAuthorInfo(res.result, userIds); this.loadCaseAuthorInfo(res.result, userIds);
} }
this.caseList.list = res.result; // this.caseList.list = res.result;
} else { } else {
console.log('加载案例错误:' + res.error); console.log('加载案例错误:' + res.error);
} }
}); });
}, },
loadCaseAuthorInfo(list, ids) {
//加载作者信息,头像,机构信息
if (ids.length == 0) {
return;
}
const noReapetIds = [...new Set(ids)];
apiUser.getByIds(ids).then(res => {
if (res.status == 200) {
list.forEach((item, index) => {
res.result.some(author => {
if (author.aid == item.authorId) {
item.authorInfo = author;
return true;
} else {
return false;
}
});
});
} else {
console.log('加载用户信息失败:' + res.error);
//this.$message.error(res.message);
}
});
},
getArticleData() { getArticleData() {
let $this = this; let $this = this;
this.articleList.list = []; this.articleList.list = [];

View File

@@ -96,26 +96,15 @@
<div style="height:35px"> <div style="height:35px">
<author :avatar="item.authorInfo.avatar" :name="item.authorInfo.name" :info="item.authorInfo.orgInfo" :sex="item.authorInfo.sex"></author> <author :avatar="item.authorInfo.avatar" :name="item.authorInfo.name" :info="item.authorInfo.orgInfo" :sex="item.authorInfo.sex"></author>
</div> </div>
<!-- <router-link :to="'/case/detail?id='+item.id"> -->
<!-- class="case-info-summary" -->
<div> <div>
<router-link :to="'/case/detail?id='+item.id"> <router-link :to="'/case/detail?id='+item.id">
<!-- {{item.summary}} -->
{{displayAll(item)}} {{displayAll(item)}}
</router-link> </router-link>
<span style="color:#588afc" v-if="item.summary.length>190" @click="changeIsAll(item)"> <span style="color:#588afc" v-if="item.summary.length>190" @click="changeIsAll(item)">
{{item.isAll?'收起':'展开'}} {{item.isAll?'收起':'展开'}}
</span> </span>
</div> </div>
<!-- </router-link> -->
<!-- <div class="button-wrap" v-if="needShowExpande">
<div class="exp-but" @click="expandeClick" v-if="!expande">展开
</div>
<div class="exp-but" @click="expandeClick" v-else>收起</div>
</div> -->
<div style="display: flex;justify-content: space-between;"> <div style="display: flex;justify-content: space-between;">
<div> <div>
<interactBar :type="0" :shares="false" :data="item" :readonly="false"></interactBar> </div> <interactBar :type="0" :shares="false" :data="item" :readonly="false"></interactBar> </div>
</div> </div>
@@ -238,23 +227,30 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from "vuex";
import portalHeader from '@/components/PortalHeader.vue'; import portalHeader from "@/components/PortalHeader.vue";
import portalFooter from '@/components/PortalFooter.vue'; import portalFooter from "@/components/PortalFooter.vue";
import portalFloatTools from '@/components/PortalFloatTools.vue'; import portalFloatTools from "@/components/PortalFloatTools.vue";
import interactBar from '@/components/Portal/interactBar.vue'; import interactBar from "@/components/Portal/interactBar.vue";
import timeShow from '@/components/Portal/datetimeShow.vue'; import timeShow from "@/components/Portal/datetimeShow.vue";
import author from '@/components/Portal/authorInfo.vue'; import author from "@/components/Portal/authorInfo.vue";
import apiCase from '@/api/modules/cases.js'; import apiCase from "@/api/modules/cases.js";
import apiUser from '@/api/system/user.js'; import apiUser from "@/api/system/user.js";
import apiSearchterm from "@/api/modules/searchterm.js"; import apiSearchterm from "@/api/modules/searchterm.js";
import { deepClone } from "../../../utils"; import { deepClone } from "../../../utils";
import apiDict from "@/api/modules/dict.js" import apiDict from "@/api/modules/dict.js";
export default { export default {
name: 'index', name: "index",
components: { portalHeader, portalFooter, portalFloatTools, interactBar,timeShow ,author}, components: {
portalHeader,
portalFooter,
portalFloatTools,
interactBar,
timeShow,
author
},
computed: { computed: {
...mapGetters(['userInfo','portalCase']), ...mapGetters(["userInfo", "portalCase"]),
word: function() { word: function() {
if (this.showAll == false) { if (this.showAll == false) {
//对文字进行处理 //对文字进行处理
@@ -294,14 +290,14 @@ export default {
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
isTop: true, isTop: true,
orderField:'comments', orderField: "comments",
// breCommend:null, // breCommend:null,
keyWord:'', keyWord: "",
majorType: null, //专业分类 majorType: null, //专业分类
orgDomain: null, // 组织领域 orgDomain: null, // 组织领域
orderAsc: false orderAsc: false
}, },
keyWord:'', keyWord: "",
anking: 2, anking: 2,
queryExpand: true, // true更多false收起 queryExpand: true, // true更多false收起
category: 0, category: 0,
@@ -320,7 +316,7 @@ export default {
this.protocolDialogVisible = true; this.protocolDialogVisible = true;
} }
this.keyWord = this.$route.query.keyword; this.keyWord = this.$route.query.keyword;
if(this.keyWord != '') { if (this.keyWord != "") {
this.isSeach = true; this.isSeach = true;
} }
this.getAnkingData(); this.getAnkingData();
@@ -331,10 +327,7 @@ export default {
this.getdomain(); this.getdomain();
// this.getCaseData(); // this.getCaseData();
this.search(); this.search();
window.addEventListener( window.addEventListener("scroll", this.handleScroll);
"scroll",
this.handleScroll
);
}, },
watch: { watch: {
@@ -372,56 +365,54 @@ export default {
} else { } else {
searchBoxHeght.style.height = "auto"; searchBoxHeght.style.height = "auto";
} }
}, },
getAnkingData() { getAnkingData() {
apiCase.usernameList(5).then(res => { apiCase.usernameList(5).then(res => {
if (res.status == 200) { if (res.status == 200) {
this.ankingList=res.result this.ankingList = res.result;
// console.log(res) // console.log(res)
} }
}) });
}, },
getPopularity() { getPopularity() {
apiCase.queryPraises(5).then(res => { apiCase.queryPraises(5).then(res => {
if (res.status == 200) { if (res.status == 200) {
this.Popularity=res.result this.Popularity = res.result;
// console.log(this.Popularity) // console.log(this.Popularity)
} }
}) });
}, },
getPositive() { getPositive() {
apiCase.queryComments(5).then(res => { apiCase.queryComments(5).then(res => {
if (res.status == 200) { if (res.status == 200) {
this.Positive=res.result this.Positive = res.result;
console.log(res) console.log(res);
} }
}) });
}, },
getdomain() { getdomain() {
let key ='org_domain' let key = "org_domain";
apiDict.items(key).then(res => { apiDict.items(key).then(res => {
if (res.status == 200) { if (res.status == 200) {
this.domain = res.result this.domain = res.result;
} }
}) });
}, },
getProfess() { getProfess() {
let key ='major_type' let key = "major_type";
apiDict.items(key).then(res => { apiDict.items(key).then(res => {
if (res.status == 200) { if (res.status == 200) {
this.Profess = res.result this.Profess = res.result;
} }
}) });
}, },
emitInput(val) { emitInput(val) {
this.keyWord = val; this.keyWord = val;
this.isSeach = true; this.isSeach = true;
this.queryCondition.pageIndex = 1 this.queryCondition.pageIndex = 1;
this.search() this.search();
}, },
searchData(num) { searchData(num) {
this.queryCondition.pageIndex = 1; this.queryCondition.pageIndex = 1;
@@ -429,18 +420,20 @@ export default {
this.getCaseData(); this.getCaseData();
}, },
handleScroll() { handleScroll() {
let innerHeight = document.querySelector('#case-list-content').clientHeight let innerHeight = document.querySelector("#case-list-content")
let outerHeight = document.documentElement.clientHeight .clientHeight;
let scrollTop = document.documentElement.scrollTop let outerHeight = document.documentElement.clientHeight;
if ((outerHeight + scrollTop + 350) >= innerHeight) { let scrollTop = document.documentElement.scrollTop;
if (outerHeight + scrollTop + 350 >= innerHeight) {
if (this.moreState == 1 && this.queryCondition.pageIndex < 4) { if (this.moreState == 1 && this.queryCondition.pageIndex < 4) {
this.loadMore(); this.loadMore();
} }
} }
if (scrollTop > 630) { if (scrollTop > 630) {
document.querySelector('#fixd-box').style.cssText = "position: fixed;top: -550px;width:245.5px"; document.querySelector("#fixd-box").style.cssText =
"position: fixed;top: -550px;width:245.5px";
} else { } else {
document.querySelector('#fixd-box').style.cssText = "position: static"; document.querySelector("#fixd-box").style.cssText = "position: static";
} }
}, },
useHotword(item) { useHotword(item) {
@@ -463,7 +456,7 @@ export default {
}, },
protocolConfirm() { protocolConfirm() {
this.protocolDialogVisible = false; this.protocolDialogVisible = false;
this.$store.dispatch('portal/SetReadProtocol', true); this.$store.dispatch("portal/SetReadProtocol", true);
}, },
handleSizeChange(item) { handleSizeChange(item) {
this.queryCondition.pageSize = item; this.queryCondition.pageSize = item;
@@ -478,7 +471,7 @@ export default {
} }
this.queryCondition.pageIndex = 1; this.queryCondition.pageIndex = 1;
if (this.keyWord != this.queryCondition.keyWord) { if (this.keyWord != this.queryCondition.keyWord) {
this.queryCondition.keyWord=this.keyWord this.queryCondition.keyWord = this.keyWord;
} }
this.getCaseData(); this.getCaseData();
}, },
@@ -488,31 +481,39 @@ export default {
this.caseList.list = []; this.caseList.list = [];
} }
this.moreState = 2; this.moreState = 2;
await apiCase.queryList(this.queryCondition).then(res=>{ await apiCase
.queryList(this.queryCondition)
.then(res => {
if (res.status == 200) { if (res.status == 200) {
if (res.result.list.length > 0) { if (res.result.list.length > 0) {
this.isSeach = false; this.isSeach = false;
res.result.list.forEach(item => { res.result.list.forEach(item => {
item.isAll = false; item.isAll = false;
item.authorInfo={aid:'',name:'',orgInfo:'',avatar:'',sex:null}; item.authorInfo = {
}) aid: "",
name: "",
orgInfo: "",
avatar: "",
sex: null
};
});
this.caseList.list.push(...res.result.list); this.caseList.list.push(...res.result.list);
this.caseList.count = res.result.count; this.caseList.count = res.result.count;
this.getCaseUserData(res.result.list) this.getCaseUserData(res.result.list);
this.moreState = 1; this.moreState = 1;
if (res.result.count === res.result.list.length) { if (res.result.count === res.result.list.length) {
this.moreState = 3; this.moreState = 3;
} }
} else { } else {
this.moreState = 3; this.moreState = 3;
} }
} else { } else {
this.$message.error(res.message); this.$message.error(res.message);
} }
}).catch(err=>{
console.log(err)
}) })
.catch(err => {
console.log(err);
});
}, },
getTags() { getTags() {
this.searchTags = []; this.searchTags = [];
@@ -528,10 +529,8 @@ export default {
caseData[i] !== null && caseData[i] !== null &&
caseData[i] !== undefined caseData[i] !== undefined
) { ) {
if(caseData[i] !== '0') { if (caseData[i] !== "0") {
this.searchTags.push( this.searchTags.push(caseData[i]);
caseData[i]
);
} }
} }
} }
@@ -539,10 +538,10 @@ export default {
tagsClose(tag, index) { tagsClose(tag, index) {
for (let i in this.queryCondition) { for (let i in this.queryCondition) {
if (tag === this.queryCondition[i]) { if (tag === this.queryCondition[i]) {
if(i == 'majorType'){ if (i == "majorType") {
this.queryCondition.majorType = null; this.queryCondition.majorType = null;
} }
if(i == 'orgDomain'){ if (i == "orgDomain") {
this.queryCondition.orgDomain = null; this.queryCondition.orgDomain = null;
} }
this.queryCondition[i] = ""; this.queryCondition[i] = "";
@@ -554,20 +553,20 @@ export default {
}, },
getCaseUserData(caseList) { getCaseUserData(caseList) {
let ids = caseList.map((item, index) => { let ids = caseList.map((item, index) => {
return item.sysCreateAid return item.authorId;
}) });
const noReapetIds=[...new Set(ids)] const noReapetIds = [...new Set(ids)];
apiUser.getByIds(ids).then(res=>{ apiUser.getByIds(noReapetIds).then(res => {
if (res.status == 200) { if (res.status == 200) {
caseList.forEach((item, index) => { caseList.forEach((item, index) => {
res.result.some(author => { res.result.some(author => {
if(author.aid==item.sysCreateAid){ if (author.aid == item.authorId) {
item.authorInfo = author; item.authorInfo = author;
return true; return true;
} else { } else {
return false; return false;
} }
}) });
}); });
} else { } else {
this.$message.error(res.message); this.$message.error(res.message);
@@ -577,32 +576,27 @@ export default {
getAnkingData() { getAnkingData() {
apiCase.usernameList(10).then(res => { apiCase.usernameList(10).then(res => {
if (res.status == 200) { if (res.status == 200) {
this.ankingList=res.result this.ankingList = res.result;
} }
}) });
}, },
getPopularity() { getPopularity() {
apiCase.queryPraises(5).then(res => { apiCase.queryPraises(5).then(res => {
if (res.status == 200) { if (res.status == 200) {
this.Popularity=res.result this.Popularity = res.result;
} }
}) });
}, },
getPositive() { getPositive() {
apiCase.queryComments(5).then(res => { apiCase.queryComments(5).then(res => {
if (res.status == 200) { if (res.status == 200) {
this.Positive=res.result this.Positive = res.result;
} }
}) });
}, },
jumpRouter(item) { jumpRouter(item) {
this.$router.push(`/case/detail?id=${item.id}`); this.$router.push(`/case/detail?id=${item.id}`);
} }
} }
}; };
@@ -651,14 +645,14 @@ export default {
::v-deep .bacolor:nth-child(even) { ::v-deep .bacolor:nth-child(even) {
background-color: #fff; background-color: #fff;
padding: 0 5px; padding: 0 5px;
} }
::v-deep .el-card { ::v-deep .el-card {
border: none; border: none;
border-radius: 0px; border-radius: 0px;
border: 1px solid #EBEEF5; border: 1px solid #ebeef5;
} }
::v-deep .el-radio-button__inner, .el-radio-group { ::v-deep .el-radio-button__inner,
.el-radio-group {
vertical-align: top; vertical-align: top;
} }
::v-deep .el-radio-button__inner { ::v-deep .el-radio-button__inner {
@@ -749,7 +743,6 @@ export default {
text-align: center; text-align: center;
padding: 10px 0; padding: 10px 0;
.pag-text { .pag-text {
} }
} }
.order-div { .order-div {
@@ -857,10 +850,7 @@ export default {
} }
} }
.ranking-card { .ranking-card {
.center { .center {
text-align: center; text-align: center;
} }