案例调整

This commit is contained in:
daihh
2022-12-27 17:53:15 +08:00
parent 61218bb21c
commit 9d950e1306

View File

@@ -7,10 +7,10 @@
<div class="xcontent2-main" style="margin-right: 30px;">
<div class="left-div">
<div class="search-div">
<div class="searchbar" v-if="fieldData.length > 0">
<div class="searchbar" v-if="tagList.length > 0">
<div style="line-height: 30px;">
<span class="item-title">搜索条件</span>
<el-tag closable v-for="(tag, tagIdx) in fieldData" :key="tagIdx" @close="tagsClose(tag,tagIdx)">{{ tag.name }}</el-tag>
<el-tag closable v-for="(tag, tagIdx) in tagList" :key="tagIdx" @close="tagsClose(tag,tagIdx)">{{ tag.name }}</el-tag>
</div>
</div>
<div class="search-item">
@@ -69,7 +69,7 @@
<span class="quyer-tag">
<el-button type="text" class="order-class" @click="searchData('views')" :class="{ actice: queryCondition.orderField == 'views' }">最热</el-button>
<el-button type="text" class="order-class" @click="searchData('')" :class="{ actice: queryCondition.orderField == '' }">最新</el-button>
<el-button type="text" class="order-class" @click="searchexcellent()" :class="{ actice: queryCondition.excellent == true }">优秀案例</el-button>
<el-button type="text" class="order-class" @click="searchexcellent()" :class="{ actice: queryCondition.orderField =='excellentTime' }">优秀案例</el-button>
<!-- <el-button type="text" class="order-class" @click="queryCondition.breCommend = queryCondition.breCommend == ture ? true : null" :class="{ actice: queryCondition.breCommend == true }">组织推荐</el-button> -->
</span>
@@ -254,29 +254,46 @@ export default {
isOk = false;
}
return isOk;
},
tagList(){ //列表属性,用于计算
let list=[];
if(this.keyWord){
list.push({ type:'0', code:'keyword', name:this.keyWord, checked:true})
}
this.domain.forEach(item=>{
if(item.fielclass){
list.push(item);
}
});
this.speciData.forEach(item=>{
if(item.fielclass){
list.push(item);
}
});
return list;
}
},
data() {
return {
fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL,
resonimg:{},
speciData:[],
domain: [],//组织领域
speciData:[],//专业分类
moreState: 1, // 1 加载更多 2 加载中 3无数据
isSeach: false,
searchwd: false,
showAll: true, //是否展开全部
initHeight:40,//原始 高度
searchRecords: [],
searchRecords: [],//热门搜索词
caseList: {
count: 0,
list: []
},
ankingList: [],
Popularity: [],
Positive: [],
domain: [],
Profess: [],
optionsList: [], //分类数据
ankingList: [],//排行数据1
Popularity: [],//排行数据2
Positive: [],//排行数据3
//Profess: [],
//optionsList: [],
protocolDialogVisible: false,
protocolConfirmButton: true,
queryCondition: {
@@ -298,27 +315,26 @@ export default {
type2: 0,
type3: 0,
isFind: false,
searchTags: [],
orgData: [],
fieldData:[],
//searchTags: [],
//orgData: [],
fielclass:true,
fielclassjor:true,
orgDomainData:'',
orgsto:[],
majorTypeData:'',
majsto:[],
Domarr:[],
majarr:[],
domData:[],
majData:[],
// orgDomainData:'',
// orgsto:[],
// majorTypeData:'',
// majsto:[],
// Domarr:[],
// majarr:[],
// domData:[],
// majData:[],
};
},
mounted() {
if(this.searchTags.length == 0){
this.queryCondition.majorType = null;
this.queryCondition.orgDomain = null;
};
// if(this.searchTags.length == 0){
// this.queryCondition.majorType = null;
// this.queryCondition.orgDomain = null;
// };
this.specialized();
if (!this.portalCase.readProtocol) {
this.protocolDialogVisible = true;
@@ -356,129 +372,143 @@ export default {
majorall(){
this.queryCondition.majorType = '';
this.fielclassjor=true;
if(this.fielclassjor){
let narr = this.fieldData;
this.fieldData = narr.filter(item => {
if(item.type == 'major_type') {
console.log(item);
item.fielclass = false;
return false;
}else{
return true;
}
})
}
this.getCaseData();
this.speciData.forEach(item=>{
item.fielclass = false;
})
// if(this.fielclassjor){
// let narr = this.fieldData;
// this.fieldData = narr.filter(item => {
// if(item.type == 'major_type') {
// console.log(item);
// item.fielclass = false;
// return false;
// }else{
// return true;
// }
// })
// }
//this.getCaseData();
this.search();
},
domainall(){
this.queryCondition.orgDomain = '';
this.domain.forEach(item=>{
item.fielclass = false;
})
this.fielclass=true;
if(this.fielclass){
var newArr = this.fieldData;
this.fieldData = newArr.filter(item => {
if(item.type == 'org_domain') {
console.log(item);
item.fielclass = false;
return false;
console.log(this.fieldData)
}else{
return true;
}
})
}
this.getCaseData();
// if(this.fielclass){
// var newArr = this.fieldData;
// this.fieldData = newArr.filter(item => {
// if(item.type == 'org_domain') {
// console.log(item);
// item.fielclass = false;
// return false;
// console.log(this.fieldData)
// }else{
// return true;
// }
// })
// }
//this.getCaseData();
this.search();
},
fieldmajor(item){//专业分类
this.fielclassjor = false;
item.fielclass = !item.fielclass;
if(item.fielclass){
let has=this.fieldData.some(fd=>{
return fd.code==item.code;
});
if(!has){
this.fieldData.push(item);
}
}else{
let delIdx=-1;
this.fieldData.some((fd,fdidx)=>{
if(fd.code==item.code){
delIdx=fdidx;
return true;
}
return false;
});
if(delIdx>-1){
this.fieldData.splice(delIdx,1);
}
}
this.majsto.push(item.code);
this.majorTypeData = this.majsto.toString()//传给后端
this.queryCondition.majorType = this.majorTypeData;
this.getCaseData();
this.ceshiorg();
},
ceshiorg(){//判断专业
this.majData = [];
this.fieldData.forEach(itx =>{
if(itx.type == 'major_type'){
console.log(typeof itx);
if(itx.fielclass == true){
this.majData.push(itx)
}
}
})
console.log(this.majData);
let b = JSON.stringify(this.majData);
if(b == '[]'){
this.fielclassjor=true;
}
},
ceshidom(){//判断组织
this.domData = [];
this.fieldData.forEach(itx =>{
if(itx.type == 'org_domain'){
console.log(typeof itx);
if(itx.fielclass == true){
this.domData.push(itx)
}
}
})
let b = JSON.stringify(this.domData);
if(b == '[]'){
this.fielclass=true;
}
this.search();
// if(item.fielclass){
// let has=this.fieldData.some(fd=>{
// return fd.code==item.code;
// });
// if(!has){
// this.fieldData.push(item);
// }
// }else{
// let delIdx=-1;
// this.fieldData.some((fd,fdidx)=>{
// if(fd.code==item.code){
// delIdx=fdidx;
// return true;
// }
// return false;
// });
// if(delIdx>-1){
// this.fieldData.splice(delIdx,1);
// }
// }
// this.majsto.push(item.code);
// this.majorTypeData = this.majsto.toString()//传给后端
// this.queryCondition.majorType = this.majorTypeData;
//this.getCaseData();
//this.ceshiorg();
},
// ceshiorg(){//判断专业
// this.majData = [];
// this.fieldData.forEach(itx =>{
// if(itx.type == 'major_type'){
// console.log(typeof itx);
// if(itx.fielclass == true){
// this.majData.push(itx)
// }
// }
// })
// console.log(this.majData);
// let b = JSON.stringify(this.majData);
// if(b == '[]'){
// this.fielclassjor=true;
// }
// },
// ceshidom(){//判断组织
// this.domData = [];
// this.fieldData.forEach(itx =>{
// if(itx.type == 'org_domain'){
// console.log(typeof itx);
// if(itx.fielclass == true){
// this.domData.push(itx)
// }
// }
// })
// let b = JSON.stringify(this.domData);
// if(b == '[]'){
// this.fielclass=true;
// }
// },
fieldswich(item){//组织领域
this.fielclass=false;
item.fielclass = !item.fielclass;
if(item.fielclass){
let has=this.fieldData.some(fd=>{
return fd.code==item.code;
});
//console.log(has,'has')
if(!has){
this.fieldData.push(item);
}
}else{
let delIdx=-1;
this.fieldData.some((fd,fdidx)=>{
if(fd.code==item.code){
delIdx=fdidx;
return true;
}
return false;
});
if(delIdx>-1){
this.fieldData.splice(delIdx,1);
}
}
this.orgsto.push(item.code);
this.orgDomainData = this.orgsto.toString()//传给后端
this.queryCondition.orgDomain = this.orgDomainData;
this.getCaseData();
this.ceshidom();
// if(item.fielclass){
// let has=this.fieldData.some(fd=>{
// return fd.code==item.code;
// });
// //console.log(has,'has')
// if(!has){
// this.fieldData.push(item);
// }
// }else{
// let delIdx=-1;
// this.fieldData.some((fd,fdidx)=>{
// if(fd.code==item.code){
// delIdx=fdidx;
// return true;
// }
// return false;
// });
// if(delIdx>-1){
// this.fieldData.splice(delIdx,1);
// }
// }
// this.orgsto.push(item.code);
// this.orgDomainData = this.orgsto.toString()//传给后端
// this.queryCondition.orgDomain = this.orgDomainData;
//this.getCaseData();
this.search();
//this.ceshidom();
},
banJump() {
if(this.resonimg.JumpUrl) {
window.open(this.resonimg.JumpUrl);
@@ -502,7 +532,7 @@ export default {
})
}
this.speciData = res.result;
this.Profess=res.result;
//this.Profess=res.result;
this.$nextTick(function() {
$this.initHeight = document.getElementById("searchBox").offsetHeight;
$this.closeSearch();
@@ -586,38 +616,38 @@ export default {
item.type=key;
})
this.domain = res.result;
if(res.result.length > 0) {
this.orgDomainLevel(res.result)
}
// if(res.result.length > 0) {
// this.orgDomainLevel(res.result)
// }
}
});
},
//删除,不再使用
getProfess() {
let key = "major_type";
apiDict.items(key).then(res => {
if (res.status == 200) {
this.Profess = res.result;
}
});
},
orgDomainLevel(organization) {
this.orgData = [];
organization.forEach(item=>{
this.orgData.push(item);
if(item.list && item.list != "" && item.list.length > 0){
item.list.forEach(it =>{
this.orgData.push(it);
})
}
})
},
// getProfess() {
// let key = "major_type";
// apiDict.items(key).then(res => {
// if (res.status == 200) {
// this.Profess = res.result;
// }
// });
// },
// orgDomainLevel(organization) {
// this.orgData = [];
// organization.forEach(item=>{
// this.orgData.push(item);
// if(item.list && item.list != "" && item.list.length > 0){
// item.list.forEach(it =>{
// this.orgData.push(it);
// })
// }
// })
// },
orgDomainTranslate(code){ // 组织领域翻译
if(code == '') {
return
}
let name = '';
let data = this.orgData.find(item => item.code == code);
let data = this.domain.find(item => item.code == code);
if(data == undefined){
name = '';
} else {
@@ -627,7 +657,7 @@ export default {
},
majorTypeTranslate(code){ // 专业分类翻译
let name = '';
let data = this.Profess.find(item => item.code == code);
let data = this.speciData.find(item => item.code == code);
if(data == undefined){
name = '';
} else {
@@ -642,8 +672,10 @@ export default {
this.search();
},
searchexcellent(){
this.queryCondition.excellent = !this.queryCondition.excellent;
this.getCaseData();
//this.queryCondition.excellent =true;
this.queryCondition.orderField='excellentTime';
this.search();
//this.getCaseData();
},
searchData(num) {
// if(num == 1){
@@ -702,7 +734,9 @@ export default {
this.queryCondition.pageIndex = item;
},
search() {
apiSearchterm.save({ keyword: this.keyWord, type: 3 });
if(this.keyWord){
apiSearchterm.save({ keyword: this.keyWord, type: 3 });
}
if (!this.isFind) {
this.isFind = true;
}
@@ -711,25 +745,42 @@ export default {
this.queryCondition.keyWord = this.keyWord;
}
if(this.queryCondition.orgDomain == 0){
this.queryCondition.orgDomain = null
this.queryCondition.orgDomain = ''
}
if(this.queryCondition.majorType == 0){
this.queryCondition.majorType = null
this.queryCondition.majorType = ''
}
this.getCaseData();
},
async getCaseData() {
// this.fieldData
this.getTags();
//this.queryCondition.pageIndex = 1;
let orgDomainList=[];
let majorTypeList=[];
this.tagList.forEach(tag=>{
if(tag.type=='0'){
this.queryCondition.keyWord=tag.name;
}else if(tag.type=='major_type'){
majorTypeList.push(tag.code);
}else if(tag.type=='org_domain'){
orgDomainList.push(tag.code);
}
});
this.queryCondition.orgDomain =orgDomainList.join(',');
this.queryCondition.majorType =majorTypeList.join(',');
if(this.queryCondition.orderField=='excellentTime'){
this.queryCondition.excellent=true;
}else{
this.queryCondition.excellent='';
}
//this.getTags();
if (this.queryCondition.pageIndex == 1) {
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;
@@ -762,60 +813,64 @@ export default {
console.log(err);
});
},
getTags() {
this.searchTags = [];
let caseData = deepClone(this.queryCondition);
for (let i in caseData) {
if (
caseData[i] !== "" &&
i !== "pageIndex" &&
i !== "pageSize" &&
i !== "orderField" &&
i !== "orderAsc" &&
i !== "isTop" &&
caseData[i] !== null &&
caseData[i] !== undefined
) {
if (caseData[i] == "0") {
return;
}
if(i == 'majorType'){
this.searchTags.push({ type:'majorType',value:this.majorTypeTranslate(caseData[i])})
}
if(i == 'orgDomain'){
this.searchTags.push({type:'orgDomain',value:this.orgDomainTranslate(caseData[i])})
}
if(i == 'keyWord'){
this.searchTags.push({type:'keyWord',value:caseData[i]})
}
}
}
},
// getTags() {
// this.searchTags = [];
// let caseData = deepClone(this.queryCondition);
// for (let i in caseData) {
// if (
// caseData[i] !== "" &&
// i !== "pageIndex" &&
// i !== "pageSize" &&
// i !== "orderField" &&
// i !== "orderAsc" &&
// i !== "isTop" &&
// caseData[i] !== null &&
// caseData[i] !== undefined
// ) {
// if (caseData[i] == "0") {
// return;
// }
// if(i == 'majorType'){
// this.searchTags.push({ type:'majorType',value:this.majorTypeTranslate(caseData[i])})
// }
// if(i == 'orgDomain'){
// this.searchTags.push({type:'orgDomain',value:this.orgDomainTranslate(caseData[i])})
// }
// if(i == 'keyWord'){
// this.searchTags.push({type:'keyWord',value:caseData[i]})
// }
// }
// }
// },
tagsClose(tag, index) {
if(tag.type=='org_domain'){
console.log(tag)
this.domain.some((m,idx)=>{
if(m.code=tag.code){
m.fielclass=false;
return true;
}
return false;
})
}else if(tag.type=='major_type'){
this.speciData.some((m,idx)=>{
if(m.code=tag.code){
m.fielclass=false;
return true;
}
return false;
})
}else if(tag.type=='keyWord'){
this.queryCondition.keyWord = "";
this.keyWord = "";
tag.fielclass=false;
if(tag.type==0){
this.keyWord='';
}
this.fieldData.splice(index,1);
this.getCaseData();
// if(tag.type=='org_domain'){
// console.log(tag)
// this.domain.some((m,idx)=>{
// if(m.code=tag.code){
// m.fielclass=false;
// return true;
// }
// return false;
// })
// }else if(tag.type=='major_type'){
// this.speciData.some((m,idx)=>{
// if(m.code=tag.code){
// m.fielclass=false;
// return true;
// }
// return false;
// })
// }else if(tag.type=='keyWord'){
// this.queryCondition.keyWord = "";
// this.keyWord = "";
// }
//this.fieldData.splice(index,1);
//this.getCaseData();
this.search();
},
getCaseUserData(caseList) {
@@ -967,7 +1022,7 @@ export default {
line-height: 30px;
display: flex;
.case-tittext {
font-size: 18px;
font-size: 18px;
font-weight: 600;
color: #333333;
width: 67%;
@@ -1071,11 +1126,11 @@ export default {
.portal-content {
display: flex;
justify-content: space-between;
}
.searchbar {
background-color: #ffffff;
}
.fixed {