Commit cb5c3abb by liang ce

提交代码

parent aba792bc
.dynamicBox{ .dynamicBox {
height: 100vh; height: 100vh;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
padding-bottom: 120rpx; padding-bottom: 120rpx;
} }
.dynamicList{
.dynamicList {
width: 100%; width: 100%;
} }
.dynamicDetails{
.dynamicDetails {
background: #FFFFFF; background: #FFFFFF;
border-radius: 16rpx; border-radius: 16rpx;
width: 702rpx; width: 702rpx;
...@@ -16,7 +18,8 @@ ...@@ -16,7 +18,8 @@
padding: 32rpx 24rpx 24rpx 24rpx; padding: 32rpx 24rpx 24rpx 24rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.meetingtitle{
.meetingtitle {
font-family: PingFangSC-Medium; font-family: PingFangSC-Medium;
font-size: 34rpx; font-size: 34rpx;
color: #1B263D; color: #1B263D;
...@@ -26,16 +29,20 @@ ...@@ -26,16 +29,20 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
.userDynamic{
.userDynamic {
margin-bottom: 34rpx; margin-bottom: 34rpx;
} }
.dynamicDetails .userDynamic:nth-last-child(1){
.dynamicDetails .userDynamic:nth-last-child(1) {
margin-bottom: 0; margin-bottom: 0;
} }
.dynamicTime{
.dynamicTime {
margin-bottom: 24rpx; margin-bottom: 24rpx;
} }
.dynamicTime text:nth-of-type(1){
.dynamicTime text:nth-of-type(1) {
opacity: 0.56; opacity: 0.56;
font-size: 26rpx; font-size: 26rpx;
color: #1B263D; color: #1B263D;
...@@ -43,12 +50,14 @@ ...@@ -43,12 +50,14 @@
line-height: 28rpx; line-height: 28rpx;
margin-right: 16rpx; margin-right: 16rpx;
} }
.dynamicTime text:nth-of-type(2){
.dynamicTime text:nth-of-type(2) {
font-size: 24rpx; font-size: 24rpx;
color: rgba(25,31,37,0.40); color: rgba(25, 31, 37, 0.40);
line-height: 24rpx; line-height: 24rpx;
} }
.dynamicFile{
.dynamicFile {
border: 1px solid #F5F6F7; border: 1px solid #F5F6F7;
border-radius: 8px; border-radius: 8px;
box-sizing: border-box; box-sizing: border-box;
...@@ -56,32 +65,37 @@ ...@@ -56,32 +65,37 @@
display: flex; display: flex;
align-items: center; align-items: center;
} }
.fileIcon{
.fileIcon {
width: 64rpx; width: 64rpx;
height: 64rpx; height: 64rpx;
margin-right: 12rpx; margin-right: 12rpx;
line-height: 64rpx; line-height: 64rpx;
} }
.fileMsg{
.fileMsg {
flex: 1; flex: 1;
} }
.fileName{
.fileName {
font-size: 28rpx; font-size: 28rpx;
color: #191F25; color: #191F25;
letter-spacing: 0; letter-spacing: 0;
line-height: 32rpx; line-height: 32rpx;
margin-bottom: 8rpx; margin-bottom: 8rpx;
} }
.fileSize{
.fileSize {
opacity: 0.56; opacity: 0.56;
font-size: 24rpx; font-size: 24rpx;
color: #191F25; color: #191F25;
letter-spacing: 0; letter-spacing: 0;
line-height: 24rpx; line-height: 24rpx;
} }
.task{
.task {
border: 1px solid #F5F6F7; border: 1px solid #F5F6F7;
box-shadow: 0 0 8rpx 0 rgba(0,0,0,0.04); box-shadow: 0 0 8rpx 0 rgba(0, 0, 0, 0.04);
border-radius: 8rpx; border-radius: 8rpx;
padding: 0 16rpx; padding: 0 16rpx;
display: flex; display: flex;
...@@ -90,19 +104,22 @@ ...@@ -90,19 +104,22 @@
width: 100%; width: 100%;
height: 76rpx; height: 76rpx;
} }
.taskName text{
.taskName text {
font-size: 28rpx; font-size: 28rpx;
color: #1B263D; color: #1B263D;
line-height: 28rpx; line-height: 28rpx;
flex: 1; flex: 1;
} }
.userLogo{
.userLogo {
border-radius: 50%; border-radius: 50%;
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
background: red; background: red;
} }
.placedTop{
.placedTop {
width: 84rpx; width: 84rpx;
height: 84rpx; height: 84rpx;
background: #FFFFFF; background: #FFFFFF;
...@@ -111,19 +128,66 @@ ...@@ -111,19 +128,66 @@
text-align: center; text-align: center;
line-height: 84rpx; line-height: 84rpx;
} }
.dynamicContent{
.dynamicContent {
display: flex; display: flex;
align-items: center; align-items: center;
width: 906rpx; width: 906rpx;
} }
.isMove{
.isMove {
transform: translateX(-156rpx); transform: translateX(-156rpx);
transition: all 150ms linear 0s; transition: all 150ms linear 0s;
} }
.placedTop .iconicon_top1{
.placedTop .iconicon_top1 {
font-size: 48rpx; font-size: 48rpx;
color: rgb(234, 12, 40); color: rgb(234, 12, 40);
} }
.placedTop .isTopIcon{
color: rgba(10,10,10,0.72); .placedTop .isTopIcon {
color: rgba(10, 10, 10, 0.72);
}
.noDate {
position: fixed;
left: 0;
top: 0;
background: #FFFFFF;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.noDate>view {
display: flex;
flex-direction: column;
align-items: center;
margin-top: -116rpx;
}
.noDate image {
width: 280rpx;
height: 290rpx;
display: block;
}
.noDateTitle {
margin: 56rpx 0 24rpx 0;
font-size: 32rpx;
color: #191F25;
letter-spacing: 0;
text-align: center;
line-height: 32rpx;
}
.noDateTip {
font-size: 28rpx;
width: 524rpx;
color: rgba(25, 31, 37, 0.40);
letter-spacing: 0;
text-align: center;
line-height: 1.5;
} }
\ No newline at end of file
<scroll-view scroll-y="{{true}}" class="dynamicBox" onScrollToLower="onScrollToLower"> <scroll-view a:if="{{dynamicList.length !== 0}}" scroll-y="{{true}}" class="dynamicBox" onScrollToLower="onScrollToLower">
<view class="dynamicList"> <view class="dynamicList">
<view a:for="{{dynamicList}}" data-id="{{item.scheduleId}}" class="dynamicContent {{isTouchMove && touchMoveId === item.scheduleId ? 'isMove' : ''}}" onTouchStart="touchstart" onTouchMove="touchmove"> <view a:for="{{dynamicList}}" data-id="{{item.scheduleId}}" class="dynamicContent {{isTouchMove && touchMoveId === item.scheduleId ? 'isMove' : ''}}" onTouchStart="touchstart" onTouchMove="touchmove">
<view class="dynamicDetails"> <view class="dynamicDetails">
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<text>{{createTime}}</text> <text>{{createTime}}</text>
</view> </view>
<block a:for="{{dynamicItem.meetingLogResourceList}}" a:for-item="resourceList"> <block a:for="{{dynamicItem.meetingLogResourceList}}" a:for-item="resourceList">
<file-list a:if="{{dynamicItem.logType === 'accessory'}}" fileList="{{resourceList.fileInfos}}" isCanEdit="{{false}}"/> <file-list a:if="{{dynamicItem.logType === 'schedule_accessory_add'}}" fileList="{{resourceList.fileInfos}}" isCanEdit="{{false}}"/>
<!--<view class="dynamicFile" a:if="{{dynamicItem.logType === 'accessory'}}" a:for="{{resourceList.fileInfos}}" a:for-item="fileList" data-file="{{fileList}}" onTap="previewFileInDingTalk"><view class="fileIcon"> <!--<view class="dynamicFile" a:if="{{dynamicItem.logType === 'accessory'}}" a:for="{{resourceList.fileInfos}}" a:for-item="fileList" data-file="{{fileList}}" onTap="previewFileInDingTalk"><view class="fileIcon">
123</view><view class="fileMsg"><view class="fileName"> 123</view><view class="fileMsg"><view class="fileName">
{{fileList.fileName}}</view><view class="fileSize"> {{fileList.fileName}}</view><view class="fileSize">
...@@ -39,3 +39,14 @@ ...@@ -39,3 +39,14 @@
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<view class="noDate" a:else>
<view>
<image mode="widthFix" src="../../assests/noDynamic.png"/>
<view class="noDateTitle">
展示安排的所有动态
</view>
<view class="noDateTip">
实时同步所有事件的最新动态,便于随时处理工作内容
</view>
</view>
</view>
\ No newline at end of file
import { getDynamicList, meetingCollection } from '../../api/request' import { getDynamicList, meetingCollection } from "../../api/request";
import { dealFileTime } from '../../utils/utils' import { dealFileTime } from "../../utils/utils";
Component({ Component({
mixins: [], mixins: [],
data: { data: {
isTop: false, isTop: false,
isTouchMove: false, isTouchMove: false,
touchMoveId: '', touchMoveId: "",
startX: '', startX: "",
startY: '', startY: "",
dynamicList: [], dynamicList: [],
current: 1, current: 1,
size: 10, size: 10,
...@@ -15,141 +15,159 @@ Component({ ...@@ -15,141 +15,159 @@ Component({
}, },
props: {}, props: {},
didMount() { didMount() {
this.getPages(1) this.getPages(1);
}, },
didUpdate() {}, didUpdate() {},
didUnmount() {}, didUnmount() {},
methods: { methods: {
getPages(current) { getPages(current) {
let that = this let that = this;
let data = { let data = {
current: current, current: current,
size: 10 size: 10
} };
getDynamicList(data).then(res => { getDynamicList(data).then(res => {
// 第一层日程数据处理 // 第一层日程数据处理
let dynamicList = res.data.data.records.map((item,index) => { if (res.data.data) {
let dynamicList = res.data.data.records.map((item, index) => {
// 第二层日程下的动态数据处理 // 第二层日程下的动态数据处理
let meetingLogResourceList = item.meetingLogDataList.map((item2,index2) => { let meetingLogResourceList = item.meetingLogDataList.map(
if (item2.category === '2') { (item2, index2) => {
if (item2.category === "2") {
// 第三层处理动态下的文件或者任务数据 // 第三层处理动态下的文件或者任务数据
let meetingLogResourceList = item2.meetingLogResourceList.map((item3,index3) => { let meetingLogResourceList = item2.meetingLogResourceList.map(
(item3, index3) => {
return { return {
...item3, ...item3,
fileInfos: item3.fileInfos ? JSON.parse(item3.fileInfos) : '' fileInfos: item3.fileInfos
? JSON.parse(item3.fileInfos)
: ""
};
} }
}) );
return { return {
logType: item2.logType, logType: item2.logType,
createTime: dealFileTime(item2.createTime), createTime: dealFileTime(item2.createTime),
creatorInfo: JSON.parse(item2.creatorInfo), creatorInfo: JSON.parse(item2.creatorInfo),
meetingLogResourceList: meetingLogResourceList meetingLogResourceList: meetingLogResourceList
} };
} else { } else {
return null return null;
}
} }
}) );
return { return {
scheduleId: item.scheduleId, scheduleId: item.scheduleId,
title: item.title, title: item.title,
traceTime: item.traceTime, traceTime: item.traceTime,
meetingLogResourceList: meetingLogResourceList meetingLogResourceList: meetingLogResourceList
} };
}) });
if (current === 1) { if (current === 1) {
that.setData({ that.setData({
dynamicList: dynamicList, dynamicList: dynamicList,
current: current, current: current,
noData: dynamicList.length === that.data.size ? true : false noData: dynamicList.length === that.data.size ? true : false
}) });
} else { } else {
let dynamicListData = [...that.data.dynamicList] let dynamicListData = [...that.data.dynamicList];
dynamicListData.push.apply(dynamicListData, dynamicList) dynamicListData.push.apply(dynamicListData, dynamicList);
that.setData({ that.setData({
dynamicList: dynamicListData, dynamicList: dynamicListData,
current: current, current: current,
noData: dynamicList.length === that.data.size ? true : false noData: dynamicList.length === that.data.size ? true : false
}) });
}
} }
}) });
}, },
touchstart(e){ touchstart(e) {
this.setData({ this.setData({
startX: e.changedTouches[0].clientX, startX: e.changedTouches[0].clientX,
startY: e.changedTouches[0].clientY, startY: e.changedTouches[0].clientY,
isTouchMove : this.data.isTouchMove ? !this.data.isTouchMove : this.data.isTouchMove isTouchMove: this.data.isTouchMove
}) ? !this.data.isTouchMove
: this.data.isTouchMove
});
}, },
touchmove(e) { touchmove(e) {
var that = this, var that = this,
startX = that.data.startX,//开始X坐标 startX = that.data.startX, //开始X坐标
startY = that.data.startY,//开始Y坐标 startY = that.data.startY, //开始Y坐标
touchMoveX = e.changedTouches[0].clientX,//滑动变化坐标 touchMoveX = e.changedTouches[0].clientX, //滑动变化坐标
touchMoveY = e.changedTouches[0].clientY,//滑动变化坐标 touchMoveY = e.changedTouches[0].clientY, //滑动变化坐标
//获取滑动角度 //获取滑动角度
angle = that.angle({ X: startX, Y: startY }, { X: touchMoveX, Y: touchMoveY }); angle = that.angle(
var isTouchMove { X: startX, Y: startY },
{ X: touchMoveX, Y: touchMoveY }
);
var isTouchMove;
//滑动超过30度角 return //滑动超过30度角 return
if (Math.abs(angle) > 30) return; if (Math.abs(angle) > 30) return;
if (touchMoveX > startX){ //右滑 if (touchMoveX > startX) {
isTouchMove = false //右滑
}else{ //左滑 isTouchMove = false;
isTouchMove = true } else {
//左滑
isTouchMove = true;
} }
//更新数据 //更新数据
that.setData({ that.setData({
isTouchMove : isTouchMove, isTouchMove: isTouchMove,
touchMoveId: e.currentTarget.dataset.id touchMoveId: e.currentTarget.dataset.id
}) });
}, },
angle (start, end) { angle(start, end) {
var _X = end.X - start.X, var _X = end.X - start.X,
_Y = end.Y - start.Y _Y = end.Y - start.Y;
//返回角度 /Math.atan()返回数字的反正切值 //返回角度 /Math.atan()返回数字的反正切值
return 360 * Math.atan(_Y / _X) / (2 * Math.PI); return (360 * Math.atan(_Y / _X)) / (2 * Math.PI);
}, },
changeCollection(e) { changeCollection(e) {
let that = this let that = this;
let index = e.target.dataset.index let index = e.target.dataset.index;
let data = { let data = {
scheduleId: e.target.dataset.scheduleid, scheduleId: e.target.dataset.scheduleid,
collection: e.target.dataset.collection collection: e.target.dataset.collection
} };
meetingCollection(data).then(res => { meetingCollection(data).then(res => {
console.log(res) console.log(res);
if (e.target.dataset.collection === 'N') { if (e.target.dataset.collection === "N") {
that.setData({ that.setData(
{
current: 1 current: 1
}, () => { },
that.getPages(1) () => {
}) that.getPages(1);
}
);
} else { } else {
let dynamicList = [...this.data.dynamicList] let dynamicList = [...this.data.dynamicList];
let ReplaceItem = dynamicList[index] let ReplaceItem = dynamicList[index];
ReplaceItem.traceTime = res.data.data ReplaceItem.traceTime = res.data.data;
dynamicList.splice(index, 1) dynamicList.splice(index, 1);
dynamicList.unshift(ReplaceItem) dynamicList.unshift(ReplaceItem);
that.setData({ that.setData({
dynamicList: dynamicList dynamicList: dynamicList
}) });
} }
}) });
}, },
previewFileInDingTalk(e) { previewFileInDingTalk(e) {
let fileMsg = e.currentTarget.dataset.file let fileMsg = e.currentTarget.dataset.file;
dd.previewFileInDingTalk({ dd.previewFileInDingTalk({
corpId: dd.corpId, corpId: dd.corpId,
spaceId: fileMsg.spaceId, spaceId: fileMsg.spaceId,
fileId: fileMsg.fileId, fileId: fileMsg.fileId,
fileName: fileMsg.fileName, fileName: fileMsg.fileName,
fileSize: fileMsg.fileSize, fileSize: fileMsg.fileSize,
fileType: fileMsg.fileType, fileType: fileMsg.fileType
}) });
}, },
onScrollToLower() { onScrollToLower() {
if (!this.data.noData) { if (!this.data.noData) {
this.getPages(this.data.current + 1) this.getPages(this.data.current + 1);
}
} }
} }
},
}); });
{ {
"component": true, "component": true,
"useComponent": { "usingComponents": {
"task-list": "../../components/taskList/taskList" "task-list": "../../components/taskList/taskList",
"file-list": "../../components/fileList/fileList"
} }
} }
\ No newline at end of file
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
</view> </view>
<view class="index"> <view class="index">
<view a:if="{{true}}"> <view a:if="{{true}}">
<scroll-view a:if="{{todayStr !== ''}}" scroll-y="{{true}}" upper-threshold="50" lower-threshold="50" style="height: 100vh;" scroll-into-view="{{todayStr}}"> <scroll-view a:if="{{todayStr !== ''}}" scroll-y="{{true}}" onScroll="onScroll" onScrollToUpper="onScrollToUpper" lower-threshold="100" onScrollToLower="loadMoreDate" style="height: 100vh;" scroll-into-view="{{todayStr}}">
<block a:for="{{scheduleList}}" a:for-item="scheduleYearList"> <block a:for="{{scheduleList}}" a:for-item="list">
<block a:for="{{scheduleYearList}}"> <block a:for="{{list}}">
<block a:if="{{item.type == 'year'}}"> <block a:if="{{item.type == 'year'}}">
<view class="month"> <view class="month">
{{item.value}}年 {{item.value}}年
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<text style="color: rgb(50, 150, 250)">{{item.value.day}}</text> <text style="color: rgb(50, 150, 250)">{{item.value.day}}</text>
</view> </view>
<view class="dataSchedule"> <view class="dataSchedule">
<!-- <view class="thisDayLine thisDayHavaMeeting" style="margin-bottom: 7.5rpx"></view> --> <!--<view class="thisDayLine thisDayHavaMeeting" style="margin-bottom: 7.5rpx"></view> -->
<view a:for="{{item.value.value}}" a:for-item="item2" data-item="{{item2}}" class="{{ item2.isBeOverdue ? 'overdue' : item2.confirmAttendance === 0 ? 'cancel' : '' }}" onTap="nextDetail"> <view a:for="{{item.value.value}}" a:for-item="item2" data-item="{{item2}}" class="{{ item2.isBeOverdue ? 'overdue' : item2.confirmAttendance === 0 ? 'cancel' : '' }}" onTap="nextDetail">
<view class="dataScheduleName"> <view class="dataScheduleName">
<text>{{item2.title}}{{item2.isfirstDayOrEndDay ? `(第${item2.isFewDays}天,共${item2.duration}天)` : '' }}</text> <text>{{item2.title}}{{item2.isfirstDayOrEndDay ? `(第${item2.isFewDays}天,共${item2.duration}天)` : '' }}</text>
...@@ -84,15 +84,14 @@ ...@@ -84,15 +84,14 @@
<text>暂无日程安排,</text> <text>暂无日程安排,</text>
<text onTap="nextPage">创建日程</text> <text onTap="nextPage">创建日程</text>
</view> </view>
<!-- <view class="thisDayLine"></view> --> <!--<view class="thisDayLine"></view> -->
</view> </view>
</view> </view>
</block> </block>
</block> </block>
</block> </block>
</scroll-view> </scroll-view>
<!-- <view class="createSchedule iconfont iconjiahao " onTap="nextPage"> <!--<view class="createSchedule iconfont iconjiahao " onTap="nextPage"></view> -->
</view> -->
</view> </view>
<view class="startPage" a:else> <view class="startPage" a:else>
<image mode="scaleToFill" src="../../assests/startPage.png"/> <image mode="scaleToFill" src="../../assests/startPage.png"/>
...@@ -102,7 +101,7 @@ ...@@ -102,7 +101,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="sidebar {{isShowSidebar === '' ? '' : isShowSidebar === false ? 'siderbarHidden' : 'siderbarShow'}}" catchTap="changesidebar"> <popup show="{{show}}" onClose="closePop" position="left">
<view class="sidebarContent" catchTap="preventSort"> <view class="sidebarContent" catchTap="preventSort">
<view class="sidebarLogo"> <view class="sidebarLogo">
<view> <view>
...@@ -191,4 +190,21 @@ ...@@ -191,4 +190,21 @@
</view> </view>
</view> </view>
</view> </view>
</view> </popup>
\ No newline at end of file <!--<view class="sidebar {{isShowSidebar === '' ? '' : isShowSidebar === false ? 'siderbarHidden' : 'siderbarShow'}}" catchTap="changesidebar"><view class="sidebarContent" catchTap="preventSort"><view class="sidebarLogo"><view>
logo</view><view>
出的鹏</view></view><view class="hasAssociated"><view class="associated">
已关联应用</view><view class="applicationList"><view class="applicationLogo"></view><view class="applicationMsg"><view><view>
Outlook日历</view><view>
支持会议日程双向同步,实时同步日程信息等</view></view><view class="operateIcon">
ic</view></view></view></view><view class="unAssociated"><view class="associated">
可关联应用</view><view class="applicationList"><view class="applicationLogo"></view><view class="applicationMsg"><view><view>
Outlook日历</view><view>
支持会议日程双向同步,实时同步日程信息等</view></view><view class="operateIcon">
ic</view></view></view><view class="applicationList"><view class="applicationLogo"></view><view class="applicationMsg"><view><view>
Outlook日历</view><view>
支持会议日程双向同步,实时同步日程信息等</view></view><view class="operateIcon">
ic</view></view></view><view class="applicationList"><view class="applicationLogo"></view><view class="applicationMsg"><view><view>
Outlook日历</view><view>
支持会议日程双向同步,实时同步日程信息等</view></view><view class="operateIcon">
ic</view></view></view></view></view></view> -->
\ No newline at end of file
{ {
"component": true "component": true,
"usingComponents": {
"popup": "../../components/popup/index"
}
} }
\ No newline at end of file
...@@ -2,22 +2,23 @@ ...@@ -2,22 +2,23 @@
border: 1rpx solid rgba(245, 246, 247, 1); border: 1rpx solid rgba(245, 246, 247, 1);
border-radius: 16rpx; border-radius: 16rpx;
border-radius: 16rpx; border-radius: 16rpx;
padding: 14rpx 16rpx 0; padding: 24rpx 22rpx 0 22rpx;
margin-top: 16rpx; margin-top: 16rpx;
} }
.task-list>.file-box { .task-list>.file-box {
position: relative; position: relative;
padding: 10rpx 10px 10rpx 76rpx; padding-left: 70rpx;
margin-bottom: 14rpx; margin-bottom: 24rpx;
height: 64rpx;
} }
.file-box>.file-icon { .file-box>.file-icon {
position: absolute; position: absolute;
width: 64rpx; width: 50rpx;
height: 64rpx; height: 64rpx;
left: 6rpx; left: 0rpx;
top: 10rpx; top: 0rpx;
background: url(../../assests/all.png) center /100% 100%; background: url(../../assests/all.png) center /100% 100%;
} }
...@@ -25,6 +26,7 @@ ...@@ -25,6 +26,7 @@
font-size: 28rpx; font-size: 28rpx;
color: rgba(25, 31, 37, 1); color: rgba(25, 31, 37, 1);
display: flex; display: flex;
line-height: 38rpx;
} }
.file-box>.file-title>text:first-child { .file-box>.file-title>text:first-child {
...@@ -40,8 +42,7 @@ ...@@ -40,8 +42,7 @@
.file-box>.file-size { .file-box>.file-size {
color: rgba(25, 31, 37, 0.56); color: rgba(25, 31, 37, 0.56);
font-size: 24rpx; font-size: 24rpx;
line-height: 40rpx; line-height: 36rpx;
height: 40rpx;
} }
.file-box-mask { .file-box-mask {
......
import { getFormatDate } from '../../utils/utils' import { getFormatDate } from '../../utils/utils'
Page({ Page({
data: { data: {
tabBarIndex: '0' tabBarIndex: '1'
}, },
onLoad() { onLoad() {
......
//防止多次重复点击 (函数节流) //防止多次重复点击 (函数节流)
export function throttle(fn, gapTime) { export function throttle(fn, gapTime) {
if (gapTime == null || gapTime == undefined) { if (gapTime == null || gapTime == undefined) {
gapTime = 1500 gapTime = 1500;
} }
let _lastTime = null let _lastTime = null;
return function () { return function() {
let _nowTime = new Date() let _nowTime = new Date();
if (_nowTime - _lastTime > gapTime || !_lastTime) { if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments) //将this和参数传给原函数 fn.apply(this, arguments); //将this和参数传给原函数
_lastTime = _nowTime _lastTime = _nowTime;
}
} }
};
} }
// 判断时间 刚刚 五分钟以内 十分钟以内 正常时间年月日 // 判断时间 刚刚 五分钟以内 十分钟以内 正常时间年月日
export function dealFileTime(time) { export function dealFileTime(time) {
let result = '' let result = "";
let argumentsTime= new Date(time.replace(/\-/g, "/")).getTime() let argumentsTime = new Date(time.replace(/\-/g, "/")).getTime();
let nowTime = new Date().getTime() let nowTime = new Date().getTime();
let diffValue = nowTime - argumentsTime let diffValue = nowTime - argumentsTime;
let minute = 1000 * 60; //把分,时,天,周,半个月,一个月用毫秒表示 let minute = 1000 * 60; //把分,时,天,周,半个月,一个月用毫秒表示
let hour = minute * 60; let hour = minute * 60;
let day = hour * 24; let day = hour * 24;
let week = day * 7; let week = day * 7;
let halfamonth = day * 15; let halfamonth = day * 15;
let month = day * 30; let month = day * 30;
if(diffValue < 0){ if (diffValue < 0) {
return; return;
} }
let minC = diffValue/minute; //计算时间差的分,时,天,周,月 let minC = diffValue / minute; //计算时间差的分,时,天,周,月
let hourC = diffValue/hour; let hourC = diffValue / hour;
let dayC = diffValue/day; let dayC = diffValue / day;
let weekC = diffValue/week; let weekC = diffValue / week;
let monthC = diffValue/month; let monthC = diffValue / month;
if(monthC >= 1 && monthC <= 3){ if (monthC >= 1 && monthC <= 3) {
result = " " + parseInt(monthC) + "月前" result = " " + parseInt(monthC) + "月前";
}else if(weekC >= 1 && weekC <= 3){ } else if (weekC >= 1 && weekC <= 3) {
result = " " + parseInt(weekC) + "周前" result = " " + parseInt(weekC) + "周前";
}else if(dayC >= 1 && dayC <= 6){ } else if (dayC >= 1 && dayC <= 6) {
result = " " + parseInt(dayC) + "天前" result = " " + parseInt(dayC) + "天前";
}else if(hourC >= 1 && hourC <= 23){ } else if (hourC >= 1 && hourC <= 23) {
result = " " + parseInt(hourC) + "小时前" result = " " + parseInt(hourC) + "小时前";
}else if(minC >= 1 && minC <= 59){ } else if (minC >= 1 && minC <= 59) {
result =" " + parseInt(minC) + "分钟前" result = " " + parseInt(minC) + "分钟前";
}else if(diffValue >= 0 && diffValue <= minute){ } else if (diffValue >= 0 && diffValue <= minute) {
result = "刚刚" result = "刚刚";
}else { } else {
let datetime = new Date(); let datetime = new Date();
datetime.setTime(time); datetime.setTime(time);
let Nyear = datetime.getFullYear(); let Nyear = datetime.getFullYear();
let Nmonth = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1; let Nmonth =
let Ndate = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate(); datetime.getMonth() + 1 < 10
let Nhour = datetime.getHours() < 10 ? "0" + datetime.getHours() : datetime.getHours(); ? "0" + (datetime.getMonth() + 1)
let Nminute = datetime.getMinutes() < 10 ? "0" + datetime.getMinutes() : datetime.getMinutes(); : datetime.getMonth() + 1;
let Nsecond = datetime.getSeconds() < 10 ? "0" + datetime.getSeconds() : datetime.getSeconds(); let Ndate =
result = Nyear + "-" + Nmonth + "-" + Ndate datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
let Nhour =
datetime.getHours() < 10
? "0" + datetime.getHours()
: datetime.getHours();
let Nminute =
datetime.getMinutes() < 10
? "0" + datetime.getMinutes()
: datetime.getMinutes();
let Nsecond =
datetime.getSeconds() < 10
? "0" + datetime.getSeconds()
: datetime.getSeconds();
result = Nyear + "-" + Nmonth + "-" + Ndate;
} }
return result; return result;
} }
...@@ -64,21 +77,58 @@ export function dealFileTime(time) { ...@@ -64,21 +77,58 @@ export function dealFileTime(time) {
format 格式 yyyyMMdd HH:mm:ss, yyyyMMdd, HH:mm:ss format 格式 yyyyMMdd HH:mm:ss, yyyyMMdd, HH:mm:ss
Symbol 分隔符号 Symbol 分隔符号
*/ */
export function getFormatDate (time, format, symbol) { export function getFormatDate(time, format, symbol) {
time = typeof(time) === 'object' ? time : new Date(time) time = typeof time === "object" ? time : new Date(time);
format = format ? format : 'yyyyMMdd HH:mm:ss' format = format ? format : "yyyyMMdd HH:mm:ss";
symbol = symbol ? symbol : '' symbol = symbol ? symbol : "";
let year = time.getFullYear() let year = time.getFullYear();
let month = time.getMonth() > 9 ? time.getMonth() + 1 : '0' + (time.getMonth() + 1) let month =
let day = time.getDate() < 10 ? '0' + time.getDate() : time.getDate() time.getMonth() < 9 ? "0" + (time.getMonth() + 1) : time.getMonth() + 1;
let hour = time.getHours() < 10 ? '0' + time.getHours() : time.getHours() let day = time.getDate() < 10 ? "0" + time.getDate() : time.getDate();
let minutes = time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes() let hour = time.getHours() < 10 ? "0" + time.getHours() : time.getHours();
let seconds = time.getSeconds() < 10 ? '0' + time.getSeconds() : time.getSeconds() let minutes =
if (format === 'yyyyMMdd HH:mm:ss') { time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes();
return symbol ? `${year}${symbol}${month}${symbol}${day} ${hour}:${minutes}:${seconds}` : `${year}/${month}/${day} ${hour}:${minutes}:${seconds}` let seconds =
} else if (format === 'yyyyMMdd') { time.getSeconds() < 10 ? "0" + time.getSeconds() : time.getSeconds();
return symbol ? `${year}${symbol}${month}${symbol}${day}` : `${year}/${month}/${day}` if (format === "yyyyMMdd HH:mm:ss") {
} else if (format === 'HH:mm:ss') { return symbol
return `${hour}:${minutes}:${seconds}` ? `${year}${symbol}${month}${symbol}${day} ${hour}:${minutes}:${seconds}`
: `${year}/${month}/${day} ${hour}:${minutes}:${seconds}`;
} else if (format === "yyyyMMdd") {
return symbol
? `${year}${symbol}${month}${symbol}${day}`
: `${year}/${month}/${day}`;
} else if (format === "HH:mm:ss") {
return `${hour}:${minutes}:${seconds}`;
}
}
// 返回每个月的第一天
export function getCurrentMonthFirst(date) {
date.setDate(1);
var month = parseInt(date.getMonth() + 1);
var day = date.getDate();
if (month < 10) {
month = "0" + month;
}
if (day < 10) {
day = "0" + day;
}
return date.getFullYear() + "-" + month + "-" + day;
}
// 返回每个月的最后一天
export function getCurrentMonthLast(date) {
var currentMonth = date.getMonth();
var nextMonth = ++currentMonth;
var nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1);
var oneDay = 1000 * 60 * 60 * 24;
var lastTime = new Date(nextMonthFirstDay - oneDay);
var month = parseInt(lastTime.getMonth() + 1);
var day = lastTime.getDate();
if (month < 10) {
month = "0" + month;
}
if (day < 10) {
day = "0" + day;
} }
return date.getFullYear() + "-" + month + "-" + day;
} }
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