作者 mxd

教师端接口对接

@@ -5,37 +5,44 @@ @@ -5,37 +5,44 @@
5 v-for="item in list" 5 v-for="item in list"
6 :key="item.id" 6 :key="item.id"
7 > 7 >
8 - <view class="answer-item2-star">  
9 - <u-rate :count="5" :readonly="true" :size="16" activeColor="#fc6402" v-model="item.score" readonly ></u-rate>  
10 - <view class="answer-item2-star-l">{{item.score}}</view>  
11 - </view> 8 +
12 <view class="myQuestion-2-i-1"> 9 <view class="myQuestion-2-i-1">
13 <view class="myQuestion-2-i-1-l"> 10 <view class="myQuestion-2-i-1-l">
14 <view class="myQuestion-2-i-1-l-i" > 11 <view class="myQuestion-2-i-1-l-i" >
15 <image 12 <image
16 :src="item.img || '/static/images/tx.png'" 13 :src="item.img || '/static/images/tx.png'"
17 mode="widthFix"> 14 mode="widthFix">
18 - </view>  
19 </image> 15 </image>
20 </view> 16 </view>
  17 +
  18 + </view>
21 <view class="myQuestion-2-i-1-r"> 19 <view class="myQuestion-2-i-1-r">
22 - <view class="myQuestion-2-i-1-r-1">{{item.name}}</view> 20 + <view class="myQuestion-2-i-1-r-1">
  21 + <view>
  22 + {{item.name}}
  23 + </view>
  24 + <view class="answer-item2-star">
  25 + <u-rate :count="5" :readonly="true" :size="16" activeColor="#fc6402" v-model="item.score" readonly ></u-rate>
  26 + <view class="answer-item2-star-l">{{item.score}}</view>
  27 + </view>
  28 + </view>
23 <view class="myQuestion-2-i-1-r-2">{{item.create_time}}发布</view> 29 <view class="myQuestion-2-i-1-r-2">{{item.create_time}}发布</view>
24 </view> 30 </view>
25 </view> 31 </view>
26 <view class="myQuestion-2-i-2"> 32 <view class="myQuestion-2-i-2">
27 - {{item.content}} 33 + {{item.question}}
28 </view> 34 </view>
29 - <!-- <view class="myQuestion-2-i-4"> 35 + <view class="myQuestion-2-i-4">
30 <u--image 36 <u--image
31 - v-for="(item, index) in []" 37 + v-for="(child, childIndex) in item.imgs"
32 :key="index" 38 :key="index"
33 radius="15rpx" 39 radius="15rpx"
34 height="145rpx" 40 height="145rpx"
35 width="145rpx" 41 width="145rpx"
36 - @click.native="seeImg(index)"  
37 - :src="item"></u--image>  
38 - </view> --> 42 + @click="previewImage(item.imgs,childIndex)"
  43 + :src="child">
  44 + </u--image>
  45 + </view>
39 </view> 46 </view>
40 <u-loadmore :status="status" v-if="!notData"/> 47 <u-loadmore :status="status" v-if="!notData"/>
41 <u-empty 48 <u-empty
@@ -63,13 +70,19 @@ @@ -63,13 +70,19 @@
63 return this.status === 'nomore' && !this.list.length 70 return this.status === 'nomore' && !this.list.length
64 } 71 }
65 }, 72 },
66 - onShow() { 73 + onLoad() {
67 this.onRetry() 74 this.onRetry()
68 }, 75 },
69 onReachBottom() { 76 onReachBottom() {
70 that.getData() 77 that.getData()
71 }, 78 },
72 methods: { 79 methods: {
  80 + previewImage(urls,current) {
  81 + uni.previewImage({
  82 + current,
  83 + urls
  84 + })
  85 + },
73 onRetry(){ 86 onRetry(){
74 this.page=1 87 this.page=1
75 this.list = [] 88 this.list = []
@@ -134,11 +147,9 @@ @@ -134,11 +147,9 @@
134 position: relative; 147 position: relative;
135 margin-bottom: 20rpx; 148 margin-bottom: 20rpx;
136 .answer-item2-star{ 149 .answer-item2-star{
137 - position: absolute;  
138 - top: 30rpx;  
139 - right: 30rpx;  
140 display: flex; 150 display: flex;
141 align-items: center; 151 align-items: center;
  152 + pointer-events: none;
142 .answer-item2-star-l{ 153 .answer-item2-star-l{
143 font-size: 24rpx; 154 font-size: 24rpx;
144 color: #323232; 155 color: #323232;
@@ -157,10 +168,14 @@ @@ -157,10 +168,14 @@
157 } 168 }
158 .myQuestion-2-i-1-r{ 169 .myQuestion-2-i-1-r{
159 margin-left: 30rpx; 170 margin-left: 30rpx;
  171 + flex: 1;
160 .myQuestion-2-i-1-r-1{ 172 .myQuestion-2-i-1-r-1{
161 font-size: 26rpx; 173 font-size: 26rpx;
162 color: #323232; 174 color: #323232;
163 font-weight: bold; 175 font-weight: bold;
  176 + display: flex;
  177 + align-items: center;
  178 + justify-content: space-between;
164 } 179 }
165 .myQuestion-2-i-1-r-2{ 180 .myQuestion-2-i-1-r-2{
166 font-size: 24rpx; 181 font-size: 24rpx;
@@ -103,6 +103,7 @@ @@ -103,6 +103,7 @@
103 uni.hideLoading() 103 uni.hideLoading()
104 if (res.code == 1) { 104 if (res.code == 1) {
105 this.info = res.data; 105 this.info = res.data;
  106 + this.$store.commit('setuser', res.data)
106 }else { 107 }else {
107 if (res.msg) { 108 if (res.msg) {
108 uni.showToast({ 109 uni.showToast({
@@ -4,39 +4,115 @@ @@ -4,39 +4,115 @@
4 <image class="rateMe-1-bg" src="@/static/imagesV2/icon67.png" mode="widthFix"></image> 4 <image class="rateMe-1-bg" src="@/static/imagesV2/icon67.png" mode="widthFix"></image>
5 <view class="rateMe-1-c"> 5 <view class="rateMe-1-c">
6 <view class="rateMe-1-c-i"> 6 <view class="rateMe-1-c-i">
7 - <view class="rateMe-1-c-i-1">6.6</view> 7 + <view class="rateMe-1-c-i-1">{{userDatas.score || 0}}</view>
8 <view class="rateMe-1-c-i-2">总评分(分)</view> 8 <view class="rateMe-1-c-i-2">总评分(分)</view>
9 </view> 9 </view>
10 <view class="rateMe-1-c-i"> 10 <view class="rateMe-1-c-i">
11 - <view class="rateMe-1-c-i-1">13</view> 11 + <view class="rateMe-1-c-i-1">{{userDatas.content_num || 0}}</view>
12 <view class="rateMe-1-c-i-2">评价人数(人)</view> 12 <view class="rateMe-1-c-i-2">评价人数(人)</view>
13 </view> 13 </view>
14 </view> 14 </view>
15 </view> 15 </view>
16 - <view class="rateMe-2"> 16 + <view class="rateMe-2" v-for="d in list" :key="d.id">
17 <view class="rateMe-2-1"> 17 <view class="rateMe-2-1">
18 <view class="rateMe-2-1-l">评分</view> 18 <view class="rateMe-2-1-l">评分</view>
19 <view class="rateMe-2-1-c"> 19 <view class="rateMe-2-1-c">
20 - <u-rate :count="10" v-model="value"></u-rate> 20 + <u-rate :count="10" :value="d.star"></u-rate>
21 </view> 21 </view>
22 - <view class="rateMe-2-1-r">一般</view> 22 + <view class="rateMe-2-1-r">{{d.star>7?'优秀':d.star>5?'良好':'一般'}}</view>
23 </view> 23 </view>
24 <view class="rateMe-2-2"> 24 <view class="rateMe-2-2">
25 <text style="color: #979797;">其它评价及建议:</text> 25 <text style="color: #979797;">其它评价及建议:</text>
26 - <text>张东老师教学水平高,桃李满天 下,学识渊博,深受学生敬仰。</text> 26 + <text>{{d.content}}</text>
27 </view> 27 </view>
28 </view> 28 </view>
  29 +
  30 + <u-loadmore :status="status" v-if="!notData"/>
  31 + <u-empty
  32 + v-if="notData"
  33 + mode="data"
  34 + text="暂无数据"
  35 + icon="/static/imagesV2/icon24.png"
  36 + >
  37 + </u-empty>
  38 +
29 </view> 39 </view>
30 </template> 40 </template>
31 41
32 <script> 42 <script>
  43 + import {
  44 + mapState
  45 + } from 'vuex'
33 export default { 46 export default {
34 data() { 47 data() {
35 return { 48 return {
36 - value: 10 49 + page: 1,
  50 + list: [],
  51 + // 加载前值为loadmore,加载中为loading,没有数据为nomore
  52 + status: 'loadmore'
  53 + };
  54 + },
  55 + computed: {
  56 + ...mapState(['userDatas']),
  57 + notData() {
  58 + return this.status === 'nomore' && !this.list.length
37 } 59 }
38 }, 60 },
  61 + onLoad() {
  62 + this.onRetry()
  63 + },
  64 + onReachBottom() {
  65 + that.getData()
  66 + },
39 methods: { 67 methods: {
  68 + onRetry(){
  69 + this.page=1
  70 + this.list = []
  71 + this.getData()
  72 + },
  73 + getData() {
  74 + if(this.status === 'loading') return;
  75 + this.status = 'loading';
  76 + uni.showLoading({
  77 + title: '加载中',
  78 + mask: true
  79 + })
  80 + this.$service.P_get('/lecturer/content', {
  81 + page: this.page
  82 + }).then(res => {
  83 + uni.hideLoading();
  84 + if (res.code == 1) {
  85 + this.page++;
  86 + this.list = [
  87 + ...this.list,
  88 + ...res.data.data
  89 + ];
  90 + this.status = res.data.data.length < res.data.per_page ? 'nomore' : 'loadmore'
  91 + }else {
  92 + this.status = 'loadmore';
  93 + if (res.msg) {
  94 + uni.showToast({
  95 + icon: 'none',
  96 + title: res.msg
  97 + })
  98 + } else {
  99 + uni.showToast({
  100 + icon: 'none',
  101 + title: '获取数据失败'
  102 + })
  103 + }
  104 + }
  105 +
  106 +
  107 + }).catch(e => {
  108 + this.status = 'loadmore';
  109 + uni.hideLoading()
  110 + uni.showToast({
  111 + icon: 'none',
  112 + title: '获取数据失败,请检查您的网络连接'
  113 + })
  114 + })
  115 + }
40 116
41 } 117 }
42 } 118 }
@@ -98,6 +174,7 @@ @@ -98,6 +174,7 @@
98 } 174 }
99 .rateMe-2-1-c{ 175 .rateMe-2-1-c{
100 margin: 0 40rpx; 176 margin: 0 40rpx;
  177 + pointer-events: none;
101 } 178 }
102 .rateMe-2-1-r{ 179 .rateMe-2-1-r{
103 font-size: 24rpx; 180 font-size: 24rpx;