Commit bb81785e by liang ce

更新字段

parent f5f88d00
...@@ -27,100 +27,55 @@ Component({ ...@@ -27,100 +27,55 @@ Component({
}, },
props: {}, props: {},
didMount() { didMount() {
// let that = this; this.getDate();
// let now = new Date(); },
// let year = now.getFullYear(); didUpdate() {
// let month = now.getMonth() + 1; if (this.props.update) {
// let day = now.getDate(); this.getDate();
// let parmsStartDate = this.returnMonthActionAndEndDate(year, month - 2, day) }
// .startDay;
// let parmsEndDate = this.returnMonthActionAndEndDate(year, month + 2, day)
// .endDay;
// let startTime = getFormatDate(
// new Date(year, month - 12, parmsStartDate),
// "yyyyMMdd",
// "-"
// );
// let endTime = getFormatDate(
// new Date(year, month + 12, parmsEndDate),
// "yyyyMMdd",
// "-"
// );
// let data = {
// startTime: `${startTime} 00:00:00`,
// endTime: `${endTime} 23:59:59`
// };
// getHomeUserSchedule1(data).then(res => {
// this.setData(
// {
// response: res.data.data
// },
// () => {
// let scheduleList = [];
// for (let i = -12; i <= 12; i++) {
// let forDate = new Date(2024, month + i, 1);
// scheduleList.push(
// that.returnScheduleList(forDate.toLocaleDateString())
// );
// }
// this.setData({
// scheduleList: scheduleList,
// pageStartTime: new Date(year, month - 13, 1).toLocaleDateString(),
// pageEndTime: new Date(year, month + 12, 1).toLocaleDateString()
// });
// }
// );
// });
// 页面显示
let data = {
startTime: "2020-01-01 00:00:00",
endTime: "2025-12-30 23:59:59"
};
let that = this;
getHomeUserSchedule1(data).then(res => {
that.setData(
{
response: res.data.data
},
() => {
let now = new Date();
let year = now.getFullYear();
let scheduleList = [];
for (let i = 0; i <= year - 2019; i++) {
scheduleList.push(that.returnScheduleList(2019 + i));
}
// 第一次加载
if (this.data.isFirstLoad) {
const today = new Date();
// finalDate 是用来定位到今天的
const finalDate = new Date(today);
// finalDate.setDate(today.getDate() - today.getDay())
that.setData({
scheduleList: scheduleList,
todayStr: finalDate.toLocaleDateString(),
thisYear: year,
maxYear: year,
canClick: true,
startPageOnShow: true,
isFirstLoad: false
});
} else {
that.setData({
scheduleList: scheduleList,
thisYear: year,
maxYear: year,
canClick: true,
startPageOnShow: true
});
}
}
);
});
}, },
didUpdate() { }, didUnmount() {},
didUnmount() { },
methods: { methods: {
nextDetail: throttle(function (e) { getDate() {
// 页面显示
let data = {
startTime: "2020-01-01 00:00:00",
endTime: "2025-12-30 23:59:59"
};
let that = this;
getHomeUserSchedule1(data).then(res => {
that.setData(
{
response: res.data.data
},
() => {
let now = new Date();
let year = now.getFullYear();
let scheduleList = [];
for (let i = 0; i <= year - 2019; i++) {
scheduleList.push(that.returnScheduleList(2019 + i));
}
// 第一次加载
if (this.data.isFirstLoad) {
const today = new Date();
// finalDate 是用来定位到今天的
const finalDate = new Date(today);
// finalDate.setDate(today.getDate() - today.getDay())
that.setData({
scheduleList: scheduleList,
todayStr: finalDate.toLocaleDateString(),
thisYear: year,
maxYear: year,
canClick: true,
startPageOnShow: true,
isFirstLoad: false
});
}
}
);
});
},
nextDetail: throttle(function(e) {
let item = e.target.dataset.item; let item = e.target.dataset.item;
dd.navigateTo({ dd.navigateTo({
url: `./../editMeeting/editMeeting?scheduleItem=${JSON.stringify(item)}` url: `./../editMeeting/editMeeting?scheduleItem=${JSON.stringify(item)}`
...@@ -185,9 +140,16 @@ Component({ ...@@ -185,9 +140,16 @@ Component({
); );
rule.all().map(item2 => { rule.all().map(item2 => {
let excludeDate = getFormatDate(item2, "yyyyMMdd"); let excludeDate = getFormatDate(item2, "yyyyMMdd");
let hasExclude = excludeDateList.scheduleList.indexOf(excludeDate) === -1; let hasExclude =
if (new Date(item2).getTime() < excludeDateList.templateList && hasExclude) { excludeDateList.scheduleList.indexOf(excludeDate) === -1;
let startTime = getFormatDate(item2, "yyyyMMdd") + " " + item.recurrenceModel.startTime; if (
new Date(item2).getTime() < excludeDateList.templateList &&
hasExclude
) {
let startTime =
getFormatDate(item2, "yyyyMMdd") +
" " +
item.recurrenceModel.startTime;
let endTime = new Date(startTime); let endTime = new Date(startTime);
endTime.setMinutes( endTime.setMinutes(
endTime.getMinutes() + item.recurrenceModel.duration endTime.getMinutes() + item.recurrenceModel.duration
...@@ -201,7 +163,7 @@ Component({ ...@@ -201,7 +163,7 @@ Component({
scheduleTemplateId: item.id, scheduleTemplateId: item.id,
startTime: startTime, startTime: startTime,
title: item.title, title: item.title,
planDate: getFormatDate(item2, "yyyyMMdd", '-') planDate: getFormatDate(item2, "yyyyMMdd", "-")
} }
); );
} }
...@@ -214,8 +176,8 @@ Component({ ...@@ -214,8 +176,8 @@ Component({
item.recurrenceModel.startTime; item.recurrenceModel.startTime;
let endTime = new Date( let endTime = new Date(
getFormatDate(item2, "yyyyMMdd") + getFormatDate(item2, "yyyyMMdd") +
" " + " " +
item.recurrenceModel.startTime item.recurrenceModel.startTime
); );
endTime.setMinutes( endTime.setMinutes(
endTime.getMinutes() + item.recurrenceModel.duration endTime.getMinutes() + item.recurrenceModel.duration
...@@ -228,7 +190,7 @@ Component({ ...@@ -228,7 +190,7 @@ Component({
scheduleTemplateId: item.id, scheduleTemplateId: item.id,
startTime: startTime, startTime: startTime,
title: item.title, title: item.title,
planDate: getFormatDate(item2, "yyyyMMdd", '-') planDate: getFormatDate(item2, "yyyyMMdd", "-")
} }
); );
}); });
...@@ -250,7 +212,7 @@ Component({ ...@@ -250,7 +212,7 @@ Component({
); );
} }
}); });
scheduleMap.forEach(function (value, key, map) { scheduleMap.forEach(function(value, key, map) {
scheduleList.push(value); scheduleList.push(value);
}); });
return scheduleList; return scheduleList;
...@@ -332,9 +294,9 @@ Component({ ...@@ -332,9 +294,9 @@ Component({
thisDayEndTime: AllScheduleList[y].endTime.slice(11, 16), thisDayEndTime: AllScheduleList[y].endTime.slice(11, 16),
isBeOverdue: isBeOverdue:
new Date().getTime() > new Date().getTime() >
new Date( new Date(
AllScheduleList[y].endTime.replace(/-/g, "/") AllScheduleList[y].endTime.replace(/-/g, "/")
).getTime() ).getTime()
? true ? true
: false : false
}); });
...@@ -369,9 +331,9 @@ Component({ ...@@ -369,9 +331,9 @@ Component({
duration: count + 1, duration: count + 1,
isBeOverdue: isBeOverdue:
new Date().getTime() > new Date().getTime() >
new Date( new Date(
AllScheduleList[y].endTime.replace(/-/g, "/") AllScheduleList[y].endTime.replace(/-/g, "/")
).getTime() ).getTime()
? true ? true
: false : false
}); });
...@@ -388,7 +350,7 @@ Component({ ...@@ -388,7 +350,7 @@ Component({
value: year value: year
}); });
let thisDay = new Date().toLocaleDateString(); let thisDay = new Date().toLocaleDateString();
DateMap.forEach(function (value, key, map) { DateMap.forEach(function(value, key, map) {
if ( if (
new Date(key).getDay() === 0 && new Date(key).getDay() === 0 &&
that.count( that.count(
...@@ -414,7 +376,7 @@ Component({ ...@@ -414,7 +376,7 @@ Component({
type: "week", type: "week",
value: `第${listWeek}周,${rangeMonth1 + 1}${rangeDay1}日 - ${ value: `第${listWeek}周,${rangeMonth1 + 1}${rangeDay1}日 - ${
rangeMonth2 == rangeMonth1 ? "" : rangeMonth2 + 1 + "月" rangeMonth2 == rangeMonth1 ? "" : rangeMonth2 + 1 + "月"
}${rangeDay2}日`, }${rangeDay2}日`,
dayStr: key dayStr: key
}); });
} }
...@@ -430,7 +392,7 @@ Component({ ...@@ -430,7 +392,7 @@ Component({
type: "week", type: "week",
value: `第${listWeek}周,${rangeMonth1 + 1}${rangeDay1}日 - ${ value: `第${listWeek}周,${rangeMonth1 + 1}${rangeDay1}日 - ${
rangeMonth2 == rangeMonth1 ? "" : rangeMonth2 + 1 + "月" rangeMonth2 == rangeMonth1 ? "" : rangeMonth2 + 1 + "月"
}${rangeDay2}日`, }${rangeDay2}日`,
dayStr: key dayStr: key
}); });
} }
...@@ -452,7 +414,7 @@ Component({ ...@@ -452,7 +414,7 @@ Component({
type: "week", type: "week",
value: `第${listWeek}周,${rangeMonth1 + 1}${rangeDay1}日 - ${ value: `第${listWeek}周,${rangeMonth1 + 1}${rangeDay1}日 - ${
rangeMonth2 == rangeMonth1 ? "" : rangeMonth2 + 1 + "月" rangeMonth2 == rangeMonth1 ? "" : rangeMonth2 + 1 + "月"
}${rangeDay2}日`, }${rangeDay2}日`,
dayStr: key dayStr: key
}); });
} }
......
<view a:if="{{tabBarIndex === '0'}}"> <view a:if="{{tabBarIndex === '0'}}">
<my-dynamic> <my-dynamic>
</my-dynamic> </my-dynamic>
</view> </view>
<view a:if="{{tabBarIndex === '1'}}"> <view a:if="{{tabBarIndex === '1'}}">
<my-schedule> <my-schedule update="{{indexNeedUpdate}}">
</my-schedule> </my-schedule>
</view> </view>
<view class="tabBar"> <view class="tabBar">
<view onTap="changeTabBar" data-tabbar='0'> <view onTap="changeTabBar" data-tabbar='0'>
<view class="tabBarView {{tabBarIndex === '0' ? 'ischooseTabBar' : ''}}"> <view class="tabBarView {{tabBarIndex === '0' ? 'ischooseTabBar' : ''}}">
<text class="iconfont iconicon_dynamic"></text> <text class="iconfont iconicon_dynamic"></text>
<text>动态</text> <text>动态</text>
</view>
</view> </view>
</view> <view onTap="changeTabBar" data-tabbar='1'>
<view onTap="changeTabBar" data-tabbar='1'> <view class="tabBarView {{tabBarIndex === '1' ? 'ischooseTabBar' : ''}}">
<view class="tabBarView {{tabBarIndex === '1' ? 'ischooseTabBar' : ''}}"> <text class="iconfont iconicon_Calendarbox1"></text>
<text class="iconfont iconicon_Calendarbox1"></text> <text>日程</text>
<text>日程</text> </view>
</view>
<view class="createMeeting" onTap="createMeeting">
<text class="iconfont iconicon_add1"></text>
</view> </view>
</view>
<view class="createMeeting" onTap="createMeeting">
<text class="iconfont iconicon_add1"></text>
</view>
</view> </view>
\ No newline at end of file
import { getFormatDate } from '../../utils/utils' import { getFormatDate } from '../../utils/utils'
Page({ import create from 'dd-store'
import exampleStore from '/stores/exampleStore'
create.Page({
store: exampleStore,
useAll: true,
data: { data: {
tabBarIndex: '1' tabBarIndex: '1',
}, },
onLoad() { onLoad() {
......
import { getMeetingRoom, getLabelTree, myMeetingPage, getReserveRoomList, getAllScheduleWithMeetingRoomByTime } from '../../api/request' import { getMeetingRoom, getLabelTree, myMeetingPage, getReserveRoomList, getAllScheduleWithMeetingRoomByTime } from '../../api/request'
import { EEXIST } from 'constants' import { EEXIST } from 'constants'
import { resolve } from 'url'
import create from 'dd-store' import create from 'dd-store'
import exampleStore from '/stores/exampleStore' import exampleStore from '/stores/exampleStore'
create.Page({ create.Page({
......
...@@ -28,6 +28,7 @@ class Store { ...@@ -28,6 +28,7 @@ class Store {
originUsers: [], originUsers: [],
originUsersId: [], originUsersId: [],
originalData: null, originalData: null,
indexNeedUpdate: false,
} }
} }
export default new Store() export default new Store()
\ 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