# Conflicts:
#	src/views/portal/case/Index.vue
This commit is contained in:
lmj
2022-06-08 14:05:44 +08:00
2 changed files with 282 additions and 271 deletions

View File

@@ -122,9 +122,9 @@
<div class="casetwo" :body-style="{ padding: '0px' }">
<!-- <div class="case-top"></div> -->
<div class="case-conent">
<div class="case-time">
<!-- <div class="case-time">
{{ca.sysCreateTime.substring(0,10)}}
</div>
</div> -->
<a :href="'case/detail?id='+ca.id" >
<span class="case-title one-line-ellipsis">
{{ca.title}}
@@ -135,17 +135,13 @@
</a>
<div class="case-inter">
<interactBar style="width:180px" :type="3" :readonly="true" :data="ca" :shares="false" :views="false"></interactBar>
</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>
</div>
</div>
</div>
</div>
</div>
<!-- 推荐案例 -->
<!-- <div class="modules">
@@ -478,14 +474,38 @@ export default {
}
});
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 {
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() {
let $this = this;
this.articleList.list = [];

View File

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