Commit fcc3edae by 李伟康

修改看板视图加载

1 parent b8dff89e
...@@ -1864,6 +1864,7 @@ ...@@ -1864,6 +1864,7 @@
"thread-loader": "^2.1.3", "thread-loader": "^2.1.3",
"url-loader": "^2.2.0", "url-loader": "^2.2.0",
"vue-loader": "^15.9.2", "vue-loader": "^15.9.2",
"vue-loader-v16": "npm:vue-loader@^16.1.0",
"vue-style-loader": "^4.1.2", "vue-style-loader": "^4.1.2",
"webpack": "^4.0.0", "webpack": "^4.0.0",
"webpack-bundle-analyzer": "^3.8.0", "webpack-bundle-analyzer": "^3.8.0",
...@@ -1878,6 +1879,51 @@ ...@@ -1878,6 +1879,51 @@
"integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==",
"dev": true "dev": true
}, },
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"ssri": { "ssri": {
"version": "8.0.1", "version": "8.0.1",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz",
...@@ -1886,6 +1932,28 @@ ...@@ -1886,6 +1932,28 @@
"requires": { "requires": {
"minipass": "^3.1.1" "minipass": "^3.1.1"
} }
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
}
} }
} }
}, },
...@@ -13221,75 +13289,6 @@ ...@@ -13221,75 +13289,6 @@
} }
} }
}, },
"vue-loader-v16": {
"version": "npm:vue-loader@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true,
"optional": true,
"requires": {
"chalk": "^4.1.0",
"hash-sum": "^2.0.0",
"loader-utils": "^2.0.0"
},
"dependencies": {
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"optional": true,
"requires": {
"color-convert": "^2.0.1"
}
},
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"optional": true,
"requires": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"optional": true,
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"optional": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"optional": true
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"optional": true,
"requires": {
"has-flag": "^4.0.0"
}
}
}
},
"vue-style-loader": { "vue-style-loader": {
"version": "4.1.3", "version": "4.1.3",
"resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz",
......
...@@ -4,13 +4,28 @@ ...@@ -4,13 +4,28 @@
<div class="carousel-box"> <div class="carousel-box">
<template v-if="dataViewLoading"> <template v-if="dataViewLoading">
<template v-if="viewList.length"> <template v-if="viewList.length">
<el-carousel ref="carousel" :autoplay="false" :loop="false" indicator-position="none" height="100%" arrow="never" class="carousel" @change="viewIndex = $event"> <el-carousel
ref="carousel"
:autoplay="false"
:loop="false"
indicator-position="none"
height="100%"
arrow="never"
class="carousel"
@change="viewIndex = $event"
>
<template v-for="(i, index) in viewList"> <template v-for="(i, index) in viewList">
<template> <template>
<el-carousel-item :key="index" class="carousel-item"> <el-carousel-item
:key="index"
class="carousel-item"
>
<template v-for="(c, cindex) in i"> <template v-for="(c, cindex) in i">
<template> <template>
<div :key="cindex" class="group"> <div
:key="cindex"
class="group"
>
<div class="title"> <div class="title">
<div class="text flex"> <div class="text flex">
<div class="icon"> <div class="icon">
...@@ -19,7 +34,10 @@ ...@@ -19,7 +34,10 @@
{{ c.title }} {{ c.title }}
</div> </div>
<div class="line-box"> <div class="line-box">
<div class="line" :style="[{ width: c.width }]"></div> <div
class="line"
:style="[{ width: c.width }]"
></div>
</div> </div>
</div> </div>
<div <div
...@@ -33,7 +51,10 @@ ...@@ -33,7 +51,10 @@
<template v-if="c.list.length"> <template v-if="c.list.length">
<template v-for="(item, ind) in c.list"> <template v-for="(item, ind) in c.list">
<template> <template>
<div :key="ind" class="item"> <div
:key="ind"
class="item"
>
<div class="top flex"> <div class="top flex">
<div class="icon"> <div class="icon">
<template v-if="item.wechatAvatarUrl"> <template v-if="item.wechatAvatarUrl">
...@@ -72,10 +93,16 @@ ...@@ -72,10 +93,16 @@
</template> </template>
</template> </template>
</el-carousel> </el-carousel>
<div class="arrow left" @click="$refs.carousel.prev()"> <div
class="arrow left"
@click="$refs.carousel.prev()"
>
<img :src="viewIndex == 0 ? leftIcon : leftActiveIcon" /> <img :src="viewIndex == 0 ? leftIcon : leftActiveIcon" />
</div> </div>
<div class="arrow right" @click="$refs.carousel.next()"> <div
class="arrow right"
@click="$refs.carousel.next()"
>
<img :src="viewIndex < viewList.length - 1 ? rightActiveIcon : rightIcon" /> <img :src="viewIndex < viewList.length - 1 ? rightActiveIcon : rightIcon" />
</div> </div>
</template> </template>
...@@ -133,10 +160,10 @@ export default { ...@@ -133,10 +160,10 @@ export default {
this.refreshTable() this.refreshTable()
}, },
methods: { methods: {
// 下拉加载 // 下拉加载
async infiniteLoad(cindex, index) { async infiniteLoad (cindex, index) {
console.log(this.pageCount,this.pageNumber) // console.log(this.pageCount, this.pageNumber)
if(this.viewList[index][cindex].list.length == 0)return if (this.viewList[index][cindex].list.length == 0) return
if (this.viewList[index][cindex].list.length == this.pageCount[cindex]) return if (this.viewList[index][cindex].list.length == this.pageCount[cindex]) return
this.pageNumber[cindex]++ this.pageNumber[cindex]++
const params = { const params = {
...@@ -145,19 +172,19 @@ export default { ...@@ -145,19 +172,19 @@ export default {
pageNumber: this.pageNumber[cindex], pageNumber: this.pageNumber[cindex],
sopJourneyStage: this.stageList[cindex].value sopJourneyStage: this.stageList[cindex].value
} }
let {list}= await this.$apis.journey.getCustomersList(params) let { list } = await this.$apis.journey.getCustomersList(params)
list.length && list.length &&
list.forEach((e) => { list.forEach((e) => {
e.day = dayjs().diff(dayjs(e.sopJourneyStageEnterTime).format('YYYY/MM/DD'), 'day') e.day = dayjs().diff(dayjs(e.sopJourneyStageEnterTime).format('YYYY/MM/DD'), 'day')
}) })
this.viewList[index][cindex].list = this.viewList[index][cindex].list.concat(list) this.viewList[index][cindex].list = this.viewList[index][cindex].list.concat(list)
}, },
async refreshTable () { async refreshTable () {
function splitArrayIntoChunks (arr, chunkSize) { function splitArrayIntoChunks (arr, chunkSize) {
const weight = 1 / arr.length const weight = 1 / arr.length
return arr.reduce((result, item, index) => { return arr.reduce((result, item, index) => {
const chunkIndex = Math.floor(index / chunkSize) const chunkIndex = Math.floor(index / chunkSize)
console.log(index,chunkIndex) // console.log(index, chunkIndex)
item.width = `${(weight * index + weight) * 100}%` item.width = `${(weight * index + weight) * 100}%`
result[chunkIndex] = result[chunkIndex] || [] result[chunkIndex] = result[chunkIndex] || []
result[chunkIndex].push(item) result[chunkIndex].push(item)
...@@ -174,26 +201,31 @@ export default { ...@@ -174,26 +201,31 @@ export default {
{ sopJourneyStage } = params { sopJourneyStage } = params
for (let k in stageList) { for (let k in stageList) {
if (stageList[k].value) { if (stageList[k].value) {
arr.push({
title: stageList[k].label,
list: null
})
params.sopJourneyStage = stageList[k].value params.sopJourneyStage = stageList[k].value
let list = [] let list = []
this.viewList = splitArrayIntoChunks(arr, 4)
if (!sopJourneyStage || sopJourneyStage == stageList[k].value) { if (!sopJourneyStage || sopJourneyStage == stageList[k].value) {
k!=0&&this.$set(this.pageNumber,k-1, 1) k != 0 && this.$set(this.pageNumber, k - 1, 1)
this.dataViewLoading = false this.dataViewLoading = false
const { list: apiList,total } = await this.$apis.journey.getCustomersList(params) const { list: apiList, total } = await this.$apis.journey.getCustomersList(params)
list = apiList list = apiList
k!=0&&this.$set(this.pageCount,k-1, total) k != 0 && this.$set(this.pageCount, k - 1, total)
} }
list.length && list.length &&
list.forEach((e) => { list.forEach((e) => {
e.day = dayjs().diff(dayjs(e.sopJourneyStageEnterTime).format('YYYY/MM/DD'), 'day') e.day = dayjs().diff(dayjs(e.sopJourneyStageEnterTime).format('YYYY/MM/DD'), 'day')
}) })
arr.push({ this.viewList.forEach(item => {
title: stageList[k].label, item.forEach(e => {
list if (!e.list && e.title === stageList[k].label) e.list = list || []
})
}) })
} }
} }
this.viewList = splitArrayIntoChunks(arr, 4)
this.dataViewLoading = true this.dataViewLoading = true
}, },
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!