teacher_detail.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <view>
  3. <view class="teachDeatil">
  4. <view class="head">
  5. <image class="teachImg" mode="widthFix" :src="teacherCourse.imgUrl"></image>
  6. <view class="headDetail">
  7. <text class="teachName">{{teacherCourse.name}}老师</text>
  8. <text class="attribute">身份:{{teacherCourse.teacherType}}</text>
  9. <view class="transactionContainer">
  10. <text class="transaction">成</text>
  11. <text class="transactionTotal">{{teacherCourse.count}}条家教记录</text>
  12. </view>
  13. <view class="transactionList">
  14. <text>最新接单:</text>
  15. <text>{{teacherCourse.latest}}</text>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="midArea">
  20. <text>高校:{{teacherCourse.school}}</text>
  21. <text>专业:{{teacherCourse.major}}</text>
  22. <text>学历:{{teacherCourse.education}}</text>
  23. <text>籍贯:{{teacherCourse.nativePlace}}</text>
  24. </view>
  25. <view class="course">
  26. <text>可授科目:</text>
  27. <view class="courseList">{{teacherCourse.subject}}</view>
  28. </view>
  29. <view class="introduceDetail">
  30. <text class="introduce-title">自我介绍</text>
  31. <text class="introduce-body">{{teacherCourse.introduce}}</text>
  32. </view>
  33. <view class="introduceDetail">
  34. <text class="introduce-title">成功经验</text>
  35. <text class="introduce-body">{{teacherCourse.experience}}</text>
  36. </view>
  37. </view>
  38. <!-- 底部功能区 -->
  39. <view class="bottomContainer">
  40. <view class="myCollect" bindtap="toStuCollectionTeach">我收藏的老师</view>
  41. <view class="collection" v-if="true" @click="collectTeacher">
  42. 加入收藏
  43. </view>
  44. <view class="collection" v-else>
  45. 已收藏
  46. </view>
  47. <view class="inviteTeach">预约老师</view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. export default {
  53. data() {
  54. return {
  55. teacherCourse: {
  56. education: '',
  57. major: '',
  58. nativePlace: '',
  59. school: ''
  60. }
  61. };
  62. },
  63. onLoad(option) {
  64. let teacherDemo = decodeURIComponent(option.item)
  65. this.teacherCourse = JSON.parse(teacherDemo)
  66. for (let i = 0; i < this.teacherCourse.length; i++) {
  67. let str = this.teacherCourse[i].profilePhoto
  68. this.teacherCourse[i].imgUrl = 'data:image/png;base64,' + str
  69. }
  70. this.getCountAndLastTime()
  71. this.getInfosByUid()
  72. },
  73. methods:{
  74. // 获取最近成交时间和成交次数
  75. async getCountAndLastTime() {
  76. const query = {
  77. uid: this.teacherCourse.uid
  78. }
  79. const { data: result } = await uni.$http.get('/education/teacher-courses/queryCountAndLastTime', query)
  80. this.teacherCourse.count = result.data.count
  81. this.teacherCourse.latest = result.data.time
  82. },
  83. // 根据uid获取该老师学校学历等
  84. async getInfosByUid() {
  85. const { data: result } = await uni.$http.get('/education/teacher-certifications/findInfosByUid', { uid: this.teacherCourse.uid })
  86. this.teacherCourse.education = result.data.one.education
  87. this.teacherCourse.major = result.data.one.major
  88. this.teacherCourse.nativePlace = result.data.one.nativePlace
  89. this.teacherCourse.school = result.data.one.school
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. /* 整个页面样式 */
  96. .teachDeatil{
  97. display: flex;
  98. position: relative;
  99. flex-direction: column;
  100. margin-left: 20rpx;
  101. }
  102. .head{
  103. display: flex;
  104. }
  105. .headDetail{
  106. margin-left: 20rpx;
  107. display: flex;
  108. flex-direction: column;
  109. font-size: 28rpx;
  110. }
  111. .teachName{
  112. font-weight: bold;
  113. }
  114. .headDetail text{
  115. padding-bottom: 10rpx;
  116. }
  117. /* 头像设置 */
  118. .teachImg{
  119. width: 200rpx;
  120. }
  121. .settledDay{
  122. display: block;
  123. float: right;
  124. }
  125. /* 中部区域 */
  126. .midArea{
  127. display: flex;
  128. /* border: 1rpx solid red; */
  129. width: 96%;
  130. margin-top: 10rpx;
  131. justify-content: space-between;
  132. flex-wrap: wrap;
  133. }
  134. .midArea text{
  135. /* display: block; */
  136. width: 48%;
  137. height: 60rpx;
  138. line-height: 60rpx;
  139. font-size: 28rpx;
  140. }
  141. /* 可授课程 */
  142. .course{
  143. margin-top: 40rpx;
  144. }
  145. .courseList{
  146. margin-top: 10rpx;
  147. }
  148. /* 可授课区域 */
  149. .teachAera{
  150. margin-top: 40rpx;
  151. }
  152. .teachAreaDetail{
  153. margin-top: 10rpx;
  154. }
  155. /* 自我介绍及案例 */
  156. .introduceDetail{
  157. display: flex;
  158. flex-direction: column;
  159. margin-top: 40rpx;
  160. }
  161. .introduce-title{
  162. margin-bottom: 20rpx;
  163. color: yellowgreen;
  164. font-weight: bold;
  165. }
  166. .introduce-body{
  167. line-height: 50rpx;
  168. font-size: 28rpx;
  169. }
  170. /* 底部区域 */
  171. .bottomContainer{
  172. width: 99%;
  173. display: flex;
  174. position: absolute;
  175. bottom: 50rpx;
  176. /* background-color: #bfa; */
  177. /* border: 1rpx solid red; */
  178. justify-content: space-around;
  179. }
  180. .myCollect,
  181. .collection,
  182. .inviteTeach{
  183. width: 30%;
  184. height: 60rpx;
  185. line-height: 60rpx;
  186. font-weight: bold;
  187. border: 1rpx solid red;
  188. border-radius: 30rpx;
  189. text-align: center;
  190. }
  191. /* 我收藏的老师 */
  192. .myCollect{
  193. color: red;
  194. /* background-color: blue; */
  195. }
  196. /* 收藏老师 */
  197. .collection{
  198. color: yellowgreen;
  199. }
  200. /* 邀请老师 */
  201. .inviteTeach{
  202. color: pink;
  203. }
  204. /* 成交记录 */
  205. .transactionContainer {
  206. margin-top: 10rpx;
  207. display: flex;
  208. }
  209. /* 成交记录标签的背景色 */
  210. .transaction {
  211. background-color: rgba(0, 128, 0, .6);
  212. }
  213. /* 教龄和成交记录标签后的文字 */
  214. .teachYears,
  215. .transactionTotal {
  216. font-size: 24rpx;
  217. margin-left: 10rpx;
  218. }
  219. /* 最新接单 */
  220. .transactionList {
  221. margin-top: 10rpx;
  222. color: green;
  223. font-size: 24rpx;
  224. }
  225. </style>