作者 mxd

在线答疑列表接口对接

@@ -139,14 +139,14 @@ export const PAYMENTTYPE = { @@ -139,14 +139,14 @@ export const PAYMENTTYPE = {
139 export const ANSWERTYPE = { 139 export const ANSWERTYPE = {
140 /** 140 /**
141 * 待解答 141 * 待解答
142 - * @value 1 142 + * @value 0
143 */ 143 */
144 - 'TOBEANSWERED': 1, 144 + 'TOBEANSWERED': 0,
145 /** 145 /**
146 * 已解答 146 * 已解答
147 - * @value 2 147 + * @value 1
148 */ 148 */
149 - 'ANSWERED': 2 149 + 'ANSWERED': 1
150 } 150 }
151 /** 151 /**
152 * 回答类型 152 * 回答类型
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <view class="homePage-2-1"> 7 <view class="homePage-2-1">
8 <image 8 <image
9 class="homePage-2-1-c" 9 class="homePage-2-1-c"
10 - :src="info.img_url || '@/static/images/tx.png'" 10 + :src="info.img_url || '/static/images/tx.png'"
11 mode="widthFix"> 11 mode="widthFix">
12 </image> 12 </image>
13 </view> 13 </view>
@@ -5,23 +5,32 @@ @@ -5,23 +5,32 @@
5 <view @click="selectItem(ANSWERTYPE.ANSWERED)" :class="{'onLine-1-i': true, 'onLine-1-is': type === ANSWERTYPE.ANSWERED}">已解答</view> 5 <view @click="selectItem(ANSWERTYPE.ANSWERED)" :class="{'onLine-1-i': true, 'onLine-1-is': type === ANSWERTYPE.ANSWERED}">已解答</view>
6 </view> 6 </view>
7 <view class="onLine-2"> 7 <view class="onLine-2">
8 - <view class="onLine-2-i" @click="toDetails">  
9 - <view class="onLine-2-i-op"> 8 + <view
  9 + class="onLine-2-i"
  10 + @click="toDetails(item)"
  11 + v-for="item in list"
  12 + :key="item.id"
  13 + >
  14 + <view class="onLine-2-i-op" v-if="type === ANSWERTYPE.TOBEANSWERED">
10 <image class="onLine-2-i-op-i" src="@/static/imagesV2/icon41.png" mode="widthFix"></image> 15 <image class="onLine-2-i-op-i" src="@/static/imagesV2/icon41.png" mode="widthFix"></image>
11 <text class="onLine-2-i-op-t">解答</text> 16 <text class="onLine-2-i-op-t">解答</text>
12 </view> 17 </view>
13 <view class="onLine-2-i-1"> 18 <view class="onLine-2-i-1">
14 - <image src="@/static/images/tx.png" class="onLine-2-i-1-1"></image> 19 + <view class="onLine-2-i-1-1">
  20 + <image :src="item.img || '/static/images/tx.png'" ></image>
  21 + </view>
15 <view class="onLine-2-i-1-r"> 22 <view class="onLine-2-i-1-r">
16 - <view class="onLine-2-i-1-r-1">李晋心</view>  
17 - <view class="onLine-2-i-1-r-2">2023-12-10发布</view> 23 + <view class="onLine-2-i-1-r-1">{{item.name || ''}}</view>
  24 + <view class="onLine-2-i-1-r-2">{{item.create_time || ''}}发布</view>
18 </view> 25 </view>
19 </view> 26 </view>
20 <view class="onLine-2-i-2"> 27 <view class="onLine-2-i-2">
21 - 老师你好请问工商管理专业的应届生可以报考工商管理 内的二级专业吗?比如说会计学,旅游管理? 28 + {{item.question || ''}}
22 </view> 29 </view>
23 </view> 30 </view>
  31 + <u-loadmore :status="status" v-if="!notData"/>
24 <u-empty 32 <u-empty
  33 + v-if="notData"
25 mode="data" 34 mode="data"
26 text="暂无数据" 35 text="暂无数据"
27 icon="/static/imagesV2/icon24.png" 36 icon="/static/imagesV2/icon24.png"
@@ -37,18 +46,84 @@ @@ -37,18 +46,84 @@
37 data() { 46 data() {
38 return { 47 return {
39 ANSWERTYPE, 48 ANSWERTYPE,
40 - type: ANSWERTYPE.TOBEANSWERED 49 + type: ANSWERTYPE.TOBEANSWERED,
  50 + page: 1,
  51 + list: [],
  52 + // 加载前值为loadmore,加载中为loading,没有数据为nomore
  53 + status: 'loadmore'
41 }; 54 };
42 }, 55 },
  56 + computed: {
  57 + notData() {
  58 + return this.status === 'nomore' && !this.list.length
  59 + }
  60 + },
  61 + onShow() {
  62 + this.onRetry()
  63 + },
  64 + onReachBottom() {
  65 + that.getData()
  66 + },
43 methods: { 67 methods: {
44 - toDetails() { 68 + toDetails(data) {
45 uni.navigateTo({ 69 uni.navigateTo({
46 - url: '/new_tec/onLineDetails/onLineDetails' 70 + url: '/new_tec/onLineDetails/onLineDetails?id=' + data.id
47 }) 71 })
48 }, 72 },
49 selectItem(type) { 73 selectItem(type) {
50 - this.type = type 74 + this.type = type;
  75 + this.onRetry();
  76 + },
  77 + onRetry(){
  78 + this.page=1
  79 + this.list = []
  80 + this.getData()
  81 + },
  82 + getData() {
  83 + if(this.status === 'loading') return;
  84 + this.status = 'loading';
  85 + uni.showLoading({
  86 + title: '加载中',
  87 + mask: true
  88 + })
  89 + this.$service.P_get('/lecturer/question', {
  90 + page: this.page,
  91 + type: this.type
  92 + }).then(res => {
  93 + uni.hideLoading();
  94 + if (res.code == 1) {
  95 + this.page++;
  96 + this.list = [
  97 + ...this.list,
  98 + ...res.data.data
  99 + ];
  100 + this.status = res.data.data.length < res.data.per_page ? 'nomore' : 'loadmore'
  101 + }else {
  102 + this.status = 'loadmore';
  103 + if (res.msg) {
  104 + uni.showToast({
  105 + icon: 'none',
  106 + title: res.msg
  107 + })
  108 + } else {
  109 + uni.showToast({
  110 + icon: 'none',
  111 + title: '获取数据失败'
  112 + })
  113 + }
  114 + }
  115 +
  116 +
  117 + }).catch(e => {
  118 + this.status = 'loadmore';
  119 + uni.hideLoading()
  120 + uni.showToast({
  121 + icon: 'none',
  122 + title: '获取数据失败,请检查您的网络连接'
  123 + })
  124 + })
51 } 125 }
  126 +
52 } 127 }
53 } 128 }
54 </script> 129 </script>
@@ -126,6 +201,8 @@ @@ -126,6 +201,8 @@
126 .onLine-2-i-1-1{ 201 .onLine-2-i-1-1{
127 height: 60rpx; 202 height: 60rpx;
128 width: 60rpx; 203 width: 60rpx;
  204 + border-radius: 50%;
  205 + overflow: hidden;
129 } 206 }
130 .onLine-2-i-1-r{ 207 .onLine-2-i-1-r{
131 margin-left: 30rpx; 208 margin-left: 30rpx;