案例优化

This commit is contained in:
zhangsir
2024-09-09 09:40:35 +08:00
parent 9ef5b5a6a3
commit 8e6c00d266
3 changed files with 95 additions and 50 deletions

View File

@@ -88,6 +88,12 @@ const usernameList = function (pageSize) {
const queryPraises = function (pageSize) { const queryPraises = function (pageSize) {
return ajax.get(`/xboe/m/boe/cases/query-praises?pageSize=${pageSize}`); return ajax.get(`/xboe/m/boe/cases/query-praises?pageSize=${pageSize}`);
} }
const queryPraisesNew = function (pageSize,rankType) {
return ajax.get(`/xboe/m/boe/cases/queryPopularity?pageSize=${pageSize}&rankType=${rankType}`);
}
const queryRecommendRank = function (pageSize) {
return ajax.get(`/xboe/m/boe/cases/queryRecommendRank?pageSize=${pageSize}`);
}
/* /*
好评榜 好评榜
@param pageSize 长度 @param pageSize 长度
@@ -95,6 +101,9 @@ const queryPraises = function (pageSize) {
const queryComments = function (pageSize) { const queryComments = function (pageSize) {
return ajax.get(`/xboe/m/boe/cases/query-comments?pageSize=${pageSize}`); return ajax.get(`/xboe/m/boe/cases/query-comments?pageSize=${pageSize}`);
} }
const queryCommentsNew = function (pageSize,rankType) {
return ajax.get(`/xboe/m/boe/cases/queryHighOpinion?pageSize=${pageSize}&rankType=${rankType}`);
}
/** /**
* 专业分类 * 专业分类
@@ -202,7 +211,10 @@ export default {
query, query,
usernameList, usernameList,
queryPraises, queryPraises,
queryPraisesNew,
queryRecommendRank,
queryComments, queryComments,
queryCommentsNew,
majorTypes, majorTypes,
details, details,
ids, ids,

View File

@@ -23,11 +23,11 @@
</div> </div>
<ul class="charts_list"> <ul class="charts_list">
<li v-for="(item, index) in Positive" :key="index" class="list"> <li v-for="(item, index) in Positive" :key="index" class="list">
<router-link style="display: flex;align-items: center;" :to="'/case/detail?id=' + item.id"> <router-link style="display: flex;align-items: center;" :to="'/case/detail?id=' + item.caseId">
<img class="num" :src="require( <img class="num" :src="require(
`../../../../public/images/${imgNumBlue(index)}.png` `../../../../public/images/${imgNumBlue(index)}.png`
)" alt=""> )" alt="">
<span class="text">{{ item.title }}</span> <span class="text">{{ item.caseTitle }}</span>
</router-link> </router-link>
</li> </li>
</ul> </ul>
@@ -47,11 +47,11 @@
</div> </div>
<ul class="charts_list"> <ul class="charts_list">
<li v-for="(item, index) in Popularity" :key="index" class="list"> <li v-for="(item, index) in Popularity" :key="index" class="list">
<router-link style="display: flex;align-items: center;" :to="'/case/detail?id=' + item.id"> <router-link style="display: flex;align-items: center;" :to="'/case/detail?id=' + item.caseId">
<img class="num" :src="require( <img class="num" :src="require(
`../../../../public/images/${imgNumOrg(index)}.png` `../../../../public/images/${imgNumOrg(index)}.png`
)" alt=""> )" alt="">
<span class="text">{{ item.title }}</span> <span class="text">{{ item.caseTitle }}</span>
</router-link> </router-link>
</li> </li>
</ul> </ul>
@@ -61,12 +61,12 @@
<div class="text">推荐榜</div> <div class="text">推荐榜</div>
</div> </div>
<ul class="charts_list"> <ul class="charts_list">
<li v-for="(item, index) in Positive" :key="index" class="list"> <li v-for="(item, index) in recommendRank" :key="index" class="list">
<router-link style="display: flex;align-items: center;" :to="'/case/detail?id=' + item.id"> <router-link style="display: flex;align-items: center;" :to="'/case/detail?id=' + item.caseId">
<img class="num" :src="require( <img class="num" :src="require(
`../../../../public/images/${imgNumPink(index)}.png` `../../../../public/images/${imgNumPink(index)}.png`
)" alt=""> )" alt="">
<span class="text">{{ item.title }}</span> <span class="text">{{ item.caseTitle }}</span>
</router-link> </router-link>
</li> </li>
</ul> </ul>
@@ -87,6 +87,7 @@ import portalHeader from '@/components/PortalHeader.vue'
ankingList: [],//排行数据1 ankingList: [],//排行数据1
Popularity: [],//排行数据2 Popularity: [],//排行数据2
Positive: [],//排行数据3 Positive: [],//排行数据3
recommendRank: [],
switch: { switch: {
'total': '总', 'total': '总',
'quarter': '季度', 'quarter': '季度',
@@ -98,21 +99,29 @@ import portalHeader from '@/components/PortalHeader.vue'
mounted() { mounted() {
this.getPopularity(); this.getPopularity();
this.getPositive(); this.getPositive();
this.getQueryRecommendRank()
}, },
methods: { methods: {
getPopularity() { getPopularity() {
apiCase.queryPraises(5).then(res => { apiCase.queryPraisesNew(10,this.popularityName == '季度' ? 1 : 2).then(res => {
if (res.status == 200) { if(res.status == 200) {
this.Popularity = [...res.result,...res.result]; this.Popularity = res.result
} }
}); })
}, },
getPositive() { getPositive() {
apiCase.queryComments(5).then(res => { apiCase.queryCommentsNew(10,this.favorableName == '季度' ? 1 : 2).then(res => {
if (res.status == 200) { if(res.status == 200) {
this.Positive = [...res.result,...res.result]; this.Positive = res.result
} }
}); })
},
getQueryRecommendRank(){
apiCase.queryRecommendRank(10).then(res => {
if(res.status == 200) {
this.recommendRank = res.result
}
})
}, },
imgNumBlue(index){ imgNumBlue(index){
return 'listblue0' + (index+1) return 'listblue0' + (index+1)
@@ -129,9 +138,11 @@ import portalHeader from '@/components/PortalHeader.vue'
}, },
positiveReview(e){ positiveReview(e){
this.favorableName = this.switch[e] this.favorableName = this.switch[e]
this.getPositive()
}, },
popularityReview(e){ popularityReview(e){
this.popularityName = this.switch[e] this.popularityName = this.switch[e]
this.getPopularity()
}, },
}, },
} }

View File

@@ -304,7 +304,7 @@
<ul class="ranking-data"> <ul class="ranking-data">
<li v-for="(item, index) in Positive" :key="index" class="title-line-ellipsis" <li v-for="(item, index) in Positive" :key="index" class="title-line-ellipsis"
style="cursor: pointer;margin-top:30px;line-height: 22px;"> style="cursor: pointer;margin-top:30px;line-height: 22px;">
<router-link :to="'/case/detail?id=' + item.id"> <router-link :to="'/case/detail?id=' + item.caseId">
<span class="portal-right-text blue-one" v-if="index == 0"> <span class="portal-right-text blue-one" v-if="index == 0">
<img :src="`${webBaseUrl}/images/listblue01.png`" alt=""> <img :src="`${webBaseUrl}/images/listblue01.png`" alt="">
</span> </span>
@@ -320,7 +320,7 @@
<span class="portal-right-text" v-if="index == 4"> <span class="portal-right-text" v-if="index == 4">
<img :src="`${webBaseUrl}/images/list05.png`" alt=""> <img :src="`${webBaseUrl}/images/list05.png`" alt="">
</span> --> </span> -->
<span class="portal-title-desc" style="font-size: 14px;">{{ item.title }}</span> <span class="portal-title-desc" style="font-size: 14px;">{{ item.caseTitle }}</span>
</router-link> </router-link>
</li> </li>
</ul> </ul>
@@ -341,7 +341,7 @@
<ul class="ranking-data"> <ul class="ranking-data">
<li v-for="(item, index) in Popularity" :key="index" class="title-line-ellipsis" <li v-for="(item, index) in Popularity" :key="index" class="title-line-ellipsis"
style="cursor: pointer;margin-top:30px;line-height: 22px;"> style="cursor: pointer;margin-top:30px;line-height: 22px;">
<router-link :to="'/case/detail?id=' + item.id"> <router-link :to="'/case/detail?id=' + item.caseId">
<span class="portal-right-text orange-one" v-if="index == 0"> <span class="portal-right-text orange-one" v-if="index == 0">
<img :src="`${webBaseUrl}/images/list-01.png`" alt=""> <img :src="`${webBaseUrl}/images/list-01.png`" alt="">
</span> </span>
@@ -357,7 +357,7 @@
<span class="portal-right-text" v-if="index == 4"> <span class="portal-right-text" v-if="index == 4">
<img :src="`${webBaseUrl}/images/list05.png`" alt=""> <img :src="`${webBaseUrl}/images/list05.png`" alt="">
</span> </span>
<span class="portal-title-desc" style="font-size: 14px;">{{ item.title }}</span> <span class="portal-title-desc" style="font-size: 14px;">{{ item.caseTitle }}</span>
</router-link> </router-link>
</li> </li>
</ul> </ul>
@@ -365,9 +365,9 @@
<div class="portal-ranking ranking-bg2" style="margin-top:26px"> <div class="portal-ranking ranking-bg2" style="margin-top:26px">
<p class="ranking-title">推荐榜</p> <p class="ranking-title">推荐榜</p>
<ul class="ranking-data"> <ul class="ranking-data">
<li v-for="(item, index) in Positive" :key="index" class="title-line-ellipsis" <li v-for="(item, index) in recommendRank" :key="index" class="title-line-ellipsis"
style="cursor: pointer;margin-top:30px;line-height: 22px;"> style="cursor: pointer;margin-top:30px;line-height: 22px;">
<router-link :to="'/case/detail?id=' + item.id"> <router-link :to="'/case/detail?id=' + item.caseId">
<span class="portal-right-text blue-one" v-if="index == 0"> <span class="portal-right-text blue-one" v-if="index == 0">
<img :src="`${webBaseUrl}/images/listred01 .png`" alt=""> <img :src="`${webBaseUrl}/images/listred01 .png`" alt="">
</span> </span>
@@ -377,7 +377,7 @@
<span class="portal-right-text blue-three" v-if="index == 2"> <span class="portal-right-text blue-three" v-if="index == 2">
<img :src="`${webBaseUrl}/images/listred03.png`" alt=""> <img :src="`${webBaseUrl}/images/listred03.png`" alt="">
</span> </span>
<span class="portal-title-desc" style="font-size: 14px;">{{ item.title }}</span> <span class="portal-title-desc" style="font-size: 14px;">{{ item.caseTitle }}</span>
</router-link> </router-link>
</li> </li>
</ul> </ul>
@@ -514,6 +514,7 @@ export default {
ankingList: [],//排行数据1 ankingList: [],//排行数据1
Popularity: [],//排行数据2 Popularity: [],//排行数据2
Positive: [],//排行数据3 Positive: [],//排行数据3
recommendRank: [],
protocolDialogVisible: false, protocolDialogVisible: false,
protocolConfirmButton: true, protocolConfirmButton: true,
years: [], years: [],
@@ -811,6 +812,7 @@ export default {
//打开排行榜下边的两个 //打开排行榜下边的两个
this.getPopularity(); this.getPopularity();
this.getPositive(); this.getPositive();
this.getQueryRecommendRank()
this.couresreso(); this.couresreso();
// window.addEventListener("scroll", this.handleScroll); // window.addEventListener("scroll", this.handleScroll);
// 获取年 // 获取年
@@ -824,9 +826,11 @@ export default {
methods: { methods: {
positiveReview(e){ positiveReview(e){
this.favorableName = this.switch[e] this.favorableName = this.switch[e]
this.getPositive()
}, },
popularityReview(e){ popularityReview(e){
this.popularityName = this.switch[e] this.popularityName = this.switch[e]
this.getPopularity()
}, },
handleType(msg){ handleType(msg){
this.queryCondition.type = msg this.queryCondition.type = msg
@@ -1584,40 +1588,58 @@ export default {
}); });
}, },
getPopularity() { getPopularity() {
apiCase.queryPraises(5).then(res => { // apiCase.queryPraises(5).then(res => {
if (res.status == 200) { // if (res.status == 200) {
this.Popularity = res.result.slice(0,3); // this.Popularity = res.result.slice(0,3);
// if (res.result.length < 5) { // // if (res.result.length < 5) {
// for (let i = 0; i = (5 - res.result.length); i++) { // // for (let i = 0; i = (5 - res.result.length); i++) {
// this.Popularity.push({ // // this.Popularity.push({
// authorName: '', // // authorName: '',
// count: 1, // // count: 1,
// id: '', // // id: '',
// title: '', // // title: '',
// }) // // })
// } // // }
// } // // }
// }
// });
apiCase.queryPraisesNew(3,this.popularityName == '季度' ? 1 : 2).then(res => {
if(res.status == 200) {
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.slice(0,3); // this.Positive = res.result.slice(0,3);
// if (res.result.length < 5) { // // if (res.result.length < 5) {
// for (let i = 0; i = (5 - res.result.length); i++) { // // for (let i = 0; i = (5 - res.result.length); i++) {
// this.Positive.push({ // // this.Positive.push({
// authorName: '', // // authorName: '',
// count: 1, // // count: 1,
// id: '', // // id: '',
// title: '', // // title: '',
// }) // // })
// } // // }
// } // // }
// }
// });
apiCase.queryCommentsNew(3,this.favorableName == '季度' ? 1 : 2).then(res => {
if(res.status == 200) {
this.Positive = res.result
} }
}); })
},
getQueryRecommendRank(){
apiCase.queryRecommendRank(3).then(res => {
if(res.status == 200) {
this.recommendRank = res.result
}
})
}, },
jumpRouter(item) { jumpRouter(item) {