fix: 后台分类切换

This commit is contained in:
From-wh 2023-02-18 11:36:29 +08:00
parent 399d1e4c78
commit 6d5d2e9378
4 changed files with 29 additions and 11 deletions

View File

@ -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) {}

View File

@ -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;

View File

@ -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;

View File

@ -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)