作者 mxd

在线答疑列表接口对接

... ... @@ -139,14 +139,14 @@ export const PAYMENTTYPE = {
export const ANSWERTYPE = {
/**
* 待解答
* @value 1
* @value 0
*/
'TOBEANSWERED': 1,
'TOBEANSWERED': 0,
/**
* 已解答
* @value 2
* @value 1
*/
'ANSWERED': 2
'ANSWERED': 1
}
/**
* 回答类型
... ...
... ... @@ -7,7 +7,7 @@
<view class="homePage-2-1">
<image
class="homePage-2-1-c"
:src="info.img_url || '@/static/images/tx.png'"
:src="info.img_url || '/static/images/tx.png'"
mode="widthFix">
</image>
</view>
... ...
... ... @@ -5,23 +5,32 @@
<view @click="selectItem(ANSWERTYPE.ANSWERED)" :class="{'onLine-1-i': true, 'onLine-1-is': type === ANSWERTYPE.ANSWERED}">已解答</view>
</view>
<view class="onLine-2">
<view class="onLine-2-i" @click="toDetails">
<view class="onLine-2-i-op">
<view
class="onLine-2-i"
@click="toDetails(item)"
v-for="item in list"
:key="item.id"
>
<view class="onLine-2-i-op" v-if="type === ANSWERTYPE.TOBEANSWERED">
<image class="onLine-2-i-op-i" src="@/static/imagesV2/icon41.png" mode="widthFix"></image>
<text class="onLine-2-i-op-t">解答</text>
</view>
<view class="onLine-2-i-1">
<image src="@/static/images/tx.png" class="onLine-2-i-1-1"></image>
<view class="onLine-2-i-1-1">
<image :src="item.img || '/static/images/tx.png'" ></image>
</view>
<view class="onLine-2-i-1-r">
<view class="onLine-2-i-1-r-1">李晋心</view>
<view class="onLine-2-i-1-r-2">2023-12-10发布</view>
<view class="onLine-2-i-1-r-1">{{item.name || ''}}</view>
<view class="onLine-2-i-1-r-2">{{item.create_time || ''}}发布</view>
</view>
</view>
<view class="onLine-2-i-2">
老师你好请问工商管理专业的应届生可以报考工商管理 内的二级专业吗?比如说会计学,旅游管理?
{{item.question || ''}}
</view>
</view>
<u-loadmore :status="status" v-if="!notData"/>
<u-empty
v-if="notData"
mode="data"
text="暂无数据"
icon="/static/imagesV2/icon24.png"
... ... @@ -37,18 +46,84 @@
data() {
return {
ANSWERTYPE,
type: ANSWERTYPE.TOBEANSWERED
type: ANSWERTYPE.TOBEANSWERED,
page: 1,
list: [],
// 加载前值为loadmore,加载中为loading,没有数据为nomore
status: 'loadmore'
};
},
computed: {
notData() {
return this.status === 'nomore' && !this.list.length
}
},
onShow() {
this.onRetry()
},
onReachBottom() {
that.getData()
},
methods: {
toDetails() {
toDetails(data) {
uni.navigateTo({
url: '/new_tec/onLineDetails/onLineDetails'
url: '/new_tec/onLineDetails/onLineDetails?id=' + data.id
})
},
selectItem(type) {
this.type = type
this.type = type;
this.onRetry();
},
onRetry(){
this.page=1
this.list = []
this.getData()
},
getData() {
if(this.status === 'loading') return;
this.status = 'loading';
uni.showLoading({
title: '加载中',
mask: true
})
this.$service.P_get('/lecturer/question', {
page: this.page,
type: this.type
}).then(res => {
uni.hideLoading();
if (res.code == 1) {
this.page++;
this.list = [
...this.list,
...res.data.data
];
this.status = res.data.data.length < res.data.per_page ? 'nomore' : 'loadmore'
}else {
this.status = 'loadmore';
if (res.msg) {
uni.showToast({
icon: 'none',
title: res.msg
})
} else {
uni.showToast({
icon: 'none',
title: '获取数据失败'
})
}
}
}).catch(e => {
this.status = 'loadmore';
uni.hideLoading()
uni.showToast({
icon: 'none',
title: '获取数据失败,请检查您的网络连接'
})
})
}
}
}
</script>
... ... @@ -126,6 +201,8 @@
.onLine-2-i-1-1{
height: 60rpx;
width: 60rpx;
border-radius: 50%;
overflow: hidden;
}
.onLine-2-i-1-r{
margin-left: 30rpx;
... ...