<!-- * @Author: EvilStorm
 * @Date: 2020-10-26 10:44:42
 * @LastEditTime: 2020-10-26 13:12:01
 * @LastEditors: EvStorm
 * @Description: 当日课程表
 * @FilePath: /timetable/src/pages/index/index.html -->
<view style="height:{{CustomBar}}px;">
    <view class="cu-bar ev-fr-start" style="height:{{CustomBar}}px;padding-top:{{StatusBar}}px;">
        <view class="action" style="color:#FFF">练手课表</view>
    </view>
</view>
<image class="backgroundTexture" mode="scaleToFill" style="height:{{CustomBar + 130}}px" src="/images/mainBG.png" />
<view class="ev-mainBody">
    <view wx:if="{{!haveCouple}}">
        <view class="ev-fr-start padding-tb-sm">
            <image class="todayCourse" mode="heightFix" src="/images/todayCourse.png" />
            <text class="padding-xs todaytitle" style="color:#FFF">今日课程</text>
        </view>
        <view wx:if="{{courseInfo.length === 0}}" class="todaytips">今天没有课,好好休息吧~</view>
        <view wx:else class="todaytips">今日共{{courseInfo.length}}堂课，请注意上课时间～</view>
    </view>
    <view wx:if="{{haveCouple}}" class="messageBox" style="margin-top:50px;">
        <image class="messageImg" mode="heightFix" src="/images/messageImg.png" />
        <view class="messageData padding-bottom" wx:if="{{message}}">
            <view class="data margin-bottom-sm" style="-webkit-line-clamp: {{showAllMsg ? 0 : 2}};">
                {{message.contents}}
            </view>
            <view class="ev-fr">
                <view class="text-gray ev-fr-start" style="font-size: 12px;">
                    <view class="text-blue padding-right-sm" bind:tap="showAllMsg">
                        {{showAllMsg ? "收起消息":"展开全部"}}
                    </view>
                    {{" " + message.time}}
                </view>
                <view class="text-blue" bind:tap="newMessage" style="font-size: 12px;">给ta留言</view>
            </view>
        </view>
        <view class="ev-fr messageData padding-bottom" wx:else bind:tap="newMessage">
            <text class="messageText">点击这里可以给对方留言哦～</text>
            <view class="messageButton ev-fc-center">
                <image style="width: 50%;height: 50%;" mode="heightFix" src="/images/messageIndex.png" />
            </view>
        </view>
    </view>
</view>
<block wx:if="{{!haveCouple}}">
    <view class="topBar"></view>
    <view class="topBarShadow"></view>
    <view class="courseBox" style="height: {{displayArea.windowHeight - CustomBar - 120}}px;background:{{userInfo.index_bgimage ? 'none':'#FFFFFF'}}">
        <view wx:if="{{!userInfo}}" style="width:100%">
            <button class="loginButton" bindgetuserinfo="bindGetUserInfo" open-type="getUserInfo" style="width:100%;height:100%">
                <image class="loginnull" mode="scaleToFill" src="/images/loginnull.png" />
            </button>
        </view>
        <block wx:else>
            <image class="customBG" mode="aspectFill" style="width:686rpx;height: {{displayArea.windowHeight - CustomBar - 120}}px" src="{{userInfo.index_bgimage ? ImgUrl + userInfo.index_bgimage:''}}" />
            <view class="courseInfoBox">
                <view class="cu-timeline" style="background:none">
                    <view wx:if="{{!courseInfo}}" class="loginnull" bind:tap="entryCoure">
                        <image style="width:100%;height:100%" mode="scaleToFill" src="/images/coursenull.png" />
                        <text wx:if="{{!userInfo.courseInfo || userInfo.courseInfo.length == 0}}" class="todaytips">
                            还没录入课程哦~
                        </text>
                        <text wx:else>今日无课程，好好放松吧～</text>
                    </view>
                    <block wx:else>
                        <view class="cu-item text-blue ev-cuItem" wx:for="{{courseInfo}}" wx:key="index">
                            <view class="scheduleinfo ev-fr-start">
                                <text class="scheduleTime">{{item.courseTime}}</text>
                                <view class="scheduleRemind" style="background: {{['','#E2FFF9','#EAF5FF','#f6f6f9'][item.courseRemind]}};color:{{['','#08d8d1','#5e99fb','#92979d'][item.courseRemind]}}" wx:if="{{item.courseRemind}}">
                                    {{['','即将开始','进行中','已结束'][item.courseRemind]}}
                                </view>
                            </view>
                            <view class="bg-blue scheduleinfoBox" style="background-color: {{colorList[index % 8]}};">
                                <view class="padding-sm">
                                    <view>{{item.sname}}</view>
                                    <text>@{{item.classroom}}</text>
                                </view>
                                <image class="timelineIcon" mode="scaleToFill" src="/images/timelineIcon.png" />
                            </view>
                        </view>
                    </block>
                </view>
            </view>
        </block>
    </view>
</block>
<block wx:if="{{haveCouple}}">
    <view class="ev-fr ev-mainBody">
        <view class="ev-fr">
            <view class="courseTitle {{ScheduleId == '0' ? '':'noSelected'}}" data-id="0" bind:tap="switchSchedule">
                我的课程
            </view>
            <view class="courseTitle padding-lr-sm {{ScheduleId == '1' ? '':'noSelected'}}" data-id="1" bind:tap="switchSchedule">
                ta的课程
            </view>
        </view>
        <view class="ev-fr" bind:tap="couplesBG">
            <image class="BGicon" mode="scaleToFill" src="/images/BGicon.png" />
            <text class="BGiconText padding-lr-sm">给Ta设置背景</text>
        </view>
    </view>
    <view class="ev-fr ev-mainBody" bind:touchstart="touchstart" bind:touchend="touchend">
        <view class="haveCoupleBox {{ScheduleId == 0? 'animation-switch-out':'animation-switch-in'}}" data-id="0" bind:tap="switchSchedule" style="height: {{displayArea.windowHeight - CustomBar - 240}}px;margin-top:20px;">
            <image class="customBG" mode="aspectFill" style="width:100%;height:100%" src="{{couplesBG ? ImgUrl + couplesBG.contents : ImgUrl +userInfo.index_bgimage}}" />
            <view class="courseInfoBox">
                <view class="cu-timeline" style="background:none">
                    <view wx:if="{{!courseInfo}}" class="coursenull" bind:tap="entryCoure">
                        <image style="width:100%;height:100%" mode="scaleToFill" src="/images/coursenull.png" />
                        <text wx:if="{{userInfo.courseInfo.length === 0}}" class="todaytips">
                            去录入你的课程吧
                        </text>
                        <text wx:else>今日无课程，好好放松吧～</text>
                    </view>
                    <block wx:else>
                        <view class="cu-item text-blue ev-cuItem" wx:for="{{courseInfo}}" wx:key="index">
                            <view class="scheduleinfo ev-fr-start">
                                <text class="scheduleTime">{{item.courseTime}}</text>
                                <view class="scheduleRemind" style="background: {{['','#E2FFF9','#EAF5FF','#f6f6f9'][item.courseRemind]}};color:{{['','#08d8d1','#5e99fb','#92979d'][item.courseRemind]}}" wx:if="{{item.courseRemind}}">
                                    {{['','即将开始','进行中','已结束'][item.courseRemind]}}
                                </view>
                            </view>
                            <view class="bg-blue scheduleinfoBox" style="background-color: {{colorList[index % 8]}};">
                                <view class="padding-sm">
                                    <view>{{item.sname}}</view>
                                    <text>@{{item.classroom}}</text>
                                </view>
                                <image class="timelineIcon" mode="scaleToFill" src="/images/timelineIcon.png" />
                            </view>
                        </view>
                    </block>
                </view>
            </view>
        </view>
        <view class="haveCoupleBox {{ScheduleId == 1? 'animation-switch-in':'animation-switch-out'}}" data-id="1" bind:tap="switchSchedule" style="height: {{displayArea.windowHeight - CustomBar - 240}}px;margin-top:20px">
            <image class="customBG" mode="aspectFill" style="width:100%;height:100%" src="{{userInfo.loversbg ? ImgUrl + userInfo.loversbg:''}}" />
            <view class="courseInfoBox">
                <view class="cu-timeline" style="background:none">
                    <view wx:if="{{!loverCourse}}" class="coursenull">
                        <image style="width:100%;height:100%" mode="scaleToFill" src="/images/coursenull.png" />
                        <text wx:if="{{userInfo.loverCourseInfo.length === 0}}" class="todaytips">
                            快去提醒ta录入课程吧
                        </text>
                        <text wx:else>Ta今天没有课哦～</text>
                    </view>
                    <block wx:else>
                        <view class="cu-item text-blue ev-cuItem" wx:for="{{loverCourse}}" wx:key="index">
                            <view class="scheduleinfo ev-fr-start">
                                <text class="scheduleTime">{{item.courseTime}}</text>
                                <view class="scheduleRemind" style="background: {{['','#E2FFF9','#EAF5FF','#f6f6f9'][item.courseRemind]}};color:{{['','#08d8d1','#5e99fb','#92979d'][item.courseRemind]}}" wx:if="{{item.courseRemind}}">
                                    {{['','即将开始','进行中','已结束'][item.courseRemind]}}
                                </view>
                            </view>
                            <view class="bg-blue scheduleinfoBox" style="background-color: {{colorList[index % 8]}};">
                                <view class="padding-sm">
                                    <view>{{item.sname}}</view>
                                    <text>@{{item.classroom}}</text>
                                </view>
                                <image class="timelineIcon" mode="scaleToFill" src="/images/timelineIcon.png" />
                            </view>
                        </view>
                    </block>
                </view>
            </view>
        </view>
    </view>
</block>
<view class="cu-modal {{couplesInvite ?'show':''}}" bind:tap="hideCouplesInvite">
    <view class="cu-dialog couplesInvite">
        <image class="messageImg" mode="heightFix" src="/images/messageImg.png" />
        <image class="loveImg" mode="heightFix" src="/images/love.png" />
        <view class="ev-fc " style="margin-top:80px">
            <view class="padding">
                <view class="cu-avatar xl round solids" style="background-image:url({{userInfo.avatar ? userInfo.avatar:''}})" />
                <text class="padding-lr-xs"></text>
                <view class="cu-avatar xl round solids" style="background-image:url({{loverInfo.avatar ? loverInfo.avatar:''}})" />
            </view>
            <view class="couplesText">{{loverInfo.nickname}}</view>
            <view class="couplesText">想与你绑定情侣关系，是否愿意？</view>
            <view class="padding-bottom padding-xl">
                <button class="cu-btn couplesButton" bind:tap="couplesConfirm">拒绝</button>
                <button class="cu-btn couplesButton bg-blue" data-type="{{true}}" bind:tap="couplesConfirm">
                    愿意
                </button>
            </view>
        </view>
    </view>
</view>
<view class="cu-modal bottom-modal {{newMessage?'show':''}} newMessage" bind:tap="cancelMessage">
    <view class="cu-dialog newMessageBox" catch:tap style="border-radius: 40rpx 40rpx 0 0">
        <view class="cu-bar bg-white ev-fr-start padding">
            <view class="MessageIcon ev-fc-center">
                <image style="width: 100%;height: 100%;" mode="heightFix" src="/images/messageIcon.png" />
            </view>
            <text class="padding-lr title">给Ta留言</text>
        </view>
        <view class="ev-fc bg-white">
            <block wx:if="{{!messageList || editMessage}}">
                <textarea placeholder="输入留言内容，建议100字以内…" value="{{messageValue}}" bindblur="messageChange" bindconfirm="messageChange" class="messageContent"></textarea>
                <view>
                    <view class="ev-fr-start">
                        <text class="title">留言发送时间</text>
                        <text class="tips padding-lr">内容会在对方留言板显示一天时间</text>
                    </view>
                    <dateTimePicker type="minute" bind:change="TimePicker">
                        <view class="sendTimeBox ev-fr">
                            <input type="text" class="sendTime padding-lr" disabled="{{true}}" value="{{sendTime}}" />
                            <text style="font-size:24px;color:#92979D" class="cuIcon-triangledownfill padding-lr-sm"></text>
                        </view>
                    </dateTimePicker>
                </view>
                <view class="ev-fr padding-tb">
                    <button bind:tap="cancelMessage" class="cu-btn cancel" type="">取消</button>
                    <button bind:tap="saveMessage" class="cu-btn confirm margin-left" disabled="{{!messageValue}}" type="">
                        保存
                    </button>
                </view>
            </block>
            <block wx:if="{{messageList && !editMessage}}">
                <view class="addMessage ev-fc-center" bind:tap="editMessage">
                    <text class="cuIcon-roundadd" style="color:#5E99FB"></text>
                    <text class="padding-xs" style="color:#5E99FB">添加新的留言</text>
                </view>
                <view wx:for="{{messageList}}" wx:key="index" class="messageBox cardBox">
                    <view class="ev-fr padding">
                        <text class="title">{{item.contents}}</text>
                        <view class="state" style="color:{{['#5E99FB','#92979D'][item.state]}}">
                            {{['未发送','已发送'][item.state]}}
                        </view>
                    </view>
                    <view class="padding-lr">
                        <text class="cuIcon-time" style="color:#5E99FB"></text>
                        <text class="padding-lr-sm">{{item.time}}</text>
                    </view>
                    <view class="padding ev-fr">
                        <view class="editButton" data-index="{{index}}" data-lid="{{item.lid}}" data-type="{{true}}" bind:tap="editMessage">
                            重新编辑
                        </view>
                        <text class="cuIcon-delete" data-lid="{{item.lid}}" data-type="{{true}}" bind:tap="delMessage" style="color:#5E99FB"></text>
                    </view>
                </view>
            </block>
        </view>
    </view>
</view>