diff --git a/src/components/PortalHeader.vue b/src/components/PortalHeader.vue index 628c84b8..b55b1091 100644 --- a/src/components/PortalHeader.vue +++ b/src/components/PortalHeader.vue @@ -1,236 +1,403 @@ diff --git a/src/views/portal/case/Index.vue b/src/views/portal/case/Index.vue index 70f7c91e..79daae12 100644 --- a/src/views/portal/case/Index.vue +++ b/src/views/portal/case/Index.vue @@ -1,10 +1,26 @@ @@ -498,9 +793,9 @@ import { deepClone } from "../../../utils"; import apiDict from "@/api/modules/dict.js"; import apiType from "@/api/modules/type.js"; import { cutFullName } from "@/utils/tools.js"; -import apiPlace from "@/api/phase2/place.js" -import AICall from '@/views/portal/case/AICall.vue' -import AICaseConsult from '@/views/portal/case/components/AICaseConsult.vue' +import apiPlace from "@/api/phase2/place.js"; +import AICall from "@/views/portal/case/AICall.vue"; +import AICaseConsult from "@/views/portal/case/components/AICaseConsult.vue"; export default { name: "case", components: { @@ -511,11 +806,10 @@ export default { timeShow, author, AICall, - AICaseConsult + AICaseConsult, }, data() { return { - timeoutId: null, isTimeData: false, articlePageList: [], @@ -523,41 +817,41 @@ export default { isTime: false, numIsFalse: true, switch: { - 'total': '总', - 'quarter': '季度', + total: "总", + quarter: "季度", }, - favorableName: '季度', - popularityName: '季度', + favorableName: "季度", + popularityName: "季度", pubTimeNum: 1, pageViewNum: 0, - twoId: '', + twoId: "", treeList: [], - caseType: process.env.VUE_APP_CASE_TYPE,//类型 + caseType: process.env.VUE_APP_CASE_TYPE, //类型 caseYears: [], - refId: '',//消息跳转案例的id - selectList: [],//点击选中的list + refId: "", //消息跳转案例的id + selectList: [], //点击选中的list twoList: [], //二级分类{type:12} - threeList: [],//三级分类{type:13} + threeList: [], //三级分类{type:13} showUClass: false, fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL, resonimg: {}, - domain: [],//组织领域 - domainAll: [],//全部的组织领域 - speciData: [],//专业分类 + domain: [], //组织领域 + domainAll: [], //全部的组织领域 + speciData: [], //专业分类 moreState: 1, // 1 加载更多 2 加载中 3无数据 isSeach: false, searchwd: false, showAll: true, //是否展开全部 - initHeight: 40,//原始 高度 - searchRecords: [],//热门搜索词 + initHeight: 40, //原始 高度 + searchRecords: [], //热门搜索词 caseList: { count: 0, list: [], - showPagCount: 0 + showPagCount: 0, }, - ankingList: [],//排行数据1 - Popularity: [],//排行数据2 - Positive: [],//排行数据3 + ankingList: [], //排行数据1 + Popularity: [], //排行数据2 + Positive: [], //排行数据3 recommendRank: [], protocolDialogVisible: false, protocolConfirmButton: true, @@ -566,28 +860,28 @@ export default { pageIndex: 1, pageSize: 5, // orderField: "excellent", - majorType: '', //专业分类code + majorType: "", //专业分类code // orderAsc: false, // isTop: true, excellent: true, - keyWord: '', + keyWord: "", orgDomainDtos: [], - caseType: '', - authorName: '', + caseType: "", + authorName: "", notInIds: [], - type: 'all', - userId: '', - parent: '', + type: "all", + userId: "", + parent: "", children: [], - name: '', + name: "", years: [], // 随机 // notInIds: [],//重复的id orderField: "id", - orderAsc: false,//排序 - sysType1: '', - sysType2: '', - sysType3: '' + orderAsc: false, //排序 + sysType1: "", + sysType2: "", + sysType3: "", }, keyWord: "", anking: 2, @@ -597,10 +891,19 @@ export default { type3: 0, isFind: false, fielclassjor: true, - localSessionKey: this.$xpage.constants.localCaseFiltersKey + localSessionKey: this.$xpage.constants.localCaseFiltersKey, }; }, watch: { + "$route.query.keyword": { + handler(newval) { + if (newval && this.keyWord != newval) { + this.keyWord = newval; + this.search(true); + } + }, + immediate: true, + }, // years() { // this.search(true) // } @@ -622,19 +925,25 @@ export default { } return isOk; }, - tagList() { //列表属性,用于计算 + tagList() { + //列表属性,用于计算 let list = []; if (this.keyWord) { - list.push({ type: '0', code: 'keyword', name: this.keyWord, checked: true }) + list.push({ + type: "0", + code: "keyword", + name: this.keyWord, + checked: true, + }); } - this.domain.forEach(one => { - var twoChildChecked = false;//是否有下级 - one.list.forEach(two => { + this.domain.forEach((one) => { + var twoChildChecked = false; //是否有下级 + one.list.forEach((two) => { if (two.fielclass) { twoChildChecked = true; } var threeChildChecked = false; - two.list.forEach(three => { + two.list.forEach((three) => { if (three.fielclass) { list.push(three); threeChildChecked = true; @@ -647,144 +956,148 @@ export default { if (one.fielclass && !twoChildChecked) { list.push(one); } - }) - this.speciData.forEach(item => { + }); + this.speciData.forEach((item) => { if (item.fielclass) { list.push(item); } }); - this.treeList.forEach(one => { - var twoChildChecked = false;//是否有下级 - one.children && one.children.forEach(two => { - if (two.checked) { - twoChildChecked = true; - } - var threeChildChecked = false; - two.children && two.children.forEach(three => { - if (three.checked) { - list.push(three); - threeChildChecked = true; + this.treeList.forEach((one) => { + var twoChildChecked = false; //是否有下级 + one.children && + one.children.forEach((two) => { + if (two.checked) { + twoChildChecked = true; + } + var threeChildChecked = false; + two.children && + two.children.forEach((three) => { + if (three.checked) { + list.push(three); + threeChildChecked = true; + } + }); + if (two.checked && !threeChildChecked) { + list.push(two); } }); - if (two.checked && !threeChildChecked) { - list.push(two); - } - }); if (one.checked && !twoChildChecked) { list.push(one); } - }) + }); // console.log(list,'计算属性'); return list; }, oneTagAll() { - return !this.domain.some(item => item.fielclass); + return !this.domain.some((item) => item.fielclass); }, twoTagAll() { - return !this.twoList.some(item => item.fielclass) + return !this.twoList.some((item) => item.fielclass); }, threeTagAll() { - return !this.threeList.some(item => item.fielclass); + return !this.threeList.some((item) => item.fielclass); }, speciAll() { - return !this.speciData.some(item => item.fielclass); - } + return !this.speciData.some((item) => item.fielclass); + }, }, beforeRouteLeave(to, from, next) { - const isScroll = 'caseDetail,caseCharts,caseExcellent' + const isScroll = "caseDetail,caseCharts,caseExcellent"; if (!isScroll.includes(to.name)) { // console.log('我是外') - this.queryCondition.pageIndex = 1 - this.search() + this.queryCondition.pageIndex = 1; + this.search(); // window.location.reload() // this.$destroy() } else { - sessionStorage.setItem('pagesScroll', JSON.stringify(window.pageYOffset)) + sessionStorage.setItem("pagesScroll", JSON.stringify(window.pageYOffset)); } window.removeEventListener("scroll", this.handleScroll); - next() + next(); }, beforeRouteEnter(to, from, next) { - if (from.name !== 'caseDetail') { + if (from.name !== "caseDetail") { // console.log('我是内') } - next(vm => { + next((vm) => { vm.$nextTick(() => { window.scrollTo({ left: 0, top: JSON.parse(sessionStorage.getItem("pagesScroll")), - }) - sessionStorage.removeItem("pagesScroll") - vm.allRequests() + }); + sessionStorage.removeItem("pagesScroll"); + vm.allRequests(); }); - }) + }); }, created() { (() => { const allData = { 0: { - orderField: 'id', - orderAsc: false + orderField: "id", + orderAsc: false, }, 1: { - orderField: 'id', - orderAsc: true + orderField: "id", + orderAsc: true, }, 2: { - orderField: 'title', - orderAsc: false + orderField: "title", + orderAsc: false, }, 3: { - orderField: 'title', - orderAsc: true + orderField: "title", + orderAsc: true, }, 4: { - orderField: 'sysCreateTime', - orderAsc: false + orderField: "sysCreateTime", + orderAsc: false, }, 5: { - orderField: 'sysCreateTime', - orderAsc: true + orderField: "sysCreateTime", + orderAsc: true, }, 6: { - orderField: 'authorId', - orderAsc: false + orderField: "authorId", + orderAsc: false, }, 7: { - orderField: 'authorId', - orderAsc: true + orderField: "authorId", + orderAsc: true, }, 8: { - orderField: 'authorName', - orderAsc: false + orderField: "authorName", + orderAsc: false, }, 9: { - orderField: 'authorName', - orderAsc: true + orderField: "authorName", + orderAsc: true, }, - } - const allArr = Object.keys(allData) + }; + const allArr = Object.keys(allData); let recordsArr = JSON.parse(sessionStorage.getItem("recordsArr")) || []; - let difference = allArr.filter(element => !recordsArr.includes(element)); + let difference = allArr.filter( + (element) => !recordsArr.includes(element) + ); if (recordsArr.length === allArr.length) { - difference = [...allArr] - recordsArr = [] + difference = [...allArr]; + recordsArr = []; } - let random = Math.floor(Math.random() * difference.length) + let random = Math.floor(Math.random() * difference.length); for (let i = 0; i < difference.length; i++) { if (i == random) { - recordsArr.push(difference[i]) + recordsArr.push(difference[i]); break; } } - sessionStorage.setItem("recordsArr", JSON.stringify(recordsArr)) + sessionStorage.setItem("recordsArr", JSON.stringify(recordsArr)); const dataList = (data) => { - this.queryCondition.orderField = data.orderField - this.queryCondition.orderAsc = data.orderAsc - } - dataList(allData[random]) - })() + this.queryCondition.orderField = data.orderField; + this.queryCondition.orderAsc = data.orderAsc; + }; + dataList(allData[random]); + })(); }, mounted() { let $this = this; @@ -804,33 +1117,36 @@ export default { // 90是测试环境,155是生产环境 // console.log(this.caseType); - Promise.all([apiType.treeList(1, Number(this.caseType ?? 155), 1), apiCase.majorTypes()]).then(rs => { + Promise.all([ + apiType.treeList(1, Number(this.caseType ?? 155), 1), + apiCase.majorTypes(), + ]).then((rs) => { if (rs[0].code == 200) { - const { records } = rs[0].data - records.forEach(item => { + const { records } = rs[0].data; + records.forEach((item) => { item.fielclass = false; - item.type = 'org_domain'; - item.list = item.children ? item.children : [] + item.type = "org_domain"; + item.list = item.children ? item.children : []; if (Array.isArray(item.children)) { - item.list.forEach(sub => { - sub.list = sub.children ? sub.children : [] - sub.fielclass = false + item.list.forEach((sub) => { + sub.list = sub.children ? sub.children : []; + sub.fielclass = false; if (Array.isArray(sub.children)) { - sub.list.forEach(three => { - three.list = three.children ? three.children : [] - three.fielclass = false - }) + sub.list.forEach((three) => { + three.list = three.children ? three.children : []; + three.fielclass = false; + }); } - }) + }); } - }) + }); this.domain = records; } if (rs[1].status == 200) { - rs[1].result.forEach(item => { + rs[1].result.forEach((item) => { item.fielclass = false; - item.type = 'major_type'; - }) + item.type = "major_type"; + }); this.speciData = rs[1].result; } this.loadLocalFilters(); @@ -851,140 +1167,145 @@ export default { // 从消息多个案例跳转到本页面 this.refId = this.$route.query.recommendId; if (this.refId) { - this.queryCondition.type = 'recommend' + this.queryCondition.type = "recommend"; } - this.loadTypeData();//加载分类 + this.loadTypeData(); //加载分类 this.getAnkingData(); this.searchterm(); //打开排行榜下边的两个 this.getPopularity(); this.getPositive(); - this.getQueryRecommendRank() + this.getQueryRecommendRank(); this.couresreso(); // window.addEventListener("scroll", this.handleScroll); // 获取年 this.getYears(); - this.allRequests() + this.allRequests(); }, beforeDestroy() { // window.removeEventListener("scroll", this.handleScroll); // console.log('销毁了'); - }, methods: { -// 是否展示入口 + // 是否展示入口 allRequests() { - window.addEventListener( - "scroll", - this.handleScroll - ); + window.addEventListener("scroll", this.handleScroll); }, deleteFavorite(e) { - this.search() + this.search(); }, positiveReview(e) { - this.favorableName = this.switch[e] - this.getPositive() + this.favorableName = this.switch[e]; + this.getPositive(); }, popularityReview(e) { - this.popularityName = this.switch[e] - this.getPopularity() + this.popularityName = this.switch[e]; + this.getPopularity(); }, handleType(msg) { // this.queryCondition.type = msg }, handleOptionClick(treeItem) { - this.treeList.forEach(one => { + this.treeList.forEach((one) => { one.checked = false; if (one.id == treeItem.id) { one.checked = true; - this.queryCondition.sysType2 = '' - this.queryCondition.sysType3 = '' - this.queryCondition.sysType1 = one.id + this.queryCondition.sysType2 = ""; + this.queryCondition.sysType3 = ""; + this.queryCondition.sysType1 = one.id; } - one.children.forEach(two => { + one.children.forEach((two) => { two.checked = false; if (two.id == treeItem.id) { - two.checked = true - this.queryCondition.sysType1 = '' - this.queryCondition.sysType3 = '' - this.queryCondition.sysType2 = two.id + two.checked = true; + this.queryCondition.sysType1 = ""; + this.queryCondition.sysType3 = ""; + this.queryCondition.sysType2 = two.id; } - two.children.forEach(three => { + two.children.forEach((three) => { three.checked = false; if (three.id == treeItem.id) { - three.checked = true - this.queryCondition.sysType1 = '' - this.queryCondition.sysType2 = '' - this.queryCondition.sysType3 = three.id + three.checked = true; + this.queryCondition.sysType1 = ""; + this.queryCondition.sysType2 = ""; + this.queryCondition.sysType3 = three.id; } - }) - }) - }) - this.getCaseData() + }); + }); + }); + this.getCaseData(); }, // 移入 changeIndex(twoId) { - this.twoId = twoId + this.twoId = twoId; }, // 移除 leaveIndex() { - this.twoId = '' + this.twoId = ""; }, // 加载分类 async loadTypeData() { try { const { result, status } = await apiType.tree(1); if (status === 200) { - result.forEach(one => { + result.forEach((one) => { one.checked = false; - if (!one.children) one.children = [] - one.children && one.children.forEach(two => { - two.checked = false; - if (!two.children) two.children = [] - two.children && two.children.forEach(three => { - three.checked = false; - if (!three.children) three.children = [] - }) - }) - }) - this.treeList = result + if (!one.children) one.children = []; + one.children && + one.children.forEach((two) => { + two.checked = false; + if (!two.children) two.children = []; + two.children && + two.children.forEach((three) => { + three.checked = false; + if (!three.children) three.children = []; + }); + }); + }); + this.treeList = result; } } catch (error) { // console.log(error); } }, getYears() { - apiCase.caseYears().then(res => { + apiCase.caseYears().then((res) => { if (res.status == 200) { const { result } = res; // console.log(result); - this.caseYears = result.map(year => ({ + this.caseYears = result.map((year) => ({ value: year, label: year, - })) + })); } - }) + }); }, // 查看率的时间 toCaseDetail(id, refId) { if (!id) { - this.$message.error('该案例已被删除') - return + this.$message.error("该案例已被删除"); + return; } - apiCase.details(id, true).then(res => { + apiCase.details(id, true).then((res) => { if (res.status == 200) { if (refId) { - apiCase.startReadTimer(refId) + apiCase.startReadTimer(refId); } - this.$router.push({ path: '/case/detail', query: { id } }); + this.$router.push({ path: "/case/detail", query: { id } }); } else { this.$message.error(res.message); } - }) + }); }, toExcellent(item) { - this.$router.push({ path: '/case/excellent', query: { majorId: item.majorId, majorName: item.majorName, riseRankTime: item.riseRankTime.split(' ')[0] } }) + this.$router.push({ + path: "/case/excellent", + query: { + majorId: item.majorId, + majorName: item.majorName, + riseRankTime: item.riseRankTime.split(" ")[0], + }, + }); }, tylClick() { window.open("https://m.qingxuetang.com/x/?appId=qxtcorp306130"); @@ -999,12 +1320,12 @@ export default { }, saveLocalFilters() { let typeCodeList = []; - this.tagList.forEach(item => { + this.tagList.forEach((item) => { typeCodeList.push({ type: item.type, code: item.code, - name: item.name - }) + name: item.name, + }); }); let typeCodeString = JSON.stringify(typeCodeList); sessionStorage.setItem(this.localSessionKey, typeCodeString); @@ -1013,36 +1334,34 @@ export default { let hasData = sessionStorage.getItem(this.localSessionKey); if (hasData) { let typeCodeList = JSON.parse(hasData); - typeCodeList.forEach(item => { - if (item.type == '0') { + typeCodeList.forEach((item) => { + if (item.type == "0") { this.keyWord = item.name; - } else if (item.type == 'major_type') { - this.speciData.some(m => { + } else if (item.type == "major_type") { + this.speciData.some((m) => { if (m.code == item.code) { m.fielclass = true; return true; } return false; - }) - - } else if (item.type == 'org_domain') { - this.domain.some(m => { + }); + } else if (item.type == "org_domain") { + this.domain.some((m) => { if (m.code == item.code) { m.fielclass = true; return true; } return false; - }) - + }); } - }) + }); } }, majorall() { - this.queryCondition.majorType = ''; - this.speciData.forEach(item => { + this.queryCondition.majorType = ""; + this.speciData.forEach((item) => { item.fielclass = false; - }) + }); this.search(true); }, // 组织领域全部 @@ -1050,40 +1369,41 @@ export default { // console.log(this.selectList, 999); if (type == 1) { // 清空一下所有的 - this.domain.forEach(item => { + this.domain.forEach((item) => { item.fielclass = false; - item?.list?.forEach(sub => { + item?.list?.forEach((sub) => { sub.fielclass = false; - sub?.list.forEach(subsub => { + sub?.list.forEach((subsub) => { subsub.fielclass = false; - }) - }) - }) + }); + }); + }); this.twoList = []; this.threeList = []; } else if (type == 2) { - this.twoList.forEach(item => { + this.twoList.forEach((item) => { item.fielclass = false; - }) + }); // 清空当前元素的三级的 - this.domain.forEach(item => { + this.domain.forEach((item) => { if (this.selectList.code == item.code) { - item?.list?.forEach(sub => { - sub?.list?.forEach(three => { - three.fielclass = false + item?.list?.forEach((sub) => { + sub?.list?.forEach((three) => { + three.fielclass = false; }); - }) + }); } - }) + }); this.threeList = []; } else if (type == 3) { - this.threeList.forEach(item => { + this.threeList.forEach((item) => { item.fielclass = false; - }) + }); } this.search(true); }, - fieldmajor(item) {//专业分类 + fieldmajor(item) { + //专业分类 item.fielclass = !item.fielclass; this.search(true); }, @@ -1093,12 +1413,12 @@ export default { // 清空下边的为false的时候 if (!item.fielclass) { if (Array.isArray(item.list)) { - item.list.forEach(subItem => { + item.list.forEach((subItem) => { subItem.fielclass = false; if (subItem.list) { - subItem.list.forEach(sub => { + subItem.list.forEach((sub) => { sub.fielclass = false; - }) + }); } }); } @@ -1118,7 +1438,7 @@ export default { this.threeList = []; this.twoList.push(...item.list); // 全选根据他判断清楚三级 - this.selectList = item + this.selectList = item; } else if (level === 2) { this.threeList = []; this.threeList.push(...item.list); @@ -1133,31 +1453,32 @@ export default { } }, couresreso() { - let key = 'case'; - apiPlace.detail(key).then(res => { - let lmj = JSON.parse(res.result.content) - this.resonimg = lmj[0] - }) + let key = "case"; + apiPlace.detail(key).then((res) => { + let lmj = JSON.parse(res.result.content); + this.resonimg = lmj[0]; + }); }, specialized() { let $this = this; - apiCase.majorTypes().then(res => { + apiCase.majorTypes().then((res) => { if (res.status == 200) { if (res.status == 200) { - res.result.forEach(item => { + res.result.forEach((item) => { item.fielclass = false; - item.type = 'major_type'; - }) + item.type = "major_type"; + }); } this.speciData = res.result; this.loadLocalFilters(1); //this.Profess=res.result; this.$nextTick(function () { - $this.initHeight = document.getElementById("searchBox").offsetHeight; + $this.initHeight = + document.getElementById("searchBox").offsetHeight; $this.closeSearch(); }); } - }) + }); }, // jumcasedet(item) { // this.$router.push({ path: '/case/detail', query: { id: item.id } }); @@ -1200,7 +1521,7 @@ export default { } }, getAnkingData() { - apiCase.usernameList(5).then(res => { + apiCase.usernameList(5).then((res) => { if (res.status == 200) { this.ankingList = res.result; } @@ -1225,12 +1546,12 @@ export default { // 无用 async getdomain() { let key = "org_domain"; - await apiDict.items("org_domain").then(res => { + await apiDict.items("org_domain").then((res) => { if (res.status == 200) { - res.result.forEach(item => { + res.result.forEach((item) => { item.fielclass = false; item.type = key; - }) + }); this.domain = res.result; this.loadLocalFilters(2); // if(res.result.length > 0) { @@ -1259,14 +1580,15 @@ export default { // } // }) // }, - orgDomainTranslate(code) { // 组织领域翻译 - if (code == '') { - return + orgDomainTranslate(code) { + // 组织领域翻译 + if (code == "") { + return; } //console.log(code,'code') //console.log(this.domain,'this.domain') - let name = ''; - let data = this.domain.find(item => { + let name = ""; + let data = this.domain.find((item) => { return item.code == code; }); if (data) { @@ -1274,9 +1596,10 @@ export default { } return name; }, - majorTypeTranslate(code) { // 专业分类翻译 - let name = ''; - let data = this.speciData.find(item => item.code == code); + majorTypeTranslate(code) { + // 专业分类翻译 + let name = ""; + let data = this.speciData.find((item) => item.code == code); if (data) { name = data.name; } @@ -1288,40 +1611,42 @@ export default { this.search(true); }, searchTime() { - this.pubTimeNum++ + this.pubTimeNum++; if (this.pubTimeNum > 2) { this.pubTimeNum = 0; } if (this.pubTimeNum != 0) { this.pageViewNum = 0; } - this.queryCondition.orderField = 'sysCreateTime' - this.queryCondition.orderAsc = this.pubTimeNum == 2 ? true : this.pubTimeNum == 1 ? false : '' + this.queryCondition.orderField = "sysCreateTime"; + this.queryCondition.orderAsc = + this.pubTimeNum == 2 ? true : this.pubTimeNum == 1 ? false : ""; this.search(true); }, searchPageView() { - this.pageViewNum++ + this.pageViewNum++; if (this.pageViewNum > 2) { this.pageViewNum = 0; } if (this.pageViewNum != 0) { this.pubTimeNum = 0; } - this.queryCondition.orderField = 'views' - this.queryCondition.orderAsc = this.pageViewNum == 2 ? true : this.pageViewNum == 1 ? false : '' + this.queryCondition.orderField = "views"; + this.queryCondition.orderAsc = + this.pageViewNum == 2 ? true : this.pageViewNum == 1 ? false : ""; this.search(true); }, yearsChange(e) { - this.search(true) + this.search(true); }, searchexcellent(num) { - this.isTimeData = false - this.isTime = false - this.caseTimeShow = true - this.pubTimeNum = 0 - this.pageViewNum = 0 - this.queryCondition.orderField = '' - this.queryCondition.orderAsc = '' + this.isTimeData = false; + this.isTime = false; + this.caseTimeShow = true; + this.pubTimeNum = 0; + this.pageViewNum = 0; + this.queryCondition.orderField = ""; + this.queryCondition.orderAsc = ""; // if(this.queryCondition.type==num){ // this.queryCondition.excellent =false; // this.queryCondition.type = ''; @@ -1330,23 +1655,23 @@ export default { // } this.queryCondition.excellent = false; this.queryCondition.type = num; - this.years = [] - if (num == 'excellent') { + this.years = []; + if (num == "excellent") { this.queryCondition.excellent = true; this.queryCondition.type = num; } - if (num == 'all' || num == 'recommend') { - this.pubTimeNum = 1 - this.queryCondition.orderField = 'sysCreateTime' - this.queryCondition.orderAsc = false + if (num == "all" || num == "recommend") { + this.pubTimeNum = 1; + this.queryCondition.orderField = "sysCreateTime"; + this.queryCondition.orderAsc = false; } - if (num == 'time') { - this.isTime = true - this.caseTimeShow = false - this.isTimeData = true + if (num == "time") { + this.isTime = true; + this.caseTimeShow = false; + this.isTimeData = true; } - if (num == 'collect') { - this.caseTimeShow = false + if (num == "collect") { + this.caseTimeShow = false; } if (this.timeoutId) { clearTimeout(this.timeoutId); @@ -1389,7 +1714,7 @@ export default { this.search(); }, searchterm() { - apiSearchterm.list(5, 3).then(res => { + apiSearchterm.list(5, 3).then((res) => { if (res.status === 200) { this.searchRecords = res.result; } @@ -1413,29 +1738,30 @@ export default { // handleCurrentChange(item) { // this.queryCondition.pageIndex = item; // }, - getAllFielclass() { //获取全部选中的标签 - let newlist = JSON.parse(JSON.stringify(this.domain)) - return newlist.filter(one => { - one.list = one.list.filter(two => { + getAllFielclass() { + //获取全部选中的标签 + let newlist = JSON.parse(JSON.stringify(this.domain)); + return newlist.filter((one) => { + one.list = one.list.filter((two) => { // if (!two.fielclass) { // one.list = [] // } - two.list = two.list.filter(three => { + two.list = two.list.filter((three) => { // if (!three.fielclass) { // two.list = [] // } return three.fielclass; - }) + }); return two.fielclass; }); - return one.fielclass - }) + return one.fielclass; + }); }, // 改变分页 currentChange(val) { - this.caseList.showPagCount = 0 - this.queryCondition.pageIndex = val - this.search() + this.caseList.showPagCount = 0; + this.queryCondition.pageIndex = val; + this.search(); }, // 查询 search(num = false) { @@ -1447,58 +1773,59 @@ export default { this.isFind = true; } if (num) { - this.caseList.showPagCount = 0 + this.caseList.showPagCount = 0; this.queryCondition.pageIndex = 1; } if (this.keyWord != this.queryCondition.keyWord) { this.queryCondition.keyWord = this.keyWord; + // this.tagList.forEach((tag, index) => { + // this.tagsClose(tag, index); + // }); } if (this.queryCondition.majorType == 0) { - this.queryCondition.majorType = '' + this.queryCondition.majorType = ""; } this.getCaseData(); }, async getCaseData() { - this.saveLocalFilters();//存储本地刷新有记录 + this.saveLocalFilters(); //存储本地刷新有记录 let majorTypeList = []; let allFielclass = JSON.parse(JSON.stringify(this.getAllFielclass())); // 获取树状id - this.queryCondition.orgDomainDtos = allFielclass.map(item => { - item.list = item.list.map(two => { - two.list = two.list.map(three => { + this.queryCondition.orgDomainDtos = allFielclass.map((item) => { + item.list = item.list.map((two) => { + two.list = two.list.map((three) => { return { - parent: three.code - } - }) + parent: three.code, + }; + }); return { parent: two.code, - children: two.list || [] - } - }) + children: two.list || [], + }; + }); return { parent: item.code, - children: item.list || [] - } - }) + children: item.list || [], + }; + }); // console.log(JSON.stringify(this.queryCondition.orgDomainDtos)); - - // 专业分类的id - this.tagList.forEach(tag => { - if (tag.type == '0') { + this.tagList.forEach((tag) => { + if (tag.type == "0") { this.queryCondition.keyWord = tag.name; - } else if (tag.type == 'major_type') { + } else if (tag.type == "major_type") { majorTypeList.push(tag.code); } }); - this.queryCondition.majorType = majorTypeList.join(','); + this.queryCondition.majorType = majorTypeList.join(","); //设置年 - this.queryCondition.years = this.years.map(item => parseInt(item)) + this.queryCondition.years = this.years.map((item) => parseInt(item)); // 设置最佳案例为true或是false - if (this.queryCondition.type == 'excellent') { + if (this.queryCondition.type == "excellent") { this.queryCondition.excellent = true; } else { this.queryCondition.excellent = false; @@ -1511,46 +1838,48 @@ export default { this.moreState = 2; // this.queryCondition.pubTimeNum = this.pubTimeNum // this.queryCondition.pageViewNum = this.pageViewNum - this.numIsFalse = true - if (this.queryCondition.type == 'collect') { + this.numIsFalse = true; + if (this.queryCondition.type == "collect") { const params = { pageIndex: this.queryCondition.pageIndex, pageSize: 5, orderField: this.queryCondition.orderField, - orderAsc: this.queryCondition.orderAsc - } - await apiCase.queryFavoriteCaseOfIndex(params).then(res => { + orderAsc: this.queryCondition.orderAsc, + }; + await apiCase.queryFavoriteCaseOfIndex(params).then((res) => { if (res.status == 200) { if (res.result.list.length > 0) { this.isSeach = false; - res.result.list.forEach(item => { - item.majorType = item.majorType ? item.majorType.split(",") : []; + res.result.list.forEach((item) => { + item.majorType = item.majorType + ? item.majorType.split(",") + : []; item.isAll = false; item.authorInfo = { aid: "", name: "", orgInfo: "", avatar: "", - sex: null + sex: null, }; }); - res.result.list.forEach(item => { - item.viewRankTags = item.viewRankTags?.slice(0, 2) || [] - }) - this.caseList.list = res.result.list + res.result.list.forEach((item) => { + item.viewRankTags = item.viewRankTags?.slice(0, 2) || []; + }); + this.caseList.list = res.result.list; this.getCaseUserData(res.result.list); // 给所有的赋值 this.caseList.count = res.result.count; this.caseList.showPagCount = res.result.count; this.timeoutId = setTimeout(() => { - this.numIsFalse = false + this.numIsFalse = false; }, 3000); } } - }) - return + }); + return; } - if (this.queryCondition.type == 'time') { + if (this.queryCondition.type == "time") { // const data = { // pageIndex: this.queryCondition.pageIndex, // pageSize: 5, @@ -1573,86 +1902,93 @@ export default { // }) const params = { pageIndex: this.queryCondition.pageIndex, - } - await apiCase.browsingHistory(params).then(res => { + }; + await apiCase.browsingHistory(params).then((res) => { if (res.status == 200) { if (res.result.list.length > 0) { this.isSeach = false; - res.result.list.forEach(item => { - item.majorType = item.majorType ? item.majorType.split(",") : []; + res.result.list.forEach((item) => { + item.majorType = item.majorType + ? item.majorType.split(",") + : []; item.isAll = false; item.authorInfo = { aid: "", name: "", orgInfo: "", avatar: "", - sex: null + sex: null, }; }); - res.result.list.forEach(item => { - item.viewRankTags = item.viewRankTags?.slice(0, 2) || [] - }) - this.caseList.list = res.result.list + res.result.list.forEach((item) => { + item.viewRankTags = item.viewRankTags?.slice(0, 2) || []; + }); + this.caseList.list = res.result.list; this.getCaseUserData(res.result.list); this.caseList.count = res.result.count; this.caseList.showPagCount = res.result.count; this.timeoutId = setTimeout(() => { - this.numIsFalse = false + this.numIsFalse = false; }, 3000); } } - }) - return + }); + return; } - await apiCase.queryListV2(this.queryCondition).then((res) => { - if (res.status == 200) { - if (res.result.list.length > 0) { - this.isSeach = false; - res.result.list.forEach(item => { - item.majorType = item.majorType ? item.majorType.split(",") : []; - item.isAll = false; - item.authorInfo = { - aid: "", - name: "", - orgInfo: "", - avatar: "", - sex: null - }; - }); - // this.caseList.list.push(...res.result.list); - this.moreState = 1; - if (res.result.count === res.result.list.length) { + await apiCase + .queryListV2(this.queryCondition) + .then((res) => { + if (res.status == 200) { + if (res.result.list.length > 0) { + this.isSeach = false; + res.result.list.forEach((item) => { + item.majorType = item.majorType + ? item.majorType.split(",") + : []; + item.isAll = false; + item.authorInfo = { + aid: "", + name: "", + orgInfo: "", + avatar: "", + sex: null, + }; + }); + // this.caseList.list.push(...res.result.list); + this.moreState = 1; + if (res.result.count === res.result.list.length) { + this.moreState = 3; + } + } else { this.moreState = 3; } + if (res.result.list.length === 0) { + this.moreState = 3; + this.isSeach = false; + } + console.log(res?.result?.list, "有没有数据1"); + res.result.list.forEach((item) => { + item.viewRankTags = item.viewRankTags?.slice(0, 2) || []; + }); + console.log(res?.result?.list, "有没有数据2"); + this.caseList.list = res.result.list; + this.getCaseUserData(res.result.list); + // 给所有的赋值 + this.caseList.count = res.result.count; + this.caseList.showPagCount = res.result.count; + this.timeoutId = setTimeout(() => { + this.numIsFalse = false; + }, 3000); } else { - this.moreState = 3; + this.$message.error(res.message); } - if (res.result.list.length === 0) { - this.moreState = 3; - this.isSeach = false; - } - console.log(res?.result?.list, '有没有数据1'); - res.result.list.forEach(item => { - item.viewRankTags = item.viewRankTags?.slice(0, 2) || [] - }) - console.log(res?.result?.list, '有没有数据2'); - this.caseList.list = res.result.list - this.getCaseUserData(res.result.list); - // 给所有的赋值 - this.caseList.count = res.result.count; - this.caseList.showPagCount = res.result.count; + }) + .catch((err) => { + // console.log(err); this.timeoutId = setTimeout(() => { - this.numIsFalse = false + this.numIsFalse = false; }, 3000); - } else { - this.$message.error(res.message); - } - }).catch(err => { - // console.log(err); - this.timeoutId = setTimeout(() => { - this.numIsFalse = false - }, 3000); - }); + }); // await apiCase.queryList(this.queryCondition).then(res => { // if (res.status == 200) { @@ -1688,18 +2024,18 @@ export default { // }); }, getCase(ids, list) { - apiCase.ids(ids).then(res => { + apiCase.ids(ids).then((res) => { if (res.status == 200) { this.isSeach = false; - const listData = [] + const listData = []; list.forEach((item, index) => { - res.result.some(con => { + res.result.some((con) => { if (con.id == item.contentId) { item.info = con; - con.eventTime = item.eventTime - listData.push(con) - if (typeof item.info.majorType == 'string') { - item.info.majorType = item.info.majorType.split(','); + con.eventTime = item.eventTime; + listData.push(con); + if (typeof item.info.majorType == "string") { + item.info.majorType = item.info.majorType.split(","); } return true; } else { @@ -1707,7 +2043,7 @@ export default { } }); }); - listData.forEach(item => { + listData.forEach((item) => { item.info = {}; item.deleted = false; item.authorInfo = { @@ -1715,18 +2051,18 @@ export default { name: "", orgInfo: "", avatar: "", - sex: null - } + sex: null, + }; item.isAll = false; - }) + }); setTimeout(() => { - this.numIsFalse = false + this.numIsFalse = false; }, 3000); this.getCaseUserData(listData); - this.caseList.list = listData - console.log(listData, 'this.caseList.list') + this.caseList.list = listData; + console.log(listData, "this.caseList.list"); } - }) + }); }, // getTags() { // this.searchTags = []; @@ -1770,17 +2106,17 @@ export default { // }, tagsClose(tag, index) { // 课程分类 - if (tag.hasOwnProperty('checked')) { + if (tag.hasOwnProperty("checked")) { tag.checked = false; - this.queryCondition.sysType1 = '' - this.queryCondition.sysType2 = '' - this.queryCondition.sysType3 = '' + this.queryCondition.sysType1 = ""; + this.queryCondition.sysType2 = ""; + this.queryCondition.sysType3 = ""; } else { // 案例分类 tag.fielclass = false; } if (tag.type == 0) { - this.keyWord = ''; + this.keyWord = ""; } // if(tag.type=='org_domain'){ // console.log(tag) @@ -1806,20 +2142,19 @@ export default { //this.fieldData.splice(index,1); //this.getCaseData(); this.search(true); - }, getCaseUserData(caseList) { let ids = caseList.map((item, index) => { return item.authorId; }); //不能为空 - if (!ids.length) return + if (!ids.length) return; const noReapetIds = [...new Set(ids)]; - apiUser.getByIds(noReapetIds).then(res => { + apiUser.getByIds(noReapetIds).then((res) => { if (res.status == 200) { caseList.forEach((item, index) => { - res.result.some(author => { + res.result.some((author) => { if (author.aid == item.authorId) { item.authorInfo = author; author.orgInfo = cutFullName(author.orgInfo, 1); @@ -1851,11 +2186,13 @@ export default { // } // }); - apiCase.queryPraisesNew(3, this.popularityName == '季度' ? 1 : 2).then(res => { - if (res.status == 200) { - this.Popularity = res.result - } - }) + apiCase + .queryPraisesNew(3, this.popularityName == "季度" ? 1 : 2) + .then((res) => { + if (res.status == 200) { + this.Popularity = res.result; + } + }); }, getPositive() { // apiCase.queryComments(5).then(res => { @@ -1874,19 +2211,21 @@ export default { // // } // } // }); - apiCase.queryCommentsNew(3, this.favorableName == '季度' ? 3 : 4).then(res => { - if (res.status == 200) { - this.Positive = res.result - } - }) + apiCase + .queryCommentsNew(3, this.favorableName == "季度" ? 3 : 4) + .then((res) => { + if (res.status == 200) { + this.Positive = res.result; + } + }); }, getQueryRecommendRank() { - apiCase.queryRecommendRank(3).then(res => { + apiCase.queryRecommendRank(3).then((res) => { if (res.status == 200) { - this.recommendRank = res.result + this.recommendRank = res.result; } - }) + }); }, jumpRouter(item) { @@ -1894,8 +2233,7 @@ export default { this.$router.push(`/case/detail?id=${item.id}`); }, // 案例立即咨询 - - } + }, }; @@ -1921,51 +2259,48 @@ export default { max-width: 400px; min-width: 260px; height: 47px; - background: #DDEDFF; + background: #ddedff; border-radius: 8px; .text { font-size: 17px; - color: #387DF7; + color: #387df7; } .icon { position: absolute; font-size: 17px; - color: #387DF7; + color: #387df7; right: 25px; top: 50%; transform: translateY(-50%); } - } // 课程分类 .course-title-style { position: relative; height: 100px; - background-image: url('../../../../public/images/courseBg.png'); + background-image: url("../../../../public/images/courseBg.png"); background-repeat: no-repeat; background-size: 100% 100%; display: flex; align-items: center; .imgTilte { - & div:first-child { padding-left: 40px; font-size: 30px; - color: #FFFFFF; + color: #ffffff; } & div:last-child { padding-left: 40px; font-size: 20px; - color: #FFFFFF; - opacity: .5; + color: #ffffff; + opacity: 0.5; font-family: ArialMT !important; } - } } @@ -1981,19 +2316,29 @@ export default { line-height: 38px; height: 38px; padding-left: 40px; - background: linear-gradient(270deg, #F0F7FF 0%, #DDEDFF 100%); + background: linear-gradient(270deg, #f0f7ff 0%, #ddedff 100%); } // 二级的高亮 .courseTwoActive { - color: #387DF7; - border-image: linear-gradient(90deg, rgba(47, 101, 236, 1), rgba(228, 236, 255, 1)) 1 1 !important; + color: #387df7; + border-image: linear-gradient( + 90deg, + rgba(47, 101, 236, 1), + rgba(228, 236, 255, 1) + ) + 1 1 !important; } .course-two { position: relative; border-bottom: 1px solid; - border-image: linear-gradient(333deg, rgba(243, 243, 243, 1), rgba(227, 227, 227, 1)) 1 1; + border-image: linear-gradient( + 333deg, + rgba(243, 243, 243, 1), + rgba(227, 227, 227, 1) + ) + 1 1; .course-two-content { cursor: pointer; @@ -2005,11 +2350,13 @@ export default { } .popover { - background: linear-gradient(180deg, rgba(78, 166, 255, 0.2) 0%, rgba(78, 166, 255, 0) 100%); + background: linear-gradient( + 180deg, + rgba(78, 166, 255, 0.2) 0%, + rgba(78, 166, 255, 0) 100% + ); } - } - } .u-class { @@ -2215,7 +2562,6 @@ export default { } .fieldbox { - display: flex; white-space: nowrap; flex-wrap: wrap; @@ -2230,7 +2576,7 @@ export default { } .fieldactive { - color: #387DF7; + color: #387df7; } } @@ -2249,7 +2595,7 @@ export default { } .fieldactive { - color: #387DF7; + color: #387df7; } } @@ -2309,7 +2655,7 @@ export default { .case-banner { height: 240px; - background: url('../../../../public/images/case-banner.png'); + background: url("../../../../public/images/case-banner.png"); } ::v-deep .el-checkbox { @@ -2318,7 +2664,6 @@ export default { border: 1px solid #3e3c3c; } } - } ::v-deep .el-radio-button { @@ -2350,7 +2695,6 @@ export default { padding: 2px 4px; margin-left: 15px; } - } } @@ -2368,7 +2712,6 @@ export default { } .keyword-text { - div { padding: 0px 8px; margin-top: 5px; @@ -2377,7 +2720,7 @@ export default { font-size: 12px; border-radius: 2px; margin-right: 8px; - color: #2C68FF; + color: #2c68ff; height: 24px; background: rgba(44, 104, 255, 0.06); } @@ -2390,7 +2733,6 @@ export default { #searchBox { overflow: hidden; - } ::v-deep .title-line-ellipsis { @@ -2444,7 +2786,7 @@ export default { margin: 15px 10px 10px 0; font-size: 16px !important; font-weight: 400; - color: #6B7C85; + color: #6b7c85; line-height: 25px; } @@ -2457,12 +2799,10 @@ export default { .portal-content { display: flex; justify-content: space-between; - } .searchbar { background-color: #ffffff; - } .fixed { @@ -2491,11 +2831,10 @@ export default { border: none; .quyer-tag { - // margin-left: 10px; .order-class { padding: 0px 12px; - color: #6E7B84; + color: #6e7b84; line-height: 32px; border-radius: 0px; @@ -2506,7 +2845,7 @@ export default { .actice { border: 0px; - background: #387DF7; + background: #387df7; color: #fff; font-size: 14px; border-radius: 4px; @@ -2518,7 +2857,8 @@ export default { text-align: center; padding: 10px 0; - .pag-text {} + .pag-text { + } } .order-div { @@ -2547,7 +2887,7 @@ export default { height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; - border-bottom: 6px solid #DCDFE6; + border-bottom: 6px solid #dcdfe6; margin-bottom: 2px; } @@ -2556,7 +2896,7 @@ export default { height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; - border-top: 6px solid #DCDFE6; + border-top: 6px solid #dcdfe6; } } } @@ -2574,7 +2914,7 @@ export default { // background: #04243C; &:hover { // background: #387DF7; - border: 1px solid #387DF7; + border: 1px solid #387df7; .text { // color: #fff; @@ -2588,7 +2928,7 @@ export default { .png { width: 18px; height: 18px; - background: url('../../../../public/images/browse.png') no-repeat; + background: url("../../../../public/images/browse.png") no-repeat; background-size: 100%; margin-right: 9px; } @@ -2600,13 +2940,13 @@ export default { } .time::before { - content: ''; + content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; - background: #04243C; + background: #04243c; opacity: 0.05; z-index: 1; border-radius: 4px; @@ -2619,13 +2959,13 @@ export default { margin-left: 15px; width: 116px; height: 38px; - background: #387DF7; + background: #387df7; border-radius: 4px; .png { width: 20px; height: 20px; - background: url('../../../assets/images/case/wighttime.png') no-repeat; + background: url("../../../assets/images/case/wighttime.png") no-repeat; background-size: 100%; margin-right: 9px; } @@ -2649,7 +2989,7 @@ export default { // background: #04243C; &:hover { // background: #387DF7; - border: 1px solid #387DF7; + border: 1px solid #387df7; .text { // color: #fff; @@ -2663,7 +3003,7 @@ export default { .png { width: 18px; height: 18px; - background: url('../../../../public/images/collect.png') no-repeat; + background: url("../../../../public/images/collect.png") no-repeat; background-size: 100%; margin-right: 9px; } @@ -2675,13 +3015,13 @@ export default { } .collect::before { - content: ''; + content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; - background: #04243C; + background: #04243c; opacity: 0.05; z-index: 1; border-radius: 4px; @@ -2694,13 +3034,13 @@ export default { margin-left: 15px; width: 116px; height: 38px; - background: #387DF7; + background: #387df7; border-radius: 4px; .png { width: 18px; height: 18px; - background: url('../../../assets/images/case/wight.png') no-repeat; + background: url("../../../assets/images/case/wight.png") no-repeat; background-size: 100%; margin-right: 9px; } @@ -2713,7 +3053,7 @@ export default { } .back_num { - background: #FFFFFF; + background: #ffffff; display: flex; justify-content: center; padding: 0 40px; @@ -2724,10 +3064,10 @@ export default { align-items: center; width: 100%; height: 38px; - background: #DDEDFF; + background: #ddedff; border-radius: 4px; - border: 1px solid #387DF7; - color: #387DF7; + border: 1px solid #387df7; + color: #387df7; } } @@ -2748,7 +3088,7 @@ export default { } .case-list { - border-bottom: 1px solid rgba(153, 153, 153, .2); + border-bottom: 1px solid rgba(153, 153, 153, 0.2); margin-top: 10px; margin-bottom: 25px; padding-left: 5px;