recycapp/pages/question/index.vue
2025-10-22 20:28:50 +08:00

116 lines
2.7 KiB
Vue

<template>
<view class="content">
<view class="problem " v-if="list.length > 0">
<view class="problem_main">
<view class="li" v-for="(item,index) in list" :key="index" @click="show(index)">
<view class="left">
<view class="left_2">{{item.name}}</view>
<view class="left_1" >
<image v-if="item.is_show==1" class="icon" src="/static/img/up.png" mode=""></image>
<image v-if="item.is_show==0" class="icon" src="/static/img/down.png" mode=""></image>
</view>
</view>
<view class="left " v-if="item.is_show==1">
<view class="left_3"><text style="white-space: pre-wrap;line-height: 20px;">{{item.content}}</text></view>
</view>
</view>
<uni-load-more :status="loadmore" :content-text="contentText" />
</view>
</view>
<view class="zanwuimg" v-if="list.length == 0">
<image src="../../static/img/null.png" mode="widthFix"></image>
<view>暂无相关数据</view>
</view>
</view>
</template>
<script>
export default{
data(){
return{
list:[],
ifBottomRefresh:false,
loadmore: 'more',
contentText: {
contentdown: '查看更多',
contentrefresh: '加载中',
contentnomore: ''
},
}
},
onLoad(e) {
this.getdata()
},
onShow() {
},
onReachBottom() {
this.page += 1
if (this.loadmore == 'noMore') return
this.ifBottomRefresh = true
this.getData()
},
methods:{
show(index){
var list = this.list;
list.forEach((item,index2) => {
if(index == index2){
list[index2].is_show = item.is_show==1 ? 0: 1;
}
})
this.list = list;
},
getdata(){
let data={page:this.page}
this.$api.question_list(data,res=>{
if(res.code == '1'){
this.list= this.list.concat(res.data.list.data)
this.loadmore = this.list.length < res.data.list.total ? 'more' : 'noMore'
}
})
}
}
}
</script>
<style lang="scss">
page{
background: #fff;
}
.problem{
background-color: #fff;
.problem_main{
width: 92%;
margin: 0 auto;padding-bottom: 10px;
.li{
padding-top: 20rpx;
border-bottom: 1px solid #eee;
.left{
overflow: hidden;
margin-bottom: 20rpx;
.left_1{
float: left;
height: 4vh;
width: 4vh;
}
.left_2{
font-size: 30rpx;
float:left;
width: 90%;
}
.left_3{
font-size: 24rpx;
float:left;
width: 92%;color: #676767;padding-left: 12px;
}
}
}
.li:last-child{
border: none;
}
}
}
</style>