Commit 58f43208 by xiexiaoqin
parents c3cb55a9 283dad30
import {
getDynamicList,
meetingCollection,
updateMeetingTask
} from "../../api/request";
import { getCreateShowTime } from "../../utils/utils";
import create from 'dd-store';
create.Component({
mixins: [],
data: {
traceTime: '1970-03-01 00:00:00',
isStopBodyScroll: false,
dynamicList: [],
current: 1,
pages: 1,
loading: true
},
props: {},
didMount() {
this.getPages(1);
},
didUpdate() {
console.log(this.data.dynamicList, 111)
},
didUnmount() { },
methods: {
setBodyDisableScroll(isStopBodyScroll) {
this.setData({
isStopBodyScroll
})
},
//点击页面关闭侧滑模块
closeSwipe() {
if (this.$store.closeActiveSwipe) {
this.$store.closeActiveSwipe()
}
},
getPages(current, callBack) {
getDynamicList({
current,
size: 10
}).then(res => {
if (!res.data.data) {
this.setData({
loading: false
})
return;
}
const dynamicList = res.data.data.records.map((item, index) => {
for (let i = 0; i < item.meetingLogDataList.length; i++) {
item.meetingLogDataList[i].meetingLogResource.groupId = item.groupId
if (item.meetingLogDataList[i].creatorInfo) {
item.meetingLogDataList[i].creatorInfo = JSON.parse(
item.meetingLogDataList[i].creatorInfo
);
}
if (item.meetingLogDataList[i].createTime) {
item.meetingLogDataList[i].createTime = getCreateShowTime(
item.meetingLogDataList[i].createTime
);
}
let itemData = item.meetingLogDataList[i].meetingLogResource;
if (itemData) {
if (itemData.taskInfos || itemData.fileInfos) {
if (itemData.creatorInfo) {
itemData.creatorInfo = JSON.parse(itemData.creatorInfo);
}
if (itemData.fileInfos) {
itemData.fileInfos = JSON.parse(itemData.fileInfos);
}
if (itemData.taskInfos) {
itemData.taskInfos = JSON.parse(itemData.taskInfos);
}
if (itemData.acceptorInfo) {
itemData.acceptorInfo = JSON.parse(itemData.acceptorInfo);
}
}
}
}
return item
});
//第一页数据会重新请求需要替换
if (current === 1) {
this.setData({
dynamicList
});
} else {
const newDynamicList = this.data.dynamicList.concat(dynamicList);
this.setData({
dynamicList: newDynamicList
});
}
this.setData({
loading: false,
current: res.data.data.current,
pages: res.data.data.pages,
});
if (callBack) {
callBack()
}
});
},
changeCollection(e) {
const { index, scheduleId, collection } = e.target.dataset;
meetingCollection({
scheduleId,
collection
}).then(res => {
//取消置顶
if (collection === "N") {
// 重新获取第一页的数据
this.getPages(1, () => {
dd.showToast({
content: '取消成功'
})
});
} else {
//置顶
const dynamicList = this.data.dynamicList;
const replaceItem = dynamicList[index];
dynamicList[index].traceTime = res.data.data;
dynamicList.splice(index, 1);
dynamicList.unshift(replaceItem);
this.setData({
dynamicList: dynamicList
}, () => {
dd.showToast({
content: '置顶成功'
})
});
}
});
},
onScrollToLower() {
if (this.data.current < this.data.pages) {
this.getPages(this.data.current + 1);
}
},
onChangeTaskStatusOnList(e) {
const data = {
groupId: e.groupId,
scheduleId: e.scheduleId,
resourceType: "task",
creatorId: getApp().globalData.userid,
creatorInfo: getApp().globalData.userInfo,
id: e.id,
logType: "task_status_modify",
taskStatus: e.status
};
updateMeetingTask(data).then(res => {
if (res.data.code === 0) {
let dataIndex1 = "";
let dataIndex2 = "";
this.data.dynamicList.forEach((item, index) => {
if (item.scheduleId === e.scheduleId) {
dataIndex1 = index;
item.meetingLogDataList.forEach((it, index2) => {
if (it.meetingLogResource.id == e.id) {
dataIndex2 = index2;
}
});
}
});
const setData = `dynamicList[${dataIndex1}].meetingLogDataList[${dataIndex2}].meetingLogResource.taskStatus`;
this.setData({
[setData]: e.status
});
}
});
},
nextPage(event) {
this.$store.data.tabBarIndex = '0'
this.update()
dd.navigateTo({ url: `./../meetingDetail/meetingDetail?scheduleItem=${JSON.stringify(event.currentTarget.dataset.item)}` });
},
}
});
......@@ -12,7 +12,7 @@
</view>
<!-- $data.$data.roomId locationName 地点 -->
<view class="place">
<view class="iconicon_room1 iconfont icon " a:if="{{$data.roomId}}">
<view class="iconicon_room iconfont icon " a:if="{{$data.roomId}}">
</view>
<view class="iconicon_location1 iconfont icon {{$data.locationName ? '' : 'noValueIcon'}}" a:else>
</view>
......
......@@ -83,6 +83,7 @@ create.Page({
}
const dynamicList = res.data.data.records.map((item, index) => {
for (let i = 0; i < item.meetingLogDataList.length; i++) {
if (item.meetingLogDataList[i].creatorInfo) {
item.meetingLogDataList[i].creatorInfo = JSON.parse(
item.meetingLogDataList[i].creatorInfo
......@@ -95,6 +96,7 @@ create.Page({
}
let itemData = item.meetingLogDataList[i].meetingLogResource;
if (itemData) {
itemData.groupId = item.groupId
if (itemData.taskInfos || itemData.fileInfos) {
if (itemData.creatorInfo) {
itemData.creatorInfo = JSON.parse(itemData.creatorInfo);
......
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