...
|
...
|
@@ -16,7 +16,7 @@ export default function() { |
|
|
isMore: false,
|
|
|
},
|
|
|
mutations: {
|
|
|
addList(state, { data }) {
|
|
|
addList(state, { data, isReset }) {
|
|
|
console.log(data)
|
|
|
if(data && data.product_list){
|
|
|
// data.product_list.
|
...
|
...
|
@@ -33,10 +33,15 @@ export default function() { |
|
|
}else {
|
|
|
state.isMore = false;
|
|
|
}
|
|
|
|
|
|
|
|
|
let list = state.favoriteProductList.list.concat(product_list);
|
|
|
Vue.set(state.favoriteProductList, "list", list);
|
|
|
if(isReset) {
|
|
|
state.favoriteProductList.list = product_list
|
|
|
}else {
|
|
|
let list = state.favoriteProductList.list.concat(product_list);
|
|
|
Vue.set(state.favoriteProductList, "list", list);
|
|
|
}
|
|
|
|
|
|
|
|
|
}else {
|
|
|
// state.isShowEmpty = true;
|
|
|
}
|
...
|
...
|
@@ -49,13 +54,23 @@ export default function() { |
|
|
|
|
|
},
|
|
|
actions: {
|
|
|
async fetchFavoriteList({ commit, state }) {
|
|
|
let page = state.page;
|
|
|
async fetchFavoriteList({ commit, state }, {isReset}={} ) {
|
|
|
console.log('...params')
|
|
|
// console.log(...params)
|
|
|
// let { isReset } = params;
|
|
|
console.log('===:'+isReset)
|
|
|
let page = 1
|
|
|
if(isReset){
|
|
|
page = 1
|
|
|
}else {
|
|
|
page = state.page;
|
|
|
}
|
|
|
// let page = state.page;
|
|
|
let limit = 20;
|
|
|
const result = await this.$api.get('/api/ufo/home/favoriteProduct', {page, limit});
|
|
|
if (result.code === 200) {
|
|
|
let data =result.data;
|
|
|
commit('addList', { data:data });
|
|
|
commit('addList', { data, isReset });
|
|
|
}else {
|
|
|
// console.log("error=//=isShowEmpty:")
|
|
|
commit('errorData');
|
...
|
...
|
|