Commit 9f9c0fb5 authored by “yiyousong”'s avatar “yiyousong”

perf: 优化首页材料显示

parent 49c42d8e
...@@ -154,9 +154,9 @@ export default { ...@@ -154,9 +154,9 @@ export default {
// [...data.hotDatumList, ...data.datumList], // [...data.hotDatumList, ...data.datumList],
// "id" // "id"
// ).slice(0, 7); // ).slice(0, 7);
datumList = data.hotDatumList.slice(0, 5); datumList = data.hotDatumList.slice(0, 7);
} else { } else {
datumList = data.datumList.slice(0, 5); datumList = data.datumList.slice(0, 7);
} }
if (data.hotMatterList) { if (data.hotMatterList) {
// matterList = this.removeDuplication( // matterList = this.removeDuplication(
......
...@@ -121,10 +121,10 @@ ...@@ -121,10 +121,10 @@
</div> </div>
<!-- 热门表单列表 --> <!-- 热门表单列表 -->
<div class="ranking-list flex1 flex flexc mt20"> <div class="ranking-list flex1 flex flexc mt20">
<div v-if="datumList && datumList.length"> <div v-if="CalcDatumList && CalcDatumList.length">
<div <div
class="ranking-item flex aic" class="ranking-item flex aic"
v-for="(v, i) in datumList" v-for="(v, i) in CalcDatumList"
:key="v.id" :key="v.id"
> >
<div class="flex aic jcc item-index"> <div class="flex aic jcc item-index">
...@@ -272,7 +272,7 @@ ...@@ -272,7 +272,7 @@
<script> <script>
// import { getHomeInfo } from "@/api"; // import { getHomeInfo } from "@/api";
import MateralsList from "@/components/MateralsList.vue"; import MateralsList from "@/components/MateralsList.vue";
import { mapState, mapMutations } from "vuex"; import { mapState, mapMutations, mapGetters } from "vuex";
import { getMaterialsList } from "@/api"; import { getMaterialsList } from "@/api";
import { deviceSystem } from "@/utils"; import { deviceSystem } from "@/utils";
import local from "@/utils/local"; import local from "@/utils/local";
...@@ -304,7 +304,8 @@ export default { ...@@ -304,7 +304,8 @@ export default {
waitTime: 2500, // 单行停顿时间(singleHeight,waitTime) waitTime: 2500, // 单行停顿时间(singleHeight,waitTime)
}; };
}, },
...mapState(["homeInfo", "datumList", "matterList", "appList", "showApp"]), ...mapGetters(["CalcDatumList"]),
...mapState(["homeInfo", "matterList", "appList", "showApp"]),
}, },
created() { created() {
// this.getHomeInfo(); // this.getHomeInfo();
......
...@@ -28,6 +28,9 @@ export default new Vuex.Store({ ...@@ -28,6 +28,9 @@ export default new Vuex.Store({
operTime(state) { operTime(state) {
return state.operTime; return state.operTime;
}, },
CalcDatumList(state) {
return state.showApp ? state.datumList.slice(0, 5) : state.datumList;
},
}, },
mutations: { mutations: {
SET_showApp(state, showApp) { SET_showApp(state, showApp) {
......
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 to comment