修改当天过期的显示bug
This commit is contained in:
@@ -60,9 +60,9 @@
|
||||
<text style="color: #fff; font-size: 60rpx;" v-if="vipList.length==0">VIP</text>
|
||||
</view>
|
||||
<view class="vip_infor" v-if="vipList&&vipList.length>0">
|
||||
<view class="vip_infor_item" v-for="(item, index) in vipList" :key="index" :class="{expired: isExpired(item.endTime.split(' ')[0])}">
|
||||
<view class="vip_infor_item" v-for="(item, index) in vipList" :key="index" :class="{expired: isExpired(item.endTime)}">
|
||||
<text>{{item.text}}VIP</text>
|
||||
<text v-if="isExpired(item.endTime.split(' ')[0])">({{item.endTime.split(' ')[0]}} 已到期)</text>
|
||||
<text v-if="isExpired(item.endTime)">({{item.endTime.split(' ')[0]}} 已到期)</text>
|
||||
<text v-else>(有效期到 {{item.endTime.split(' ')[0]}})</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -371,9 +371,11 @@
|
||||
},
|
||||
//判断过期的vip
|
||||
isExpired(dateString){
|
||||
const date = new Date(dateString);
|
||||
const now = new Date();
|
||||
return date < now;
|
||||
const dataTime = new Date(dateString.replace(' ', 'T'));
|
||||
//获取当前时间的Date对象
|
||||
const currentTime = new Date();
|
||||
//比较两个时间
|
||||
return dataTime < currentTime;
|
||||
},
|
||||
// 获取用户的角色信息
|
||||
getUserRole() {
|
||||
@@ -522,17 +524,21 @@
|
||||
|
||||
//筛选出来已过期的
|
||||
let listAll = this.vipList;
|
||||
let list = this.vipList.filter(item => !this.isExpired(item.endTime.split(' ')[0]));
|
||||
let list = this.vipList.filter(item => !this.isExpired(item.endTime));
|
||||
|
||||
//全部的 vip模块展示
|
||||
if(listAll.length>0){
|
||||
listAll = this.showDataList(listAll);
|
||||
}else{
|
||||
this.textList = [];
|
||||
}
|
||||
|
||||
console.log('-------listAll',listAll)
|
||||
//筛选过期以后的 昵称模块展示需要
|
||||
if(list.length>0){
|
||||
list = this.showDataList(list);
|
||||
}else{
|
||||
this.textList = [];
|
||||
}
|
||||
console.log('-------list',list)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user