task#15348,列表接口获取更换

This commit is contained in:
2024-10-08 16:30:04 +08:00
parent 75e014562f
commit 31d3bcf071
4 changed files with 92 additions and 62 deletions

View File

@ -11,7 +11,7 @@
>
<template slot="title">
<div v-show="!show">培训文档</div>
<van-field v-model="keyword" placeholder="请输入关键词" v-show="show" @input="getList"/>
<van-field v-model="keyword" placeholder="请输入关键词" v-show="show" @input="getTrainingList"/>
</template>
<template slot="right">
<div class="rightWrap" @click="show = !show">
@ -31,16 +31,15 @@
<van-pull-refresh v-model="isLoading" @refresh="onRefresh" style="min-height:85vh">
<div class="itemWrap" v-for="(item,index) in pageList" :key="index" @click="goH5Detail(item)">
<div class="info flexBetween common">
<!-- item.mustRead===1-->
<div class="title">{{ item.name }}<span class="read">必读</span></div>
<div class="title">{{ item.name }}<span v-if="item.mustRead===1" class="read">必读</span></div>
<div class="time">{{ item.updateTime }}</div>
</div>
<div class="imgWrap">
<img :src="item.themePicture">
</div>
<div class="num common">{{ item.synopsis }}</div>
<div style="text-align: right" v-if="item.docType?.label !== '普通材料'">
<span style="color: red;font-size: 14px;margin-right: 8px">{{ item.listShowButton==null ? '已处理' : '未处理' }}</span>
<div style="text-align: right" >
<span style="color: red;font-size: 14px;margin-right: 8px">{{ item.alreadyRead===1 ? '已处理' : '未处理' }}</span>
</div>
</div>
</van-pull-refresh>
@ -53,7 +52,7 @@
<script>
import {myMixins} from "@/utils/myMixins"
import {pageList} from "@/api/mine"
import {getTrainingList} from "@/api/mine"
export default {
name: "trainDocment",
computed: {
@ -61,11 +60,12 @@ export default {
mixins:[myMixins],
data(){
return{
tabArr: [{name: '车型技术参数', status: 1}, {name: '中道服务规范', status: 2},{name: '中道小课堂', status: 3}],
tabArr: [{name: '车型技术参数', status: 1}, {name: '中道服务规范', status:2},{name: '中道小课堂', status: 3}],
activeIndex: 0,
pageNum:1,
pageSize:10,
pageList:[],
totalList:[],
keyword:'',
show:false,
showEmpty:false,
@ -73,11 +73,14 @@ export default {
}
},
mounted() {
this.getList();
const urlParams = new URLSearchParams(window.location.search);
const supplierId = urlParams.get('supplierId');
this.$toast(supplierId);
this.getTrainingList();
},
methods:{
onRefresh() {
this.getList()
this.getTrainingList()
setTimeout(() => {
this.$toast('刷新成功');
this.isLoading = false;
@ -85,24 +88,29 @@ export default {
},
async changeTab(index) {
this.activeIndex = index
this.pageNum = 1
this.pageList = [];
if(this.activeIndex === 0){
this.trainingType =1
}else{
this.trainingType=2
}
await this.getList()
await this.getTrainingList()
},
async getList(){
let res= await pageList({
pageNum:this.pageNum,
pageSize:this.pageSize,
docType:1,
keyword:this.keyword || ''
async getTrainingList(){
let res= await getTrainingList({
type:2,
id:33041,
text:this.keyword || '',
})
this.pageList=res.data;
if(res.data.length === 0){
this.totalList=[]
this.pageList=[]
this.totalList=res.data.list
let result=[]
if(this.activeIndex === 0){
result=this.totalList?.filter(q => q.title === '车型技术参数');
}else if(this.activeIndex === 1){
result=this.totalList?.filter(q => q.title === '中道服务规范');
}else if(this.activeIndex === 2){
result=this.totalList?.filter(q => q.title === '中道小课堂');
}
if(result){
this.pageList=result[0].materials
}
if(this.pageList?.length === 0){
this.showEmpty = true
}else {
this.showEmpty = false
@ -110,7 +118,7 @@ export default {
},
initShow(){
this.keyword= '',
this.getList()
this.getTrainingList()
}
}
}