作者 mxd

教师端接口对接

... ... @@ -5,37 +5,44 @@
v-for="item in list"
:key="item.id"
>
<view class="answer-item2-star">
<u-rate :count="5" :readonly="true" :size="16" activeColor="#fc6402" v-model="item.score" readonly ></u-rate>
<view class="answer-item2-star-l">{{item.score}}</view>
</view>
<view class="myQuestion-2-i-1">
<view class="myQuestion-2-i-1-l">
<view class="myQuestion-2-i-1-l-i" >
<image
:src="item.img || '/static/images/tx.png'"
mode="widthFix">
</view>
</image>
</view>
</view>
<view class="myQuestion-2-i-1-r">
<view class="myQuestion-2-i-1-r-1">{{item.name}}</view>
<view class="myQuestion-2-i-1-r-1">
<view>
{{item.name}}
</view>
<view class="answer-item2-star">
<u-rate :count="5" :readonly="true" :size="16" activeColor="#fc6402" v-model="item.score" readonly ></u-rate>
<view class="answer-item2-star-l">{{item.score}}</view>
</view>
</view>
<view class="myQuestion-2-i-1-r-2">{{item.create_time}}发布</view>
</view>
</view>
<view class="myQuestion-2-i-2">
{{item.content}}
{{item.question}}
</view>
<!-- <view class="myQuestion-2-i-4">
<view class="myQuestion-2-i-4">
<u--image
v-for="(item, index) in []"
v-for="(child, childIndex) in item.imgs"
:key="index"
radius="15rpx"
height="145rpx"
width="145rpx"
@click.native="seeImg(index)"
:src="item"></u--image>
</view> -->
@click="previewImage(item.imgs,childIndex)"
:src="child">
</u--image>
</view>
</view>
<u-loadmore :status="status" v-if="!notData"/>
<u-empty
... ... @@ -63,13 +70,19 @@
return this.status === 'nomore' && !this.list.length
}
},
onShow() {
onLoad() {
this.onRetry()
},
onReachBottom() {
that.getData()
},
methods: {
previewImage(urls,current) {
uni.previewImage({
current,
urls
})
},
onRetry(){
this.page=1
this.list = []
... ... @@ -134,11 +147,9 @@
position: relative;
margin-bottom: 20rpx;
.answer-item2-star{
position: absolute;
top: 30rpx;
right: 30rpx;
display: flex;
align-items: center;
pointer-events: none;
.answer-item2-star-l{
font-size: 24rpx;
color: #323232;
... ... @@ -157,10 +168,14 @@
}
.myQuestion-2-i-1-r{
margin-left: 30rpx;
flex: 1;
.myQuestion-2-i-1-r-1{
font-size: 26rpx;
color: #323232;
font-weight: bold;
display: flex;
align-items: center;
justify-content: space-between;
}
.myQuestion-2-i-1-r-2{
font-size: 24rpx;
... ...
... ... @@ -103,6 +103,7 @@
uni.hideLoading()
if (res.code == 1) {
this.info = res.data;
this.$store.commit('setuser', res.data)
}else {
if (res.msg) {
uni.showToast({
... ...
... ... @@ -4,39 +4,115 @@
<image class="rateMe-1-bg" src="@/static/imagesV2/icon67.png" mode="widthFix"></image>
<view class="rateMe-1-c">
<view class="rateMe-1-c-i">
<view class="rateMe-1-c-i-1">6.6</view>
<view class="rateMe-1-c-i-1">{{userDatas.score || 0}}</view>
<view class="rateMe-1-c-i-2">总评分(分)</view>
</view>
<view class="rateMe-1-c-i">
<view class="rateMe-1-c-i-1">13</view>
<view class="rateMe-1-c-i-1">{{userDatas.content_num || 0}}</view>
<view class="rateMe-1-c-i-2">评价人数(人)</view>
</view>
</view>
</view>
<view class="rateMe-2">
<view class="rateMe-2" v-for="d in list" :key="d.id">
<view class="rateMe-2-1">
<view class="rateMe-2-1-l">评分</view>
<view class="rateMe-2-1-c">
<u-rate :count="10" v-model="value"></u-rate>
<u-rate :count="10" :value="d.star"></u-rate>
</view>
<view class="rateMe-2-1-r">一般</view>
<view class="rateMe-2-1-r">{{d.star>7?'优秀':d.star>5?'良好':'一般'}}</view>
</view>
<view class="rateMe-2-2">
<text style="color: #979797;">其它评价及建议:</text>
<text>张东老师教学水平高,桃李满天 下,学识渊博,深受学生敬仰。</text>
<text>{{d.content}}</text>
</view>
</view>
<u-loadmore :status="status" v-if="!notData"/>
<u-empty
v-if="notData"
mode="data"
text="暂无数据"
icon="/static/imagesV2/icon24.png"
>
</u-empty>
</view>
</template>
<script>
import {
mapState
} from 'vuex'
export default {
data() {
return {
value: 10
page: 1,
list: [],
// 加载前值为loadmore,加载中为loading,没有数据为nomore
status: 'loadmore'
};
},
computed: {
...mapState(['userDatas']),
notData() {
return this.status === 'nomore' && !this.list.length
}
},
onLoad() {
this.onRetry()
},
onReachBottom() {
that.getData()
},
methods: {
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/content', {
page: this.page
}).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: '获取数据失败,请检查您的网络连接'
})
})
}
}
}
... ... @@ -98,6 +174,7 @@
}
.rateMe-2-1-c{
margin: 0 40rpx;
pointer-events: none;
}
.rateMe-2-1-r{
font-size: 24rpx;
... ...