teacher_course_my_detail.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <view>
  3. <my-coursedetail v-if="showDetail" :item="course" :location="location" :marker="marker" :timeAM="timeAM" :timePM="timePM" :timeEvening="timeEvening" buttonMessage="新发布" :isShowCollect="false" :isShowPrivate="true" @publishButton="publishButton"></my-coursedetail>
  4. </view>
  5. </template>
  6. <script>
  7. import formTime from '@/mixins/form-time.js'
  8. export default {
  9. mixins: [formTime],
  10. data() {
  11. return {
  12. showDetail: false,
  13. course: {},
  14. location: [],
  15. marker: [{
  16. id: 1,
  17. joinCluster:true,
  18. latitude: 0,
  19. longitude: 0,
  20. width: 40,
  21. height: 40,
  22. iconPath: '/static/location.png',
  23. }],
  24. };
  25. },
  26. onLoad(option) {
  27. if (option.courseId !== undefined) {
  28. const courseId = decodeURIComponent(option.courseId)
  29. this.getCourseDetailById(courseId)
  30. }
  31. },
  32. methods:{
  33. // 获取课程详情
  34. async getCourseDetailById(id) {
  35. const {data: result} = await uni.$http.get('/education/teacher-courses/getPersonCourseDetailById', {courseId: id})
  36. this.course = result.data.one
  37. this.formatForm()
  38. },
  39. // 上课表格格式化
  40. formatForm() {
  41. this.location = this.course.locationAl.split(",")
  42. this.marker[0].latitude = Number(this.location[0])
  43. this.marker[0].longitude = Number(this.location[1])
  44. this.courseWeekday = this.course.teachTime.split(",")
  45. this.parseCourseWeekday()
  46. this.showDetail = true
  47. },
  48. publishButton() {
  49. uni.navigateTo({
  50. url:'/subpkg/teacher/course/teacher_course_add?item=' + encodeURIComponent(JSON.stringify(this.course))
  51. })
  52. }
  53. }
  54. }
  55. </script>
  56. <!-- 设置页面背景 -->
  57. <style lang="scss">
  58. page{
  59. height: 100%;
  60. // background-color: #FFF;
  61. }
  62. </style>
  63. <style lang="scss" scoped>
  64. </style>