From-wh пре 2 година
родитељ
комит
6d5d2e9378

+ 2 - 5
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) {}

+ 11 - 4
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;

+ 8 - 1
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;

+ 8 - 1
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)