123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361 |
- <template>
- <view class="homework-container">
- <!-- 头部区域 -->
- <top-box :timeStamp="timeStamp" />
- <view class="module-container">
- <view style="margin: 0 20rpx;">
- <u-tabs :list="list" :current="current" @change="changeModule"
- :activeStyle="{color: '#3c9cff',fontWeight: 'bold',transform: 'scale(1.08)',}"
- :inactiveStyle="{fontWeight: 'bold',transform: 'scale(1)'}" lineColor="#3c9cff" lineWidth="60">
- </u-tabs>
- </view>
- <view class="module-box" v-for="(item,index) in pageData" :key="index" v-if="current == index">
- <!-- 详情头部卡片 -->
- <view class="card" :style="{backgroundColor: `${item.color}`}">
- <view class="box">
- <view class="flex">
- <text class="card-title">今日{{item.name}}数:</text>
- <text class="card-title" style="margin-left: 20rpx;">{{item.detail.data.length}}</text>
- </view>
- <view class="box" style="margin: 10rpx 0 0 0;">
- <view class="flex">
- <text class="card-subtitle">完成数量:</text>
- <text class="card-subtitle" style="margin-left: 20rpx;">{{finishData.length}}</text>
- </view>
- <view class="flex">
- <text class="card-subtitle">完成情况:</text>
- <text class="card-subtitle" style="margin-left: 20rpx;">{{item.level}}</text>
- </view>
- </view>
- </view>
- <view class="image" :style="{backgroundImage:`url(${item.image})`}"></view>
- </view>
- <!-- 中间标题 -->
- <view class="flex">
- <view class="cut-off">{{item.name}}信息</view>
- </view>
- <!-- 列表 -->
- <view class="detail-box" v-if="current == index">
- <view class="detail-box-item">
- <view class="item-info">
- <view class="t-icon t-icon-ceping"></view>
- <view class="item-text">近七天完成率</view>
- </view>
- <!-- 图表部分 -->
- <view class="charts-box" v-if="current == 0">
- <qiun-data-charts type="fin-area" :chartData="homeworkData.testData" :loadingType="4"
- :canvas2d='true' tooltipFormat='HomeworkPercent' canvasId='canvans0980111' />
- </view>
- <view class="charts-box" v-if="current == 1">
- <qiun-data-charts type="fin-area" :chartData="homeworkData.homeworkData" :loadingType="4"
- :canvas2d='true' tooltipFormat='HomeworkPercent' canvasId='canvans0933511' />
- </view>
- <view class="charts-box" v-if="current == 2">
- <qiun-data-charts type="fin-area" :chartData="homeworkData.activityData" :loadingType="4"
- :canvas2d='true' tooltipFormat='HomeworkPercent' canvasId='canvans0531032' />
- </view>
- </view>
- <!-- 完成列表 -->
- <view class="detail-box-item">
- <view class="item-info">
- <view class="t-icon t-icon-shenhe"></view>
- <view class="item-text">今日已完成</view>
- <!-- 完成列表展示所有已完成的评测作业和活动信息 -->
- </view>
- <view style="margin-bottom: 20rpx;">
- <view class="block-box" v-for="(item,index) in finishData" :key="index">
- <view class="index" style="height: 100rpx;background-color: #00b894;"></view>
- <view class="class-block" style="height: 100rpx;width: 90%;">
- <view class="block-title">{{item.name}}</view>
- <view class="block-subtitle">科目:</view>
- <view class="block-tag-box">
- <view class="block-tag">{{item.subject}}</view>
- </view>
- <view class="block-subtitle">布置老师:</view>
- <view class="block-tag-box">
- <view class="block-tag">{{item.teacher}}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 列表 -->
- <view class="detail-box-item">
- <view class="item-info">
- <view class="t-icon t-icon-daiban"></view>
- <view class="item-text">{{item.detail.title}}</view>
- <!-- 详情列表展示(评测,活动或者作业)信息 -->
- <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="navData"></view>
- <view class="msg" @click="navData" style="color: #3C9CFF;">详情列表</view>
- </view>
- </view>
- <view style="margin-bottom: 20rpx;">
- <view class="block-box" v-for="(i,x) in item.detail.data" :key="x">
- <view class="index" style="height: 100rpx;"></view>
- <view class="class-block" style="height: 100rpx; width: 90%;">
- <view class="block-title">{{i.name}}</view>
- <view class="block-tag-box">
- <view class="block-tag">{{i.subject}}</view>
- </view>
- <view class="block-tag-box">
- <view class="block-tag">{{i.teacher}}</view>
- </view>
- <view class="block-subtitle">{{i.description}}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex'
- export default {
- computed: {
- ...mapState('m_chart', ['homeworkData']),
- },
- data() {
- return {
- //模块名
- list: [{
- name: '评测详情'
- }, {
- name: '作业详情'
- }, {
- name: '活动详情'
- }],
- //当前模块
- current: 0,
- //页面数据内容
- pageData: '',
- //完成内容
- finishData: [],
- //历史数据
- historyData: {
- test: [90, 89, 98, 100, 50, 55, 60],
- homework: [10, 29, 38, 60, 50, 88, 100],
- activity: [70, 19, 28, 40, 60, 100, 83]
- },
- //时间戳
- timeStamp: '',
- };
- },
- watch: {
- current() {
- this.getFinishData()
- }
- },
- onLoad(options) {
- this.init()
- if (options.index)
- this.current = options.index
- },
- //刷新页面
- onPullDownRefresh() {
- this.init()
- setTimeout(function() {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- methods: {
- ...mapMutations('m_chart', ['updateTestArea', 'updateHomeworkArea', 'updateActivityArea']),
- ...mapMutations('m_children', ['updateHomeworkDetail']),
- //初始化页面
- init() {
- this.$getTimeStamp()
- this.$initHomework()
- this.saveToStudyChart()
- this.getLevel()
- this.getFinishData()
- },
- //更改模块
- changeModule(index) {
- this.current = index.index
- },
- //获得评判信息
- getLevel() {
- this.pageData[0].level = this.historyData.test[6] >= 40 ? (this.historyData.test[6] >= 70 ? '优秀' : '良好') :
- '较差'
- this.pageData[1].level = this.historyData.homework[6] >= 40 ? (this.historyData.homework[6] >= 70 ? '优秀' :
- '良好') : '较差'
- this.pageData[2].level = this.historyData.activity[6] >= 40 ? (this.historyData.activity[6] >= 70 ? '优秀' :
- '良好') : '较差'
- },
- //获得完成数量
- getFinishData() {
- if (this.current === 0)
- this.finishData = this.pageData[0].detail.data.filter(x => x.finish === true)
- if (this.current === 1)
- this.finishData = this.pageData[1].detail.data.filter(x => x.finish === true)
- if (this.current === 2)
- this.finishData = this.pageData[2].detail.data.filter(x => x.finish === true)
- },
- //记录到图表
- saveToStudyChart() {
- let temp = {
- categories: [],
- series: [{
- "name": "",
- "data": []
- }]
- }
- //时间
- temp.categories = this.$getRecentDateArray(7)
- //数据
- //解除对象指向同一块内存(拷贝)
- temp.series[0].data = this.historyData.test
- let testDataTemp = JSON.parse(JSON.stringify(temp))
- this.updateTestArea(testDataTemp)
- temp.series[0].data = this.historyData.homework
- let homeworkDataTemp = JSON.parse(JSON.stringify(temp))
- this.updateHomeworkArea(homeworkDataTemp)
- temp.series[0].data = this.historyData.activity
- let activityDataTemp = JSON.parse(JSON.stringify(temp))
- this.updateActivityArea(activityDataTemp)
- },
- //导航到详情页面
- navData() {
- this.updateHomeworkDetail(this.pageData[this.current].detail.data)
- uni.navigateTo({
- url: '/subpkg/homeworkdata/homeworkdata'
- })
- }
- }
- }
- </script>
- <style lang="scss">
- @import '@/pages/common/blockmsg.scss';
- .home-topinfo {
- background: linear-gradient($color-yellow, $page-background-color) !important;
- }
- //模块
- .module-container {
- margin-top: -70rpx;
- //头部卡片
- .card {
- display: flex;
- justify-content: space-around;
- margin: 20rpx auto 20rpx auto;
- height: 220rpx;
- width: 95%;
- // background: linear-gradient(to right, #ff95007a,#ff8419);
- border-radius: $card-border-radius;
- .card-title {
- font-size: 48rpx;
- font-weight: bold;
- color: #FFF;
- }
- .card-subtitle {
- font-size: 28rpx;
- color: #FFF;
- }
- .border-bottom {
- height: 10rpx;
- width: 100%;
- border-radius: $card-border-radius;
- background-color: #FFF;
- margin: 5rpx 0 5rpx 0;
- }
- .image {
- position: relative;
- right: -30rpx;
- height: 300rpx;
- width: 300rpx;
- background-size: 100%;
- background-repeat: no-repeat;
- z-index: 2;
- }
- }
- //头部卡片
- .box {
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- margin: 25rpx 0;
- }
- //中间标题
- .cut-off {
- font-size: 30rpx;
- font-weight: bold;
- color: #606266;
- margin-left: 40rpx;
- }
- //列表block
- .detail-box {
- display: flex;
- flex-flow: row wrap;
- margin: 20rpx 20rpx 0 20rpx;
- justify-content: space-between;
- .detail-box-item {
- margin: 0 0 4% 0;
- width: 100%;
- height: auto;
- background-color: #FFF;
- border-radius: $card-border-radius;
- .item-info {
- display: flex;
- align-items: center;
- padding: 20rpx;
- .t-icon {
- width: 40rpx;
- height: 40rpx;
- }
- .item-text {
- font-size: 30rpx;
- font-weight: bold;
- color: $color-title;
- margin-left: 15rpx;
- }
- }
- }
- }
- }
- //图表
- .charts-box {
- width: 100%;
- height: 300rpx;
- }
- .flex {
- display: flex;
- align-items: center;
- margin-left: 20rpx;
- }
- .msg {
- color: $color-title;
- margin-left: 10rpx;
- font-size: 28rpx;
- }
- </style>
|