微信

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <div class="mainPage flex-v">
  3. <nav class="flex-h">
  4. <a class="flex-item" v-for="(item,index) in locations" :key="index" :class="{'active':index==active.index}" @click="changeLocation(item,index)">{{item.LocationName}}</a>
  5. </nav>
  6. <div class="flex-item">
  7. <div>
  8. <div v-for="(item,index) in locations" :key="index" :hidden="index!==active.index">
  9. <div class="banner flex-h">
  10. <div class="flex-item">
  11. <swiper :options="swiperOption" ref="mySwiper">
  12. <swiper-slide class="swiper-slide" v-for="(banner,bindex) in item.Banners" :key="bindex">
  13. <img :src='banner.ImageUrl' class="cover" style="border-radius: .12rem;" alt="" @click="jump(banner)">
  14. </swiper-slide>
  15. </swiper>
  16. </div>
  17. </div>
  18. <h5>{{item.Title}}</h5>
  19. <div class="courseList flex-h">
  20. <ul class="flex-item" v-if="!fiveANoData">
  21. <router-link tag="li" v-for="(course,cindex) in item.Courses" :key="cindex" :to="{name:'majorProjectsDetail',query:{id: course.CourseId}}">
  22. <courseItem :data="courseInfo(course)"></courseItem>
  23. </router-link>
  24. </ul>
  25. <!-- <span v-if="fiveANoData" style="width:100%;line-height:.3rem;display:block;text-align:center;color:#ccc;margin-bottom:.1rem;">暂无数据</span> -->
  26. </div>
  27. <div style="width:100%;height:.1rem;background:#f8f8f8;margin:0 auto;"></div>
  28. <h5>{{item.Consult}}</h5>
  29. <div class="newsList flex-h">
  30. <ul class="flex-item">
  31. <router-link tag="li" :to="{name:'',query:{}}" v-for="(newinfo,nindex) in item.News" :key="nindex">
  32. <newsItem :data="newinfo" @jump='jump'></newsItem>
  33. </router-link>
  34. </ul>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import courseItem from '../../../components/courseItem/index'
  43. import newsItem from '../../../components/newsItem/index'
  44. import { swiper, swiperSlide } from 'vue-awesome-swiper'
  45. import 'swiper/dist/css/swiper.css'
  46. import { mapState, createNamespacedHelpers } from 'vuex'
  47. const { mapActions: mapFiveAActions } = createNamespacedHelpers('fiveA')
  48. export default {
  49. name: '',
  50. data () {
  51. return {
  52. fiveANoData: false,
  53. active: {
  54. index: 0,
  55. locationid: ''
  56. },
  57. swiperOption: {
  58. observer: true,
  59. loop: true,
  60. autoplay: {
  61. disableOnInteraction: false,
  62. }
  63. },
  64. locations: [],
  65. }
  66. },
  67. computed: {
  68. MySwiper () {
  69. return this.$refs.mySwiper.swiper
  70. },
  71. MySwiperMsg () {
  72. return this.$refs.MySwiperMsg.swiper
  73. },
  74. },
  75. components: {
  76. newsItem,
  77. swiper,
  78. swiperSlide,
  79. courseItem,
  80. },
  81. created () {
  82. const _that = this
  83. this.getLocationDetails().then(res => {
  84. _that.locations = res
  85. })
  86. },
  87. methods: {
  88. ...mapFiveAActions([
  89. 'getLocationDetails',
  90. ]),
  91. changeLocation (item, index) {
  92. this.active.index = index
  93. },
  94. courseInfo (course) {
  95. return {
  96. id: course.CourseId,
  97. title: course.CourseName,
  98. img: course.CourseImg,
  99. remark: course.Remark,
  100. address: course.CaseAddress,
  101. tag: course.CourseTags || [],
  102. courseType: '',
  103. defaultPrice: course.Price + '/节',
  104. getWay: 'ticket'
  105. }
  106. },
  107. // returnCourseList (arr) { // 转换课程列表格式
  108. // for (var n = 0; n < arr.length; n++) {
  109. // this.courseList.push()
  110. // }
  111. // },
  112. jump (item) {
  113. // console.log(item)
  114. item.ForwardType = item.ForwardType || ''
  115. if (item.ForwardType === 'url') {
  116. window.location.href = item.ForwardUrl
  117. } else if (item.ForwardType === 'course') {
  118. this.$router.push({ name: '', query: { id: item.ForwardResourceId } }) // 此处去课程详情
  119. } else {
  120. window.location.href = item.InfoUrl
  121. }
  122. }
  123. }
  124. }
  125. </script>
  126. <!-- Add "scoped" attribute to limit CSS to this component only -->
  127. <style lang="scss" scoped>
  128. @import 'page.scss';
  129. </style>