Commit dcb9c063 by fengzhaoyu

feat: 编辑

parent bdb33035
...@@ -6,8 +6,12 @@ import { ...@@ -6,8 +6,12 @@ import {
getCurrentMonthLast, getCurrentMonthLast,
throttle throttle
} from "../../utils/utils"; } from "../../utils/utils";
Component({ import create from 'dd-store'
import exampleStore from '/stores/exampleStore'
create.Component({
mixins: [], mixins: [],
store: exampleStore,
useAll: true,
data: { data: {
response: "", response: "",
scheduleList: [], scheduleList: [],
...@@ -31,13 +35,14 @@ Component({ ...@@ -31,13 +35,14 @@ Component({
}, },
didUpdate() { didUpdate() {
if (this.props.update) { if (this.props.update) {
this.store.data.indexNeedUpdate = false;
this.update();
this.getDate(); this.getDate();
} }
}, },
didUnmount() {}, didUnmount() { },
methods: { methods: {
getDate() { getDate: throttle(function (e) {
// 页面显示
let data = { let data = {
startTime: "2020-01-01 00:00:00", startTime: "2020-01-01 00:00:00",
endTime: "2025-12-30 23:59:59" endTime: "2025-12-30 23:59:59"
...@@ -56,26 +61,24 @@ Component({ ...@@ -56,26 +61,24 @@ Component({
scheduleList.push(that.returnScheduleList(2019 + i)); scheduleList.push(that.returnScheduleList(2019 + i));
} }
// 第一次加载 // 第一次加载
if (this.data.isFirstLoad) { const today = new Date();
const today = new Date(); // finalDate 是用来定位到今天的
// finalDate 是用来定位到今天的 const finalDate = new Date(today);
const finalDate = new Date(today); // finalDate.setDate(today.getDate() - today.getDay())
// finalDate.setDate(today.getDate() - today.getDay()) that.setData({
that.setData({ scheduleList: scheduleList,
scheduleList: scheduleList, todayStr: finalDate.toLocaleDateString(),
todayStr: finalDate.toLocaleDateString(), thisYear: year,
thisYear: year, maxYear: year,
maxYear: year, canClick: true,
canClick: true, startPageOnShow: true,
startPageOnShow: true, isFirstLoad: false
isFirstLoad: false });
});
}
} }
); );
}); });
}, }, 1000),
nextDetail: throttle(function(e) { 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)}`
...@@ -176,8 +179,8 @@ Component({ ...@@ -176,8 +179,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
...@@ -212,7 +215,7 @@ Component({ ...@@ -212,7 +215,7 @@ Component({
); );
} }
}); });
scheduleMap.forEach(function(value, key, map) { scheduleMap.forEach(function (value, key, map) {
scheduleList.push(value); scheduleList.push(value);
}); });
return scheduleList; return scheduleList;
...@@ -294,9 +297,9 @@ Component({ ...@@ -294,9 +297,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
}); });
...@@ -331,9 +334,9 @@ Component({ ...@@ -331,9 +334,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
}); });
...@@ -350,7 +353,7 @@ Component({ ...@@ -350,7 +353,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(
...@@ -376,7 +379,7 @@ Component({ ...@@ -376,7 +379,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
}); });
} }
...@@ -392,7 +395,7 @@ Component({ ...@@ -392,7 +395,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
}); });
} }
...@@ -414,7 +417,7 @@ Component({ ...@@ -414,7 +417,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
}); });
} }
......
...@@ -340,6 +340,8 @@ create.Page({ ...@@ -340,6 +340,8 @@ create.Page({
addSchedule(data).then(res => { addSchedule(data).then(res => {
console.log(res) console.log(res)
if (res.data.code === 0) { if (res.data.code === 0) {
this.store.data.indexNeedUpdate = true
this.update()
dd.navigateBack({ dd.navigateBack({
delta: 1 delta: 1
}) })
......
...@@ -139,7 +139,7 @@ create.Page({ ...@@ -139,7 +139,7 @@ create.Page({
let data = { let data = {
id: this.data.scheduleItem.id, id: this.data.scheduleItem.id,
scheduleTemplateId: this.data.scheduleItem.scheduleTemplateId, scheduleTemplateId: this.data.scheduleItem.scheduleTemplateId,
planDate: this.data.scheduleItem.planDate.replace(/\//g, '-') planDate: this.data.scheduleItem.planDate
} }
getScheduleDetail(data).then(res => { getScheduleDetail(data).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
...@@ -152,10 +152,9 @@ create.Page({ ...@@ -152,10 +152,9 @@ create.Page({
participatorUserId.push(value.participator.userId) participatorUserId.push(value.participator.userId)
originUsers.push(value.participator) originUsers.push(value.participator)
if (value.participator.userId === getApp().globalData.userid) { if (value.participator.userId === getApp().globalData.userid) {
// this.setData({ this.setData({
// aheadTimes: value. aheadTimes: value.aheadList
// }) })
} }
} }
for (let item of this.data.comListData.repeatList) { for (let item of this.data.comListData.repeatList) {
...@@ -556,6 +555,8 @@ create.Page({ ...@@ -556,6 +555,8 @@ create.Page({
'conToastData.showToast': true, 'conToastData.showToast': true,
'conToastData.title': '保存成功' 'conToastData.title': '保存成功'
}) })
this.store.data.indexNeedUpdate = true
this.update()
if (this.store.data.originalData.repeatable === 1) { if (this.store.data.originalData.repeatable === 1) {
observer.notice(res.data.data) observer.notice(res.data.data)
} }
...@@ -709,6 +710,8 @@ create.Page({ ...@@ -709,6 +710,8 @@ create.Page({
planDate: this.data.scheduleItem.planDate planDate: this.data.scheduleItem.planDate
} }
deleteSchedule(data).then(res => { deleteSchedule(data).then(res => {
this.store.data.indexNeedUpdate = true
this.update()
dd.navigateBack({ dd.navigateBack({
delta: 1 delta: 1
}) })
......
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