From b3420bd6ba11c615697b99e09294e60bed07afb2 Mon Sep 17 00:00:00 2001 From: ‘fengzhaoyu’ <feng.zhaoyu@mingwork.com> Date: Thu, 15 Oct 2020 09:20:58 +0800 Subject: [PATCH] fix:添加展开全部 收起 任务为空的时候的创建 --- components/head-img/head-img.acss | 30 ++++++++++++++++++++++++++++++ components/head-img/head-img.axml | 10 ++++++++++ components/head-img/head-img.js | 11 +++++++++++ components/head-img/head-img.json | 3 +++ components/notes/notes.acss | 26 ++++++++++++++++++++++++++ components/notes/notes.axml | 14 +++++++++++--- components/notes/notes.js | 39 ++++++++++++++++++++++++++++++++++++--- components/popup/index.acss | 2 ++ pages/createTask/createTask.axml | 2 +- pages/createTask/createTask.js | 24 +++++++++++++++++++----- pages/meetingDetail/meetingDetail.acss | 19 ++++--------------- pages/meetingDetail/meetingDetail.axml | 13 +++---------- pages/meetingDetail/meetingDetail.js | 27 +++++++++++++++++++-------- pages/meetingDetail/meetingDetail.json | 3 ++- pages/meetingDetail/utils.js | 1 + pages/participantsDetail/participantsDetail.axml | 6 +----- pages/participantsDetail/participantsDetail.js | 4 +++- pages/participantsDetail/participantsDetail.json | 1 + 18 files changed, 183 insertions(+), 52 deletions(-) create mode 100755 components/head-img/head-img.acss create mode 100644 components/head-img/head-img.axml create mode 100644 components/head-img/head-img.js create mode 100644 components/head-img/head-img.json diff --git a/components/head-img/head-img.acss b/components/head-img/head-img.acss new file mode 100755 index 0000000..3223680 --- /dev/null +++ b/components/head-img/head-img.acss @@ -0,0 +1,30 @@ + .name { + font-size: 24rpx; + margin-top: 8rpx; + opacity: 0.56; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .participate-status { + line-height: 15px; + vertical-align: top; + width: 15px; + height: 15px; + position: absolute; + background: #fff; + bottom: 0rpx; + font-size: 12px; + right: -3rpx; + border-radius: 50%; + text-align: center; + } + + .participate { + color: #15BC83; + } + + .noParticipateStatus { + color: #F25643; + } \ No newline at end of file diff --git a/components/head-img/head-img.axml b/components/head-img/head-img.axml new file mode 100644 index 0000000..11babd5 --- /dev/null +++ b/components/head-img/head-img.axml @@ -0,0 +1,10 @@ +<view class="{{className}}"> + <image a:if="{{item.headUrl}}" mode="scaleToFill" src="{{item.headUrl}}" /> + <view a:else> + {{item.username.substring(item.username.length-numLength)}} + </view> + <view a:if="{{item.confirmAttendance == 0}}" class=" noParticipateStatus participate-status iconicon_noAgreed1 iconfont"> + </view> + <view a:if="{{item.confirmAttendance == 1}}" class=" participate participate-status iconicon_Agreed1 iconfont"> + </view> +</view> \ No newline at end of file diff --git a/components/head-img/head-img.js b/components/head-img/head-img.js new file mode 100644 index 0000000..ed899fc --- /dev/null +++ b/components/head-img/head-img.js @@ -0,0 +1,11 @@ +Component({ + mixins: [], + data: {}, + props: { + numLength: 2 + }, + didMount() { }, + didUpdate() { }, + didUnmount() { }, + methods: {}, +}); diff --git a/components/head-img/head-img.json b/components/head-img/head-img.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/components/head-img/head-img.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/components/notes/notes.acss b/components/notes/notes.acss index 78bb498..ccb1153 100755 --- a/components/notes/notes.acss +++ b/components/notes/notes.acss @@ -9,4 +9,30 @@ min-height: 400rpx; padding: 32rpx; margin-bottom: 16rpx; +} + +.parent-node { + max-height: 200rpx; + display: block; + display: -webkit-box; + /*关键属性(必须有的) */ + -webkit-box-orient: vertical; + /*规定子元素的排列方向 */ + -webkit-line-clamp: 5; + /*行数*/ + /* 实现多余的文字隐藏并用省略号来代表被隐藏的文字 */ + overflow: hidden; + text-overflow: ellipsis; +} + +.state { + margin-top: 16rpx; + color: rgba(10, 10, 10) +} + +.hide { + max-height: max-content; + text-overflow: unset; + max-height: unset; + -webkit-line-clamp: unset; } \ No newline at end of file diff --git a/components/notes/notes.axml b/components/notes/notes.axml index f178496..3c78d35 100644 --- a/components/notes/notes.axml +++ b/components/notes/notes.axml @@ -1,9 +1,17 @@ <view a:if="{{isEdit}}"> <form onSubmit="complete"> - <textarea value="{{notes ? notes.meetingNotes : ''}}" class="notes-edit" name="textarea" auto-height placeholder="输入笔记内容"></textarea> + <textarea value="{{notes ? notes.meetingNotes : ''}}" maxlength= "-1" class="notes-edit" name="textarea" auto-height placeholder="输入笔记内容"></textarea> <button form-type="submit" class="picker-complete">完成</button> </form> </view> -<view a:else class="notes"> - {{meetingNotes}} +<view a:else class="notes "> + <!--<view id="parent" class="parent-node {{isExpand == false ? 'hide' : ''}}"><text id="content">{{meetingNotes}}</text></view> --> + <view> + <text id="content"> + {{meetingNotes.length > 50&&!isExpand ? `${meetingNotes.substring(0,50)} ${" "}...` :meetingNotes }} + </text> + </view> + <view a:if="{{meetingNotes.length > 50}}" class="state" onTap="handleState"> + {{isExpand ?"收起": "展开全部" }} + </view> </view> \ No newline at end of file diff --git a/components/notes/notes.js b/components/notes/notes.js index 295b342..4cef13d 100644 --- a/components/notes/notes.js +++ b/components/notes/notes.js @@ -4,11 +4,39 @@ create.Component({ store: pageStore, mixins: [], data: { - notes: null //store + notes: null,//store + isExpand: null, }, props: {}, - didMount() { }, - didUpdate() { }, + didMount() { + // const _that = this + + // dd.createSelectorQuery() + // .select('#parent').boundingClientRect() + // .select('#content').boundingClientRect().exec((ret) => { + // if (ret[1].height > ret[0].height) { + // _that.setData({ + // isExpand: true, + // }) + // } else { + // _that.setData({ + // showState: null + // }) + // } + // // if (ret[1].height > 50) { + // // _that.setData({ + // // isExpand: true, + // // }) + // // } else { + // // _that.setData({ + // // showState: null + // // }) + // // } + // console.log(JSON.stringify(ret, null, 2)); + // }); + }, + didUpdate() { + }, didUnmount() { }, methods: { complete: function (e) { @@ -18,5 +46,10 @@ create.Component({ } this.props.onGetNotes(e.detail.value.textarea) }, + handleState() { + this.setData({ + isExpand: !this.data.isExpand + }) + } }, }); diff --git a/components/popup/index.acss b/components/popup/index.acss index 22d7510..7d18057 100644 --- a/components/popup/index.acss +++ b/components/popup/index.acss @@ -1,5 +1,7 @@ .dm-popup-content { position: fixed; + max-height: 100vh; + overflow-y: scroll; } .dm-popup-mask { diff --git a/pages/createTask/createTask.axml b/pages/createTask/createTask.axml index 8422c6f..5883b10 100644 --- a/pages/createTask/createTask.axml +++ b/pages/createTask/createTask.axml @@ -20,7 +20,7 @@ <text class="participator-title">{{currentTask.endTime ? `${currentTask.endTime} 截止`: '设置截止时间'}}</text> </view> <view class="save" onTap="addTask"> - <view class="button {{limitClick ? 'gray' : ''}}"> + <view class="button {{limitClick || !currentTask.title.trim() ? 'gray' : ''}}"> 立即创建 </view> <view class="tabBarBottom" a:if="{{isIPX}}"> diff --git a/pages/createTask/createTask.js b/pages/createTask/createTask.js index af8f9de..a0f41b2 100644 --- a/pages/createTask/createTask.js +++ b/pages/createTask/createTask.js @@ -7,6 +7,7 @@ import { updateMeetingTask } from '../../api/request'; create.Page({ store: pageStore, data: { + $data: null, currentTask: {}, show: false, isIPX: false, @@ -34,9 +35,21 @@ create.Page({ } }, handleOpenTime() { - this.setData({ - show: true - }) + const _that = this + dd.datePicker({ + format: 'yyyy-MM-dd HH:mm', + currentDate: this.$store.data.startTime, + success: (res) => { + if (!res.date) { + return + } + _that.store.data.currentTask.endTime = `${res.date}:00` + _that.update() + }, + }); + // this.setData({ + // show: true + // }) }, closePopup() { this.setData({ @@ -50,11 +63,12 @@ create.Page({ this.closePopup(); }, addTask() { - if (this.data.limitClick) { + const task = this.store.data.currentTask; + + if (this.data.limitClick || !(task.title.trim())) { return } this.setData({ limitClick: true }); - const task = this.store.data.currentTask; updateMeetingTask({ meetingId: this.data.meetingId, platform: 'dingTalk', diff --git a/pages/meetingDetail/meetingDetail.acss b/pages/meetingDetail/meetingDetail.acss index f113d88..e3e6f5b 100644 --- a/pages/meetingDetail/meetingDetail.acss +++ b/pages/meetingDetail/meetingDetail.acss @@ -331,21 +331,6 @@ input { position: relative; } -.conflict { - line-height: 15px; - vertical-align: top; - width: 15px; - height: 15px; - position: absolute; - background: #fff; - bottom: 0rpx; - color: #FF943E; - font-size: 12px; - right: -3rpx; - border-radius: 50%; - text-align: center; -} - .headUrl>image { vertical-align: top; width: 100%; @@ -691,4 +676,8 @@ input { white-space: nowrap; padding: 0 15px; font-size: 24rpx; +} + +.iconpeople1 { + line-height: 40rpx; } \ No newline at end of file diff --git a/pages/meetingDetail/meetingDetail.axml b/pages/meetingDetail/meetingDetail.axml index 4d96e83..d937836 100644 --- a/pages/meetingDetail/meetingDetail.axml +++ b/pages/meetingDetail/meetingDetail.axml @@ -53,8 +53,7 @@ <!-- $data.startTime $data.endTime repeatable recurrenceModel 时间 重复 --> <view class="permissionContant"> <view class="time"> - <view class="iconicon_conflict iconfont icon"> - </view> + <view class="iconicon_conflict iconfont icon"></view> <view class="timeContaint"> <view> <view class="timeText" catchTap="handleTime" data-type='time'> @@ -88,14 +87,8 @@ </view> <view class="participatorListBottom" catchTap="goParticipantsDetail"> <view class="people" a:for="{{$data.showParticipatorList.length > 10 ? [...$data.showParticipatorList].splice(0, 11) : $data.showParticipatorList}}"> - <view class="headUrl"> - <image a:if="{{item.headUrl}}" mode="scaleToFill" src="{{item.headUrl}}" /> - <text a:else>{{item.platform==="outlook" ? item.username.substring(0, 2) : item.username.substring(item.username.length-2, item.username.length)}} - </text> - <view class="conflict iconicon_conflict iconfont" a:if="{{conflictPeople.includes(item.userId)}}"> - </view> - </view> - <!--<view class="name">{{item.name}}</view> --> + <head-img className="headUrl" item="{{item}}"></head-img> + <!--<view class="headUrl"><image a:if="{{item.headUrl}}" mode="scaleToFill" src="{{item.headUrl}}" /><view class="conflict iconicon_conflict iconfont" a:if="{{conflictPeople.includes(item.userId)}}"></view></view><view class="name">{{item.name}}</view> --> </view> <view class="addPeople iconfont iconicon_add1" catchTap="handleAddParticipator" data-type='participator'></view> </view> diff --git a/pages/meetingDetail/meetingDetail.js b/pages/meetingDetail/meetingDetail.js index 78bd695..c88e96d 100644 --- a/pages/meetingDetail/meetingDetail.js +++ b/pages/meetingDetail/meetingDetail.js @@ -556,7 +556,7 @@ create.Page({ let participatorList = {} if (this.data.organizer === this.data.currentPeople) { participatorList[getApp().globalData.userid] = { - userId: getApp().globalData.userid, username: getApp().globalData.name, headUrl: getApp().globalData.avatar, platform: 'dingtalk' + userId: getApp().globalData.userid, username: getApp().globalData.name, headUrl: getApp().globalData.avatar, platform: 'dingtalk', confirmAttendance: this.data.confirmAttendance } } @@ -637,7 +637,7 @@ create.Page({ }, // 参会人详情 goParticipantsDetail() { - dd.navigateTo({ url: `./../participantsDetail/participantsDetail?scheduleItem=${this.store.data.scheduleItem}&organizer=${this.data.organizer}` }) + dd.navigateTo({ url: `./../participantsDetail/participantsDetail?scheduleItem=${this.store.data.scheduleItem}&organizer=${this.data.organizer}&confirmAttendance=${this.data.confirmAttendance}` }) }, @@ -831,6 +831,10 @@ create.Page({ this.setData({ confirmAttendance: -9 }) + this.$store.data.participatorList[this.data.currentPeople].confirmAttendance = -9 + this.$store.data.showParticipatorList = Object.values(this.$store.data.participatorList) + this.$store.data.originUsers = [...this.$store.data.showParticipatorList] + this.update() if (this.data.repeat.repeatable === 1) { if (this.$store.modifyErpeatMeeting) { this.$store.modifyErpeatMeeting() @@ -844,26 +848,33 @@ create.Page({ }, // 参加状态保存 participateSave(dataParticipate) { + const _that = this return new Promise((resolve) => { isParticipate(dataParticipate).then(res => { resolve(res) if (res.data.code !== 0) { - console.log(res) return } - this.setData({ + _that.setData({ 'aheadTime.aheadTimes': [15], 'aheadTime.aheadTimesListId': [15], confirmAttendance: dataParticipate.value }) + + _that.$store.data.participatorList[_that.data.currentPeople].confirmAttendance = dataParticipate.value + _that.$store.data.showParticipatorList = Object.values(_that.$store.data.participatorList) + _that.$store.data.originUsers = [..._that.$store.data.showParticipatorList] + _that.update() + + if (dataParticipate.type === "only") { - if (this.$store.modifyOnceMeetingContent) { - this.$store.modifyOnceMeetingContent({ id: this.data.scheduleItem.id, confirmAttendance: dataParticipate.value }) + if (_that.$store.modifyOnceMeetingContent) { + _that.$store.modifyOnceMeetingContent({ id: this.data.scheduleItem.id, confirmAttendance: dataParticipate.value }) } return } - if (this.$store.modifyErpeatMeeting) { - this.$store.modifyErpeatMeeting() + if (_that.$store.modifyErpeatMeeting) { + _that.$store.modifyErpeatMeeting() } }) diff --git a/pages/meetingDetail/meetingDetail.json b/pages/meetingDetail/meetingDetail.json index 066dcd3..3fecf44 100644 --- a/pages/meetingDetail/meetingDetail.json +++ b/pages/meetingDetail/meetingDetail.json @@ -12,6 +12,7 @@ "toast": "../../components/toast/toast", "selectpopup": "../../components/selectPopup/selectPopup", "centerpopup": "../../components/centerPopup/centerPopup", - "meeting-time-picker": "../../components/meetingTimePicker/meetingTimePicker" + "meeting-time-picker": "../../components/meetingTimePicker/meetingTimePicker", + "head-img": "../../components/head-img/head-img" } } \ No newline at end of file diff --git a/pages/meetingDetail/utils.js b/pages/meetingDetail/utils.js index aa4ea38..284b110 100644 --- a/pages/meetingDetail/utils.js +++ b/pages/meetingDetail/utils.js @@ -13,6 +13,7 @@ export function getSelectRepeatId(recurrenceModel, repeatList) { export function getInitialPsarticipants(participants) { let people = {} for (let i = 0; i < participants.length; i++) { + participants[i].participator.confirmAttendance = participants[i].confirmAttendance people[participants[i].participator.userId] = participants[i].participator } return people diff --git a/pages/participantsDetail/participantsDetail.axml b/pages/participantsDetail/participantsDetail.axml index 7ca527b..cb10131 100644 --- a/pages/participantsDetail/participantsDetail.axml +++ b/pages/participantsDetail/participantsDetail.axml @@ -1,11 +1,7 @@ <view class="participantsDetail"> <view class="peopleContaint"> <view class="peopleList" a:for="{{!!scheduleItem ? showContactPeople : $data.showParticipatorList}}" a:for-item="item"> - <view class="headImg"> - <image a:if="{{!!item.headUrl}}" mode="scaleToFill" src="{{item.headUrl}}"/> - <text a:else>{{item.username.substring(0, 1)}}</text> - <!--<text a:if="{{conflictPeople.includes(item.userId)}}" class="conflict iconicon_conflict iconfont"></text> --> - </view> + <head-img className="headImg" numLength="{{1}}" item="{{item}}"></head-img> <view class="info"> <text class="name">{{item.username}}</text> <text a:if="{{(!scheduleItem || currentPeople === organizer) ? !(item.userId == currentPeople) : !(originUsersId.includes(item.userId)) }}" class="close iconicon_close iconfont" data-userId="{{item.userId}}" onTap="delParticipants"></text> diff --git a/pages/participantsDetail/participantsDetail.js b/pages/participantsDetail/participantsDetail.js index 52bb188..1745347 100644 --- a/pages/participantsDetail/participantsDetail.js +++ b/pages/participantsDetail/participantsDetail.js @@ -19,9 +19,11 @@ create.Page({ contactPeople: {}, showContactPeople: [], originUsersId: [], + confirmAttendance: null }, onLoad(event) { this.setData({ + confirmAttendance: event.confirmAttendance, isIPX: checkFullScren(), scheduleItem: event.scheduleItem, organizer: event.organizer, @@ -67,7 +69,7 @@ create.Page({ // 发起人 可选 必选 else if (this.data.currentPeople === this.data.organizer) { participatorList[getApp().globalData.userid] = { - userId: getApp().globalData.userid, username: getApp().globalData.name, headUrl: getApp().globalData.avatar, platform: 'dingtalk' + userId: getApp().globalData.userid, username: getApp().globalData.name, headUrl: getApp().globalData.avatar, platform: 'dingtalk', confirmAttendance: this.data.confirmAttendance } } // 编辑 参会人可选必选 diff --git a/pages/participantsDetail/participantsDetail.json b/pages/participantsDetail/participantsDetail.json index a3c680b..6c23cdc 100644 --- a/pages/participantsDetail/participantsDetail.json +++ b/pages/participantsDetail/participantsDetail.json @@ -1,5 +1,6 @@ { "usingComponents": { + "head-img": "../../components/head-img/head-img", "popup": "../../components/popup/index", "list": "../../components/list/list", "toast": "../../components/toast/toast", -- libgit2 0.26.0