This commit is contained in:
zhangsir
2024-09-10 11:10:58 +08:00
parent 8e6c00d266
commit a59d1cea93
5 changed files with 340 additions and 55 deletions

View File

@@ -1,6 +1,6 @@
/* 案例模块的相关处理*/
import ajax from '@/utils/xajax.js'
import ajaxs from '@/api/ajax.js'
/**首页查询
* pageSize
* orderField
@@ -195,11 +195,30 @@ const endReadTimer = (data)=> ajax.postJson('/xboe/m/boe/cases/recommend/record
const caseYears = function (query = {}) {
return ajax.post('/xboe/m/boe/cases/caseYears', query);
}
//案例推荐榜单
const getQueryRecommendRank = function (params) {
return ajax.get(`/xboe/m/boe/cases/queryRecommendRank?pageSize=${params.pageSize}`)
}
//案例上榜
const riseIntoRank = (data) => ajax.post(`/xboe/m/boe/cases/riseIntoRank?caseId=${data.caseId}`)
//取消上榜
const cancelRiseIntoRank = (data) => ajax.post(`/xboe/m/boe/cases/cancelRiseIntoRank?caseId=${data.caseId}`)
//调整榜单
const adjustRank = (data) => ajax.post(`/xboe/m/boe/cases/adjustRank?caseIds=${data.caseIds}`)
//收藏案例
const queryFavoriteCaseOfIndex = (params) => ajax.get(`/xboe/m/boe/cases/queryFavoriteCaseOfIndex?pageIndex=${params.pageIndex}&pageSize=${params.pageSize}&orderField=${params.orderField}&orderAsc=${params.orderAsc}`)
//浏览记录
const queryViewRecord = (data) => ajaxs.post(`/statApi/xboe/m/stat/userdynamic/list?pageIndex=${data.pageIndex}&pageSize=${data.pageSize}&contentType=${data.contentType}&aid=${data.aid}&hidden=${data.hidden}`)
//浏览量TOP榜单
const queryPopularityOfMajor = (params) => ajax.get(`/xboe/m/boe/cases/queryPopularityOfMajor?pageSize=${params.pageSize}&rankMonth=${params.rankMonth}&majorId=${params.majorId}`)
export default {
getQueryRecommendRank,
queryPopularityOfMajor,
queryViewRecord,
queryFavoriteCaseOfIndex,
riseIntoRank,
cancelRiseIntoRank,
adjustRank,
indexList,
queryList,
queryListV2,

View File

@@ -15,7 +15,7 @@
<div v-if="!onlyAvatar" style="padding-left: 14px;padding-top: 6px;font-size: 14px;">
<span style="color: #333333;font-weight: 600;font-size: 16px;">{{userName}}</span>
<span class="author-text" v-if="userInfo && userInfo!=''"> {{userInfo}} </span>
<span class="comWords">20篇最佳案例</span>
<span style="margin-right: 15px;" class="comWords" v-if="authorTags.length != 0" v-for="tag in authorTags">{{tag}}</span>
</div>
<slot />
</div>
@@ -50,6 +50,12 @@
onlyAvatar:{
type:Boolean,
default:false
},
authorTags: {
type:Array,
default(){
return []
}
}
},
data(){

View File

@@ -32,6 +32,9 @@
</div>
</div>
</div>
<div style="margin: 5px 0 0 5px;">
<el-button type="primary" @click="recoRanking">推荐榜单</el-button>
</div>
</div>
<el-table style="100%" :data="caseList" border stripe>
<el-table-column label="标题" prop="title" show-overflow-tooltip>
@@ -49,6 +52,7 @@
<el-table-column label="操作">
<template slot-scope="scope">
<el-button-group>
<el-button style="margin:0 5px" type="text" v-if="scope.row.recommendRank === ''" @click="suggest(scope.row)" icon="el-icon-delete">榜单推荐</el-button>
<!-- <el-button type="text" @click="shareItem(scope.row)" icon="el-icon-share" style="margin:0 5px">推荐</el-button> -->
<el-button style="margin:0 5px" v-if="!scope.row.isTop && scope.row.confidentialityLevel == '内部'" type="text"
@click="setTop(scope.row)" icon="el-icon-top">置顶</el-button>
@@ -56,9 +60,12 @@
@click="setTop(scope.row)" icon="el-icon-bottom">取消置顶</el-button>
<el-button type="text" icon="el-icon-medal"
v-if="scope.row.filePath && scope.row.confidentialityLevel == '内部'"><span @click="cancal(scope.row)"
v-if="scope.row.excellent">取消最佳</span><span @click="open(scope.row)" v-else>最佳案例</span></el-button>
v-if="scope.row.excellent">取消最佳</span>
<!-- <span @click="open(scope.row)" v-else>最佳案例</span> -->
<span @click="theBest(scope.row)" v-else>最佳</span>
</el-button>
<el-button style="margin:0 5px" type="text" @click="delItem(scope.row)" icon="el-icon-delete">删除</el-button>
<el-button style="margin:0 5px" type="text" @click="theBest(scope.row)" icon="el-icon-delete">最佳</el-button>
<!-- <el-button style="margin:0 5px" type="text" @click="theBest(scope.row)" icon="el-icon-delete">最佳</el-button> -->
</el-button-group>
</template>
</el-table-column>
@@ -157,6 +164,36 @@
<el-button type="primary" @click="parameBest"> </el-button>
</span>
</el-dialog>
<el-drawer
title="推荐榜单"
:visible.sync="RankingShow"
size="70%">
<div style="padding: 10px 20px 80px">
<el-table :data="tableData" border stripe>
<el-table-column
type="index"
width="50">
</el-table-column>
<el-table-column label="案例标题" prop="caseTitle"></el-table-column>
<el-table-column label="作者名称" prop="caseAuthor"></el-table-column>
<el-table-column label="上榜人" prop="caseAuthor"></el-table-column>
<el-table-column label="上榜时间" prop="recommendRankPusTime"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button-group>
<el-button style="margin:0 5px" type="text" @click="handleNotRank(scope.row)" icon="el-icon-top">取消推荐</el-button>
<el-button style="margin:0 5px" type="text" @click="moveUp(scope.row,scope.$index)" icon="el-icon-delete">上移排序</el-button>
<el-button style="margin:0 5px" type="text" @click="moveDown(scope.row,scope.$index)" icon="el-icon-delete">下移排序</el-button>
</el-button-group>
</template>
</el-table-column>
</el-table>
</div>
<div class="rank_footer">
<el-button @click="closeDrawer" style="width: 130px;height:40px;margin-right: 30px;" type="default">取消</el-button>
<el-button @click="queryList" style="width: 130px;height:40px;margin-right: 15px;" type="primary">确定</el-button>
</div>
</el-drawer>
</div>
</template>
@@ -167,8 +204,12 @@ export default {
name: 'articleItems',
data() {
return {
adminList: [],
caseType: process.env.VUE_APP_CASE_TYPE,
RankingShow: false,
bestYear: '',
bestOrg: '',
bestId: '',
bestTextarea: '',
bestValue: false,
excellent: false,
@@ -179,6 +220,8 @@ export default {
excellent: '',
}, //查询对象
caseList: [], //案例列表
tableData: [],
caseIds: '',
count: 0,
recommend: {
dlgShow: false,
@@ -211,16 +254,149 @@ export default {
},
mounted() {
this.getData();
this.getList();
apiCase.treeList(1,Number(this.caseType ?? 155),1).then(res=>{
if(res.code == 200){
this.adminList = res.result;
}
})
},
watch:{
RankingShow(val){
if(val){
this.getList()
}
}
},
methods: {
orgDomainTranslate(code) { // 组织领域翻译
if (code == '') {
return
}
let name = '';
let data = this.adminList.find(item => {
return item.code == code;
});
if (data) {
name = data.name;
}
return name;
},
suggest(record){
this.$confirm('你确认要推荐此案例么?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
apiCase.riseIntoRank({caseId:record.id}).then(res=>{
if(res.status == 200 ){
this.$message.success('成功')
this.getData()
}
}).catch(()=>{
this.$message.error('失败')
})
})
},
handleNotRank(record){
this.$confirm('你确认要取消推荐么?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
apiCase.cancelRiseIntoRank({caseId:record?.caseId}).then(res=>{
if(res.status == 200){
this.$message.success('取消推荐成功')
this.getList()
this.getData()
}
}).catch(()=>{
this.$message.error('取消推荐失败')
})
})
},
moveUp(row,index){
console.log(row,index,'index')
if(index == 0){
this.$message.error('已经排到第一位了')
return
}
this.swapArray(this.tableData,index,index-1)
},
moveDown(row,index){
if(index == this.tableData.length - 1){
this.$message.error('已经排到最后一位了')
return
}
this.swapArray(this.tableData,index,index+1)
},
swapArray(arr, index1, index2){
const temp = arr[index1];
arr.splice(index1, 1);
arr.splice(index2, 0, temp);
},
getList(){
apiCase.getQueryRecommendRank({pageSize:3}).then(res=>{
console.log(res,'res')
if(res.status == 200){
this.tableData = res.result
this.caseIds = res.result.map(item=>item.caseId).join(',')
}
})
},
notBest(){
this.bestValue = false
this.bestYear = ''
this.bestOrg = ''
this.bestId = ''
this.bestTextarea = ''
},
parameBest(){
this.notBest()
this.excellent = true;
let data = {
id: this.bestId,
excellent: this.excellent,
excellentReason: this.bestTextarea
}
apiCase.excellent(data).then(res=>{
if (res.status == 200) {
this.$message({
type: 'success',
message: '设置最佳案例成功!'
});
this.getData()
}else{
this.$message({
type: 'error',
message: '设置最佳案例失败!'
});
}
this.notBest()
})
},
recoRanking(){
this.RankingShow = true
},
closeDrawer(){
this.RankingShow = false
},
queryList(){
if(this.caseIds != this.tableData.map(item=>item.caseId).join(',')){
apiCase.adjustRank({caseIds:this.tableData.map(item=>item.caseId).join(',')}).then(res=>{
if(res.status == 200){
this.$message({
message: '调整成功',
type: 'success'
})
}
}).catch(()=>{
this.$message({
message: '调整失败',
type: 'error'
})
})
}
this.RankingShow = false
},
// 导出
importList() {
@@ -405,6 +581,9 @@ export default {
},
theBest(item){
this.bestValue = true
this.bestId = item.id
this.bestOrg = this.orgDomainTranslate(item.orgDomainParent)
this.bestYear = item.sysCreateTime.split('-')[0]
},
//添加推荐
shareItem(item) {
@@ -519,6 +698,18 @@ export default {
</script>
<style lang="scss" scoped>
.rank_footer{
position: absolute;
bottom: 0;
right: 0;
width: 100%;
height: 80px;
display: flex;
justify-content: flex-end;
align-items: center;
background: #fff;
padding-right: 20px;
}
::v-deep .el-dialog__header{
border-bottom: 1px solid #909399;
}

View File

@@ -11,17 +11,17 @@
<div class="ex_select">
<div class="ex_left">
<div style="margin-right: 12px;">
<el-select clearable v-model="majorValue" @change="majorChange" placeholder="请选择专业">
<el-select v-model="majorValue" @change="majorChange" placeholder="请选择专业">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in speciData"
:key="item.name"
:label="item.name"
:value="item.code">
</el-option>
</el-select>
</div>
<div>
<el-select clearable v-model="monthValue" @change="monthChange" placeholder="请选择月份">
<el-select v-model="monthValue" @change="monthChange" placeholder="请选择月份">
<el-option
v-for="item in optionsMonth"
:key="item.value"
@@ -44,12 +44,12 @@
<div class="case-tittext">
<span class="title-line-ellipsis" v-html="item.title"></span>
</div>
<div class="case-activeText" @click.stop="toExcellent(item)">
<!-- <div class="case-activeText" @click.stop="toExcellent(item)">
<span v-if="item.breCommend" class="comWords"
style="background-color:rgba(232, 139, 72);"></span>
<span v-if="item.excellent" class="comWords" style="background-color:red;">最佳</span>
<span class="comWords" style="background-color:orange">2024年度最佳</span>
</div>
</div> -->
<div class="case-info-date portal-time">
<i class="el-icon-time"></i>
<time-show :time="item.sysCreateTime"></time-show>
@@ -139,26 +139,12 @@ import apiPlace from "@/api/phase2/place.js"
},
data() {
return {
options: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}],
majorId: '',
rankMonth: '',
optionsMonth:
[...Array(12)].map((item,i)=>{
return{
value: i+1,
value: i+1 + '',
label: (i+1)+'月'
}
})
@@ -176,7 +162,7 @@ import apiPlace from "@/api/phase2/place.js"
treeList:[],
queryCondition: {
pageIndex: 1,
pageSize: 5,
pageSize: 10,
majorType: '', //专业分类code
excellent: true,
keyWord: '',
@@ -201,7 +187,12 @@ import apiPlace from "@/api/phase2/place.js"
}
},
mounted() {
this.majorValue = this.$route.query.majorName
this.monthValue = this.$route.query.riseRankTime.split('-')[1] + '月'
this.getCaseData()
apiCase.majorTypes().then(res=>{
this.speciData = res.result;
})
Promise.all([apiType.treeList(1,Number(this.caseType ?? 155),1), apiCase.majorTypes()]).then(rs => {
if (rs[0].code == 200) {
const {records} = rs[0].data
@@ -294,10 +285,14 @@ import apiPlace from "@/api/phase2/place.js"
},
methods: {
majorChange(e){
this.majorId = e
this.getCaseData()
},
monthChange(e){
// console.log(e,'xixixix')
const mon = e.length == 1 ? '0'+e : e
const arr = this.$route.query.riseRankTime.split('-')
this.rankMonth = arr[0] + '-' + mon + '-' + arr[2]
this.getCaseData()
},
orgDomainTranslate(code) { // 组织领域翻译
if (code == '') {
@@ -424,11 +419,13 @@ import apiPlace from "@/api/phase2/place.js"
}
});
this.queryCondition.majorType = majorTypeList.join(',');
await apiCase.queryListV2(this.queryCondition).then((res) => {
this.queryCondition.majorId = this.majorId || this.$route.query.majorId
this.queryCondition.rankMonth = (this.rankMonth || this.$route.query.riseRankTime) + ' 00:00:00'
await apiCase.queryPopularityOfMajor(this.queryCondition).then((res) => {
if (res.status == 200) {
if (res.result.list.length > 0) {
if (res.result.length > 0) {
this.isSeach = false;
res.result.list.forEach(item => {
res.result.forEach(item => {
item.majorType = item.majorType ? item.majorType.split(",") : [];
item.isAll = false;
item.authorInfo = {
@@ -440,14 +437,14 @@ import apiPlace from "@/api/phase2/place.js"
};
});
}
console.log(res?.result?.list ,'有没有数据');
this.caseList.list = res.result.list
if(this.caseList.list.length == 0){
console.log(res?.result,'有没有数据');
this.caseList.list = res.result
if(this.caseList.length == 0){
this.isSeach = true
}else{
this.isSeach = false
}
this.getCaseUserData(res.result.list);
this.getCaseUserData(res.result);
// 给所有的赋值
this.caseList.count = res.result.count;
this.caseList.showPagCount = res.result.count;

View File

@@ -199,12 +199,15 @@
<div class="case-tittext">
<span class="title-line-ellipsis" v-html="item.title"></span>
</div>
<div class="case-activeText" @click.stop="toExcellent(item)">
<span v-if="item.breCommend" class="comWords"
<div class="case-activeText">
<!-- <span v-if="item.breCommend" class="comWords"
style="background-color:rgba(232, 139, 72);"></span>
<span v-if="item.excellent" class="comWords" style="background-color:red;">最佳</span>
<span class="comWords" style="width: 98px;height: 24px;background: #F99000;border-radius: 2px;font-weight: 400;font-size: 12px;color: #FFFFFF;padding: 3px 12px 4px 9px;">
2024年度最佳
<span v-if="item.excellent" class="comWords" style="background-color:red;">最佳</span> -->
<span v-if="item.excellentTag" class="comWords" style="width: 98px;height: 24px;background: #F99000;border-radius: 2px;font-weight: 400;font-size: 12px;color: #FFFFFF;padding: 3px 12px 4px 9px;">
{{item.excellentTag}}
</span>
<span @click.stop="toExcellent(tag)" v-if="item.viewRankTags.length != 0" v-for="tag in item.viewRankTags" class="comWords" style="width: 98px;height: 24px;background: #F99000;border-radius: 2px;font-weight: 400;font-size: 12px;color: #FFFFFF;padding: 3px 12px 4px 9px;">
{{tag.tagName}}
</span>
</div>
<div class="case-info-date portal-time">
@@ -217,7 +220,7 @@
<!-- </router-link> -->
<div style="height:58px;padding-top:14px ">
<author :avatar="item.authorInfo.avatar" :name="item.authorInfo.name" :info="item.authorInfo.orgInfo"
:sex="item.authorInfo.sex" :aid="item.authorInfo.aid">
:sex="item.authorInfo.sex" :authorTags="item.authorTags" :aid="item.authorInfo.aid">
<template>
<div v-if="item.breCommend"
style="padding-top: 6px;flex: 1;display: flex;justify-content: flex-end;color: #999;font-size: 12px;">
@@ -531,7 +534,7 @@ export default {
caseType: '',
authorName: '',
notInIds: [],
type: 'excellent',
type: 'all',
userId: '',
parent: '',
children: [],
@@ -916,8 +919,7 @@ export default {
this.$router.push({ path: '/case/detail', query: { id } });
},
toExcellent(item){
console.log(item,'xixi')
this.$router.push({path:'/case/excellent',query:{id:item.id}})
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");
@@ -1228,6 +1230,8 @@ export default {
if(this.pubTimeNum != 0){
this.pageViewNum = 0;
}
this.queryCondition.orderField = 'sysCreateTime'
this.queryCondition.orderAsc = this.pubTimeNum == 2 ? true : this.pubTimeNum == 1 ? false : ''
this.search(true);
},
searchPageView(){
@@ -1238,6 +1242,8 @@ export default {
if(this.pageViewNum != 0){
this.pubTimeNum = 0;
}
this.queryCondition.orderField = 'views'
this.queryCondition.orderAsc = this.pageViewNum == 2 ? true : this.pageViewNum == 1 ? false : ''
this.search(true);
},
searchexcellent(num) {
@@ -1410,8 +1416,74 @@ export default {
// this.caseList.list = [];
// }
this.moreState = 2;
this.queryCondition.pubTimeNum = this.pubTimeNum
this.queryCondition.pageViewNum = this.pageViewNum
// this.queryCondition.pubTimeNum = this.pubTimeNum
// this.queryCondition.pageViewNum = this.pageViewNum
if(this.queryCondition.type == 'collect'){
const params = {
pageIndex:this.queryCondition.pageIndex,
pageSize:10,
orderField:this.queryCondition.orderField,
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(",") : [];
item.isAll = false;
item.authorInfo = {
aid: "",
name: "",
orgInfo: "",
avatar: "",
sex: null
};
});
this.caseList.list = res.result.list
console.log(res.result.list ,'有没有1111数据')
this.getCaseUserData(res.result.list);
// 给所有的赋值
this.caseList.count = res.result.count;
this.caseList.showPagCount = res.result.count;
}
}
})
return
}
if(this.queryCondition.type=='time'){
const data = {
pageIndex: this.queryCondition.pageIndex,
pageSize: 10,
contentType: 3,
aid: this.userInfo.aid || '965628977500655616',
hidden: '',
}
await apiCase.queryViewRecord(data).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 = res.result.list
this.getCaseUserData(res.result.list);
// 给所有的赋值
this.caseList.count = res.result.count;
this.caseList.showPagCount = res.result.count;
}
}
})
return
}
await apiCase.queryListV2(this.queryCondition).then((res) => {
if (res.status == 200) {
if (res.result.list.length > 0) {