【银保app】首页保费排行榜日期只是展示当前时间 柱状图动画调整

This commit is contained in:
liu.xiaofeng@ebiz-digits.com
2022-11-16 16:14:43 +08:00
parent 6e07415a6a
commit 0333c0c699

View File

@@ -31,7 +31,7 @@
<img src="@/assets/YB_APP/images/1.png"> <img src="@/assets/YB_APP/images/1.png">
<span style="margin-left: 10px;font-size: 16px;font-weight: bold;">个人保费排行榜</span> <span style="margin-left: 10px;font-size: 16px;font-weight: bold;">个人保费排行榜</span>
</span> </span>
<span @click="clickCalendar" style="color: #2a409d;border:lpx solid #eee;padding: 6px 12px;border-radius: 15px;background: #f4f6ff;cursor: pointer;font-weight: bold;"> <span style="color: #2a409d;border:lpx solid #eee;padding: 6px 12px;border-radius: 15px;background: #f4f6ff;cursor: pointer;font-weight: bold;">
{{calendarValue}} {{calendarValue}}
</span> </span>
</div> </div>
@@ -274,14 +274,14 @@
<van-popup v-model="calendarShow" position="bottom"> <van-popup v-model="calendarShow" position="bottom">
<van-datetime-picker <van-datetime-picker
v-model="currentDate" v-model="currentDate"
type="month-day" type="date"
title="选择日" title="选择日"
:min-date="minDate" :min-date="minDate"
:max-date="maxDate" :max-date="maxDate"
:formatter="formatter" @cancel="handleCurrentDateCancel"
@confirm="handleCurrentDateConfirm"
/> />
</van-popup> </van-popup>
</div> </div>
</template> </template>
@@ -290,7 +290,7 @@ import { homeConfigYB, getPremRankList, timelyContYB } from '@/api/YB_APP/index'
import { Swipe, SwipeItem, NoticeBar, Icon, Popup, DatetimePicker } from 'vant' import { Swipe, SwipeItem, NoticeBar, Icon, Popup, DatetimePicker } from 'vant'
import config from '@/config' import config from '@/config'
import png8 from '@/assets/YB_APP/images/8.png'; import png8 from '@/assets/YB_APP/images/8.png';
import utils from '@/assets/js/utils/date-utils'
export default { export default {
name: 'Home', name: 'Home',
components: { components: {
@@ -301,19 +301,9 @@ export default {
[Popup.name]: Popup, [Popup.name]: Popup,
}, },
data() { data() {
const formatter = (type, val) => {
if (type === 'year') {
return `${val}`;
}
if (type === 'month') {
return `${val}`;
}
return val;
};
return { return {
config, config,
currentDate:'', currentDate:new Date(),
formatter,
marginTop:'80', marginTop:'80',
getCodeValue:'', getCodeValue:'',
png8, png8,
@@ -326,7 +316,7 @@ export default {
calendarShow:false, calendarShow:false,
minDate: new Date(2019, 1, 1), minDate: new Date(2019, 1, 1),
maxDate: new Date(2030, 12, 31), maxDate: new Date(2030, 12, 31),
calendarValue:'9月27日', calendarValue:'',
colorOne:false, colorOne:false,
colorTwo:false, colorTwo:false,
colorThree:false, colorThree:false,
@@ -335,6 +325,10 @@ export default {
} }
}, },
mounted(){ mounted(){
let monthNum = new Date().getMonth()+1
let daysNum = new Date().getUTCDate()
this.calendarValue = monthNum +'月'+daysNum+'日'
this.getHomeConfigYB() this.getHomeConfigYB()
this.getPremRankList() this.getPremRankList()
this.getTimelyContYB() this.getTimelyContYB()
@@ -351,6 +345,18 @@ export default {
} }
}, },
methods:{ methods:{
handleCurrentDateCancel() {
this.calendarShow = false
},
handleCurrentDateConfirm(e) {
this.calendarShow = false
// let titleTime = utils.formatDate(e, 'yyyy-MM')
// this.calendarValue = utils.formatDate(e, 'MM-dd')
let monthNum = utils.formatDate(e, 'MM')
let daysNum = utils.formatDate(e, 'dd')
this.calendarValue = monthNum+'月'+daysNum+'日'
this.getPremRankList()
},
setMarginTop(){ setMarginTop(){
EWebBridge.webCallAppInJs("top_bar_height").then(data => { EWebBridge.webCallAppInJs("top_bar_height").then(data => {
console.log(data,'top_bar_height') console.log(data,'top_bar_height')
@@ -421,20 +427,20 @@ export default {
setAnimation(){ setAnimation(){
if(this.activePersonalType == 1){ if(this.activePersonalType == 1){
this.ebizPremRankGMList.forEach((item,index)=>{ this.ebizPremRankGMList.forEach((item,index)=>{
let ruleTrue1 = ` @keyframes changeWidth`+[index]+` { 0% {width: 0px;} 100% {width: `+item.prem/this.ebizPremRankGMList[0].prem*170+`px;} }` let ruleTrue1 = ` @keyframes changeWidth`+[index]+` { 0% {width: 0%;} 100% {width: `+item.prem/this.ebizPremRankGMList[0].prem*100+`%;} }`
let sheet1 = document.styleSheets[0] let sheet1 = document.styleSheets[0]
sheet1.insertRule(ruleTrue1, 0) sheet1.insertRule(ruleTrue1, 0)
this.$refs['ebizPremRankGMList'+index].style.width = parseInt(item.prem/this.ebizPremRankGMList[0].prem*170)+'px' this.$refs['ebizPremRankGMList'+index].style.width = parseInt(item.prem/this.ebizPremRankGMList[0].prem*100)+'%'
this.$refs['ebizPremRankGMList'+index].style.animation = "changeWidth"+index+" 2s forwards" this.$refs['ebizPremRankGMList'+index].style.animation = "changeWidth"+index+" 2s forwards"
}) })
} }
if(this.activePersonalType == 2){ if(this.activePersonalType == 2){
this.ebizPremRankQJList.forEach((item,index)=>{ this.ebizPremRankQJList.forEach((item,index)=>{
let ruleTrue2 = ` @keyframes changeTotalWidth`+[index]+` { 0% {width: 0px;} 100% {width: `+item.prem/this.ebizPremRankQJList[0].prem*170+`px;} }` let ruleTrue2 = ` @keyframes changeTotalWidth`+[index]+` { 0% {width: 0%;} 100% {width: `+item.prem/this.ebizPremRankQJList[0].prem*100+`%;} }`
let sheet2 = document.styleSheets[0] let sheet2 = document.styleSheets[0]
sheet2.insertRule(ruleTrue2, 0) sheet2.insertRule(ruleTrue2, 0)
this.$refs['ebizPremRankQJList'+index].style.width = parseInt(item.prem/this.ebizPremRankQJList[0].prem*170)+'px' this.$refs['ebizPremRankQJList'+index].style.width = parseInt(item.prem/this.ebizPremRankQJList[0].prem*100)+'%'
this.$refs['ebizPremRankQJList'+index].style.animation = "changeTotalWidth"+index+" 2s forwards" this.$refs['ebizPremRankQJList'+index].style.animation = "changeTotalWidth"+index+" 2s forwards"
}) })
} }