|
@@ -35,7 +35,7 @@
|
|
|
<view v-if="!isSearch">没有找到符合条件的信息</view>
|
|
|
<view v-if="isSearch">
|
|
|
<view class="teachInfo" @click="toTeachDetail(item)" v-for="(item, index) in teacherList" :key="index" >
|
|
|
- <image class="teachImg" mode="widthFix" src="../../static/zly.jpeg"></image>
|
|
|
+ <image class="teachImg" mode="widthFix" :src="item.imgUrl"></image>
|
|
|
<view class="introduce">
|
|
|
<text class="teachName">{{item.name}}老师</text>
|
|
|
<text class="attribute">{{item.teacherType}}</text>
|
|
@@ -60,10 +60,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- isLoading: false,
|
|
|
+ isLoading: false, // 请求阀
|
|
|
iconType: 'bottom',
|
|
|
content: false,
|
|
|
isSearch: true,
|
|
@@ -80,7 +81,8 @@
|
|
|
education: '',
|
|
|
sex: '',
|
|
|
school: '',
|
|
|
- mode: ''
|
|
|
+ mode: '',
|
|
|
+ imgUrl: '/static/teacher.png'
|
|
|
},
|
|
|
educations: [{
|
|
|
value: '专科在读',
|
|
@@ -159,7 +161,7 @@
|
|
|
toTeachDetail(item) {
|
|
|
let teacher = JSON.stringify(item)
|
|
|
uni.navigateTo({
|
|
|
- url: '/subpkg/teacher_detail/teacher_detail?item='+teacher
|
|
|
+ url: '/subpkg/teacher_detail/teacher_detail?item=' + encodeURIComponent(teacher)
|
|
|
})
|
|
|
},
|
|
|
// 展开搜索栏
|
|
@@ -180,8 +182,22 @@
|
|
|
const { data: result } = await uni.$http.post('/education/teacher-courses/showCourse', this.queryObject)
|
|
|
|
|
|
this.isLoading = false
|
|
|
- console.log(result)
|
|
|
+
|
|
|
+ // 加载完数据执行
|
|
|
+ cb && cb()
|
|
|
+ if (result.code !== 20000) return uni.$showMsg('获取数据失败')
|
|
|
+
|
|
|
this.teacherList = [...this.teacherList, ...result.data.course]
|
|
|
+
|
|
|
+ for (let i = 0; i < this.teacherList.length; i++) {
|
|
|
+
|
|
|
+ // let str = Base64.encode(this.teacherList[i].imgUrl)
|
|
|
+ let str = this.teacherList[i].profilePhoto
|
|
|
+ // console.log(str)
|
|
|
+ this.teacherList[i].imgUrl = 'data:image/png;base64,' + str
|
|
|
+ }
|
|
|
+ // console.log(this.teacherList)
|
|
|
+ this.total = result.data.count
|
|
|
},
|
|
|
// 触底事件
|
|
|
onReachBottom() {
|
|
@@ -193,7 +209,17 @@
|
|
|
|
|
|
this.queryObject.pageNum += 1
|
|
|
// 重新获取数据
|
|
|
-
|
|
|
+ this.getTeacherList()
|
|
|
+ },
|
|
|
+ // 下拉刷新事件
|
|
|
+ onPullDownRefresh() {
|
|
|
+ // 1. 重置关键数据
|
|
|
+ this.queryObject.pageNum = 1
|
|
|
+ this.total = 0
|
|
|
+ this.isLoading = false
|
|
|
+ this.teacherList = []
|
|
|
+ // 2.重新发起请求
|
|
|
+ this.getTeacherList(() => uni.stopPullDownRefresh())
|
|
|
}
|
|
|
}
|
|
|
}
|