goods_cate.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view :style="colorStyle">
  3. <goodsCate1 v-if="category == 1" ref="classOne" :isNew="isNew"></goodsCate1>
  4. <goodsCate2 v-if="category == 2" ref="classTwo" :isNew="isNew" @jumpIndex="jumpIndex"></goodsCate2>
  5. <goodsCate3 v-if="category == 3" ref="classThree" :isNew="isNew" @jumpIndex="jumpIndex"></goodsCate3>
  6. </view>
  7. </template>
  8. <script>
  9. import colors from '@/mixins/color';
  10. import goodsCate1 from './goods_cate1';
  11. import goodsCate2 from './goods_cate2';
  12. import goodsCate3 from './goods_cate3';
  13. import { colorChange } from '@/api/api.js';
  14. import { mapGetters } from 'vuex';
  15. import { getCategoryVersion } from '@/api/public.js';
  16. import tabBar from '@/pages/index/visualization/components/tabBar.vue';
  17. export default {
  18. computed: mapGetters(['isLogin', 'uid']),
  19. components: {
  20. goodsCate1,
  21. goodsCate2,
  22. goodsCate3,
  23. tabBar
  24. },
  25. mixins: [colors],
  26. data() {
  27. return {
  28. category: '',
  29. is_diy: uni.getStorageSync('is_diy'),
  30. status: 0,
  31. version: '',
  32. isNew: false
  33. };
  34. },
  35. onLoad() {},
  36. onReady() {},
  37. onShow() {
  38. this.getCategoryVersion();
  39. },
  40. methods: {
  41. getCategoryVersion() {
  42. uni.$emit('uploadFooter');
  43. getCategoryVersion().then((res) => {
  44. if (!uni.getStorageSync('CAT_VERSION') || res.data.version != uni.getStorageSync('CAT_VERSION')) {
  45. uni.setStorageSync('CAT_VERSION', res.data.version);
  46. uni.$emit('uploadCatData');
  47. }
  48. this.classStyle();
  49. });
  50. },
  51. jumpIndex() {
  52. // uni.reLaunch({
  53. // url: '/pages/index/index'
  54. // })
  55. },
  56. classStyle() {
  57. colorChange('category').then((res) => {
  58. let status = res.data.status;
  59. this.category = status;
  60. uni.setStorageSync('is_diy', res.data.is_diy);
  61. this.$nextTick((e) => {
  62. if (status == 2 || status == 3) {
  63. uni.hideTabBar();
  64. } else {
  65. this.$refs.classOne.is_diy = res.data.is_diy;
  66. if (!this.is_diy) {
  67. uni.hideTabBar();
  68. } else {
  69. this.$refs.classOne.getNav();
  70. }
  71. }
  72. });
  73. });
  74. }
  75. },
  76. onReachBottom: function () {
  77. if (this.category == 2) {
  78. this.$refs.classTwo.productslist();
  79. }
  80. if (this.category == 3) {
  81. this.$refs.classThree.productslist();
  82. }
  83. }
  84. };
  85. </script>
  86. <style scoped lang="scss">
  87. /deep/.mask {
  88. z-index: 99;
  89. }
  90. ::-webkit-scrollbar {
  91. width: 0;
  92. height: 0;
  93. color: transparent;
  94. display: none;
  95. }
  96. </style>