123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- <template>
- <view class="home-container">
- <!-- 头部区域 -->
- <top-box v-bind:timeStamp="timeStamp"></top-box>
- <!-- 滚动条 -->
- <view class="notice">
- <u-notice-bar :text="noticeMsg" mode="closable" bgColor="rgba(73, 125, 220, 0.25)" color="#FFF" url="/subpkg/mymsg/mymsg"></u-notice-bar>
- </view>
- <!-- 卡片区域 -->
- <view class="card-box">
- <!-- 今日课程 -->
- <view class="card-item" style="width: 100%;">
- <view class="card-info" style="padding-bottom: 30rpx;">
- <view :class="icon.class"></view>
- <text class="info-text">今日课程</text>
- <view style="display: flex; align-items: center;margin: 0 10rpx 0 auto;">
- <view class="t-icon t-icon-liebiao" style="width: 30rpx; height: 30rpx;"
- @click="navClass"></view>
- <view class="msg" style="margin-left: 10rpx; font-size: 14px;color: #3C9CFF;" @click="navClass">课程列表</view>
- </view>
- </view>
- <todayclass-box :classCurrent="classCurrent"></todayclass-box>
- </view>
- <!-- 今日打卡 -->
- <view class="card-item" @click="navCalendar(attendanceData.attendance,attendanceData.attendanceTime,attendanceData.attendanceQuality)">
- <view class="card-info">
- <view :class="icon.record"></view>
- <text class="info-text">今日打卡</text>
- </view>
- <view class="space">
- <view class="home-title-text">
- <view class="msg">今日出勤:</view>
- <view class="card-content">{{attendanceData.attendance}}</view>
- </view>
- <view class="home-title-text">
- <view class="msg">打卡时间:</view>
- <view style="margin-left: 10rpx;">
- <!-- <u-tag text="8点15分" plain shape="circle"></u-tag> -->
- <view style="display: flex; align-items: center; margin-left: 10rpx;">
- <view class="number-box">{{attendanceData.attendanceTimeAfter[0]}}</view>
- <view style="color: #3C9CFF;">:</view>
- <view class="number-box">{{attendanceData.attendanceTimeAfter[1]}}</view>
- </view>
- </view>
- </view>
- <view class="home-title-text">
- <view class="msg">出勤质量:</view>
- <view class="card-content">{{attendanceData.attendanceQuality}}</view>
- </view>
- </view>
- </view>
- <!-- 评测 -->
- <view class="card-item" @click="navHomework(0)">
- <view class="card-info">
- <view :class="icon.evaluation"></view>
- <text class="info-text">今日评测</text>
- </view>
- <view class="charts-box">
- <qiun-data-charts type="arcbar" :chartData="todayData.evaluationArcbar" :loadingType="4"
- :canvas2d='true' canvasId='canvans9313111' :opts="evaluationOpts" />
- </view>
- </view>
- <!-- 作业 -->
- <view class="card-item" @click="navHomework(1)">
- <view class="card-info">
- <view :class="icon.homework"></view>
- <text class="info-text">今日作业</text>
- </view>
- <view class="charts-box">
- <qiun-data-charts type="arcbar" :chartData="todayData.homeworkArcbar" :loadingType="4"
- :canvas2d='true' canvasId='canvans9327676' :opts="homeworkOpts" />
- </view>
- </view>
- <!-- 问卷 -->
- <view class="card-item" @click="navHomework(2)">
- <view class="card-info">
- <view :class="icon.activity"></view>
- <text class="info-text">今日活动</text>
- </view>
- <view class="charts-box">
- <qiun-data-charts type="arcbar" :chartData="todayData.activityArcbar" :loadingType="4"
- :canvas2d='true' canvasId='canvans9313176' :opts="activityOpts" />
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex'
- export default {
- computed: {
- ...mapState('m_chart', ['todayData']),
- ...mapState('m_children', ['childreninfo', 'classList']),
- ...mapState('m_parent', ['myData'])
- },
- data() {
- return {
- //滚动通知
- noticeMsg: '',
- //当前课程索引
- classCurrent: '',
- //打卡数据
- attendanceData: {
- //出勤状况
- attendance: '已打卡',
- //打卡时间
- attendanceTime: '08:15',
- //处理后时间
- attendanceTimeAfter: [],
- //出勤质量
- attendanceQuality: '优秀'
- },
- //属性(不修改)
- //图标
- icon: {
- record: 't-icon t-icon-dakaqiandao',
- class: 't-icon t-icon-banji',
- evaluation: 't-icon t-icon-ceping',
- homework: 't-icon t-icon-bianji1',
- activity: 't-icon t-icon-huodong'
- },
- //评测进度条属性
- evaluationOpts: {},
- //作业进度条属性
- homeworkOpts: {},
- //活动进度条属性
- activityOpts: {},
- //时间戳
- timeStamp: '',
- }
- },
- onLoad() {
- this.setOpts()
- this.$getTimeStamp()
- this.getNoticeMsg()
- this.getClassCurrent()
- this.getAttendanceTimeAfter()
- },
- onPullDownRefresh() {
- this.$getTimeStamp()
- this.getClassCurrent()
- console.log('refresh')
- setTimeout(function() {
- uni.stopPullDownRefresh()
- }, 1000);
- },
- methods: {
- //获取滚动通知
- getNoticeMsg() {
- this.noticeMsg = `您有 ${this.myData.msgList.length} 个通知,请点击查看`
- },
- //计算当前课程
- getClassCurrent() {
- //当前时间戳是否在课程时间段内
- function CompareDate(start, finish) {
- //获得当前时间时间戳
- let timeNow = (new Date()).format("yyyy-MM-dd hh:mm").replace(new RegExp("-", "gm"), "/")
- let timeHaoMiao = (new Date(timeNow)).getTime()
- //获得课程开始结束时间戳
- let today = (new Date()).format("yyyy-MM-dd ")
- let classStart = (today + start).replace(new RegExp("-", "gm"), "/")
- let classFinish = (today + finish).replace(new RegExp("-", "gm"), "/")
- let classStartHaoMiao = (new Date(classStart)).getTime()
- let classFinishHaoMiao = (new Date(classFinish)).getTime()
- //比较
- if (timeHaoMiao < classFinishHaoMiao) {
- if (classStartHaoMiao < timeHaoMiao)
- return true
- }
- return false
- }
- //获取当前课程索引值
- let i = 1
- for (let item of this.classList) {
- let timeArr = item.time.split("-")
- let res = CompareDate(timeArr[0], timeArr[1])
- if (res) {
- break
- }
- i++
- }
- //判断是否不在任意一个时间段内
- if (i > this.classList.length) {
- i = -1
- }
- this.classCurrent = i
- i = 0
- },
- //处理打卡时间
- getAttendanceTimeAfter() {
- this.attendanceData.attendanceTimeAfter = this.attendanceData.attendanceTime.split(':')
- },
- //导航
- navHomework(index) {
- uni.reLaunch({
- url: `/pages/homework/homework?index=${index}`
- })
- },
- navCalendar(attendance,attendanceTime,attendanceQuality) {
- uni.navigateTo({
- url: `/subpkg/calendarmsg/calendarmsg?attendance=${attendance}&attendanceTime=${attendanceTime}&attendanceQuality=${attendanceQuality}`
- })
- },
- navClass() {
- uni.navigateTo({
- url: '/subpkg/classmsg/classmsg'
- })
- },
- //设置圆环图描述更新
- setOpts() {
- //圆环图标题和副标题动态变化
- let evaluation = {
- title: {
- name: this.todayData.evaluationArcbar.series[0].data * 100 + "%",
- color: this.todayData.evaluationArcbar.series[0].color
- },
- subtitle: {
- name: this.todayData.evaluationArcbar.series[0].name
- },
- extra: {
- arcbar: {
- type: 'circle'
- }
- }
- }
- let homework = {
- title: {
- name: this.todayData.homeworkArcbar.series[0].data * 100 + "%",
- color: this.todayData.homeworkArcbar.series[0].color
- },
- subtitle: {
- name: this.todayData.homeworkArcbar.series[0].name
- },
- extra: {
- arcbar: {
- type: 'circle'
- }
- }
- }
- let activity = {
- title: {
- name: this.todayData.activityArcbar.series[0].data * 100 + "%",
- color: this.todayData.activityArcbar.series[0].color
- },
- subtitle: {
- name: this.todayData.activityArcbar.series[0].name
- },
- extra: {
- arcbar: {
- type: 'circle'
- }
- }
- }
- this.evaluationOpts = evaluation;
- this.homeworkOpts = homework;
- this.activityOpts = activity;
- },
- },
- }
- </script>
- <style lang="scss">
- @import '@/pages/common/mainpage.scss';
- .number-box {
- width: 40rpx;
- height: 40rpx;
- border-radius: 8rpx;
- background-color: #3C9CFF;
- color: #FFF;
- padding: 5rpx;
- margin: 5rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .space {
- height: 100%;
- width: 100%;
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- }
- </style>
|