<template> <view> <status-nav :navBarTitle="ifPlanFault" returnColor="#c2c2c2"></status-nav> <container-subgroup> <view slot="content" style="margin: 0 -16rpx;" class="fon28"> <view @tap="goDetail(item.id)" class="bacf radius10 pad-s30 mar-x10 pad-x10 animated fadeIn" v-for="(item,index) in dataList" :key="index"> <view class=" pad-zy10 disjbac"> <image :src="item.cover_img" mode="aspectFill" lazy-load class="flexs mar-y20" style="width: 240rpx;height: 174rpx;border-radius: 6rpx;"></image> <view style="height: 174rpx;" class="width100 disjb fc fon24 posir"> <view> <view class="clips1 fon28 bold col0 pad-y50">{{item.title}}</view> <view class="col9 clips2 line-h40">{{item.summary}}</view> </view> <view class="disjbac col9"> <view class="disac"> 热度:<rate :size="32" :gutter="10" :readonly="true" v-model="item.hot*1"></rate> </view> <view>{{item.reading}}人已查阅</view> </view> <image src="/static/public/icon-plan-fire.png" mode="widthFix" style="width: 29rpx;height: 43rpx;position: absolute;right: 10rpx;top: -6rpx;"></image> </view> </view> <view class="bbot mar-s20"></view> </view> <pitera v-if="total==dataList.length && dataList.length" textStr="暂无更多列表数据"></pitera> </view> </container-subgroup> <nothing-page v-if="dataList.length==0 && !ifLogin" content="暂无更多列表数据"></nothing-page> </view> </template> <script> import rate from '@/components/rate.vue'; import pitera from '@/components/nothing/pitera.vue'; export default { components:{ rate, pitera }, data() { return { rateNum:5, ifPlanFault:'', current:'', size:20, page:1, total:0, type_id:'',//解决方案类型id dataList:[], ifLogin:true } }, onReachBottom() { if(this.total != this.dataList.length) { this.page++; this.getPlanFault(); } }, onLoad(op) { this.ifPlanFault = `${['解决方案','常见故障'][op.index*1]}`; this.current = op.index*1; if(op.type_id!=undefined) this.type_id = op.type_id; this.getPlanFault(); }, methods: { // 去新产品详情 goDetail(id){ uni.navigateTo({ url:`/pagesB/plan-fault-product-detail/detail?index=${this.current}&id=${id}` }) }, // 查询常见故障、解决方案列表 getPlanFault(){ let url = [ '/universal/api.solution/solution_list', '/universal/api.question/question_list' ]; let params = [ { is_recommend:0, list_rows:this.size, page:this.page }, { list_rows:this.size, page:this.page } ] uni.showLoading({ title:'加载中...', mask:true }) // 常见故障 this.$requst.get(url[this.current],params[this.current]).then(res=>{ if(res.code==1) { this.total = res.data.total; res.data.data.forEach(item=>{ let obj = { id:item.id, cover_img: item.cover_img, title:item.title,//标题 summary:item.summary,//描述 hot:item.hot,//热度 reading:item.reading//查阅 } this.dataList.push(obj); }) } uni.hideLoading(); this.ifLogin = false; }) } } } </script> <style> </style>