app-index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <view class="app-index">
  3. <view class="custom-header-container">
  4. <view class="header-bg" :style="{height:headerBgHeight}">
  5. <image src="../../../static/image/course/bg.png"/>
  6. </view>
  7. <view class="custom-header-status-bar" :style="{height:getStausBarHeight}"></view>
  8. <view class="custom-header-top-container">
  9. <view class="custom-header-title">课程报名</view>
  10. </view>
  11. </view>
  12. <!-- #ifdef MP-WEIXIN -->
  13. <template v-if="mall.setting.is_official_account == 1">
  14. <official-account></official-account>
  15. </template>
  16. <!-- #endif -->
  17. <view class="page-width">
  18. <app-quick-navigation></app-quick-navigation>
  19. </view>
  20. <block v-for="(item, index) in newPage" :key="index">
  21. <template v-if="item.key === 'search'">
  22. <view class="page-width">
  23. <app-search-for></app-search-for>
  24. </view>
  25. </template>
  26. <template v-else-if="item.key === 'banner'">
  27. <view v-if="item.banners.length > 0" class="banner">
  28. <app-swiper
  29. imageKey="pic_url"
  30. :swiperHeight=300
  31. :swiperList="item.banners"
  32. ></app-swiper>
  33. </view>
  34. </template>
  35. <template v-else-if="item.key === 'cat'">
  36. <view class="cat mt-20">
  37. <app-index-cat
  38. :cat-pic-url="item.cat_pic_url"
  39. :name="item.name"
  40. :list-style="item.list_style"
  41. :list="item.goods"
  42. :cat-id="item.relation_id"
  43. ></app-index-cat>
  44. </view>
  45. </template>
  46. <template v-else-if="item.key === 'home_nav'">
  47. <view>
  48. <app-navigation-icon
  49. :navs="item.home_navs"
  50. :columns="Number(item.row_num)"
  51. :rows="-1"
  52. ></app-navigation-icon>
  53. </view>
  54. </template>
  55. <template v-else-if="item.key === 'notice'">
  56. <view>
  57. <app-announcement
  58. :name="item.notice_name"
  59. :content="item.notice_content"
  60. :icon="item.notice_url"
  61. :background="item.notice_bg_color"
  62. :text-color="item.notice_text_color"
  63. ></app-announcement>
  64. </view>
  65. </template>
  66. <template v-else-if="item.key === 'video'">
  67. <view class="mt-20">
  68. <app-video :pic-url="item.video_pic_url"
  69. :url="item.video_url"
  70. ></app-video>
  71. </view>
  72. </template>
  73. <template v-else-if="item.key === 'topic'">
  74. <view class="mt-20">
  75. <app-topic :topic_list="item.topics"
  76. :count="Number(item.topic_num)"
  77. :icon="item.label_url"
  78. :logo_2="item.topic_url_2"
  79. :logo_1="item.topic_url"
  80. ></app-topic>
  81. </view>
  82. </template>
  83. <template v-else-if="item.key === 'coupon'">
  84. <view class="mt-20">
  85. <app-exclusive-coupon :coupon_list="item.coupons"
  86. :receive-bg="item.coupon_url"
  87. :unclaimed-bg="item.coupon_not_url"
  88. :index="index"
  89. @click="changeCoupon"
  90. ></app-exclusive-coupon>
  91. </view>
  92. </template>
  93. <template v-else-if="item.key === 'block'">
  94. <view>
  95. <app-image-ad :image-style="item.block.status" :list="item.block.value"></app-image-ad>
  96. </view>
  97. </template>
  98. <template v-else-if="item.key === 'miaosha'">
  99. <view class="miaosha mt-20">
  100. <app-index-miaosha :page-hide="pageHide" :value="item.miaosha"></app-index-miaosha>
  101. </view>
  102. </template>
  103. <template v-else-if="item.key === 'fxhb'">
  104. <view>
  105. <app-popup-ad :opened="true" :is_storage="is_storage" :list="item.fxhb"></app-popup-ad>
  106. </view>
  107. </template>
  108. <template v-else-if="item.key === 'pintuan'">
  109. <view class="pintuan mt-20">
  110. <app-index-pintuan :value="item.pintuan"></app-index-pintuan>
  111. </view>
  112. </template>
  113. <template v-else-if="item.key === 'booking'">
  114. <view class="booking mt-20">
  115. <app-index-booking :value="item.booking"></app-index-booking>
  116. </view>
  117. </template>
  118. <template v-else-if="item.key === 'mch'">
  119. <view class="mch mt-20">
  120. <app-good-shop-recommendation :list="item.mch"></app-good-shop-recommendation>
  121. </view>
  122. </template>
  123. <template v-else-if="item.key === 'advance'">
  124. <view class="advance mt-20">
  125. <app-index-advance :value="item.advance.data.list"></app-index-advance>
  126. </view>
  127. </template>
  128. <template v-else-if="item.key === 'pick'">
  129. <view class="advance mt-20">
  130. <app-index-pick :value="item.pick.list" :activity="item.pick.activity"></app-index-pick>
  131. </view>
  132. </template>
  133. </block>
  134. </view>
  135. </template>
  136. <script>
  137. import { mapState } from 'vuex';
  138. import appSearchFor from '../../page-component/app-search-for/app-search-for.vue';
  139. import appSwiper from '../../page-component/app-swiper/swiper.vue';
  140. import appNavigationIcon from '../../page-component/app-navigation-icon/app-navigation-icon.vue';
  141. import appAnnouncement from '../../page-component/app-announcement/app-announcement.vue';
  142. import appVideo from '../../page-component/app-video/app-video.vue';
  143. import appTopic from '../../page-component/app-special-topic/app-special-topic-normal.vue';
  144. import appExclusiveCoupon from '../../page-component/app-exclusive-coupon/app-exclusive-coupon.vue';
  145. import appImageAd from '../../page-component/app-image-ad/app-image-ad.vue';
  146. import appReservation from '../../page-component/app-reservation/app-reservation.vue';
  147. import appJumpButton from "../../basic-component/app-jump-button/app-jump-button.vue";
  148. import appGoodShopRecommendation
  149. from "../../page-component/app-good-shop-recommendation/app-good-shop-recommendation.vue";
  150. import appTimer from "../../basic-component/app-timer/app-timer.vue";
  151. import appQuickNavigation from "../../page-component/app-quick-navigation/app-quick-navigation.vue";
  152. import appPopupAd from "../../page-component/app-popup-ad/app-popup-ad.vue";
  153. import appIndexMiaosha from "../../page-component/app-index-miaosha/app-index-miaosha.vue";
  154. import appIndexPintuan from "../../page-component/app-index-pintuan/app-index-pintuan.vue";
  155. import appIndexBooking from "../../page-component/app-index-booking/app-index-booking.vue";
  156. import appIndexCat from "../../page-component/app-index-cat/app-index-cat.vue";
  157. import appIndexAdvance from '../../page-component/app-index-advance/app-index-advance.vue';
  158. import appIndexPick from '../../page-component/app-index-pick/app-index-pick.vue';
  159. export default {
  160. name: 'app-index',
  161. data() {
  162. return {
  163. newPage: [],
  164. time: -1,
  165. }
  166. },
  167. props: {
  168. homePages: {
  169. type: Array,
  170. default() {
  171. return [];
  172. }
  173. },
  174. is_storage: Boolean,
  175. pageHide: Boolean,
  176. },
  177. computed: {
  178. ...mapState('mallConfig', {
  179. mall: state => state.mall,
  180. theme: state => state.theme
  181. }),
  182. newData() {
  183. uni.setNavigationBarTitle({
  184. title: this.mall.name
  185. });
  186. },
  187. getStausBarHeight(){
  188. try {
  189. const res = uni.getSystemInfoSync();
  190. return res.statusBarHeight + 'px';
  191. } catch (err) {
  192. console.log(err)
  193. }
  194. },
  195. headerBgHeight(){
  196. try {
  197. const res = uni.getSystemInfoSync();
  198. return 120+44+res.statusBarHeight + 'px';
  199. } catch (err) {
  200. console.log(err)
  201. }
  202. }
  203. },
  204. watch: {
  205. homePages: {
  206. handler: function(data) {
  207. this.newPage = [];
  208. let start = -1;
  209. let num = 0;
  210. clearInterval(this.time);
  211. if (data.length> 0) {
  212. this.time = setInterval(() => {
  213. start++;
  214. num++;
  215. this.newPage.push(...data.slice(start, num));
  216. if (num === data.length) {
  217. clearInterval(this.time);
  218. }
  219. }, 100);
  220. }
  221. },
  222. immediate: true,
  223. }
  224. },
  225. methods: {
  226. changeCoupon(data, index) {
  227. this.newPage[index].coupons[data].is_receive = '1';
  228. }
  229. },
  230. components: {
  231. 'app-search-for': appSearchFor,
  232. 'app-swiper': appSwiper,
  233. 'app-navigation-icon': appNavigationIcon,
  234. 'app-announcement': appAnnouncement,
  235. 'app-video': appVideo,
  236. 'app-topic': appTopic,
  237. 'app-exclusive-coupon': appExclusiveCoupon,
  238. 'app-image-ad': appImageAd,
  239. 'app-reservation': appReservation,
  240. 'app-good-shop-recommendation': appGoodShopRecommendation,
  241. 'app-jump-button': appJumpButton,
  242. 'app-timer': appTimer,
  243. 'app-quick-navigation': appQuickNavigation,
  244. 'app-popup-ad': appPopupAd,
  245. 'app-index-miaosha': appIndexMiaosha,
  246. 'app-index-pintuan': appIndexPintuan,
  247. 'app-index-booking': appIndexBooking,
  248. 'app-index-cat': appIndexCat,
  249. 'app-index-advance': appIndexAdvance,
  250. appIndexPick,
  251. },
  252. }
  253. </script>
  254. <style scoped lang="scss">
  255. .mch {
  256. background-color: #ffffff;
  257. }
  258. .mt-20 {
  259. margin-top: #{20rpx};
  260. }
  261. .banner{
  262. width: 94vw;
  263. height: auto;
  264. margin: 0 3vw;
  265. padding: 5vw 0;
  266. z-index: 1;
  267. .swipe {
  268. width: 100%;
  269. height: 42vw;
  270. /* background: #eee; */
  271. border-radius: 10px;
  272. overflow: hidden;
  273. z-index: 1;
  274. .banner-img{
  275. width: 100%;
  276. height: 100%;
  277. }
  278. }
  279. }
  280. </style>