Commit 0391326d by fengzhaoyu

commit -m "整理代码"

parent 704a2838
...@@ -24,7 +24,6 @@ Component({ ...@@ -24,7 +24,6 @@ Component({
didUnmount() { }, didUnmount() { },
methods: { methods: {
comSelectList(event) { comSelectList(event) {
debugger
if (this.props.multiple && event.currentTarget.dataset.item.id != -1) { if (this.props.multiple && event.currentTarget.dataset.item.id != -1) {
if (this.data.comSelectList.includes(-1)) { if (this.data.comSelectList.includes(-1)) {
this.setData({ this.setData({
......
...@@ -36,35 +36,30 @@ ...@@ -36,35 +36,30 @@
<view class="timeText" catchTap="handleTime"> <view class="timeText" catchTap="handleTime">
{{showTime}} {{showTime}}
</view> </view>
<view class="repeatModal" a:if="{{comListData.comSelectListId !== 0}}" catchTap="showPopup" data-type='repeat'> <view class="repeatModal" a:if="{{repeat.repeatable !== 0}}" catchTap="handleRepeatModal">
{{comListData.repeatList[comListData.comSelectListId].text}}重复 {{repeat.repeatList[repeat.selectRepeatId].text}}重复
</view> </view>
</view> </view>
<view class="icon iconfont iconicon_repeat1 " catchTap="handleRepeatModal" a:if="{{comListData.comSelectListId == 0}}"> <view class="icon iconfont iconicon_repeat1 " catchTap="handleRepeatModal" a:if="{{repeat.repeatable == 0}}">
</view> </view>
</view> </view>
</view> </view>
<!-- participatorList participatorUserId 参会人 --> <!-- participatorList participatorUserId 参会人 -->
<view class="participator"> <view class="participator">
<view class="iconicon_attender iconfont icon {{$data.participatorList.length>1 ? '' : 'noValueIcon'}}"> <view class="iconicon_attender iconfont icon {{$data.showParticipatorList.length>1 ? '' : 'noValueIcon'}}">
</view> </view>
<view class="participatorContaint"> <view class="participatorContaint">
<view class="participatorText" a:if="{{$data.participatorList.length < 2}}" catchTap="handleAddParticipator" data-type='participator'> <view class="participatorText" a:if="{{$data.showParticipatorList.length < 2}}" catchTap="handleAddParticipator" data-type='participator'>
添加参会人 添加参会人
</view> </view>
<view class="participatorList" a:else> <view class="participatorList" a:else>
<view class="participatorListTop"> <view class="participatorListTop">
<view class="participatorText"> <view class="participatorText">
<view> {{$data.showParticipatorList.length}}位参会人
{{$data.participatorList.length}}位参会人
</view>
<view class="conflictStatus" a:if="{{conflictPeople.length}}">
{{conflictPeople.length}}人日程安排冲突
</view>
</view> </view>
<view class="iconright iconfont icon" style=" vertical-align: middle" catchTap="nextPage" data-nextPage="participantsDetail"></view> <view class="iconright iconfont icon" style=" vertical-align: middle" catchTap="goParticipantsDetail"></view>
</view> </view>
<view class="participatorListBottom" catchTap="nextPage" data-nextPage="participantsDetail"> <view class="participatorListBottom" catchTap="goParticipantsDetail">
<view class="people" a:for="{{$data.participatorList.length > 10 ? [...$data.participatorList].splice(0, 11) : $data.participatorList}}"> <view class="people" a:for="{{$data.participatorList.length > 10 ? [...$data.participatorList].splice(0, 11) : $data.participatorList}}">
<view class="headUrl"> <view class="headUrl">
<image a:if="{{item.headUrl}}" mode="scaleToFill" src="{{item.headUrl}}" /> <image a:if="{{item.headUrl}}" mode="scaleToFill" src="{{item.headUrl}}" />
......
<block a:if="{{getData}}"> <!--<block a:if="{{getData}}"> -->
<block>
<view class=" {{(popupShow || show || centerPopup.showCenterPopup || conToastData.showToast || conSelectPopupData.showSelectPopup || comShareData.isShow )? 'metingDetail' : ''}}"> <view class=" {{(popupShow || show || centerPopup.showCenterPopup || conToastData.showToast || conSelectPopupData.showSelectPopup || comShareData.isShow )? 'metingDetail' : ''}}">
<import src="../../template/deleteBtn/index.axml"/> <import src="../../template/deleteBtn/index.axml"/>
<view class="hideDetail" a:if="{{isExpand}}"> <view class="hideDetail" a:if="{{isExpand}}">
...@@ -6,12 +7,7 @@ ...@@ -6,12 +7,7 @@
{{title}} {{title}}
</view> </view>
<view class="hideTime"> <view class="hideTime">
<text a:if="{{isAcrossDay}}"> {{showTime}}
{{`${$data.startTime.substring(5, 7)}月${$data.startTime.substring(8, 10)}日 ${$data.startTime.substring(11, 16)}-${$data.endTime.substring(5, 7)}月${$data.endTime.substring(8, 10)}日 ${$data.endTime.substring(11, 16)}`}}
</text>
<text a:else>
{{`${$data.startTime.substring(5, 7)}月${$data.startTime.substring(8, 10)}日 ${week} ${$data.startTime.substring(11, 16)}-${$data.endTime.substring(11, 16)}`}}
</text>
</view> </view>
<view class="hideIcon iconfont iconicon_slide" onTap="expand"> <view class="hideIcon iconfont iconicon_slide" onTap="expand">
</view> </view>
...@@ -61,12 +57,7 @@ ...@@ -61,12 +57,7 @@
<view class="timeContaint"> <view class="timeContaint">
<view> <view>
<view class="timeText" catchTap="showPopup" data-type='time'> <view class="timeText" catchTap="showPopup" data-type='time'>
<text a:if="{{isAcrossDay}}"> {{showTime}}
{{`${$data.startTime.substring(5, 7)}月${$data.startTime.substring(8, 10)}日 ${$data.startTime.substring(11, 16)}`}}-{{`${$data.endTime.substring(5, 7)}月${$data.endTime.substring(8, 10)}日 ${$data.endTime.substring(11, 16)}`}}
</text>
<text a:else>
{{`${$data.startTime.substring(5, 7)}月${$data.startTime.substring(8, 10)}日 ${week} ${$data.startTime.substring(11, 16)}-${$data.endTime.substring(11, 16)}`}}
</text>
<!-- 3月1日 周日 14:00-16:00 --> <!-- 3月1日 周日 14:00-16:00 -->
</view> </view>
<view class="repeatModal" a:if="{{comListData.comSelectListId !== 0}}" catchTap="showPopup" data-type='repeat'> <view class="repeatModal" a:if="{{comListData.comSelectListId !== 0}}" catchTap="showPopup" data-type='repeat'>
...@@ -236,7 +227,4 @@ ...@@ -236,7 +227,4 @@
</view> </view>
</view> </view>
</block> </block>
<view class="loading" a:if="{{loading || !getData}}"> <!--<view class="loading" a:if="{{loading || !getData}}"><view class="image"></view></view> -->
<view class="image"> \ No newline at end of file
</view>
</view>
\ No newline at end of file
export function getSelectRepeatId(recurrenceModel, repeatList) {
for (let i = 0; i < repeatList.length; i++) {
if (repeatList[i].recurrenceModel.model === recurrenceModel.model) {
}
}
return 0
}
\ No newline at end of file
<view class="participantsDetail"> <view class="participantsDetail">
<view class="peopleContaint"> <view class="peopleContaint">
<view class="peopleList" a:for="{{!!scheduleItem ? contactPeople : $data.participatorList}}" a:for-item="item"> <view class="peopleList" a:for="{{!!scheduleItem ? contactPeople : $data.showParticipatorList}}" a:for-item="item">
<view class="headImg"> <view class="headImg">
<image a:if="{{!!item.headUrl}}" mode="scaleToFill" src="{{item.headUrl}}"/> <image a:if="{{!!item.headUrl}}" mode="scaleToFill" src="{{item.headUrl}}"/>
<text a:else>{{item.username.substring(0, 1)}}</text> <text a:else>{{item.username.substring(0, 1)}}</text>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="addParticipants" catchTap="showPopup"> <view class="addParticipants" catchTap="addParticipator">
<text class="iconfont iconicon_add "></text> <text class="iconfont iconicon_add "></text>
<text>添加参会人</text> <text>添加参会人</text>
</view> </view>
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
class Store { class Store {
data = { data = {
locationName: '', locationName: '',
participatorList: [], participatorList: {},
participatorUserId: [], // 参会人的userId showParticipatorList: [],
roomId: '', roomId: '',
startTime: '', startTime: '',
endTime: '', endTime: '',
...@@ -22,21 +22,20 @@ class Store { ...@@ -22,21 +22,20 @@ class Store {
} }
resetData() { resetData() {
this.data.roomId = '' this.data.roomId = ''
this.data.participatorList = [] this.data.participatorList = {}
this.data.participatorUserId = [] this.data.showParticipatorList = []
this.data.originUsers = [] // this.data.originUsers = []
this.data.originUsersId = [] // this.data.originUsersId = []
this.data.locationName = '' this.data.locationName = ''
this.data.onceMeetingContent = null this.data.onceMeetingContent = null
this.update(); this.update();
} }
resetEditData() { resetEditData() {
this.data.roomId = '' this.data.roomId = ''
this.data.participatorList = [] // this.data.originUsers = []
this.data.originUsers = [] // this.data.originUsersId = []
this.data.originUsersId = [] this.data.participatorList = {}
this.data.participatorList = [] this.data.showParticipatorList = []
this.data.participatorUserId = []
this.data.locationName = '' this.data.locationName = ''
this.data.updateInfo = { this.data.updateInfo = {
updateType: '', updateType: '',
......
import globalStore from "../stores/exampleStore"
import { resolve } from "path";
//防止多次重复点击 (函数节流) //防止多次重复点击 (函数节流)
export function throttle(fn, gapTime) { export function throttle(fn, gapTime) {
if (gapTime == null || gapTime == undefined) { if (gapTime == null || gapTime == undefined) {
...@@ -172,6 +174,7 @@ endTime 结束时间 ...@@ -172,6 +174,7 @@ endTime 结束时间
*/ */
export function getShowTime(startTime, endTime) { export function getShowTime(startTime, endTime) {
debugger
const weekList = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'] const weekList = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
const weekIndex = new Date(startTime).getDay() const weekIndex = new Date(startTime).getDay()
let isAcrossDay = false let isAcrossDay = false
...@@ -196,3 +199,102 @@ export function getTwoYearToday(startTime) { ...@@ -196,3 +199,102 @@ export function getTwoYearToday(startTime) {
let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() let day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
return year + '-' + month + '-' + day return year + '-' + month + '-' + day
} }
// 处理重复模型
export function dealRepeatModal(item) {
const repeatWeek = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA']
// 不重复
if (item.repeatable === 0) {
return {
repeatable: item.repeatable,
recurrenceModel: item.recurrenceModel
}
}
const initialTime = globalStore.data.startTime.replace(/\//g, "-").substring(0, 10)
const terminateTime = getTwoYearToday(globalStore.data.startTime)
const recurrenceModel = {
model: item.recurrenceModel.model,
initialTime: initialTime,
terminateTime: terminateTime,
interval: 1
}
// 每天重复
if (item.recurrenceModel.model === "daily") {
return {
repeatable: item.repeatable,
recurrenceModel: recurrenceModel,
selectRepeatId: item.id
}
}
// 每月重复
if (item.recurrenceModel.model === "absolute_Monthly") {
recurrenceModel.daysOfMonth = [new Date(globalStore.data.startTime).getDate()]
return {
repeatable: item.repeatable,
recurrenceModel: recurrenceModel,
selectRepeatId: item.id
}
}
// 每周重复
if (item.recurrenceModel.weekDayList && item.recurrenceModel.weekDayList.length > 4) {
recurrenceModel.weekDayList = item.recurrenceModel.weekDayList
return {
repeatable: item.repeatable,
recurrenceModel: recurrenceModel,
selectRepeatId: item.id
}
}
// 每周的一天重复
recurrenceModel.weekDayList = repeatWeek[new Date(globalStore.data.startTime).getDay()]
return {
repeatable: item.repeatable,
recurrenceModel: recurrenceModel,
selectRepeatId: item.id
}
}
// 修改时间修改重复模型
export function modifyTimeImpactRepeat(recurrenceModel) {
const repeatWeek = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA']
const initialTime = globalStore.data.startTime.replace(/\//g, "-").substring(0, 10)
const terminateTime = getTwoYearToday(globalStore.data.startTime)
recurrenceModel.initialTime = initialTime
recurrenceModel.terminateTime = terminateTime
if (recurrenceModel.model === 'weekly' && recurrenceModel.weekDayList.length === 1) {
recurrenceModel.weekDayList = repeatWeek[new Date(globalStore.data.startTime).getDay()]
}
if (recurrenceModel.model === 'absolute_Monthly') {
recurrenceModel.daysOfMonth = [new Date(globalStore.data.startTime).getDate()]
}
return recurrenceModel
}
// 添加参会人
export function selectPeople(select, require) {
const _that = this
return new Promise((resolve) => {
dd.complexChoose({
title: "选择参会人", //标题
multiple: true, //是否多选
pickedUsers: select, //已选用户 s
requiredUsers: require, //必选用户(不可取消选中状态)
responseUserOnly: true, //返回人,或者返回人和部门
success: function (res) {
resolve(res)
},
fail: function (err) {
}
})
})
}
// 可选中去掉必选人
export function selectedelRequired(select, require) {
return select.filter(it => {
return !require.includes(it.userId)
})
}
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