teacher_course_my_collect.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view>
  3. <view class="itemWrapper" 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. .itemWrapper{
  68. height: 220rpx;
  69. }
  70. .itemFather{
  71. position: relative;
  72. display: flex;
  73. padding: 10rpx;
  74. height: 170rpx;
  75. align-items: center;
  76. }
  77. /* 设置单个教员背景 */
  78. .publicItem{
  79. margin-left: 20rpx;
  80. margin-right: 20rpx;
  81. margin-top: 10rpx ;
  82. margin-bottom: 10rpx ;
  83. // border: 0rpx solid gray;
  84. padding: 10rpx 20rpx;
  85. border-radius: 30rpx;
  86. background-color: #ffffff;
  87. }
  88. .teachTitle{
  89. font-size: 14px;
  90. position: absolute;
  91. left: 200rpx;
  92. top: 10rpx;
  93. font-weight: bold;
  94. color: #6d6d6d;
  95. }
  96. /* 教员头像 */
  97. .teachImg{
  98. width: 25%;
  99. height: 95%;
  100. border-radius: 20%;
  101. }
  102. /* 距离 */
  103. .teachDistance{
  104. position: absolute;
  105. left: 330rpx;
  106. top: 10rpx;
  107. font-weight: bold;
  108. color: #3ed598;
  109. font-size: 12px;
  110. }
  111. /* teachsex */
  112. .publicSex{
  113. position: absolute;
  114. right: 10rpx;
  115. top: 5rpx;
  116. // border: 0rpx solid gray;
  117. padding: 5rpx 10rpx;
  118. border-radius: 50%;
  119. background-color: #3ed598;
  120. color: #ffffff;
  121. font-size: 12px;
  122. }
  123. /* teachEdu */
  124. .teachEdu{
  125. position: absolute;
  126. right: 10rpx;
  127. top: 60rpx;
  128. // border: 0rpx solid gray;
  129. padding: 5rpx 10rpx;
  130. border-radius: 30rpx;
  131. background-color: #3ed598;
  132. color: #ffffff;
  133. font-size: 12px;
  134. }
  135. /* teach课程 */
  136. .teachSubject{
  137. position: absolute;
  138. left: 200rpx;
  139. top: 115rpx;
  140. // border: 0rpx solid gray;
  141. padding: 5rpx 12rpx;
  142. border-radius: 30rpx;
  143. background-color: #3ed598;
  144. color: #ffffff;
  145. font-size: 12px;
  146. }
  147. /* teach课程 */
  148. .teachYears{
  149. position: absolute;
  150. right: 10rpx;
  151. top: 115rpx;
  152. border: 2px solid #3ed598;
  153. padding: 5rpx 20rpx;
  154. border-radius: 30rpx;
  155. color: #3ed598;
  156. font-size: 12px;
  157. font-weight: bold;
  158. }
  159. .teachCollege{
  160. border: 2px solid #3ed598;
  161. border-radius: 30rpx;
  162. padding: 0rpx 10rpx;
  163. font-size: 12px;
  164. position: absolute;
  165. left: 200rpx;
  166. top: 60rpx;
  167. color: #3ed598;
  168. }
  169. </style>