作者 mxd

在线答疑接口对接

@@ -99,9 +99,9 @@ export const MYQUESTIONTYPE = { @@ -99,9 +99,9 @@ export const MYQUESTIONTYPE = {
99 'ANSWERED': 1, 99 'ANSWERED': 1,
100 /** 100 /**
101 * 未解答 101 * 未解答
102 - * @value 2 102 + * @value 0
103 */ 103 */
104 - 'UNANSWERED': 2 104 + 'UNANSWERED': 0
105 } 105 }
106 /** 106 /**
107 * 大咖课类型 107 * 大咖课类型
@@ -162,4 +162,20 @@ export const MESSAGETYPE = { @@ -162,4 +162,20 @@ export const MESSAGETYPE = {
162 * @value 2 162 * @value 2
163 */ 163 */
164 'VOICEANSWERS': 2 164 'VOICEANSWERS': 2
  165 +}
  166 +
  167 +/**
  168 + * 评分状态
  169 + */score
  170 +export const SCORESTATE = {
  171 + /**
  172 + * 未评分
  173 + * @value 0
  174 + */
  175 + 'UNRATED': 0,
  176 + /**
  177 + * 已评分
  178 + * @value 1
  179 + */
  180 + 'RATED': 1,
165 } 181 }
@@ -8,16 +8,21 @@ @@ -8,16 +8,21 @@
8 </view> 8 </view>
9 <view class="answer-2"> 9 <view class="answer-2">
10 <view class="answer-2-l"> 10 <view class="answer-2-l">
11 - <picker @change="bindpickerChange" :value="index" :range="subjectList" range-key="title"> 11 + <picker @change="keMupickerChange" :value="keMu.value" :range="keMu.list">
12 <view class="answer-2-l-i"> 12 <view class="answer-2-l-i">
13 - 任课科目 <u-icon size="12" name="arrow-down-fill" color="#646464"></u-icon> 13 + {{ keMu.list[keMu.value] === '全部' ? '任课科目' : keMu.list[keMu.value] }}
  14 + <u-icon size="12" name="arrow-down-fill" color="#646464"></u-icon>
14 </view> 15 </view>
15 </picker> 16 </picker>
16 - <picker @change="bindpickerChange2" :value="index" :range="basedOnList" range-key="title">  
17 - <view class="answer-2-l-i">  
18 - 用户评价 <u-icon size="12" name="arrow-down-fill" color="#646464"></u-icon> 17 + <view
  18 + class="answer-2-l-i"
  19 + @click="sortChange"
  20 + >
  21 + 用户评价
  22 + <view class="icon" :class="{asc: sort === 'asc'}">
  23 + <u-icon size="12" name="arrow-down-fill" color="#2D81FF"></u-icon>
19 </view> 24 </view>
20 - </picker> 25 + </view>
21 </view> 26 </view>
22 <view class="answer-2-r" @click="toMyQuestion"> 27 <view class="answer-2-r" @click="toMyQuestion">
23 <image class="answer-2-r-i" src="@/static/imagesV2/icon39.png" mode="widthFix"></image> 28 <image class="answer-2-r-i" src="@/static/imagesV2/icon39.png" mode="widthFix"></image>
@@ -36,63 +41,69 @@ @@ -36,63 +41,69 @@
36 <template> 41 <template>
37 <view class="answer"> 42 <view class="answer">
38 <view v-if="type === PAGETYPE.ONLINE"> 43 <view v-if="type === PAGETYPE.ONLINE">
39 - <view class="answer-item" v-for="item in 20" :key="item">  
40 - <view class="answer-item-tw" @click="toAnswerForm"> 44 + <view class="answer-item" v-for="d in list" :key="d.id">
  45 + <view class="answer-item-tw" @click="toAnswerForm(d)">
41 <image class="answer-item-tw-i" src="@/static/imagesV2/icon41.png"></image> 46 <image class="answer-item-tw-i" src="@/static/imagesV2/icon41.png"></image>
42 <text>提问</text> 47 <text>提问</text>
43 </view> 48 </view>
44 <view class="answer-item-l"> 49 <view class="answer-item-l">
45 - <image class="answer-item-l-img" src="@/static/images/tx.png" mode="widthFix"></image> 50 + <view class="answer-item-l-img">
  51 + <image :src="d.img_url || '/static/images/tx.png'" mode="widthFix"></image>
  52 + </view>
46 </view> 53 </view>
47 <view class="answer-item-r"> 54 <view class="answer-item-r">
48 - <view class="answer-item-r-1">程菲</view>  
49 - <view class="answer-item-r-2">笔试系统精讲班</view> 55 + <view class="answer-item-r-1">{{d.title}}</view>
  56 + <view class="answer-item-r-2">{{d.sub_title}}</view>
50 <view class="answer-item-r-3"> 57 <view class="answer-item-r-3">
51 <image class="answer-item-r-3-i" src="@/static/imagesV2/icon40.png" mode="widthFix"></image> 58 <image class="answer-item-r-3-i" src="@/static/imagesV2/icon40.png" mode="widthFix"></image>
52 <text class="answer-item-r-3-la">用户评分</text> 59 <text class="answer-item-r-3-la">用户评分</text>
53 - <text class="answer-item-r-3-f">3.6</text> 60 + <text class="answer-item-r-3-f">{{d.start}}</text>
54 </view> 61 </view>
55 </view> 62 </view>
56 </view> 63 </view>
57 </view> 64 </view>
58 <view v-if="type === PAGETYPE.CLASSROOM"> 65 <view v-if="type === PAGETYPE.CLASSROOM">
59 - <view class="answer-item2"> 66 + <view class="answer-item2" v-for="d in list" :key="d.id">
60 <view class="myQuestion-2-i-1"> 67 <view class="myQuestion-2-i-1">
61 <view class="myQuestion-2-i-1-l"> 68 <view class="myQuestion-2-i-1-l">
62 - <image class="myQuestion-2-i-1-l-i" src="@/static/images/tx.png" mode="widthFix"></image> 69 + <view class="myQuestion-2-i-1-l-i">
  70 + <image :src="d.img || '/static/images/tx.png'" mode="widthFix"></image>
  71 + </view>
  72 +
63 </view> 73 </view>
64 <view class="myQuestion-2-i-1-r"> 74 <view class="myQuestion-2-i-1-r">
65 - <view class="myQuestion-2-i-1-r-1">李晋心</view>  
66 - <view class="myQuestion-2-i-1-r-2">2023-12-10发布</view> 75 + <view class="myQuestion-2-i-1-r-1">{{d.name}}</view>
  76 + <view class="myQuestion-2-i-1-r-2">{{d.create_time}}发布</view>
67 </view> 77 </view>
68 </view> 78 </view>
69 <view class="myQuestion-2-i-2"> 79 <view class="myQuestion-2-i-2">
70 - 老师你好请问工商管理专业的应届生可以报考工商管理  
71 - 内的二级专业吗?比如说会计学,旅游管理? 80 + {{d.question}}
72 </view> 81 </view>
73 - <view class="myQuestion-2-i-4"> 82 + <view class="myQuestion-2-i-4" v-if="d.imgs && d.imgs.length">
74 <u--image 83 <u--image
75 - v-for="(item, index) in []" 84 + v-for="(item, index) in d.imgs"
76 :key="index" 85 :key="index"
77 radius="15rpx" 86 radius="15rpx"
78 height="145rpx" 87 height="145rpx"
79 width="145rpx" 88 width="145rpx"
80 - @click.native="seeImg(index)" 89 + @click.native="seeImg(d.imgs, index)"
81 :src="item"></u--image> 90 :src="item"></u--image>
82 </view> 91 </view>
83 - <view class="myQuestion-2-i-3"> 92 + <view class="myQuestion-2-i-3" >
84 <view class="myQuestion-2-i-3-l"> 93 <view class="myQuestion-2-i-3-l">
85 - <view class="myQuestion-2-i-3-l-1" v-if="false">已解答</view>  
86 - <view class="myQuestion-2-i-3-l-1 myQuestion-2-i-3-l-1s" v-else>已解答</view>  
87 - <view class="myQuestion-2-i-3-l-t">程菲</view> 94 + <view class="myQuestion-2-i-3-l-1" v-if="d.answer_type != 0">已解答</view>
  95 + <view class="myQuestion-2-i-3-l-1 myQuestion-2-i-3-l-1s" v-else>未解答</view>
  96 + <view class="myQuestion-2-i-3-l-t">{{d.tname}}</view>
88 </view> 97 </view>
89 <view class="myQuestion-2-i-3-r"> 98 <view class="myQuestion-2-i-3-r">
90 - 2023-12-11 99 + {{d.answer_time || ''}}
91 </view> 100 </view>
92 </view> 101 </view>
93 </view> 102 </view>
94 </view> 103 </view>
  104 + <u-loadmore :status="status" v-if="!notData"/>
95 <u-empty 105 <u-empty
  106 + v-if="notData"
96 mode="data" 107 mode="data"
97 text="暂无数据" 108 text="暂无数据"
98 icon="/static/imagesV2/icon24.png" 109 icon="/static/imagesV2/icon24.png"
@@ -117,36 +128,162 @@ @@ -117,36 +128,162 @@
117 return { 128 return {
118 PAGETYPE, 129 PAGETYPE,
119 type: PAGETYPE.CLASSROOM, 130 type: PAGETYPE.CLASSROOM,
120 - subjectList: [  
121 - {  
122 - title: '科目',  
123 - id: 1  
124 - }  
125 - ],  
126 - basedOnList: [  
127 - {  
128 - title: '用户评价',  
129 - id: 1  
130 - }  
131 - ] 131 + keMu: {
  132 + list: [],
  133 + value: 0
  134 + },
  135 + // 分页
  136 + page: 1,
  137 + // 排序 asc-升序,desc-降序
  138 + sort: 'desc',
  139 + title: '',
  140 + list: [],
  141 + // 加载前值为loadmore,加载中为loading,没有数据为nomore
  142 + status: 'loadmore',
  143 +
132 } 144 }
133 }, 145 },
134 - mounted() {  
135 - 146 + computed: {
  147 + notData() {
  148 + return this.status === 'nomore' && !this.list.length
  149 + }
  150 + },
  151 + onShow() {
  152 + this.onRetry()
136 }, 153 },
137 onReachBottom() { 154 onReachBottom() {
138 - debugger 155 + this.getData()
  156 + },
  157 + onLoad() {
  158 + this.getKeMuList();
139 }, 159 },
140 methods: { 160 methods: {
141 - toAnswerForm() { 161 + // tab切换
  162 + switchItem(type) {
  163 + this.type = type;
  164 + this.onRetry();
  165 + },
  166 + // 科目选择修改
  167 + keMupickerChange(e) {
  168 + this.keMu.value = e.detail.value;
  169 + this.onRetry();
  170 + },
  171 + // 排序切换
  172 + sortChange() {
  173 + this.sort = this.sort === 'asc' ? 'desc' : 'asc';
  174 + this.onRetry();
  175 + },
  176 + confirm(e) {
  177 + this.title = e;
  178 + this.onRetry();
  179 + },
  180 + // 获取科目列表
  181 + getKeMuList() {
  182 + uni.showLoading({
  183 + title: '加载中',
  184 + mask: true
  185 + })
  186 + this.$service.P_get('/question/kemu').then(res => {
  187 + uni.hideLoading();
  188 + if (res.code == 1) {
  189 + this.keMu.list = [
  190 + '全部',
  191 + ...res.data
  192 + ];
  193 + }else {
  194 + if (res.msg) {
  195 + uni.showToast({
  196 + icon: 'none',
  197 + title: res.msg
  198 + })
  199 + } else {
  200 + uni.showToast({
  201 + icon: 'none',
  202 + title: '获取数据失败'
  203 + })
  204 + }
  205 + }
  206 + }).catch(e => {
  207 + uni.hideLoading()
  208 + uni.showToast({
  209 + icon: 'none',
  210 + title: '获取数据失败,请检查您的网络连接'
  211 + })
  212 + })
  213 + },
  214 + // 列表分页初始化
  215 + onRetry(){
  216 + this.page= 1;
  217 + this.list = [];
  218 + this.status = 'loadmore';
  219 + this.getData()
  220 + },
  221 + // 获取数据
  222 + getData() {
  223 + if(this.status === 'loading' || this.status === 'nomore') return;
  224 + this.status = 'loading';
  225 + uni.showLoading({
  226 + title: '加载中',
  227 + mask: true
  228 + })
  229 + const { keMu, page, sort, type, title } = this;
  230 +
  231 + let api = '';
  232 + if(type === PAGETYPE.CLASSROOM) {
  233 + api = '/question/all'
  234 + }else {
  235 + api = '/question/lecturer'
  236 + }
  237 +
  238 + this.$service.P_get(api, {
  239 + page,
  240 + order_sort: sort,
  241 + sub_tilte: keMu.list[keMu.value] === '全部' || !keMu.list[keMu.value] ? '' : keMu.list[keMu.value],
  242 + title,
  243 + }).then(res => {
  244 + uni.hideLoading();
  245 + if (res.code == 1) {
  246 + this.page++;
  247 + this.list = [
  248 + ...this.list,
  249 + ...res.data.data
  250 + ];
  251 + this.status = res.data.data.length < res.data.per_page ? 'nomore' : 'loadmore'
  252 + }else {
  253 + this.status = 'loadmore';
  254 + if (res.msg) {
  255 + uni.showToast({
  256 + icon: 'none',
  257 + title: res.msg
  258 + })
  259 + } else {
  260 + uni.showToast({
  261 + icon: 'none',
  262 + title: '获取数据失败'
  263 + })
  264 + }
  265 + }
  266 +
  267 +
  268 + }).catch(e => {
  269 + this.status = 'loadmore';
  270 + uni.hideLoading()
  271 + uni.showToast({
  272 + icon: 'none',
  273 + title: '获取数据失败,请检查您的网络连接'
  274 + })
  275 + })
  276 + },
  277 + // 提问
  278 + toAnswerForm(data) {
142 uni.navigateTo({ 279 uni.navigateTo({
143 - url: '/pagesStu/answerForm/answerForm' 280 + url: '/pagesStu/answerForm/answerForm?id=' + data.id
144 }) 281 })
145 }, 282 },
146 - seeImg(index) { 283 + seeImg(urls, current = 0) {
147 uni.previewImage({ 284 uni.previewImage({
148 - current: index, // 当前显示图片的链接,不填则默认为 urls 的第一张图片  
149 - urls: this.info.imgs // 需要预览的图片链接列表 285 + current, // 当前显示图片的链接,不填则默认为 urls 的第一张图片
  286 + urls // 需要预览的图片链接列表
150 }) 287 })
151 }, 288 },
152 toMyQuestion() { 289 toMyQuestion() {
@@ -158,18 +295,9 @@ @@ -158,18 +295,9 @@
158 let result = this.$refs.searchTopRef.getOtherHeight() 295 let result = this.$refs.searchTopRef.getOtherHeight()
159 this.$refs.paddingTopBRef.setOtherHeight(result, 'px') 296 this.$refs.paddingTopBRef.setOtherHeight(result, 'px')
160 }, 297 },
161 - bindpickerChange(e) {  
162 -  
163 - },  
164 - bindpickerChange2(e) {  
165 -  
166 - },  
167 - switchItem(type) {  
168 - this.type = type  
169 - },  
170 - confirm(e) {  
171 - console.log(e)  
172 - } 298 +
  299 +
  300 +
173 } 301 }
174 } 302 }
175 </script> 303 </script>
@@ -219,6 +347,9 @@ @@ -219,6 +347,9 @@
219 padding-right: 25rpx; 347 padding-right: 25rpx;
220 display: flex; 348 display: flex;
221 align-items: center; 349 align-items: center;
  350 + .asc {
  351 + transform: scaleY(-1);
  352 + }
222 } 353 }
223 } 354 }
224 .answer-2-r{ 355 .answer-2-r{
@@ -283,7 +414,8 @@ @@ -283,7 +414,8 @@
283 .answer-item-l-img{ 414 .answer-item-l-img{
284 height: 110rpx; 415 height: 110rpx;
285 width: 110rpx; 416 width: 110rpx;
286 - border-radius: 200rpx; 417 + border-radius: 50%;
  418 + overflow: hidden;
287 } 419 }
288 } 420 }
289 .answer-item-r{ 421 .answer-item-r{
@@ -328,6 +460,7 @@ @@ -328,6 +460,7 @@
328 background-color: #FFFFFF; 460 background-color: #FFFFFF;
329 box-sizing: border-box; 461 box-sizing: border-box;
330 border-radius: 20rpx; 462 border-radius: 20rpx;
  463 + margin-bottom: 20rpx;
331 .myQuestion-2-i-1{ 464 .myQuestion-2-i-1{
332 display: flex; 465 display: flex;
333 align-items: center; 466 align-items: center;
@@ -335,7 +468,8 @@ @@ -335,7 +468,8 @@
335 .myQuestion-2-i-1-l-i{ 468 .myQuestion-2-i-1-l-i{
336 height: 60rpx; 469 height: 60rpx;
337 width: 60rpx; 470 width: 60rpx;
338 - border-radius: 100%; 471 + border-radius: 50%;
  472 + overflow: hidden;
339 } 473 }
340 } 474 }
341 .myQuestion-2-i-1-r{ 475 .myQuestion-2-i-1-r{
@@ -364,8 +498,10 @@ @@ -364,8 +498,10 @@
364 display: flex; 498 display: flex;
365 justify-content: space-between; 499 justify-content: space-between;
366 align-items: center; 500 align-items: center;
  501 + margin-top: 20rpx;
367 .myQuestion-2-i-3-l{ 502 .myQuestion-2-i-3-l{
368 display: flex; 503 display: flex;
  504 + align-items: center;
369 .myQuestion-2-i-3-l-1{ 505 .myQuestion-2-i-3-l-1{
370 border-radius: 20rpx 20rpx 0px 20rpx; 506 border-radius: 20rpx 20rpx 0px 20rpx;
371 height: 40rpx; 507 height: 40rpx;
@@ -3,53 +3,61 @@ @@ -3,53 +3,61 @@
3 <view class="answerDetails-c"> 3 <view class="answerDetails-c">
4 <view class="myQuestion-2-i-1"> 4 <view class="myQuestion-2-i-1">
5 <view class="myQuestion-2-i-1-l"> 5 <view class="myQuestion-2-i-1-l">
6 - <image class="myQuestion-2-i-1-l-i" src="@/static/images/tx.png" mode="widthFix"></image> 6 + <view class="myQuestion-2-i-1-l-i">
  7 + <image :src="info.img || '/static/images/tx.png'" mode="widthFix"></image>
  8 + </view>
7 </view> 9 </view>
8 <view class="myQuestion-2-i-1-r"> 10 <view class="myQuestion-2-i-1-r">
9 - <view class="myQuestion-2-i-1-r-1">李晋心</view>  
10 - <view class="myQuestion-2-i-1-r-2">2023-12-10发布</view> 11 + <view class="myQuestion-2-i-1-r-1">{{info.name}}</view>
  12 + <view class="myQuestion-2-i-1-r-2">{{info.create_time}}发布</view>
11 </view> 13 </view>
12 </view> 14 </view>
13 <view class="myQuestion-2-i-2"> 15 <view class="myQuestion-2-i-2">
14 - 老师你好请问工商管理专业的应届生可以报考工商管理  
15 - 内的二级专业吗?比如说会计学,旅游管理? 16 + {{info.question}}
16 </view> 17 </view>
17 - <view class="myQuestion-2-i-5"></view> 18 +
18 <view class="myQuestion-2-i-4"> 19 <view class="myQuestion-2-i-4">
19 <u--image 20 <u--image
20 - v-for="(item, index) in []" 21 + v-for="(item, index) in info.imgs"
21 :key="index" 22 :key="index"
22 radius="15rpx" 23 radius="15rpx"
23 height="145rpx" 24 height="145rpx"
24 width="145rpx" 25 width="145rpx"
25 - @click.native="seeImg(index)" 26 + @click.native="seeImg(info.imgs,index)"
26 :src="item"></u--image> 27 :src="item"></u--image>
27 </view> 28 </view>
28 - <view class="myQuestion-2-i-3"> 29 + <view class="myQuestion-2-i-5"></view>
  30 + <view class="myQuestion-2-i-3" v-if="isAnswered">
29 <view class="myQuestion-2-i-3-c"> 31 <view class="myQuestion-2-i-3-c">
30 <view class="myQuestion-2-i-3-c-1"> 32 <view class="myQuestion-2-i-3-c-1">
31 <view class="myQuestion-2-i-3-c-1-l"> 33 <view class="myQuestion-2-i-3-c-1-l">
32 <image class="myQuestion-2-i-3-c-1-l-i" src="@/static/images/tx.png" mode="widthFix"></image> 34 <image class="myQuestion-2-i-3-c-1-l-i" src="@/static/images/tx.png" mode="widthFix"></image>
33 - <text class="myQuestion-2-i-3-c-1-l-t">程菲老师回复</text> 35 + <text class="myQuestion-2-i-3-c-1-l-t">{{info.lecturer.title}}老师回复</text>
34 </view> 36 </view>
35 - <view class="myQuestion-2-i-3-c-1-r">2023-12-10</view> 37 + <view class="myQuestion-2-i-3-c-1-r">{{info.answer_time}}</view>
36 </view> 38 </view>
37 - <view class="myQuestion-2-i-3-c-2">  
38 - 同学你好,这个问题问的好,你说的这些都是不可以报的! 39 + <view class="myQuestion-2-i-3-c-2" v-if="isTextReply">
  40 + {{info.answer}}
39 </view> 41 </view>
40 - <view style="margin-top: 28rpx;">  
41 - <VoicePlayback /> 42 + <view style="margin-top: 28rpx;" v-if="isVoiceReply">
  43 + <VoicePlayback
  44 + ref="voicePlayback"
  45 + />
42 </view> 46 </view>
43 - <u-empty  
44 - mode="data"  
45 - text="暂无回复"  
46 - icon="/static/imagesV2/icon43.png"  
47 - >  
48 - </u-empty> 47 +
49 </view> 48 </view>
50 </view> 49 </view>
  50 +
  51 + <u-empty
  52 + v-else
  53 + mode="data"
  54 + text="暂无回复"
  55 + icon="/static/imagesV2/icon43.png"
  56 + >
  57 + </u-empty>
  58 +
51 </view> 59 </view>
52 - <view class="answerDetails-b"> 60 + <view class="answerDetails-b" v-if="isAnswered && isUnRated">
53 <view class="answerDetails-b-c"> 61 <view class="answerDetails-b-c">
54 <view class="answerDetails-b-c-l"> 62 <view class="answerDetails-b-c-l">
55 <view class="answerDetails-b-c-l-1">请对本次答复</view> 63 <view class="answerDetails-b-c-l-1">请对本次答复</view>
@@ -57,7 +65,7 @@ @@ -57,7 +65,7 @@
57 </view> 65 </view>
58 <view class="answerDetails-b-c-r"> 66 <view class="answerDetails-b-c-r">
59 <u-rate :count="5" v-model="score" size="20"></u-rate> 67 <u-rate :count="5" v-model="score" size="20"></u-rate>
60 - <view class="answerDetails-b-c-r-c">提交</view> 68 + <view class="answerDetails-b-c-r-c" @click="submit">提交</view>
61 </view> 69 </view>
62 </view> 70 </view>
63 </view> 71 </view>
@@ -66,24 +74,150 @@ @@ -66,24 +74,150 @@
66 74
67 <script> 75 <script>
68 import VoicePlayback from "@/components/VoicePlayback/index.vue" 76 import VoicePlayback from "@/components/VoicePlayback/index.vue"
  77 + import { MESSAGETYPE, SCORESTATE } from "@/emit/index.js"
69 export default { 78 export default {
70 components: { 79 components: {
71 VoicePlayback 80 VoicePlayback
72 }, 81 },
73 data() { 82 data() {
74 return { 83 return {
  84 + id: '',
  85 + info: {},
75 score: 5 86 score: 5
76 } 87 }
77 }, 88 },
  89 + computed: {
  90 + // 是否已解答
  91 + isAnswered() {
  92 + return this.isVoiceReply || this.isTextReply;
  93 + },
  94 + // 是否文字回复
  95 + isTextReply() {
  96 + const { answer_type } = this.info;
  97 + return answer_type === MESSAGETYPE.TEXTANSWER
  98 + },
  99 + // 是否语音回复
  100 + isVoiceReply() {
  101 + const { answer_type } = this.info;
  102 + return answer_type === MESSAGETYPE.VOICEANSWERS
  103 + },
  104 + //语音回复数据
  105 + voiceReplyData() {
  106 + let obj = null;
  107 + if(this.isVoiceReply) {
  108 + obj = JSON.parse(this.info.answer);
  109 + }
  110 + return obj
  111 + },
  112 + // 是否未评分
  113 + isUnRated() {
  114 + return this.info.is_score === SCORESTATE.UNRATED
  115 + }
  116 + },
  117 + onLoad(option) {
  118 + this.id = option.id;
  119 + this.getInfo();
  120 + },
78 methods: { 121 methods: {
79 - 122 + getInfo() {
  123 + uni.showLoading({
  124 + title: '加载中',
  125 + mask: true
  126 + })
  127 + this.$service.P_get('/question/info', {
  128 + id: this.id
  129 + }).then(res => {
  130 + uni.hideLoading();
  131 + if (res.code == 1) {
  132 + this.info = res.data;
  133 + if(typeof res.data.imgs === 'string') {
  134 + this.info.imgs = res.data.imgs.split(',');
  135 + }
  136 +
  137 +
  138 + this.$nextTick(() => {
  139 + if(this.isVoiceReply) {
  140 + this.$refs.voicePlayback.init(this.voiceReplyData)
  141 + }
  142 + })
  143 +
  144 + }else {
  145 + if (res.msg) {
  146 + uni.showToast({
  147 + icon: 'none',
  148 + title: res.msg
  149 + })
  150 + } else {
  151 + uni.showToast({
  152 + icon: 'none',
  153 + title: '获取数据失败'
  154 + })
  155 + }
  156 + }
  157 +
  158 +
  159 + }).catch(e => {
  160 + uni.hideLoading()
  161 + uni.showToast({
  162 + icon: 'none',
  163 + title: '获取数据失败,请检查您的网络连接'
  164 + })
  165 + })
  166 + },
  167 + seeImg(urls, current = 0) {
  168 + uni.previewImage({
  169 + current, // 当前显示图片的链接,不填则默认为 urls 的第一张图片
  170 + urls // 需要预览的图片链接列表
  171 + })
  172 + },
  173 + // 提交评分
  174 + submit() {
  175 + uni.showLoading({
  176 + title: '提交中',
  177 + mask: true
  178 + })
  179 + this.$service.P_get('/question/score', {
  180 + id: this.id,
  181 + score: this.score
  182 + }).then(res => {
  183 + uni.hideLoading();
  184 + if (res.code == 1) {
  185 +
  186 + uni.showToast({
  187 + icon:'none',
  188 + title:'保存成功'
  189 + })
  190 + this.info.is_score = SCORESTATE.RATED;
  191 + }else {
  192 + if (res.msg) {
  193 + uni.showToast({
  194 + icon: 'none',
  195 + title: res.msg
  196 + })
  197 + } else {
  198 + uni.showToast({
  199 + icon: 'none',
  200 + title: '获取数据失败'
  201 + })
  202 + }
  203 + }
  204 +
  205 +
  206 + }).catch(e => {
  207 + uni.hideLoading()
  208 + uni.showToast({
  209 + icon: 'none',
  210 + title: '获取数据失败,请检查您的网络连接'
  211 + })
  212 + })
  213 + }
80 } 214 }
81 } 215 }
82 </script> 216 </script>
83 217
84 <style lang="scss" scoped> 218 <style lang="scss" scoped>
85 .answerDetails{ 219 .answerDetails{
86 - padding: 20rpx 25rpx; 220 + padding: 20rpx 25rpx 140rpx;
87 .answerDetails-b{ 221 .answerDetails-b{
88 position: fixed; 222 position: fixed;
89 left: 0; 223 left: 0;
@@ -148,7 +282,8 @@ @@ -148,7 +282,8 @@
148 .myQuestion-2-i-1-l-i{ 282 .myQuestion-2-i-1-l-i{
149 height: 60rpx; 283 height: 60rpx;
150 width: 60rpx; 284 width: 60rpx;
151 - border-radius: 100%; 285 + border-radius: 50%;
  286 + overflow: hidden;
152 } 287 }
153 } 288 }
154 .myQuestion-2-i-1-r{ 289 .myQuestion-2-i-1-r{
@@ -30,10 +30,14 @@ @@ -30,10 +30,14 @@
30 export default { 30 export default {
31 data() { 31 data() {
32 return { 32 return {
  33 + id: '',
33 fileList: [], 34 fileList: [],
34 content: '' 35 content: ''
35 }; 36 };
36 }, 37 },
  38 + onLoad(option) {
  39 + this.id = option.id;
  40 + },
37 methods: { 41 methods: {
38 imgdel(e){ 42 imgdel(e){
39 var that =this 43 var that =this
@@ -131,21 +135,48 @@ @@ -131,21 +135,48 @@
131 135
132 }, 136 },
133 submit() { 137 submit() {
  138 + console.log(this.fileList);
  139 + uni.showLoading({
  140 + title: '提交中',
  141 + mask: true
  142 + })
  143 +
134 var datas = { 144 var datas = {
135 - content: this.content, 145 + tid: this.id,
  146 + question: this.content,
136 imgs: this.fileList 147 imgs: this.fileList
137 } 148 }
138 - var jkurl = '/praise/add' 149 +
  150 + var jkurl = '/question/add';
139 this.$service.P_post(jkurl, datas).then(res => { 151 this.$service.P_post(jkurl, datas).then(res => {
  152 + uni.hideLoading();
  153 + if (res.code == 1) {
  154 + uni.showToast({
  155 + icon:'none',
  156 + title:'保存成功'
  157 + })
  158 + setTimeout(function(){
  159 + uni.navigateBack()
  160 + },1000)
  161 + }else {
  162 + if (res.msg) {
  163 + uni.showToast({
  164 + icon: 'none',
  165 + title: res.msg
  166 + })
  167 + } else {
  168 + uni.showToast({
  169 + icon: 'none',
  170 + title: '获取数据失败'
  171 + })
  172 + }
  173 + }
  174 + }).catch(e => {
  175 + uni.hideLoading()
140 uni.showToast({ 176 uni.showToast({
141 - icon:'none',  
142 - title: '上传成功' 177 + icon: 'none',
  178 + title: '获取数据失败,请检查您的网络连接'
143 }) 179 })
144 - setTimeout(() => {  
145 - uni.navigateBack({  
146 - delta: 1  
147 - })  
148 - }, 1500)  
149 }) 180 })
150 }, 181 },
151 async afterRead(event) { 182 async afterRead(event) {
@@ -5,42 +5,52 @@ @@ -5,42 +5,52 @@
5 <view @click="switchItem(MYQUESTIONTYPE.UNANSWERED)" :class="{'myQuestion-i': true, 'myQuestion-is': type === MYQUESTIONTYPE.UNANSWERED}">未解答</view> 5 <view @click="switchItem(MYQUESTIONTYPE.UNANSWERED)" :class="{'myQuestion-i': true, 'myQuestion-is': type === MYQUESTIONTYPE.UNANSWERED}">未解答</view>
6 </view> 6 </view>
7 <view class="myQuestion-2"> 7 <view class="myQuestion-2">
8 - <view class="myQuestion-2-i" @click="toAnswerDetails"> 8 + <view class="myQuestion-2-i" v-for="d in list" :key="d.id" @click="toAnswerDetails(d)">
9 <view class="myQuestion-2-i-1"> 9 <view class="myQuestion-2-i-1">
10 <view class="myQuestion-2-i-1-l"> 10 <view class="myQuestion-2-i-1-l">
11 - <image class="myQuestion-2-i-1-l-i" src="@/static/images/tx.png" mode="widthFix"></image> 11 + <view class="myQuestion-2-i-1-l-i">
  12 + <image :src="d.img || '/static/images/tx.png'" mode="widthFix"></image>
  13 + </view>
12 </view> 14 </view>
13 <view class="myQuestion-2-i-1-r"> 15 <view class="myQuestion-2-i-1-r">
14 - <view class="myQuestion-2-i-1-r-1">李晋心</view>  
15 - <view class="myQuestion-2-i-1-r-2">2023-12-10发布</view> 16 + <view class="myQuestion-2-i-1-r-1">{{d.name}}</view>
  17 + <view class="myQuestion-2-i-1-r-2">{{d.create_time}}发布</view>
16 </view> 18 </view>
17 </view> 19 </view>
18 <view class="myQuestion-2-i-2"> 20 <view class="myQuestion-2-i-2">
19 - 老师你好请问工商管理专业的应届生可以报考工商管理  
20 - 内的二级专业吗?比如说会计学,旅游管理? 21 + {{d.question}}
21 </view> 22 </view>
22 - <view class="myQuestion-2-i-4"> 23 + <view class="myQuestion-2-i-4" v-if="d.imgs && d.imgs.length">
23 <u--image 24 <u--image
24 - v-for="(item, index) in []" 25 + v-for="(item, index) in d.imgs"
25 :key="index" 26 :key="index"
26 radius="15rpx" 27 radius="15rpx"
27 height="145rpx" 28 height="145rpx"
28 width="145rpx" 29 width="145rpx"
29 - @click.native="seeImg(index)" 30 + @click.stop="seeImg(d.imgs, index)"
30 :src="item"></u--image> 31 :src="item"></u--image>
31 </view> 32 </view>
32 <view class="myQuestion-2-i-3"> 33 <view class="myQuestion-2-i-3">
33 <view class="myQuestion-2-i-3-l"> 34 <view class="myQuestion-2-i-3-l">
34 - <view class="myQuestion-2-i-3-l-1" v-if="false">已解答</view>  
35 - <view class="myQuestion-2-i-3-l-1 myQuestion-2-i-3-l-1s" v-else>已解答</view>  
36 - <view class="myQuestion-2-i-3-l-t">程菲</view> 35 + <view class="myQuestion-2-i-3-l-1" v-if="type === MYQUESTIONTYPE.ANSWERED">已解答</view>
  36 + <view class="myQuestion-2-i-3-l-1 myQuestion-2-i-3-l-1s" v-else>未解答</view>
  37 + <view class="myQuestion-2-i-3-l-t">{{d.tname}}</view>
37 </view> 38 </view>
38 <view class="myQuestion-2-i-3-r"> 39 <view class="myQuestion-2-i-3-r">
39 - 2023-12-11 40 + {{d.answer_time || ''}}
40 </view> 41 </view>
41 </view> 42 </view>
42 </view> 43 </view>
43 </view> 44 </view>
  45 +
  46 + <u-loadmore :status="status" v-if="!notData"/>
  47 + <u-empty
  48 + v-if="notData"
  49 + mode="data"
  50 + text="暂无数据"
  51 + icon="/static/imagesV2/icon24.png"
  52 + >
  53 + </u-empty>
44 </view> 54 </view>
45 </template> 55 </template>
46 56
@@ -53,23 +63,86 @@ @@ -53,23 +63,86 @@
53 return { 63 return {
54 MYQUESTIONTYPE, 64 MYQUESTIONTYPE,
55 type: MYQUESTIONTYPE.ANSWERED, 65 type: MYQUESTIONTYPE.ANSWERED,
  66 + page: 1,
  67 + list: [],
  68 + // 加载前值为loadmore,加载中为loading,没有数据为nomore
  69 + status: 'loadmore'
56 } 70 }
57 }, 71 },
  72 + onLoad() {
  73 + this.onRetry()
  74 + },
  75 + onReachBottom() {
  76 + this.getData()
  77 + },
58 methods: { 78 methods: {
59 - toAnswerDetails() { 79 + toAnswerDetails(data) {
60 uni.navigateTo({ 80 uni.navigateTo({
61 - url: '/pagesStu/answerDetails/answerDetails' 81 + url: '/pagesStu/answerDetails/answerDetails?id=' + data.id
62 }) 82 })
63 }, 83 },
  84 + // 切换tab
64 switchItem(type) { 85 switchItem(type) {
65 this.type = type 86 this.type = type
  87 + this.onRetry();
66 }, 88 },
67 - seeImg(index) { 89 + seeImg(urls, current = 0) {
68 uni.previewImage({ 90 uni.previewImage({
69 - current: index, // 当前显示图片的链接,不填则默认为 urls 的第一张图片  
70 - urls: [] // 需要预览的图片链接列表 91 + current, // 当前显示图片的链接,不填则默认为 urls 的第一张图片
  92 + urls // 需要预览的图片链接列表
  93 + })
  94 + },
  95 + onRetry(){
  96 + this.page= 1;
  97 + this.list = [];
  98 + this.status = 'loadmore';
  99 + this.getData()
  100 + },
  101 + getData() {
  102 + if(this.status === 'loading' || this.status === 'nomore') return;
  103 + this.status = 'loading';
  104 + uni.showLoading({
  105 + title: '加载中',
  106 + mask: true
  107 + })
  108 + this.$service.P_get('/question/my', {
  109 + page: this.page,
  110 + type: this.type
  111 + }).then(res => {
  112 + uni.hideLoading();
  113 + if (res.code == 1) {
  114 + this.page++;
  115 + this.list = [
  116 + ...this.list,
  117 + ...res.data.data
  118 + ];
  119 + this.status = res.data.data.length < res.data.per_page ? 'nomore' : 'loadmore'
  120 + }else {
  121 + this.status = 'loadmore';
  122 + if (res.msg) {
  123 + uni.showToast({
  124 + icon: 'none',
  125 + title: res.msg
  126 + })
  127 + } else {
  128 + uni.showToast({
  129 + icon: 'none',
  130 + title: '获取数据失败'
  131 + })
  132 + }
  133 + }
  134 +
  135 +
  136 + }).catch(e => {
  137 + this.status = 'loadmore';
  138 + uni.hideLoading()
  139 + uni.showToast({
  140 + icon: 'none',
  141 + title: '获取数据失败,请检查您的网络连接'
  142 + })
71 }) 143 })
72 } 144 }
  145 +
73 } 146 }
74 } 147 }
75 </script> 148 </script>
@@ -117,6 +190,7 @@ @@ -117,6 +190,7 @@
117 background-color: #FFFFFF; 190 background-color: #FFFFFF;
118 box-sizing: border-box; 191 box-sizing: border-box;
119 border-radius: 20rpx; 192 border-radius: 20rpx;
  193 + margin-bottom: 20rpx;
120 .myQuestion-2-i-1{ 194 .myQuestion-2-i-1{
121 display: flex; 195 display: flex;
122 align-items: center; 196 align-items: center;
@@ -124,7 +198,8 @@ @@ -124,7 +198,8 @@
124 .myQuestion-2-i-1-l-i{ 198 .myQuestion-2-i-1-l-i{
125 height: 60rpx; 199 height: 60rpx;
126 width: 60rpx; 200 width: 60rpx;
127 - border-radius: 100%; 201 + border-radius: 50%;
  202 + overflow: hidden;
128 } 203 }
129 } 204 }
130 .myQuestion-2-i-1-r{ 205 .myQuestion-2-i-1-r{
@@ -155,6 +230,7 @@ @@ -155,6 +230,7 @@
155 display: flex; 230 display: flex;
156 justify-content: space-between; 231 justify-content: space-between;
157 align-items: center; 232 align-items: center;
  233 + margin-top: 20rpx;
158 .myQuestion-2-i-3-l{ 234 .myQuestion-2-i-3-l{
159 display: flex; 235 display: flex;
160 .myQuestion-2-i-3-l-1{ 236 .myQuestion-2-i-3-l-1{