Commit e51e72c7 by fengzhaoyu

请求空格 冲突列表

parents 01060816 26382446
...@@ -24,8 +24,7 @@ export default function http (data) { ...@@ -24,8 +24,7 @@ export default function http (data) {
} else { } else {
return new Promise((resolve, rejects) => { return new Promise((resolve, rejects) => {
login().then(res => { login().then(res => {
// getApp().globalData.token = res.data.data.accessToken.access_token //'3a025eee-15ae-4805-9214-fe0599d47f17' // getApp().globalData.token = res.data.data.accessToken.access_token //'3a025eee-15ae-4805-9214-fe0599d47f17' //
getApp().globalData.token = '0a081219-f3ea-481c-a17d-19ea5b75da8d' //'3a025eee-15ae-4805-9214-fe0599d47f17' //
getApp().globalData.name = res.data.data.oapiUser.name getApp().globalData.name = res.data.data.oapiUser.name
getApp().globalData.userid = res.data.data.oapiUser.userid getApp().globalData.userid = res.data.data.oapiUser.userid
getApp().globalData.avatar = res.data.data.oapiUser.avatar getApp().globalData.avatar = res.data.data.oapiUser.avatar
......
...@@ -148,7 +148,7 @@ export function getHomeUserSchedule (data) { ...@@ -148,7 +148,7 @@ export function getHomeUserSchedule (data) {
return $http({ return $http({
method: 'post', method: 'post',
data: JSON.stringify(data), data: JSON.stringify(data),
url: `/meet/schedule/getHomeUserSchedule ` url: `/meet/schedule/getHomeUserSchedule`
}) })
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<view class="weekTime"> <view class="weekTime">
{{week1}} {{week1}}
</view> </view>
<!-- <view class="line {{!!timeStaus ? 'selectLine' : ''}}"> --> <!--<view class="line {{!!timeStaus ? 'selectLine' : ''}}"> -->
</view> </view>
<view class="endTime {{timeStaus === '1' ? 'selectTime' : ''}}" data-timeStaus="1" onTap="selectTime"> <view class="endTime {{timeStaus === '1' ? 'selectTime' : ''}}" data-timeStaus="1" onTap="selectTime">
<view class="timeContainer"> <view class="timeContainer">
...@@ -39,12 +39,11 @@ ...@@ -39,12 +39,11 @@
<view class="icon iconfont icondingwei"> <view class="icon iconfont icondingwei">
</view> </view>
<view class="text" data-nextPage="place" onTap="nextPage"> <view class="text" data-nextPage="place" onTap="nextPage">
<view class="selectPlace" a:if="{{!!locationName}}"> <view class="selectPlace" a:if="{{!!locationName}}">
<text>{{locationName}}</text> <text>{{locationName}}</text>
<text class="iconshanchu iconfont" catchTap="closePlace"></text> <text class="iconshanchu iconfont" catchTap="closePlace"></text>
</view> </view>
<text a:else>添加地点</text> <text a:else>添加地点</text>
</view> </view>
</view> </view>
<!-- 参会人 --> <!-- 参会人 -->
...@@ -72,9 +71,10 @@ ...@@ -72,9 +71,10 @@
</view> </view>
<view class="tip"> <view class="tip">
<text class="noConflict" a:if="{{conflictPeope === []}}"> <text class="noConflict" a:if="{{conflictPeope === []}}">
所有参与者都有空</text> 所有参与者都有空
</text>
<text class="conflict" a:else> <text class="conflict" a:else>
<text class="conflict" a:if="{{conflictPeople.includes(item.userId)}}" a:for="{{participatorList}}" a:for-item="item">{{item.username}}</text> 会议冲突 <text class="conflict" a:if="{{conflictPeople.includes(item.userId)}}" a:for="{{participatorList}}" a:for-item="item">{{item.username}}</text> 会议冲突
</text> </text>
</view> </view>
</view> </view>
...@@ -86,8 +86,9 @@ ...@@ -86,8 +86,9 @@
<view class="icon iconfont iconfont iconhuiqiantixing"> <view class="icon iconfont iconfont iconhuiqiantixing">
</view> </view>
<view class="text"> <view class="text">
<text>提前15分钟提醒 {{conflictPeople.length}} <text>
</text> 提前15分钟提醒
</text>
<text class="close iconshanchu iconfont"></text> <text class="close iconshanchu iconfont"></text>
</view> </view>
</view> </view>
...@@ -99,7 +100,4 @@ ...@@ -99,7 +100,4 @@
</view> </view>
</view> </view>
<mw-modal isShowModal="{{isShowModal}}" time="{{propsTime}}" onChange="changeSelectTime"> <mw-modal isShowModal="{{isShowModal}}" time="{{propsTime}}" onChange="changeSelectTime">
</mw-modal> </mw-modal>
<!-- <mw-message visible="{true}" onDmMessageHide="onDmMessageHide" type="{{type}}" content="{{content}}" duration="800"></mw-message> -->
\ No newline at end of file
import create from 'dd-store' import create from 'dd-store'
import exampleStore from '/stores/exampleStore' import exampleStore from '/stores/exampleStore'
// import { addSchedule, getUserScheduleInTime, getHomeUserSchedule } from '../../api/request.js' import { addSchedule, getUserScheduleInTime, getHomeUserSchedule } from '../../api/request.js'
import { getHomeUserSchedule } from '../../api/request.js'
import { stringify } from 'querystring'; import { stringify } from 'querystring';
create.Page({ create.Page({
store: exampleStore, store: exampleStore,
...@@ -18,24 +16,10 @@ create.Page({ ...@@ -18,24 +16,10 @@ create.Page({
propsTime: '', propsTime: '',
}, },
onLoad() { onLoad() {
let data = {
"startTime":"2020-01-01 00:00:00",
"endTime":"2025-12-30 23:59:59"
}
try {
getHomeUserSchedule(data).then(res => {
console.log(res)
}).catch(err => {
console.log(111)
})
}catch(e){
dd.alert({content: e})
}
this.store.data.conflictPeople = [] this.store.data.conflictPeople = []
this.store.data.participatorList = [] this.store.data.participatorList = []
this.store.data.locationName = '' this.store.data.locationName = ''
this.store.data.participatorUserId = [getApp().globalData.userid] this.store.data.participatorUserId.push(getApp().globalData.userid)
this.update() this.update()
dd.setNavigationBar({ dd.setNavigationBar({
title: '创建会议' title: '创建会议'
...@@ -48,7 +32,6 @@ create.Page({ ...@@ -48,7 +32,6 @@ create.Page({
var w = weekList[date.getDay()]; var w = weekList[date.getDay()];
var h = date.getHours() var h = date.getHours()
var min = date.getMinutes(); var min = date.getMinutes();
console.log(h, min)
this.setData({ this.setData({
time1: `${y}/${m}/${d} ${h < 10 ? "0" + date.getHours() : date.getHours()}:${min < 30 ? '00' : '30'}`, time1: `${y}/${m}/${d} ${h < 10 ? "0" + date.getHours() : date.getHours()}:${min < 30 ? '00' : '30'}`,
time2: `${y}/${m}/${d} ${min < 30 ? h < 10 ? "0" + date.getHours() : date.getHours() : (h + 1) < 10 ? "0" + (date.getHours() + 1) : date.getHours() + 1}:${min < 30 ? '30' : '00'}`, time2: `${y}/${m}/${d} ${min < 30 ? h < 10 ? "0" + date.getHours() : date.getHours() : (h + 1) < 10 ? "0" + (date.getHours() + 1) : date.getHours() + 1}:${min < 30 ? '30' : '00'}`,
...@@ -73,7 +56,6 @@ create.Page({ ...@@ -73,7 +56,6 @@ create.Page({
}, },
// 选择时间组件回调 // 选择时间组件回调
changeSelectTime(e) { changeSelectTime(e) {
console.log(e)
if (e.status === 1) { if (e.status === 1) {
var date1 = new Date(e.time); var date1 = new Date(e.time);
var weekList = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'] var weekList = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
...@@ -161,9 +143,13 @@ create.Page({ ...@@ -161,9 +143,13 @@ create.Page({
}, },
// 跳转下一页 // 跳转下一页
nextPage(event) { nextPage(event) {
let time = {
time1: this.data.time1,
time2: this.data.time2
}
switch (event.target.dataset.nextPage) { switch (event.target.dataset.nextPage) {
case 'participantsDetail': case 'participantsDetail':
dd.navigateTo({ url: './../participantsDetail/participantsDetail' }) dd.navigateTo({ url: `./../participantsDetail/participantsDetail?time=${JSON.stringify(time)}` })
break; break;
case 'place': case 'place':
dd.navigateTo({ url: './../place/place' }) dd.navigateTo({ url: './../place/place' })
...@@ -199,7 +185,7 @@ create.Page({ ...@@ -199,7 +185,7 @@ create.Page({
}, },
meetingRoomId: 222 || null meetingRoomId: 222 || null
} }
getHomeUserSchedule(data).then(res => { addSchedule(data).then(res => {
dd.navigateBack({ dd.navigateBack({
delta: 1 delta: 1
}) })
...@@ -226,8 +212,6 @@ create.Page({ ...@@ -226,8 +212,6 @@ create.Page({
} }
} }
this.update() this.update()
}).catch(err => {
dd.alert({content:'1'})
}) })
} }
}); });
import { getHomeUserSchedule } from '../../api/request.js' import { getHomeUserSchedule } from '../../api/request.js'
Page({ Page({
data: {
AllScheduleList: [],
scheduleList: []
},
onLoad(query) { onLoad(query) {
// 页面加载 // 页面加载
dd.setNavigationBar({ dd.setNavigationBar({
...@@ -9,8 +13,18 @@ Page({ ...@@ -9,8 +13,18 @@ Page({
"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"
} }
let that = this
getHomeUserSchedule(data).then(res => { getHomeUserSchedule(data).then(res => {
console.log(res) that.setData({
AllScheduleList: res.data.data
},() => {
let now = new Date()
let year = now.getFullYear();
let scheduleList = this.returnScheduleList(year);
that.setData({
scheduleList: scheduleList
})
})
}) })
}, },
onReady() { onReady() {
...@@ -19,6 +33,46 @@ Page({ ...@@ -19,6 +33,46 @@ Page({
onShow() { onShow() {
// 页面显示 // 页面显示
}, },
returnScheduleList (year) {
let DateMap = new Map();
if (year % 4 == 0 && year % 100 != 0 || year % 400 ==0) {
for(let i = 1; i <= 366; i++) {
DateMap.set(`${new Date(year, 0, i).toLocaleDateString()}`, {
scheduleList:[]
})
}
} else {
for(let i = 1; i <= 365; i++) {
DateMap.set(`${new Date(year, 0, i).toLocaleDateString()}`, {
scheduleList:[]
})
}
}
for(let y=0;y<this.data.AllScheduleList.length;y++) {
let date1 = this.data.AllScheduleList[y].startTime.slice(0,10)
let date2 = this.data.AllScheduleList[y].endTime.slice(0,10)
let count = this.count(date1, date2)
if(count == 0) {
DateMap.get(`${new Date(this.data.AllScheduleList[y].startTime).toLocaleDateString()}`).scheduleList.push(this.data.AllScheduleList[y])
} else {
for(let j = 0;j<=count;j++) {
let time = new Date();
time.setDate(time.getDate()+j)
// let finalDate = day.setDate(day.getDate()+j)
console.log(`${time.getFullYear()}/${time.getMonth()+1}/${time.getDate()}`)
DateMap.get(`${time.getFullYear()}/${time.getMonth()+1}/${time.getDate()}`).scheduleList.push(this.data.AllScheduleList[y])
}
}
}
console.log(DateMap)
return DateMap
},
count(date1, date2){
var date1=new Date(date1);
var date2=new Date(date2);
var date=(date2.getTime()-date1.getTime())/(1000*60*60*24);/*不用考虑闰年否*/
return date
},
onHide() { onHide() {
// 页面隐藏 // 页面隐藏
}, },
......
import create from 'dd-store' import create from 'dd-store'
import exampleStore from '/stores/exampleStore' import exampleStore from '/stores/exampleStore'
import { addSchedule, getUserScheduleInTime, getHomeUserSchedule } from '../../api/request.js'
create.Page({ create.Page({
store: exampleStore, store: exampleStore,
useAll: true, useAll: true,
time1: '',
time2: '',
data: { data: {
}, },
onLoad() { onLoad(event) {
console.log(JSON.parse(event.time))
this.setData({
time1: event.time1,
time2: event.time1
})
dd.setNavigationBar({ dd.setNavigationBar({
title: `参会人(${this.store.data.participatorList.length}人)` title: `参会人(${this.store.data.participatorList.length}人)`
}) })
...@@ -13,10 +21,7 @@ create.Page({ ...@@ -13,10 +21,7 @@ create.Page({
}, },
// 保存信息 // 保存信息
saveInfo() { saveInfo() {
dd.navigateBack({ this.conflict()
delta: 1
})
}, },
// 添加参会人 // 添加参会人
addParticipants() { addParticipants() {
...@@ -66,7 +71,6 @@ create.Page({ ...@@ -66,7 +71,6 @@ create.Page({
dd.setNavigationBar({ dd.setNavigationBar({
title: `参会人(${this.store.data.participatorList.length}人)` title: `参会人(${this.store.data.participatorList.length}人)`
}) })
}, },
// 数组去重 // 数组去重
setArrary(arr, userId) { setArrary(arr, userId) {
...@@ -77,4 +81,23 @@ create.Page({ ...@@ -77,4 +81,23 @@ create.Page({
} }
return Object.values(containt) return Object.values(containt)
}, },
// 会议冲突
conflict() {
let data = {
startTime: `${this.data.time1}:00`,
endTime: `${this.data.time2}:00`,
userIds: this.store.data.participatorUserId
}
getUserScheduleInTime(data).then(res => {
for (let value in res.data.data) {
if (!!res.data.data[value].length) {
this.store.data.conflictPeople.push(value)
}
}
this.update()
dd.navigateBack({
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