Commit bb08e258 by liang ce

修改解绑绑定outlook逻辑

parent 55b9f0a9
const app = getApp();
import $http from "./http";
import $binding from "./binding";
// 获取创建会议室的会议室列表
export function getMeetingRoom(data) {
return $http({
method: "get",
data: data,
url: "/meet/meeting-room/page"
});
}
// 获取会议室分类
// 办公区域
// OFFICE_LOCATION(0,"meeting_room_location")
// 会议室设施
// OFFICE_FACILITY(1,"meeting_room_facility")
// 会议室分类
// OFFICE_CATEGORY(2,"meeting_room_category")
export function getLabelTree(data) {
return $http({
method: "get",
data: data,
url: "/admin/label/tree"
});
}
// 更新办公区域,设施,分类
export function getMettingRoomLabelUpdate(data) {
return $http({
method: "POST",
data: JSON.stringify(data),
url: "/admin/label/update"
});
}
// 添加办公区域、会议室分类、会议室设置
export function getMettingRoomLabelSave(data) {
return $http({
method: "POST",
data: JSON.stringify(data),
url: "/admin/label/save"
});
}
// 删除办公区域、会议室分类、会议室设置
export function getMettingRoomLabelRemove(data) {
return $http({
method: "get",
data: data,
url: `/admin/label/remove/${data}`
});
}
// 删除会议室
export function getRemoveMeetingRoom(data) {
return $http({
method: "get",
data: "",
url: `/meet/meeting-room/remove/${data}`
});
}
// 创建会议室
export function saveMettingRoom(data) {
return $http({
method: "post",
data: JSON.stringify(data),
url: "/meet/meeting-room/save"
});
}
// 修改会议室
export function mettingRoomUpdate(data) {
return $http({
method: "post",
data: JSON.stringify(data),
url: "/meet/meeting-room/update"
});
}
// 获取会议室详情
export function getMeetingRoomVOByUuid(data) {
return $http({
method: "get",
data: "",
url: `/meet/meeting-room/getMeetingRoomVOByUuid/${data}`
});
}
// 获取我的会议
export function myMeetingPage(data) {
return $http({
method: "post",
data: JSON.stringify(data),
url: "/meet/meeting/myPage"
});
}
// 获取预定会议室列表
export function getReserveRoomList(data) {
return $http({
......@@ -97,24 +11,6 @@ export function getReserveRoomList(data) {
});
}
// 获取预定会议详情
export function getMyMeetingDetails(data) {
return $http({
method: "get",
data: "",
url: `/meet/meeting/${data}`
});
}
// 修改预定时间设置
export function updateGlobalSetting(data) {
return $http({
method: "post",
data: JSON.stringify(data),
url: `/meet/meeting-global-setting/update`
});
}
// 获取首页信息
export function getHomeUserSchedule(data) {
return $http({
......@@ -318,3 +214,12 @@ export function getThirdUserPlatForm(data) {
url: `/admin/third/user/getThirdUserPlatForm`
});
}
// 解绑第三方app
export function unbindingApp(data) {
return $http({
method: "get",
data: "",
url: `/admin/third/user/remove/${data}`
});
}
......@@ -11,7 +11,7 @@
<view class="applicationList" a:for="{{relatedAppList}}" a:if="{{item.platform !== 'dingTalk'}}">
<view class="applicationLogo {{item.platform}}">
</view>
<view class="applicationMsg">
<view class="applicationMsg" data-item="{{item}}" catchTap="toAppDetails">
<view>
<view>
{{item.thirdUserIdentify}}
......@@ -33,7 +33,7 @@
<view class="applicationList" a:if="{{relatedAppPlatformList.indexOf('outlook') === -1}}">
<view class="applicationLogo outlook">
</view>
<view class="applicationMsg" catchTap="bindingOutlook">
<view class="applicationMsg" data-platform="outlook" catchTap="bindingOutlook">
<view>
<view>
Outlook日历
......
import { getThirdUserPlatForm } from "../../api/request";
import { throttle } from "../../utils/utils";
import create from "dd-store";
create.Component({
mixins: [],
......@@ -13,18 +14,34 @@ create.Component({
this.setData({
userInfo: JSON.parse(getApp().globalData.userInfo)
});
this.getDate();
this.getData();
},
didUpdate() {
if (this.$store.data.relatedAppNeedUpdate) {
this.$store.data.relatedAppNeedUpdate = false;
if (typeof this.$store.data.relatedAppNeedUpdate === "object") {
let relatedAppList = this.data.relatedAppList;
let relatedAppPlatformList = this.data.relatedAppPlatformList;
relatedAppList.push({
thirdUserIdentify: this.$store.data.relatedAppNeedUpdate.name,
platform: this.$store.data.relatedAppNeedUpdate.platform
});
relatedAppPlatformList.push(
this.$store.data.relatedAppNeedUpdate.platform
);
this.setData({
relatedAppList: relatedAppList,
relatedAppPlatformList: relatedAppPlatformList
});
this.$store.data.relatedAppNeedUpdate = "";
this.update();
} else if (this.$store.data.relatedAppNeedUpdate === "1") {
this.$store.data.relatedAppNeedUpdate = "";
this.update();
this.getDate();
this.getData();
}
},
didUnmount() { },
didUnmount() {},
methods: {
getDate() {
getData() {
getThirdUserPlatForm().then(res => {
let relatedAppPlatformList = [];
res.data.data.forEach(item => {
......@@ -32,15 +49,24 @@ create.Component({
});
this.setData({
relatedAppList: res.data.data,
relatedAppPlatformList: relatedAppPlatformList
relatedAppPlatformList: res.data.data.map(it => it.platform)
});
});
},
preventSort() {
return false;
},
bindingOutlook() {
dd.navigateTo({ url: "./../bindingOutlook/bindingOutlook" });
bindingOutlook(e) {
dd.navigateTo({
url: `./../bindingOutlook/bindingOutlook?platform=${e.target.dataset.platform}`
});
},
toAppDetails(e) {
dd.navigateTo({
url: `./../outlookDetails/outlookDetails?item=${JSON.stringify(
e.target.dataset.item
)}`
});
}
}
});
......@@ -6,9 +6,13 @@ import create from "dd-store";
create.Page({
data: {
$data: null,
url: ""
url: "",
platform: ''
},
onLoad() {
onLoad(e) {
this.setData({
platform: e.platform
})
this.webViewContext = dd.createWebViewContext("web-view-1");
let data = `${getApp().globalData.userid},${dd.corpId}`;
getOutlookUrl(data).then(res => {
......@@ -26,7 +30,10 @@ create.Page({
};
authorizationCodeReplacementToken(data).then(res => {
if (res.data.data) {
this.$store.data.relatedAppNeedUpdate = true;
this.$store.data.relatedAppNeedUpdate = {
name: res.data.data,
platform: this.data.platform
}
this.update();
dd.navigateBack({
delta: 1
......
import {
getMeetingRoom,
myMeetingPage,
getReserveRoomList,
getAllScheduleWithMeetingRoomByTime
} from "../../api/request";
......
.relatedAppPage {
height: 100vh;
background: #FFFFFF;
}
.platformMsg {
display: flex;
padding: 34rpx 32rpx;
align-items: center;
}
.platformImg {
width: 60rpx;
height: 60rpx;
margin-right: 24rpx;
}
.outlook {
background: url(../../assests/outlookLogo.png) center /100% 100%;
}
.zoom {
background: url(../../assests/zoomLogo.png) center /100% 100%;
}
.unBinding {
width: 686rpx;
height: 96rpx;
margin: 22rpx auto;
border-radius: 48rpx;
border: 2rpx solid rgba(222, 222, 222, 1);
text-align: center;
line-height: 0.96rem;
font-size: 34rpx;
color: rgba(242, 86, 67, 1);
}
\ No newline at end of file
<view>
New Page
<view class="relatedAppPage">
<view class="platformMsg" a:if="{{item.platform === 'outlook'}}">
<view class="platformImg {{item.platform}}">
</view>
<view class="platformName">
{{item.thirdUserIdentify}}
</view>
</view>
<view class="platformMsg" a:if="{{item.platform === 'zoom'}}">
<view class="platformImg {{item.platform}}">
</view>
<view class="platformName">
{{item.thirdUserIdentify}}
</view>
</view>
<view class="unBinding" onTap="unbind">
取消关联
</view>
</view>
\ No newline at end of file
import {} from "../../api/request";
import { unbindingApp } from "../../api/request";
import create from "dd-store";
create.Page({
data: {
$data: null,
item: ""
},
onLoad() {},
onLoad(e) {
this.setData({
item: JSON.parse(e.item)
});
},
unbind() {
unbindingApp(this.data.item.platform).then(res => {
if (res.data.data) {
this.$store.data.relatedAppNeedUpdate = "1";
this.update();
dd.navigateBack({
delta: 1
});
}
});
}
});
......@@ -5,7 +5,14 @@ import {
updateMeetingTask,
getHomeUserSchedule1
} from "../../api/request";
import { getDateMap, getExcludeDate, getNextDateList, getWeekNumber, getBlankList, toLocaleDateString } from './schedule.js';
import {
getDateMap,
getExcludeDate,
getNextDateList,
getWeekNumber,
getBlankList,
toLocaleDateString
} from "./schedule.js";
import {
getFormatDate,
throttle,
......@@ -27,17 +34,16 @@ create.Page({
todayStr: toLocaleDateString(currentDate),
currentData: toLocaleDateString(currentDate),
currentDataIndex: 0,
offset: 'stop',
offset: "stop",
show: false,
loading: true,
traceTime: '1970-03-01 00:00:00',
traceTime: "1970-03-01 00:00:00",
isStopBodyScroll: false,
dynamicList: [],
current: 1,
pages: 1,
listLoading: true,
isFullscreen: false
},
scrollTop: 0,
pageSize: 10,
......@@ -59,15 +65,15 @@ create.Page({
}
//单次会议往DateMap中添加
if (this.$store.data.onceMeetingContent) {
this.getScheduleList(this.$store.data.onceMeetingContent, 'once');
this.getScheduleList(this.$store.data.onceMeetingContent, "once");
}
},
onLoad() {
this.setData({
isFullscreen: getApp().globalData.isFullscreen
})
});
dd.setNavigationBar({
title: this.$store.data.tabBarIndex == '0' ? "动态" : '日程'
title: this.$store.data.tabBarIndex == "0" ? "动态" : "日程"
});
//获取动态列表
this.getPages(1);
......@@ -79,12 +85,12 @@ create.Page({
setBodyDisableScroll(isStopBodyScroll) {
this.setData({
isStopBodyScroll
})
});
},
//点击页面关闭侧滑模块
closeSwipe() {
if (this.$store.closeActiveSwipe) {
this.$store.closeActiveSwipe()
this.$store.closeActiveSwipe();
}
},
getPages(current, callBack) {
......@@ -95,12 +101,11 @@ create.Page({
if (!res.data.data) {
this.setData({
listLoading: false
})
});
return;
}
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
......@@ -113,7 +118,7 @@ create.Page({
}
let itemData = item.meetingLogDataList[i].meetingLogResource;
if (itemData) {
itemData.groupId = item.groupId
itemData.groupId = item.groupId;
if (itemData.taskInfos || itemData.fileInfos) {
if (itemData.creatorInfo) {
itemData.creatorInfo = JSON.parse(itemData.creatorInfo);
......@@ -130,7 +135,7 @@ create.Page({
}
}
}
return item
return item;
});
//第一页数据会重新请求需要替换
......@@ -147,10 +152,10 @@ create.Page({
this.setData({
listLoading: false,
current: res.data.data.current,
pages: res.data.data.pages,
pages: res.data.data.pages
});
if (callBack) {
callBack()
callBack();
}
});
},
......@@ -166,8 +171,8 @@ create.Page({
// 重新获取第一页的数据
this.getPages(1, () => {
dd.showToast({
content: '取消成功'
})
content: "取消成功"
});
});
} else {
//置顶
......@@ -176,14 +181,17 @@ create.Page({
dynamicList[index].traceTime = res.data.data;
dynamicList.splice(index, 1);
dynamicList.unshift(replaceItem);
this.setData({
this.setData(
{
dynamicList: dynamicList
}, () => {
},
() => {
dd.showToast({
content: '置顶成功'
})
content: "置顶成功"
});
}
);
}
});
},
//动态上拉加载分页数据
......@@ -233,9 +241,10 @@ create.Page({
const centerPage = Math.floor(i / this.pageSize);
// firstPage转为4的倍数,一次下拉加载40条
const firstPage = centerPage - 2;
this.firstPage = firstPage % 4 == 0 ? firstPage : firstPage - firstPage % 4;
this.firstPage =
firstPage % 4 == 0 ? firstPage : firstPage - (firstPage % 4);
this.currentPage = centerPage + 2;
break
break;
}
}
},
......@@ -253,41 +262,40 @@ create.Page({
endTime: endTime,
startTime: startTime,
planDate: getFormatDate(startTime, "yyyyMMdd", "-"),
thisDayStartTime: getFormatDate(startTime, 'HH:mm'),
thisDayEndTime: getFormatDate(endTime, 'HH:mm'),
thisDayStartTime: getFormatDate(startTime, "HH:mm"),
thisDayEndTime: getFormatDate(endTime, "HH:mm"),
confirmAttendance: item.confirmAttendance,
title: item.title,
id: item.id,
isBeOverdue: currentDate.getTime() > endTime.getTime() ? true : false
};
//模板会议id为空
if (type == 'repeat') {
if (type == "repeat") {
pushItem.scheduleTemplateId = item.id;
pushItem.id = ''
pushItem.id = "";
}
// 如果是跨天会议,需要手动在起始天以后的其他天 添加会议日程
const nextDateList = getNextDateList(startTime, endTime);//返回日期包括起始天
const nextDateList = getNextDateList(startTime, endTime); //返回日期包括起始天
if (nextDateList.length > 1) {
pushItem.isDaySpan = true;
pushItem.isFewDays = 1;
pushItem.isfirstDayOrEndDay = '0'// 0 第一天,1中间的天,2结束的天
pushItem.isfirstDayOrEndDay = "0"; // 0 第一天,1中间的天,2结束的天
pushItem.duration = nextDateList.length;
for (let i = 1; i < nextDateList.length; i++) {
if (DateMap.has(nextDateList[i])) {
DateMap.get(nextDateList[i]).unshift({
...pushItem,
isFewDays: i + 1,
isfirstDayOrEndDay: nextDateList.length - 1 === i ? "2" : "1",// 0 第一天,1中间的天,2结束的天
isfirstDayOrEndDay: nextDateList.length - 1 === i ? "2" : "1" // 0 第一天,1中间的天,2结束的天
});
}
}
}
if (DateMap.has(toLocaleDateString(startTime))) {
DateMap.get(toLocaleDateString(startTime)).push(pushItem)
DateMap.get(toLocaleDateString(startTime)).push(pushItem);
}
},
// 根据接口返回数据生成填充DateMap
setDateMapByResponse(response) {
......@@ -299,16 +307,22 @@ create.Page({
if (item.scheduleTemplateId) {
scheduleListWithTemplateId.push(item);
} else {
this.setDateMapValue(new Date(item.startTime.replace(/-/g, '/')), new Date(item.endTime.replace(/-/g, '/')), item);
this.setDateMapValue(
new Date(item.startTime.replace(/-/g, "/")),
new Date(item.endTime.replace(/-/g, "/")),
item
);
}
});
// 处理重复会议 templateList
response.templateList.forEach(item => {
//日程会议
const itemScheduleList = scheduleListWithTemplateId.filter(it => it.scheduleTemplateId == item.id);
const itemScheduleList = scheduleListWithTemplateId.filter(
it => it.scheduleTemplateId == item.id
);
// 生成rrules规则
const initialTimeList = item.initialTime.split('-');
const initialTimeList = item.initialTime.split("-");
const startTimeList = item.startTime.split(":");
const DTSTART = `${initialTimeList[0]}${initialTimeList[1]}${initialTimeList[2]}T${startTimeList[0]}${startTimeList[1]}00Z`;
const rule = RRule.fromString(
......@@ -319,14 +333,20 @@ create.Page({
//如果有日程会议则用日程会议替换
let replaceItem = [];
if (itemScheduleList.length > 0) {
replaceItem = itemScheduleList.filter(it => it.planDate == getFormatDate(startTime, "yyyyMMdd", "-"))
replaceItem = itemScheduleList.filter(
it => it.planDate == getFormatDate(startTime, "yyyyMMdd", "-")
);
}
if (replaceItem.length > 0) {
this.setDateMapValue(new Date(replaceItem[0].startTime.replace(/-/g, '/')), new Date(replaceItem[0].endTime.replace(/-/g, '/')), replaceItem[0]);
this.setDateMapValue(
new Date(replaceItem[0].startTime.replace(/-/g, "/")),
new Date(replaceItem[0].endTime.replace(/-/g, "/")),
replaceItem[0]
);
} else {
this.setDateMapValue(startTime, endTime, item, 'repeat');
}
this.setDateMapValue(startTime, endTime, item, "repeat");
}
};
// 需要剔除某一天
if (item.excludePlanDates) {
const excludeData = getExcludeDate(item.excludePlanDates.split(","));
......@@ -335,10 +355,16 @@ create.Page({
startTime.setHours(startTime.getHours() - 8);
// 生成结束时间
const endTime = new Date(startTime);
endTime.setMinutes(endTime.getMinutes() + item.recurrenceModel.duration);
endTime.setMinutes(
endTime.getMinutes() + item.recurrenceModel.duration
);
// 剔除规则: 时间小于futureTime 时间不在单个排除日期里面
if (startTime.getTime() < excludeData.minFutureTime &&
!excludeData.excludeDateList.includes(getFormatDate(startTime, "yyyyMMdd", "-"))) {
if (
startTime.getTime() < excludeData.minFutureTime &&
!excludeData.excludeDateList.includes(
getFormatDate(startTime, "yyyyMMdd", "-")
)
) {
setDateMapValueAll(startTime, endTime, item);
}
});
......@@ -350,25 +376,25 @@ create.Page({
startTime.setHours(startTime.getHours() - 8);
// 生成结束时间
const endTime = new Date(startTime);
endTime.setMinutes(endTime.getMinutes() + item.recurrenceModel.duration);
endTime.setMinutes(
endTime.getMinutes() + item.recurrenceModel.duration
);
setDateMapValueAll(startTime, endTime, item);
});
}
});
}
},
//日程数据
getScheduleList(response, type) {
if (type == 'once') {
if (type == "once") {
this.setDateMapValue(response.startTime, response.endTime, response);
} else {
this.setDateMapByResponse(response);
}
// 取出DateMap的value值平铺到DateList
const DateList = [];
DateMap.forEach(function (value, key) {
DateMap.forEach(function(value, key) {
const keyDate = new Date(key);
const year = keyDate.getFullYear();
const month = keyDate.getMonth();
......@@ -398,7 +424,8 @@ create.Page({
const rangeDay2 = new Date(rangeDate).getDate();
DateList.push({
type: "week",
value: `第${getWeekNumber(year, month, date)}周,${month + 1}${date}日 - ${
value: `第${getWeekNumber(year, month, date)}周,${month +
1}${date}日 - ${
rangeMonth2 == month ? "" : rangeMonth2 + 1 + "月"
}${rangeDay2}日`,
dateStr: `${year}/${month + 1}/${date}-week`
......@@ -409,7 +436,7 @@ create.Page({
value.forEach((item, index) => {
if (index === 0) {
DateList.push({
type: key !== toLocaleDateString(currentDate) ? "day" : 'today',
type: key !== toLocaleDateString(currentDate) ? "day" : "today",
week: weekList[day],
hasDateLabel: padZero(date),
value: item,
......@@ -423,7 +450,10 @@ create.Page({
});
}
});
} else if (value.length === 0 && key === toLocaleDateString(currentDate)) {
} else if (
value.length === 0 &&
key === toLocaleDateString(currentDate)
) {
DateList.push({
type: "thisday",
value: "",
......@@ -438,7 +468,10 @@ create.Page({
this.getPagination(this.scheduleList);
// 第一次加载
this.setData({
scheduleList: this.scheduleList.slice(this.firstPage * this.pageSize, this.currentPage * this.pageSize),
scheduleList: this.scheduleList.slice(
this.firstPage * this.pageSize,
this.currentPage * this.pageSize
),
loading: false
});
},
......@@ -447,7 +480,10 @@ create.Page({
if (this.currentPage < this.totalPages) {
this.currentPage++;
this.setData({
scheduleList: this.scheduleList.slice(this.firstPage * this.pageSize, this.currentPage * this.pageSize)
scheduleList: this.scheduleList.slice(
this.firstPage * this.pageSize,
this.currentPage * this.pageSize
)
});
} else {
//超出加载一年的数据
......@@ -457,52 +493,61 @@ create.Page({
this.scheduleList.push(...yearData);
this.setData({
scheduleList: this.scheduleList.slice(this.firstPage * this.pageSize)
})
});
}
},
onPullDownRefresh() {
if (this.$store.data.tabBarIndex == '0') {
if (this.$store.data.tabBarIndex == "0") {
this.getPages(1);
dd.stopPullDownRefresh();
return
return;
}
//日程页面到顶部的时候才下拉加载数据,否则定位距离太长
if (this.$store.data.tabBarIndex == '1' && this.scrollTop !== 0) {
if (this.$store.data.tabBarIndex == "1" && this.scrollTop !== 0) {
dd.stopPullDownRefresh();
return
return;
}
// const todayStr = this.data.scheduleList[0].dateStr;
if (this.firstPage > 0) {
this.firstPage -= 4;
this.currentPage -= 4;
this.setData({
todayStr: '',
scheduleList: this.scheduleList.slice(this.firstPage * this.pageSize, this.currentPage * this.pageSize)
}, () => {
this.setData(
{
todayStr: "",
scheduleList: this.scheduleList.slice(
this.firstPage * this.pageSize,
this.currentPage * this.pageSize
)
},
() => {
this.setData({
todayStr: this.data.scheduleList[this.pageSize * 4 - 1].dateStr
});
dd.stopPullDownRefresh();
});
}
);
} else {
this.minYear--;
const yearData = getBlankList(this.minYear);
this.blankDataLength += yearData.length;
this.scheduleList.unshift(...yearData);
this.totalPages = Math.ceil(this.scheduleList.length / this.pageSize);
this.currentPage = Math.floor(yearData.length * 2 / this.pageSize);
this.setData({
todayStr: '',
scheduleList: this.scheduleList.slice(0, yearData.length * 2),
}, () => {
this.currentPage = Math.floor((yearData.length * 2) / this.pageSize);
this.setData(
{
todayStr: "",
scheduleList: this.scheduleList.slice(0, yearData.length * 2)
},
() => {
this.setData({
//加载一年的数据重定位可能会有点问题,重置一下
currentData: this.scheduleList[yearData.length - 1].dateStr,
currentDataIndex: yearData.length - 1,
todayStr: this.scheduleList[yearData.length - 1].dateStr
});
dd.stopPullDownRefresh()
})
dd.stopPullDownRefresh();
}
);
}
},
//计算高度
......@@ -510,14 +555,14 @@ create.Page({
let height = 0;
let i = 0;
while (height <= scrollTop) {
if (this.data.scheduleList[i].type.indexOf('day') !== '-1') {
height += this.dateHeight
if (this.data.scheduleList[i].type.indexOf("day") !== "-1") {
height += this.dateHeight;
} else {
height += this.otherHeight
height += this.otherHeight;
}
i++
i++;
}
return i
return i;
},
scroll(e) {
//计算有偏差
......@@ -549,18 +594,18 @@ create.Page({
this.setData({
currentData: this.data.scheduleList[0].dateStr,
currentDataIndex: 0
})
});
}
if (this.timer) {
clearTimeout(this.timer)
clearTimeout(this.timer);
}
this.timer = setTimeout(() => {
this.setData({
offset: 'stop'
})
}, 500)
offset: "stop"
});
}, 500);
//每次计算偏移值
const offset = this.getScrollOffset(e.detail.scrollTop);
......@@ -570,51 +615,61 @@ create.Page({
offset
});
}
this.resetToview = false
this.resetToview = false;
}
dd.createSelectorQuery().selectAll('.li').boundingClientRect().exec((rect) => {
if (offset == 'next') {
dd.createSelectorQuery()
.selectAll(".li")
.boundingClientRect()
.exec(rect => {
if (offset == "next") {
for (let i = this.data.currentDataIndex; i < rect[0].length; i++) {
if (rect[0][i].top > 0) {
if (this.data.scheduleList[i].dateStr.split('/')[1] !== this.data.currentData.split('/')[1]) {
if (
this.data.scheduleList[i].dateStr.split("/")[1] !==
this.data.currentData.split("/")[1]
) {
this.setData({
currentData: this.data.scheduleList[i].dateStr,
currentDataIndex: i
})
});
}
break;
}
}
}
else if (offset == 'before') {
let i = Math.min(this.data.currentDataIndex, this.data.scheduleList.length - 1);
} else if (offset == "before") {
let i = Math.min(
this.data.currentDataIndex,
this.data.scheduleList.length - 1
);
for (; i > 0; i--) {
if (rect[0][i].top < 50) {
if (this.data.scheduleList[i].dateStr.split('/')[1] !== this.data.currentData.split('/')[1]) {
if (
this.data.scheduleList[i].dateStr.split("/")[1] !==
this.data.currentData.split("/")[1]
) {
this.setData({
currentData: this.data.scheduleList[i].dateStr,
currentDataIndex: i
})
});
}
break;
}
}
}
})
});
},
//判断滚动方向
getScrollOffset(scrollTop) {
let offset = 'stop';
let offset = "stop";
if (scrollTop > this.scrollTop) {
//向下滚动
offset = 'next'
offset = "next";
} else {
//向上滚动
offset = 'before'
offset = "before";
}
this.scrollTop = scrollTop;
return offset
return offset;
},
closePop() {
this.setData({
......@@ -629,15 +684,19 @@ create.Page({
createMeeting() {
dd.navigateTo({ url: "./../createMeeting/createMeeting" });
},
nextDetail: throttle(function (e) {
nextDetail: throttle(function(e) {
dd.navigateTo({
url: `./../meetingDetail/meetingDetail?scheduleItem=${encodeURIComponent(JSON.stringify(e.target.dataset.item))}`
url: `./../meetingDetail/meetingDetail?scheduleItem=${encodeURIComponent(
JSON.stringify(e.target.dataset.item)
)}`
});
}, 1000),
backToToday(type) {
if (!type) {
//如果当前的日期还没加载出来点击无效,下拉积累数据过长可以去掉
const isFindArr = this.data.scheduleList.filter(it => it.dateStr == toLocaleDateString(currentDate));
const isFindArr = this.data.scheduleList.filter(
it => it.dateStr == toLocaleDateString(currentDate)
);
if (isFindArr.length == 0 || this.data.scheduleList.length > 100) {
//去掉头部空数据
if (this.minYear < minYear) {
......@@ -651,7 +710,10 @@ create.Page({
}
this.getPagination(this.scheduleList);
this.setData({
scheduleList: this.scheduleList.slice(this.firstPage * this.pageSize, this.currentPage * this.pageSize)
scheduleList: this.scheduleList.slice(
this.firstPage * this.pageSize,
this.currentPage * this.pageSize
)
});
}
}
......@@ -678,11 +740,11 @@ create.Page({
dd.setNavigationBar({
title: title
});
if (tabbar == '1' && lastTimeTabBarIndex == tabbar) {
if (tabbar == "1" && lastTimeTabBarIndex == tabbar) {
this.backToToday();
}
if (this.isFirstLoad) {
this.backToToday('first');
this.backToToday("first");
this.isFirstLoad = false;
this.resetToview = true;
}
......@@ -692,7 +754,7 @@ create.Page({
maxClickCount--;
if (maxClickCount == 0) {
dd.alert({
content: '版本号198'
content: "版本号198"
});
maxClickCount = 5;
}
......
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