course_detail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view>
  3. <my-coursedetail :item="course" :location="location" :marker="marker" :timeAM="timeAM" :timePM="timePM" :timeEvening="timeEvening" buttonMessage="以此为模板新发布" :isShowCollect="false" :isShowPrivate="true"></my-coursedetail>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. course: {},
  11. teacherInfo: {},
  12. courseWeekday: [],
  13. location: [],
  14. marker: [{
  15. id: 1,
  16. joinCluster:true,
  17. latitude: 0,
  18. longitude: 0,
  19. width: 40,
  20. height: 40,
  21. iconPath: '/static/location.png',
  22. }],
  23. // 上课时间
  24. // 上午
  25. timeAM: [{
  26. value: 'A1',
  27. name: '1',
  28. checked: false
  29. },
  30. {
  31. name: '2',
  32. value: 'A2',
  33. checked: false
  34. },
  35. {
  36. name: '3',
  37. value: 'A3',
  38. checked: false
  39. },
  40. {
  41. name: '4',
  42. value: 'A4',
  43. checked: false
  44. },
  45. {
  46. name: '5',
  47. value: 'A5',
  48. checked: false
  49. },
  50. {
  51. name: '6',
  52. value: 'A6',
  53. checked: false
  54. },
  55. {
  56. name: '7',
  57. value: 'A7',
  58. checked: false
  59. }
  60. ],
  61. // 下午
  62. timePM: [{
  63. value: 'P1',
  64. name: '1',
  65. checked: false
  66. },
  67. {
  68. name: '2',
  69. value: 'P2',
  70. checked: false
  71. },
  72. {
  73. name: '3',
  74. value: 'P3',
  75. checked: false
  76. },
  77. {
  78. name: '4',
  79. value: 'P4',
  80. checked: false
  81. },
  82. {
  83. name: '5',
  84. value: 'P5',
  85. checked: false
  86. },
  87. {
  88. name: '6',
  89. value: 'P6',
  90. checked: false
  91. },
  92. {
  93. name: '7',
  94. value: 'P7',
  95. checked: false
  96. }
  97. ],
  98. // 晚上
  99. timeEvening: [{
  100. name: '1',
  101. value: 'E1',
  102. checked: false
  103. },
  104. {
  105. name: '2',
  106. value: 'E2',
  107. checked: false
  108. },
  109. {
  110. name: '3',
  111. value: 'E3',
  112. checked: false
  113. },
  114. {
  115. name: '4',
  116. value: 'E4',
  117. checked: false
  118. },
  119. {
  120. name: '5',
  121. value: 'E5',
  122. checked: false
  123. },
  124. {
  125. name: '6',
  126. value: 'E6',
  127. checked: false
  128. },
  129. {
  130. name: '7',
  131. value: 'E7',
  132. checked: false
  133. }
  134. ],
  135. };
  136. },
  137. created() {
  138. this.getTeachInfo()
  139. },
  140. onLoad(option) {
  141. this.course = JSON.parse(decodeURIComponent(option.item))
  142. this.location = this.course.locationAl.split(",")
  143. this.marker[0].latitude = Number(this.location[0])
  144. this.marker[0].longitude = Number(this.location[1])
  145. this.courseWeekday = this.course.teachTime.split(",")
  146. // console.log("选中的日期:" + this.courseWeekday)
  147. for (let i = 0; i < this.courseWeekday.length; i++) {
  148. for (let x = 0; x < this.timeAM.length; x++) {
  149. if (this.courseWeekday[i] == this.timeAM[x].value) {
  150. this.timeAM[x].checked = true
  151. }
  152. }
  153. for (let y = 0; y < this.timePM.length; y++) {
  154. if (this.courseWeekday[i] == this.timePM[y].value) {
  155. // console.log(this.timePM[y].value)
  156. this.timePM[y].checked = true
  157. }
  158. }
  159. for (let z = 0; z < this.timeEvening.length; z++) {
  160. if (this.courseWeekday[i] == this.timeEvening[z].value) {
  161. this.timeEvening[z].checked = true
  162. }
  163. }
  164. }
  165. },
  166. methods:{
  167. // 获取最近成交时间和成交次数
  168. async getCountAndLastTime() {
  169. const query = {
  170. uid: this.teacherCourse.uid
  171. }
  172. const { data: result } = await uni.$http.get('/education/teacher-courses/queryCountAndLastTime', query)
  173. this.teacherCourse.count = result.data.count
  174. this.teacherCourse.latest = result.data.time
  175. },
  176. // 根据uid获取该老师学校学历等
  177. async getInfosByUid() {
  178. const { data: result } = await uni.$http.get('/education/teacher-certifications/findInfosByUid', { uid: this.teacherCourse.uid })
  179. this.teacherCourse.education = result.data.one.education
  180. this.teacherCourse.major = result.data.one.major
  181. this.teacherCourse.nativePlace = result.data.one.nativePlace
  182. this.teacherCourse.school = result.data.one.school
  183. },
  184. // 获取老师认证信息
  185. async getTeachInfo() {
  186. const { data: result } = await uni.$http.get('/education/teacher-certifications/getInfos')
  187. // console.log("hh", result)
  188. this.teacherInfo = result.data
  189. this.teacherInfo.imgUrl = 'data:image/png;base64,' + this.teacherInfo.imgUrl
  190. this.course.name = this.teacherInfo.name
  191. this.course.education = this.teacherInfo.education
  192. this.course.profilePhoto = this.teacherInfo.imgUrl
  193. this.course.sex = this.teacherInfo.sex
  194. console.log(this.course)
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. </style>