Commit 7929a68b by xiexiaoqin

fix: await promise resolve to navback

parent 5946d2cb
...@@ -28,7 +28,6 @@ export default function xFetch({ url, method, data, type }) { ...@@ -28,7 +28,6 @@ export default function xFetch({ url, method, data, type }) {
} }
}, },
fail: function (err) { fail: function (err) {
console.log('err', JSON.stringify(err))
if (err && err.status == 401) { if (err && err.status == 401) {
login(); login();
} }
......
...@@ -320,7 +320,7 @@ create.Page({ ...@@ -320,7 +320,7 @@ create.Page({
this.conflictPeople() this.conflictPeople()
this.resetRepeatList() this.resetRepeatList()
}, },
addSchedule: throttle(function () { addSchedule: throttle(async function () {
let data = { let data = {
title: this.data.title || `${getApp().globalData.name}创建的会议`, title: this.data.title || `${getApp().globalData.name}创建的会议`,
location: { location: {
...@@ -339,40 +339,27 @@ create.Page({ ...@@ -339,40 +339,27 @@ create.Page({
meetingRoomId: this.$store.data.roomId, meetingRoomId: this.$store.data.roomId,
meetingWayModel: this.data.meetingWayModel meetingWayModel: this.data.meetingWayModel
} }
addSchedule(data).then(res => { const res = await addSchedule(data);
if (res.data.code === 0) { if (res.data.code === 0) {
this.$store.data.tabBarIndex = '1' this.$store.data.tabBarIndex = '1'
if (this.data.repeatable === 0) { if (this.data.repeatable === 0) {
// this.$store.data.onceMeetingContent = { if (this.$store.addOnceMeeting) {
// startTime: new Date(this.$store.data.startTime), await this.$store.addOnceMeeting({
// endTime: new Date(this.$store.data.endTime), startTime: new Date(this.$store.data.startTime),
// confirmAttendance: res.data.data.confirmAttendance, endTime: new Date(this.$store.data.endTime),
// title: res.data.data.title, confirmAttendance: res.data.data.confirmAttendance,
// id: res.data.data.id title: res.data.data.title,
// } id: res.data.data.id
if (this.$store.addOnceMeeting) { })
this.$store.addOnceMeeting({
startTime: new Date(this.$store.data.startTime),
endTime: new Date(this.$store.data.endTime),
confirmAttendance: res.data.data.confirmAttendance,
title: res.data.data.title,
id: res.data.data.id
})
}
} else {
if (this.$store.modifyErpeatMeeting) {
this.$store.modifyErpeatMeeting()
}
// this.$store.data.indexNeedUpdate = true
} }
this.update() } else {
dd.navigateBack({ if (this.$store.modifyErpeatMeeting) {
delta: 1 await this.$store.modifyErpeatMeeting()
}) }
} }
}) dd.navigateBack()
}
}), }),
// 获取时间参数 // 获取时间参数
......
...@@ -97,20 +97,20 @@ create.Page({ ...@@ -97,20 +97,20 @@ create.Page({
//获取日程列表 //获取日程列表
this.getData(); this.getData();
this.$store.modifyOnceMeetingContent = (content) => { this.$store.modifyOnceMeetingContent = async (content) => {
this.modifyOnceMeetingContent(content); await this.modifyOnceMeetingContent(content);
} }
this.$store.modifyErpeatMeeting = () => { this.$store.modifyErpeatMeeting = async () => {
this.modifyErpeatMeeting() await this.modifyErpeatMeeting()
} }
this.$store.addOnceMeeting = (content) => { this.$store.addOnceMeeting = async (content) => {
this.addOnceMeeting(content) await this.addOnceMeeting(content)
} }
this.update(); this.update();
}, },
//添加单次会议 //添加单次会议
addOnceMeeting(content) { async addOnceMeeting(content) {
this.getData(true); await this.getData(true);
dd.setNavigationBar({ dd.setNavigationBar({
title: "日程" title: "日程"
}); });
...@@ -124,12 +124,12 @@ create.Page({ ...@@ -124,12 +124,12 @@ create.Page({
}); });
}, },
//修改重复会议 //修改重复会议
modifyErpeatMeeting() { async modifyErpeatMeeting() {
this.getData(); await this.getData();
}, },
//修改会议,除单次会议修改成重复会议 //修改会议,除单次会议修改成重复会议
modifyOnceMeetingContent(content) { async modifyOnceMeetingContent(content) {
this.getData(true); await this.getData(true);
const scheduleListIndex = `scheduleList[${this.data.scheduleListIndex}].value`; const scheduleListIndex = `scheduleList[${this.data.scheduleListIndex}].value`;
const item = this.data.scheduleList[this.data.scheduleListIndex].value const item = this.data.scheduleList[this.data.scheduleListIndex].value
this.setData({ this.setData({
...@@ -148,8 +148,8 @@ create.Page({ ...@@ -148,8 +148,8 @@ create.Page({
} }
} }
}, },
getData(onlyChangeSign) { async getData(onlyChangeSign) {
getHomeUserSchedule1({ await getHomeUserSchedule1({
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"
}).then(res => { }).then(res => {
...@@ -213,6 +213,8 @@ create.Page({ ...@@ -213,6 +213,8 @@ create.Page({
this.timer = null; this.timer = null;
}, },
refresh() { refresh() {
this.isFirstLoad = true;
this.isLoaded = false;
this.onLoad(); this.onLoad();
}, },
//动态列表侧滑的时候禁止页面上下滑动 //动态列表侧滑的时候禁止页面上下滑动
......
...@@ -651,8 +651,6 @@ create.Page({ ...@@ -651,8 +651,6 @@ create.Page({
return new Promise((resolve, rejects) => { return new Promise((resolve, rejects) => {
modifySchedule(Object.assign(data, obj)).then(res => { modifySchedule(Object.assign(data, obj)).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
// that.$store.data.indexNeedUpdate = true
// that.update()
if (data.modifyContent !== 'title') { if (data.modifyContent !== 'title') {
if (this.$store.modifyErpeatMeeting) { if (this.$store.modifyErpeatMeeting) {
this.$store.modifyErpeatMeeting() this.$store.modifyErpeatMeeting()
...@@ -754,8 +752,6 @@ create.Page({ ...@@ -754,8 +752,6 @@ create.Page({
} }
isParticipate(data1).then(res => { isParticipate(data1).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
// this.$store.data.indexNeedUpdate = true
// this.update()
this.setData({ this.setData({
confirmAttendance: 0 confirmAttendance: 0
}) })
...@@ -782,8 +778,6 @@ create.Page({ ...@@ -782,8 +778,6 @@ create.Page({
} }
isParticipate(data).then(res => { isParticipate(data).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
// this.$store.data.indexNeedUpdate = true
// this.update()
this.setData({ this.setData({
aheadTimes: [15], aheadTimes: [15],
'comListData.aheadTimesListId': [15], 'comListData.aheadTimesListId': [15],
...@@ -817,11 +811,10 @@ create.Page({ ...@@ -817,11 +811,10 @@ create.Page({
templateId: this.data.scheduleItem.scheduleTemplateId, templateId: this.data.scheduleItem.scheduleTemplateId,
planDate: this.data.scheduleItem.planDate planDate: this.data.scheduleItem.planDate
} }
deleteSchedule(data).then(res => { deleteSchedule(data).then(async () => {
if (this.$store.modifyErpeatMeeting) { if (this.$store.modifyErpeatMeeting) {
this.$store.modifyErpeatMeeting() await this.$store.modifyErpeatMeeting()
} }
// _that.$store.data.indexNeedUpdate = true;
_that.$store.data.isIndexAffairListNeedUpdate = true; _that.$store.data.isIndexAffairListNeedUpdate = true;
_that.update() _that.update()
dd.navigateBack({ dd.navigateBack({
...@@ -1253,11 +1246,10 @@ create.Page({ ...@@ -1253,11 +1246,10 @@ create.Page({
identify: this.data.organizer === getApp().globalData.userid ? 'major' : 'identify', identify: this.data.organizer === getApp().globalData.userid ? 'major' : 'identify',
deleteModel: 'only' deleteModel: 'only'
} }
deleteSchedule(data).then(res => { deleteSchedule(data).then(async () => {
// _that.$store.data.indexNeedUpdate = true;
if (this.$store.modifyErpeatMeeting) { if (this.$store.modifyErpeatMeeting) {
this.$store.modifyErpeatMeeting() await this.$store.modifyErpeatMeeting()
} }
_that.$store.data.isIndexAffairListNeedUpdate = true; _that.$store.data.isIndexAffairListNeedUpdate = true;
_that.update() _that.update()
...@@ -1285,11 +1277,6 @@ create.Page({ ...@@ -1285,11 +1277,6 @@ create.Page({
} else { } else {
isParticipate(data).then(res => { isParticipate(data).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
// this.$store.data.indexNeedUpdate = true
// this.update()
this.setData({ this.setData({
aheadTimes: [15], aheadTimes: [15],
'comListData.aheadTimesListId': [15], 'comListData.aheadTimesListId': [15],
...@@ -1318,8 +1305,6 @@ create.Page({ ...@@ -1318,8 +1305,6 @@ create.Page({
} else { } else {
isParticipate(data).then(res => { isParticipate(data).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
// this.$store.data.indexNeedUpdate = true
// this.update()
this.setData({ this.setData({
confirmAttendance: 0 confirmAttendance: 0
}) })
...@@ -1347,8 +1332,6 @@ create.Page({ ...@@ -1347,8 +1332,6 @@ create.Page({
} }
isParticipate(data).then(res => { isParticipate(data).then(res => {
if (res.data.code === 0) { if (res.data.code === 0) {
// this.$store.data.indexNeedUpdate = true
// this.update()
this.setData({ this.setData({
confirmAttendance: -9 confirmAttendance: -9
}) })
......
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