Commit 5e48c457 by 施宇

h5自营

parent d3987db0
......@@ -19,3 +19,4 @@ yarn-error.log*
*.sln
*.sw*
/view
/view
......@@ -18,7 +18,8 @@ const state = {
classLight: {},
zyFilterData: {}, //过滤数据
zyData: [],
total: 0,
loading:false,
finished:false
}
const mutations = {
xianhuo(state, payload) {
......@@ -33,7 +34,7 @@ const mutations = {
} else if (payload.type == "class_light") {
state.classLight = payload.data;
} else if (payload.type == "zydata") {
state.zyData = payload.data
state.zyData = state.zyData.concat(payload.data)
}
}
}
......@@ -41,10 +42,14 @@ const actions = {
getZyData({
commit
}, payload) {
state.loading = true;
state.finished = false;
let p = payload.data.params;
console
Services.getZyData(qs.stringify(payload.data)).then((res) => {
state.loading = false;
let data = res.data;
if (data.error_code == 0) {
state.total = data.data.total;
if (data.data.aggs) {
commit("xianhuo", { //过滤数据
type: "filter",
......@@ -83,6 +88,7 @@ const actions = {
}
}).catch(function (err) {
state.loading = false;
});
}
}
......
......@@ -143,12 +143,10 @@
</div>
<div class="content_scroll">
<van-list
v-model="loading"
v-model="loadingXh"
:finished="finished"
finished-text="我是有底线的噢"
@load="onLoad"
error-text="请求失败,点击重新加载"
:immediate-check="true"
>
<GoodsOne :dataList="zyData"></GoodsOne>
</van-list>
......@@ -203,9 +201,8 @@ export default {
isResetData: false, //是否重置数据
isShowRight: false, //是否展示右侧
list: [],
loading: false,
finished: false,
p: 1
loadingXh: false,
p: 0
};
},
created() {},
......@@ -218,10 +215,15 @@ export default {
classLight: state => state.xianhuo.classLight,
zyFilterData: state => state.xianhuo.zyFilterData,
zyData: state => state.xianhuo.zyData,
total: state => state.xianhuo.total
total: state => state.xianhuo.total,
loading: state => state.xianhuo.loading,
finished: state => state.xianhuo.finished
})
},
watch: {
loading(now) {
this.loadingXh = now;
},
zyRankInit(now) {
this.getZyData();
},
......@@ -244,6 +246,8 @@ export default {
},
methods: {
onLoad() {
console.log(this.loadingXh);
this.p++;
this.getZyData();
},
toSearch() {},
......@@ -298,7 +302,7 @@ export default {
}
},
getZyData(rightFilter = {}) {
let params = { p: 1, offset: 10 };
let params = { p: this.p, offset: 10 };
let rightFilterStr = JSON.stringify(rightFilter);
if (this.addClassStr) {
params["class_id/condition"] = this.addClassStr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment