You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
3.0 KiB

3 months ago
  1. <template>
  2. <view class="page" :data-theme="theme" :style="{height:winHeight + 'px'}">
  3. <cate v-show="currentPage == 'one'"></cate>
  4. <pageFooter v-if="footerShow"></pageFooter>
  5. </view>
  6. </template>
  7. <script>
  8. import pageFooter from '@/components/pageFooter/index.vue'
  9. import cate from './components/default_cate';
  10. import {getShare} from '@/api/public.js';
  11. import {mapGetters} from 'vuex';
  12. const app = getApp();
  13. export default {
  14. data() {
  15. return {
  16. footerShow:true,
  17. currentPage:'one',
  18. theme:app.globalData.theme,
  19. showSlide:true,
  20. winHeight:'',
  21. configApi: {}, //分享类容配置
  22. }
  23. },
  24. computed: mapGetters(['isLogin', 'uid']),
  25. onLoad(){
  26. let that = this;
  27. let config = that.$Cache.getItem('categoryConfig');
  28. that.showSlide = config.isShowCategory == 'true'? true : false;
  29. switch (config.categoryConfig) {
  30. case '1':
  31. that.$set(that,'currentPage','one');
  32. break;
  33. case '2':
  34. that.$set(that,'currentPage','two');
  35. break;
  36. case '3':
  37. that.$set(that,'currentPage','three');
  38. uni.hideTabBar()
  39. this.footerShow=false
  40. break;
  41. case '4':
  42. that.$set(that,'currentPage','four');
  43. uni.hideTabBar()
  44. this.footerShow=false
  45. break;
  46. }
  47. uni.getSystemInfo({
  48. success: function (res) {
  49. that.winHeight = res.windowHeight;
  50. }
  51. });
  52. // #ifdef H5
  53. that.shareApi();
  54. // #endif
  55. },
  56. onShow(){
  57. switch (this.currentPage){
  58. case 'one':
  59. break;
  60. case 'two':
  61. break;
  62. case 'three':
  63. uni.hideTabBar()
  64. this.footerShow=false
  65. setTimeout(()=>{
  66. if(this.isLogin){
  67. //登录的情况下获取模板3,4的购物车商品数量和列表
  68. this.$refs.classThree.getCartNum();
  69. this.$refs.classThree.getCartLists(1);
  70. }
  71. },500)
  72. break;
  73. case 'four':
  74. uni.hideTabBar()
  75. this.footerShow=false
  76. setTimeout(()=>{
  77. if(this.isLogin){
  78. this.$refs.classFour.getCartNum();
  79. this.$refs.classFour.getCartLists(1);
  80. }
  81. },500)
  82. break;
  83. }
  84. },
  85. components:{
  86. cate,pageFooter
  87. },
  88. methods:{
  89. shareApi: function() {
  90. getShare().then(res => {
  91. this.$set(this, 'configApi', res.data);
  92. // #ifdef H5
  93. this.setOpenShare(res.data);
  94. // #endif
  95. })
  96. },
  97. // 微信分享;
  98. setOpenShare: function(data) {
  99. let that = this;
  100. if (that.$wechat.isWeixin()) {
  101. let configAppMessage = {
  102. desc: data.synopsis,
  103. title: data.title,
  104. link: location.href,
  105. imgUrl: data.img
  106. };
  107. that.$wechat.wechatEvevt(["updateAppMessageShareData", "updateTimelineShareData"],
  108. configAppMessage);
  109. }
  110. },
  111. },
  112. onReachBottom(){
  113. if(this.currentPage=='two'){
  114. this.$refs.classTwo.getProductList();
  115. }
  116. if(this.currentPage=='three'){
  117. this.$refs.classThree.productslist();
  118. }
  119. if(this.currentPage=='four'){
  120. this.$refs.classFour.productslist();
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss">
  126. .page{
  127. background: #fff;
  128. height: 100% !important;
  129. }
  130. </style>