Commit cb5c3abb by liang ce

提交代码

parent aba792bc
.dynamicBox{
.dynamicBox {
height: 100vh;
width: 100%;
overflow: hidden;
box-sizing: border-box;
padding-bottom: 120rpx;
}
.dynamicList{
.dynamicList {
width: 100%;
}
.dynamicDetails{
.dynamicDetails {
background: #FFFFFF;
border-radius: 16rpx;
width: 702rpx;
......@@ -16,7 +18,8 @@
padding: 32rpx 24rpx 24rpx 24rpx;
box-sizing: border-box;
}
.meetingtitle{
.meetingtitle {
font-family: PingFangSC-Medium;
font-size: 34rpx;
color: #1B263D;
......@@ -26,16 +29,20 @@
justify-content: space-between;
align-items: center;
}
.userDynamic{
.userDynamic {
margin-bottom: 34rpx;
}
.dynamicDetails .userDynamic:nth-last-child(1){
.dynamicDetails .userDynamic:nth-last-child(1) {
margin-bottom: 0;
}
.dynamicTime{
.dynamicTime {
margin-bottom: 24rpx;
}
.dynamicTime text:nth-of-type(1){
.dynamicTime text:nth-of-type(1) {
opacity: 0.56;
font-size: 26rpx;
color: #1B263D;
......@@ -43,12 +50,14 @@
line-height: 28rpx;
margin-right: 16rpx;
}
.dynamicTime text:nth-of-type(2){
.dynamicTime text:nth-of-type(2) {
font-size: 24rpx;
color: rgba(25,31,37,0.40);
color: rgba(25, 31, 37, 0.40);
line-height: 24rpx;
}
.dynamicFile{
.dynamicFile {
border: 1px solid #F5F6F7;
border-radius: 8px;
box-sizing: border-box;
......@@ -56,32 +65,37 @@
display: flex;
align-items: center;
}
.fileIcon{
.fileIcon {
width: 64rpx;
height: 64rpx;
margin-right: 12rpx;
line-height: 64rpx;
}
.fileMsg{
.fileMsg {
flex: 1;
}
.fileName{
.fileName {
font-size: 28rpx;
color: #191F25;
letter-spacing: 0;
line-height: 32rpx;
margin-bottom: 8rpx;
}
.fileSize{
.fileSize {
opacity: 0.56;
font-size: 24rpx;
color: #191F25;
letter-spacing: 0;
line-height: 24rpx;
}
.task{
.task {
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;
padding: 0 16rpx;
display: flex;
......@@ -90,19 +104,22 @@
width: 100%;
height: 76rpx;
}
.taskName text{
.taskName text {
font-size: 28rpx;
color: #1B263D;
line-height: 28rpx;
flex: 1;
}
.userLogo{
.userLogo {
border-radius: 50%;
width: 48rpx;
height: 48rpx;
background: red;
}
.placedTop{
.placedTop {
width: 84rpx;
height: 84rpx;
background: #FFFFFF;
......@@ -111,19 +128,66 @@
text-align: center;
line-height: 84rpx;
}
.dynamicContent{
.dynamicContent {
display: flex;
align-items: center;
width: 906rpx;
}
.isMove{
.isMove {
transform: translateX(-156rpx);
transition: all 150ms linear 0s;
}
.placedTop .iconicon_top1{
.placedTop .iconicon_top1 {
font-size: 48rpx;
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 a:for="{{dynamicList}}" data-id="{{item.scheduleId}}" class="dynamicContent {{isTouchMove && touchMoveId === item.scheduleId ? 'isMove' : ''}}" onTouchStart="touchstart" onTouchMove="touchmove">
<view class="dynamicDetails">
......@@ -17,7 +17,7 @@
<text>{{createTime}}</text>
</view>
<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">
123</view><view class="fileMsg"><view class="fileName">
{{fileList.fileName}}</view><view class="fileSize">
......@@ -38,4 +38,15 @@
</view>
</view>
</view>
</scroll-view>
\ No newline at end of file
</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 { dealFileTime } from '../../utils/utils'
import { getDynamicList, meetingCollection } from "../../api/request";
import { dealFileTime } from "../../utils/utils";
Component({
mixins: [],
data: {
isTop: false,
isTouchMove: false,
touchMoveId: '',
startX: '',
startY: '',
touchMoveId: "",
startX: "",
startY: "",
dynamicList: [],
current: 1,
size: 10,
......@@ -15,141 +15,159 @@ Component({
},
props: {},
didMount() {
this.getPages(1)
this.getPages(1);
},
didUpdate() {},
didUnmount() {},
methods: {
getPages(current) {
let that = this
let that = this;
let data = {
current: current,
size: 10
}
};
getDynamicList(data).then(res => {
// 第一层日程数据处理
let dynamicList = res.data.data.records.map((item,index) => {
// 第二层日程下的动态数据处理
let meetingLogResourceList = item.meetingLogDataList.map((item2,index2) => {
if (item2.category === '2') {
// 第三层处理动态下的文件或者任务数据
let meetingLogResourceList = item2.meetingLogResourceList.map((item3,index3) => {
return {
...item3,
fileInfos: item3.fileInfos ? JSON.parse(item3.fileInfos) : ''
if (res.data.data) {
let dynamicList = res.data.data.records.map((item, index) => {
// 第二层日程下的动态数据处理
let meetingLogResourceList = item.meetingLogDataList.map(
(item2, index2) => {
if (item2.category === "2") {
// 第三层处理动态下的文件或者任务数据
let meetingLogResourceList = item2.meetingLogResourceList.map(
(item3, index3) => {
return {
...item3,
fileInfos: item3.fileInfos
? JSON.parse(item3.fileInfos)
: ""
};
}
);
return {
logType: item2.logType,
createTime: dealFileTime(item2.createTime),
creatorInfo: JSON.parse(item2.creatorInfo),
meetingLogResourceList: meetingLogResourceList
};
} else {
return null;
}
})
return {
logType: item2.logType,
createTime: dealFileTime(item2.createTime),
creatorInfo: JSON.parse(item2.creatorInfo),
meetingLogResourceList: meetingLogResourceList
}
} else {
return null
}
})
return {
scheduleId: item.scheduleId,
title: item.title,
traceTime: item.traceTime,
meetingLogResourceList: meetingLogResourceList
);
return {
scheduleId: item.scheduleId,
title: item.title,
traceTime: item.traceTime,
meetingLogResourceList: meetingLogResourceList
};
});
if (current === 1) {
that.setData({
dynamicList: dynamicList,
current: current,
noData: dynamicList.length === that.data.size ? true : false
});
} else {
let dynamicListData = [...that.data.dynamicList];
dynamicListData.push.apply(dynamicListData, dynamicList);
that.setData({
dynamicList: dynamicListData,
current: current,
noData: dynamicList.length === that.data.size ? true : false
});
}
})
if (current === 1) {
that.setData({
dynamicList: dynamicList,
current: current,
noData: dynamicList.length === that.data.size ? true : false
})
} else {
let dynamicListData = [...that.data.dynamicList]
dynamicListData.push.apply(dynamicListData, dynamicList)
that.setData({
dynamicList: dynamicListData,
current: current,
noData: dynamicList.length === that.data.size ? true : false
})
}
})
});
},
touchstart(e){
touchstart(e) {
this.setData({
startX: e.changedTouches[0].clientX,
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) {
var that = this,
startX = that.data.startX,//开始X坐标
startY = that.data.startY,//开始Y坐标
touchMoveX = e.changedTouches[0].clientX,//滑动变化坐标
touchMoveY = e.changedTouches[0].clientY,//滑动变化坐标
//获取滑动角度
angle = that.angle({ X: startX, Y: startY }, { X: touchMoveX, Y: touchMoveY });
var isTouchMove
startX = that.data.startX, //开始X坐标
startY = that.data.startY, //开始Y坐标
touchMoveX = e.changedTouches[0].clientX, //滑动变化坐标
touchMoveY = e.changedTouches[0].clientY, //滑动变化坐标
//获取滑动角度
angle = that.angle(
{ X: startX, Y: startY },
{ X: touchMoveX, Y: touchMoveY }
);
var isTouchMove;
//滑动超过30度角 return
if (Math.abs(angle) > 30) return;
if (touchMoveX > startX){ //右滑
isTouchMove = false
}else{ //左滑
isTouchMove = true
}
if (touchMoveX > startX) {
//右滑
isTouchMove = false;
} else {
//左滑
isTouchMove = true;
}
//更新数据
that.setData({
isTouchMove : isTouchMove,
isTouchMove: isTouchMove,
touchMoveId: e.currentTarget.dataset.id
})
});
},
angle (start, end) {
angle(start, end) {
var _X = end.X - start.X,
_Y = end.Y - start.Y
_Y = end.Y - start.Y;
//返回角度 /Math.atan()返回数字的反正切值
return 360 * Math.atan(_Y / _X) / (2 * Math.PI);
return (360 * Math.atan(_Y / _X)) / (2 * Math.PI);
},
changeCollection(e) {
let that = this
let index = e.target.dataset.index
let that = this;
let index = e.target.dataset.index;
let data = {
scheduleId: e.target.dataset.scheduleid,
collection: e.target.dataset.collection
}
};
meetingCollection(data).then(res => {
console.log(res)
if (e.target.dataset.collection === 'N') {
that.setData({
current: 1
}, () => {
that.getPages(1)
})
console.log(res);
if (e.target.dataset.collection === "N") {
that.setData(
{
current: 1
},
() => {
that.getPages(1);
}
);
} else {
let dynamicList = [...this.data.dynamicList]
let ReplaceItem = dynamicList[index]
ReplaceItem.traceTime = res.data.data
dynamicList.splice(index, 1)
dynamicList.unshift(ReplaceItem)
let dynamicList = [...this.data.dynamicList];
let ReplaceItem = dynamicList[index];
ReplaceItem.traceTime = res.data.data;
dynamicList.splice(index, 1);
dynamicList.unshift(ReplaceItem);
that.setData({
dynamicList: dynamicList
})
});
}
})
});
},
previewFileInDingTalk(e) {
let fileMsg = e.currentTarget.dataset.file
let fileMsg = e.currentTarget.dataset.file;
dd.previewFileInDingTalk({
corpId: dd.corpId,
spaceId: fileMsg.spaceId,
fileId: fileMsg.fileId,
fileName: fileMsg.fileName,
fileSize: fileMsg.fileSize,
fileType: fileMsg.fileType,
})
fileType: fileMsg.fileType
});
},
onScrollToLower() {
if (!this.data.noData) {
this.getPages(this.data.current + 1)
this.getPages(this.data.current + 1);
}
}
},
}
});
{
"component": true,
"useComponent": {
"task-list": "../../components/taskList/taskList"
"usingComponents": {
"task-list": "../../components/taskList/taskList",
"file-list": "../../components/fileList/fileList"
}
}
\ 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 @@
border: 1rpx solid rgba(245, 246, 247, 1);
border-radius: 16rpx;
border-radius: 16rpx;
padding: 14rpx 16rpx 0;
padding: 24rpx 22rpx 0 22rpx;
margin-top: 16rpx;
}
.task-list>.file-box {
position: relative;
padding: 10rpx 10px 10rpx 76rpx;
margin-bottom: 14rpx;
padding-left: 70rpx;
margin-bottom: 24rpx;
height: 64rpx;
}
.file-box>.file-icon {
position: absolute;
width: 64rpx;
width: 50rpx;
height: 64rpx;
left: 6rpx;
top: 10rpx;
left: 0rpx;
top: 0rpx;
background: url(../../assests/all.png) center /100% 100%;
}
......@@ -25,6 +26,7 @@
font-size: 28rpx;
color: rgba(25, 31, 37, 1);
display: flex;
line-height: 38rpx;
}
.file-box>.file-title>text:first-child {
......@@ -40,8 +42,7 @@
.file-box>.file-size {
color: rgba(25, 31, 37, 0.56);
font-size: 24rpx;
line-height: 40rpx;
height: 40rpx;
line-height: 36rpx;
}
.file-box-mask {
......
import { getFormatDate } from '../../utils/utils'
Page({
data: {
tabBarIndex: '0'
tabBarIndex: '1'
},
onLoad() {
......
//防止多次重复点击 (函数节流)
export function throttle(fn, gapTime) {
if (gapTime == null || gapTime == undefined) {
gapTime = 1500
}
let _lastTime = null
return function () {
let _nowTime = new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments) //将this和参数传给原函数
_lastTime = _nowTime
}
if (gapTime == null || gapTime == undefined) {
gapTime = 1500;
}
let _lastTime = null;
return function() {
let _nowTime = new Date();
if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments); //将this和参数传给原函数
_lastTime = _nowTime;
}
};
}
// 判断时间 刚刚 五分钟以内 十分钟以内 正常时间年月日
export function dealFileTime(time) {
let result = ''
let argumentsTime= new Date(time.replace(/\-/g, "/")).getTime()
let nowTime = new Date().getTime()
let diffValue = nowTime - argumentsTime
let minute = 1000 * 60; //把分,时,天,周,半个月,一个月用毫秒表示
let hour = minute * 60;
let day = hour * 24;
let week = day * 7;
let halfamonth = day * 15;
let month = day * 30;
if(diffValue < 0){
return;
}
let minC = diffValue/minute; //计算时间差的分,时,天,周,月
let hourC = diffValue/hour;
let dayC = diffValue/day;
let weekC = diffValue/week;
let monthC = diffValue/month;
if(monthC >= 1 && monthC <= 3){
result = " " + parseInt(monthC) + "月前"
}else if(weekC >= 1 && weekC <= 3){
result = " " + parseInt(weekC) + "周前"
}else if(dayC >= 1 && dayC <= 6){
result = " " + parseInt(dayC) + "天前"
}else if(hourC >= 1 && hourC <= 23){
result = " " + parseInt(hourC) + "小时前"
}else if(minC >= 1 && minC <= 59){
result =" " + parseInt(minC) + "分钟前"
}else if(diffValue >= 0 && diffValue <= minute){
result = "刚刚"
}else {
let datetime = new Date();
datetime.setTime(time);
let Nyear = datetime.getFullYear();
let Nmonth = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1;
let 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;
let result = "";
let argumentsTime = new Date(time.replace(/\-/g, "/")).getTime();
let nowTime = new Date().getTime();
let diffValue = nowTime - argumentsTime;
let minute = 1000 * 60; //把分,时,天,周,半个月,一个月用毫秒表示
let hour = minute * 60;
let day = hour * 24;
let week = day * 7;
let halfamonth = day * 15;
let month = day * 30;
if (diffValue < 0) {
return;
}
let minC = diffValue / minute; //计算时间差的分,时,天,周,月
let hourC = diffValue / hour;
let dayC = diffValue / day;
let weekC = diffValue / week;
let monthC = diffValue / month;
if (monthC >= 1 && monthC <= 3) {
result = " " + parseInt(monthC) + "月前";
} else if (weekC >= 1 && weekC <= 3) {
result = " " + parseInt(weekC) + "周前";
} else if (dayC >= 1 && dayC <= 6) {
result = " " + parseInt(dayC) + "天前";
} else if (hourC >= 1 && hourC <= 23) {
result = " " + parseInt(hourC) + "小时前";
} else if (minC >= 1 && minC <= 59) {
result = " " + parseInt(minC) + "分钟前";
} else if (diffValue >= 0 && diffValue <= minute) {
result = "刚刚";
} else {
let datetime = new Date();
datetime.setTime(time);
let Nyear = datetime.getFullYear();
let Nmonth =
datetime.getMonth() + 1 < 10
? "0" + (datetime.getMonth() + 1)
: datetime.getMonth() + 1;
let 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;
}
/*
返回时间补0
......@@ -64,21 +77,58 @@ export function dealFileTime(time) {
format 格式 yyyyMMdd HH:mm:ss, yyyyMMdd, HH:mm:ss
Symbol 分隔符号
*/
export function getFormatDate (time, format, symbol) {
time = typeof(time) === 'object' ? time : new Date(time)
format = format ? format : 'yyyyMMdd HH:mm:ss'
symbol = symbol ? symbol : ''
let year = time.getFullYear()
let month = time.getMonth() > 9 ? time.getMonth() + 1 : '0' + (time.getMonth() + 1)
let day = time.getDate() < 10 ? '0' + time.getDate() : time.getDate()
let hour = time.getHours() < 10 ? '0' + time.getHours() : time.getHours()
let minutes = time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes()
let seconds = time.getSeconds() < 10 ? '0' + time.getSeconds() : time.getSeconds()
if (format === 'yyyyMMdd HH:mm:ss') {
return symbol ? `${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 getFormatDate(time, format, symbol) {
time = typeof time === "object" ? time : new Date(time);
format = format ? format : "yyyyMMdd HH:mm:ss";
symbol = symbol ? symbol : "";
let year = time.getFullYear();
let month =
time.getMonth() < 9 ? "0" + (time.getMonth() + 1) : time.getMonth() + 1;
let day = time.getDate() < 10 ? "0" + time.getDate() : time.getDate();
let hour = time.getHours() < 10 ? "0" + time.getHours() : time.getHours();
let minutes =
time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes();
let seconds =
time.getSeconds() < 10 ? "0" + time.getSeconds() : time.getSeconds();
if (format === "yyyyMMdd HH:mm:ss") {
return symbol
? `${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}`;
}
}
\ No newline at end of file
}
// 返回每个月的第一天
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