一个番茄酱 2 years ago
parent
commit
0c23ec18f6

+ 5 - 0
education_uni/package-lock.json

@@ -8,6 +8,11 @@
       "version": "0.2.1",
       "resolved": "https://registry.npmmirror.com/@escook/request-miniprogram/-/request-miniprogram-0.2.1.tgz",
       "integrity": "sha512-ueWV5YsaEm/ycQZuEjMiA88GFMhfBQSjy9GrP9omy4xAQajkGTbYIlnhzsDfWzRPmRC1fKmAiKMrCVcgS+SHcQ=="
+    },
+    "base-64": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmmirror.com/base-64/-/base-64-1.0.0.tgz",
+      "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg=="
     }
   }
 }

+ 2 - 1
education_uni/package.json

@@ -10,7 +10,8 @@
 	"author": "",
 	"license": "ISC",
 	"dependencies": {
-		"@escook/request-miniprogram": "^0.2.1"
+		"@escook/request-miniprogram": "^0.2.1",
+		"base-64": "^1.0.0"
 	},
 	"devDependencies": {}
 }

+ 11 - 2
education_uni/pages.json

@@ -21,8 +21,8 @@
             "path" : "pages/teacher/teacher",
             "style" :                                                                                    
             {
-				// "navigationBarTitleText": "",
-                "enablePullDownRefresh": false,
+				"navigationBarTitleText": "找老师",
+                "enablePullDownRefresh": true,
 				"onReachBottomDistance": 150
             }
             
@@ -112,6 +112,15 @@
                     "enablePullDownRefresh": false
                 }
                 
+                }
+                ,{
+                    "path" : "my_invite/my_invite",
+                    "style" :                                                                                    
+                {
+                    "navigationBarTitleText": "我发出的邀请",
+                    "enablePullDownRefresh": false
+                }
+                
                 }
             ]
 		}

+ 32 - 6
education_uni/pages/teacher/teacher.vue

@@ -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())
 			}
 		}
 	}

BIN
education_uni/static/teacher.png


BIN
education_uni/static/zly.jpeg


+ 19 - 0
education_uni/subpkg/my_invite/my_invite.vue

@@ -0,0 +1,19 @@
+<template>
+	<view>
+		
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				
+			};
+		}
+	}
+</script>
+
+<style lang="scss">
+
+</style>

+ 16 - 6
education_uni/subpkg/teacher_detail/teacher_detail.vue

@@ -2,7 +2,7 @@
 	<view>
 		<view class="teachDeatil">
 		    <view class="head">
-		        <image class="teachImg" mode="widthFix" src="{{teachDetail[0].imgUrl || (teachDetail[3].sex == '男' ? '../../images/boy.png' : '../../images/girl.png')}}"></image>
+		        <image class="teachImg" mode="widthFix" :src="teacherCourse.imgUrl"></image>
 		        
 		        <view class="headDetail">
 		            <text class="teachName">{{teacherCourse.name}}老师</text>
@@ -41,10 +41,10 @@
 		<!-- 底部功能区 -->
 		<view class="bottomContainer">
 		    <view class="myCollect" bindtap="toStuCollectionTeach">我收藏的老师</view>
-		    <view class="collection" wx:if="{{!teachDetail[15].collection}}" bindtap="collectTeacher">
+		    <view class="collection" v-if="true" @click="collectTeacher">
 		        加入收藏
 		    </view>
-		    <view class="collection" wx:else>
+		    <view class="collection" v-else>
 		        已收藏
 		    </view>
 		    <view class="inviteTeach">预约老师</view>
@@ -56,14 +56,24 @@
 	export default {
 		data() {
 			return {
-				teacherCourse: ''
+				teacherCourse: {
+					education: '',
+					major: '',
+					nativePlace: '',
+					school: ''
+				}
 			};
 		},
 		onLoad(option) {
-			this.teacherCourse = JSON.parse(option.item)
+			let teacherDemo = decodeURIComponent(option.item)
+			this.teacherCourse = JSON.parse(teacherDemo)
+			for (let i = 0; i < this.teacherCourse.length; i++) {
+				let str = this.teacherCourse[i].profilePhoto
+				this.teacherCourse[i].imgUrl = 'data:image/png;base64,' + str
+			}
 			this.getCountAndLastTime()
 			this.getInfosByUid()
-			console.log(this.teacherCourse)
+			
 		},
 		methods:{
 			// 获取最近成交时间和成交次数