Commit 8148ecff by xiexiaoqin

add createTime convert

parent bd40251b
...@@ -157,7 +157,6 @@ ...@@ -157,7 +157,6 @@
<text>不参加</text> <text>不参加</text>
</view> </view>
</view> </view>
<!--<view class="footerBottom"><view onTap="showPop" data-pop="{{title: '创建任务', type: 'createTask'}}"><text class="iconfont iconicon_task1"></text>任务</view><view><text class="iconfont iconicon_data" onTap="uploadFile"></text>文件</view><text class="devider"></text><view><text class="iconfont iconicon_share1"></text></view></view> -->
<view class="footerBottom"> <view class="footerBottom">
<view onTap="showCreateTask" data-pop="{{title: '创建任务', type: 'createTask'}}"> <view onTap="showCreateTask" data-pop="{{title: '创建任务', type: 'createTask'}}">
<text class="iconfont iconicon_task1"></text>任务 <text class="iconfont iconicon_task1"></text>任务
...@@ -197,7 +196,7 @@ ...@@ -197,7 +196,7 @@
</view> </view>
<file-list fileView="{{item.fileView}}" onDeleteMeetingFile="deleteMeetingFile"/> <file-list fileView="{{item.fileView}}" onDeleteMeetingFile="deleteMeetingFile"/>
</view> </view>
<view a:if="{{item.content}}" class='simple-column'>{{item.content}}{{item.createTime}}</view> <view a:if="{{item.content}}" class='simple-column'>{{item.content}} {{item.createTime}}</view>
</block> </block>
</view> </view>
<popup show="{{show}}" onClose="closePop" title="{{pop.title}}"> <popup show="{{show}}" onClose="closePop" title="{{pop.title}}">
......
...@@ -150,14 +150,15 @@ create.Page({ ...@@ -150,14 +150,15 @@ create.Page({
let participatorUserId = [] let participatorUserId = []
let repeatListMap = new Map() let repeatListMap = new Map()
for (let value of res.data.data.userList) { for (let value of res.data.data.userList) {
participatorList.push(value.participator) if (value.participator) {
participatorUserId.push(value.participator.userId) participatorList.push(value.participator)
originUsers.push(value.participator) participatorUserId.push(value.participator.userId)
if (value.participator.userId === getApp().globalData.userid) { originUsers.push(value.participator)
// this.setData({ if (value.participator.userId === getApp().globalData.userid) {
// aheadTimes: value. // this.setData({
// }) // aheadTimes: value.
// })
}
} }
} }
for (let item of this.data.comListData.repeatList) { for (let item of this.data.comListData.repeatList) {
...@@ -1139,6 +1140,10 @@ create.Page({ ...@@ -1139,6 +1140,10 @@ create.Page({
getMeetingRoomAffairs(id).then(res => { getMeetingRoomAffairs(id).then(res => {
const affairList = res.data.data || []; const affairList = res.data.data || [];
const newAffairList = affairList.map(it => { const newAffairList = affairList.map(it => {
if (it.createTime) {
it.createTime = getCreateShowTime(it.createTime);
console.log(it.createTime)
}
if (it.category == '2' && it.fileView) { if (it.category == '2' && it.fileView) {
if (it.fileView.creatorInfo) { if (it.fileView.creatorInfo) {
it.fileView.creatorInfo = JSON.parse(it.fileView.creatorInfo); it.fileView.creatorInfo = JSON.parse(it.fileView.creatorInfo);
...@@ -1382,3 +1387,50 @@ create.Page({ ...@@ -1382,3 +1387,50 @@ create.Page({
}) })
} }
}); });
// 判断是刚刚 60分钟以内 23小时以内 正常时间年月日
function getCreateShowTime(createdTime) {
let timeResule = ''
const creatTime = createdTime.replace(/\-/g, "/")
const year = new Date().getFullYear()
const month = new Date().getMonth() + 1
const day = new Date().getDate()
const creatYear = new Date(creatTime).getFullYear()
const creatMonth = new Date(creatTime).getMonth() + 1
const creatDay = new Date(creatTime).getDate()
if (year == creatYear) {
if (month == creatMonth) {
if (day == creatDay) {
const letMin = (new Date().getTime() - new Date(creatTime).getTime()) / 1000 / 60;
if (letMin < 2) {
timeResule = '刚刚'
} else if (letMin < 60) {
timeResule = letMin + '分钟前'
} else {
timeResule = (letMin / 60).toFixed(0) + '小时前'
}
} else {
timeResule = day - creatDay + '天前'
}
} else {
const leftDay = (new Date().getTime() - new Date(creatTime).getTime()) / 1000 / 60 / 60 / 24;
if (leftDay < 28) {
if (leftDay < 1) {
timeResule = (leftDay * 24).toFixed(0) + '小时前'
} else {
timeResule = letDay.toFixed(0) + '天前'
}
} else {
timeResule = `${creatTime.substring(5, 7)}${creatTime.substring(8, 10)}${creatTime.substring(11, 16)}`
}
}
} else {
timeResule = `${creatTime.substring(0, 4)}${creatTime.substring(5, 7)}${creatTime.substring(8, 10)}${creatTime.substring(11, 16)}`
}
return timeResule
}
\ No newline at end of file
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