diff --git a/template/uni-app/pages/goods_cate/goods_cate.vue b/template/uni-app/pages/goods_cate/goods_cate.vue index 56a5d8957..d6628cd12 100644 --- a/template/uni-app/pages/goods_cate/goods_cate.vue +++ b/template/uni-app/pages/goods_cate/goods_cate.vue @@ -40,11 +40,9 @@ } }, onLoad() {}, - onReady() { - this.getCategoryVersion() - }, + onReady() {}, onShow() { - + this.getCategoryVersion() }, methods: { getCategoryVersion() { @@ -58,7 +56,6 @@ } this.classStyle(); }) - }, jumpIndex() { if (this.is_diy) {} diff --git a/template/uni-app/pages/goods_cate/goods_cate1.vue b/template/uni-app/pages/goods_cate/goods_cate1.vue index 0ab4ee40b..704773ee3 100644 --- a/template/uni-app/pages/goods_cate/goods_cate1.vue +++ b/template/uni-app/pages/goods_cate/goods_cate1.vue @@ -112,7 +112,7 @@ cartNum: state => state.indexData.cartNum }) }, - mounted() { + mounted() { console.log(this.version) let that = this // #ifdef H5 @@ -127,6 +127,13 @@ this.activeRouter = '/' + curRoute this.getAllCategory(); }, + watch: { + isNew(newVal) { + if (newVal) { + this.getAllCategory(); + } + } + }, methods: { getNav() { getNavigation().then(res => { @@ -179,9 +186,9 @@ this.$set(this, 'lock', true); }, getAllCategory: function() { - let that = this; - console.log(this.version,'1',uni.getStorageSync('CAT_VERSION')) - if (this.version !== uni.getStorageSync('CAT_VERSION')) { + let that = this; + console.log(this.version, '1', uni.getStorageSync('CAT_VERSION')) + if (this.isNew || !uni.getStorageSync('CAT1_DATA')) { getCategoryList().then(res => { uni.setStorageSync('CAT1_DATA', res.data) that.productList = res.data; diff --git a/template/uni-app/pages/goods_cate/goods_cate2.vue b/template/uni-app/pages/goods_cate/goods_cate2.vue index 539136e78..68f69c87c 100644 --- a/template/uni-app/pages/goods_cate/goods_cate2.vue +++ b/template/uni-app/pages/goods_cate/goods_cate2.vue @@ -115,6 +115,13 @@ default: false } }, + watch: { + isNew(newVal) { + if (newVal) { + this.getAllCategory(); + } + } + }, computed: mapGetters(['isLogin', 'uid']), components: { productWindow, @@ -631,7 +638,7 @@ }, getAllCategory: function() { let that = this; - if (this.isNew) { + if (this.isNew || !uni.getStorageSync('CAT2_DATA')) { getCategoryList().then(res => { uni.setStorageSync('CAT2_DATA', res.data) let data = res.data; diff --git a/template/uni-app/pages/goods_cate/goods_cate3.vue b/template/uni-app/pages/goods_cate/goods_cate3.vue index 1eb2ef40e..2e6ae5b38 100644 --- a/template/uni-app/pages/goods_cate/goods_cate3.vue +++ b/template/uni-app/pages/goods_cate/goods_cate3.vue @@ -119,6 +119,13 @@ default: false } }, + watch: { + isNew(newVal) { + if (newVal) { + this.getAllCategory(); + } + } + }, data() { return { categoryList: [], @@ -667,7 +674,7 @@ }, getAllCategory: function() { let that = this; - if (this.isNew) { + if (this.isNew || !uni.getStorageSync('CAT3_DATA')) { getCategoryList().then(res => { let data = res.data; uni.setStorageSync('CAT3_DATA', data)