fix:兼容safari 时间处理

This commit is contained in:
weifs
2023-04-25 14:18:55 +08:00
parent 9034a70b8f
commit c869e88c40
83 changed files with 255 additions and 236 deletions
@@ -80,7 +80,7 @@
<p>{{item.claim_time?.substr(0,16)}}</p>
</div>
</div>
<p class="comment" v-if="item.identitylink?.comment">“{{ item.identitylink?.comment }}”</p>
<p class="comment" v-if="item.identitylink?.comment"><span>“{{ item.identitylink?.comment }}”</span></p>
</TimelineItem>
<!-- 抄送 -->
@@ -184,7 +184,7 @@ export default {
// 把时间转成几小时前
getTimeAgo(time,type) {
const currentTime = new Date();
const timeDiff = (currentTime - new Date(time)) / 1000; // convert to seconds
const timeDiff = (currentTime - new Date((time + '').replace(/-/g,"/"))) / 1000; // convert to seconds
if (timeDiff < 60) {
return type == 2 ? "0"+this.$L('分钟') : this.$L('刚刚');
} else if (timeDiff < 3600) {
@@ -195,13 +195,13 @@ export default {
return type == 2 ? `${hours}${this.$L('小时')}` : `${hours} ${this.$L('小时前')}`;
} else {
const days = Math.floor(timeDiff / 3600 / 24);
return type == 2 ? `${days}${this.$L('天')}` : `${days} ${this.$L('天')}`;
return type == 2 ? `${days+1}${this.$L('天')}` : `${days+1} ${this.$L('天')}`;
}
},
// 获取时间差
getTimeDifference(startTime,endTime) {
const currentTime = new Date(endTime);
const timeDiff = (currentTime - new Date(startTime)) / 1000; // convert to seconds
const currentTime = new Date((endTime + '').replace(/-/g,"/"));
const timeDiff = (currentTime - new Date((startTime + '').replace(/-/g,"/"))) / 1000; // convert to seconds
if (timeDiff < 60) {
return {time:timeDiff,unit:this.$L('秒')};
} else if (timeDiff < 3600) {
@@ -212,7 +212,7 @@ export default {
return {time:hours,unit:this.$L('小时')};
} else {
const days = Math.floor(timeDiff / 3600 / 24);
return {time:days,unit:this.$L('天')};
return {time:days + 1,unit:this.$L('天')};
}
},
// 获取详情
@@ -498,7 +498,7 @@ export default {
onInitiate(){
this.$refs.initiateRef.validate((valid) => {
if (valid) {
this.loadIng++;
this.loadIng = 1;
var obj = JSON.parse(JSON.stringify(this.addData))
// if((addTitle || '').indexOf('班') == -1){
obj.startTime = obj.startTime +" "+ obj.startTimeHour + ":" + obj.startTimeMinute;
+5 -1
View File
@@ -701,6 +701,8 @@
}
.open-review-details{
width: 245px;
display: inline-block;
.cause{
border-bottom: 1px solid #e3e3e3;
border-top: 1px solid #e3e3e3;
@@ -714,8 +716,10 @@
.btn-raw{
display: flex;
text-align: center;
gap: 10px;
padding: 10px 0 5px 0;
>button.ivu-btn-primary{
margin-right: 12px;
}
}
}
}
+6 -3
View File
@@ -224,10 +224,13 @@
}
.comment{
border-radius:5px;
background-color: #eaeaea;
padding: 3px 10px;
margin-top: 5px;
margin-left: 45px;
span{
background-color: #eaeaea;
border-radius: 5px;
padding: 3px 10px;
display: inline-block;
}
}
}