teacher_course_my_collect.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view>
  3. <view v-for="(item, index) in teacherList" :key="index">
  4. <view class="publicItem" @click="toTeachDetail(item)">
  5. <view class="itemFather">
  6. <image class="teachImg" :src="item.profilePhoto"></image>
  7. <view class="teachTitle">{{item.name}}教员</view>
  8. <view class="publicSex">{{item.sex}}</view>
  9. <view class="teachCollege">{{item.school}}</view>
  10. <view class="teachEdu">{{item.education}}</view>
  11. <view class="teachDistance">
  12. <uni-icons type="location" color="#3ed598" ></uni-icons>
  13. <text>{{item.kil}}</text>km</view>
  14. <view class="teachSubject">{{item.subject}}</view>
  15. <view class="teachYears">教龄 {{item.teachAge}}</view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import { mapState } from 'vuex'
  23. import computeDistance from '@/mixins/compute-distance.js'
  24. export default {
  25. mixins: [computeDistance],
  26. computed: {
  27. ...mapState('m_user', ['location'])
  28. },
  29. data() {
  30. return {
  31. // 老师列表
  32. teacherList: []
  33. }
  34. },
  35. onShow() {
  36. this.getTeacherList()
  37. },
  38. methods: {
  39. // 老师细节
  40. toTeachDetail(item) {
  41. uni.navigateTo({
  42. url: '/subpkg/teacher/course/teacher_course_all_detail?item=' + encodeURIComponent(JSON.stringify(item))
  43. })
  44. },
  45. // 获取老师列表
  46. async getTeacherList() {
  47. const { data: result } = await uni.$http.get('/education/my-favorite-courses/findPersonCollection')
  48. for (let i = 0; i < result.data.course.length; i++) {
  49. let arr = result.data.course[i].locationAl.split(",")
  50. let kil = this.space(arr[0], arr[1], this.location.latitude, this.location.longitude)
  51. result.data.course[i].kil = kil
  52. result.data.course[i].name = result.data.course[i].name.slice(0,1)
  53. }
  54. this.teacherList = result.data.course
  55. }
  56. }
  57. }
  58. </script>
  59. <!-- 设置页面背景 -->
  60. <style lang="scss">
  61. page{
  62. height: 100%;
  63. // background-color: #D4F5E9;
  64. }
  65. </style>
  66. <style scoped lang="scss">
  67. .itemFather{
  68. position: relative;
  69. display: flex;
  70. padding: 10rpx;
  71. height: 170rpx;
  72. align-items: center;
  73. }
  74. /* 设置单个教员背景 */
  75. .publicItem{
  76. margin-left: 20rpx;
  77. margin-right: 20rpx;
  78. margin-top: 10rpx ;
  79. margin-bottom: 10rpx ;
  80. // border: 0rpx solid gray;
  81. padding: 10rpx 20rpx;
  82. border-radius: 30rpx;
  83. background-color: #ffffff;
  84. }
  85. .teachTitle{
  86. font-size: 14px;
  87. position: absolute;
  88. left: 200rpx;
  89. top: 10rpx;
  90. font-weight: bold;
  91. color: #6d6d6d;
  92. }
  93. /* 教员头像 */
  94. .teachImg{
  95. width: 25%;
  96. height: 95%;
  97. border-radius: 20%;
  98. }
  99. /* 距离 */
  100. .teachDistance{
  101. position: absolute;
  102. left: 330rpx;
  103. top: 10rpx;
  104. font-weight: bold;
  105. color: #3ed598;
  106. font-size: 12px;
  107. }
  108. /* teachsex */
  109. .publicSex{
  110. position: absolute;
  111. right: 10rpx;
  112. top: 5rpx;
  113. // border: 0rpx solid gray;
  114. padding: 5rpx 10rpx;
  115. border-radius: 50%;
  116. background-color: #3ed598;
  117. color: #ffffff;
  118. font-size: 12px;
  119. }
  120. /* teachEdu */
  121. .teachEdu{
  122. position: absolute;
  123. right: 10rpx;
  124. top: 60rpx;
  125. // border: 0rpx solid gray;
  126. padding: 5rpx 10rpx;
  127. border-radius: 30rpx;
  128. background-color: #3ed598;
  129. color: #ffffff;
  130. font-size: 12px;
  131. }
  132. /* teach课程 */
  133. .teachSubject{
  134. position: absolute;
  135. left: 200rpx;
  136. top: 115rpx;
  137. // border: 0rpx solid gray;
  138. padding: 5rpx 12rpx;
  139. border-radius: 30rpx;
  140. background-color: #3ed598;
  141. color: #ffffff;
  142. font-size: 12px;
  143. }
  144. /* teach课程 */
  145. .teachYears{
  146. position: absolute;
  147. right: 10rpx;
  148. top: 115rpx;
  149. border: 2px solid #3ed598;
  150. padding: 5rpx 20rpx;
  151. border-radius: 30rpx;
  152. color: #3ed598;
  153. font-size: 12px;
  154. font-weight: bold;
  155. }
  156. .teachCollege{
  157. border: 2px solid #3ed598;
  158. border-radius: 30rpx;
  159. padding: 0rpx 10rpx;
  160. font-size: 12px;
  161. position: absolute;
  162. left: 200rpx;
  163. top: 60rpx;
  164. color: #3ed598;
  165. }
  166. </style>