123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596 |
- <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: '#4169E1',fontWeight: 'bold',transform: 'scale(1.08)',}"
- :inactiveStyle="{fontWeight: 'bold',transform: 'scale(1)'}" lineColor="#4169E1" lineWidth="60">
- </u-tabs>
- </view>
- <!-- 模块卡片 -->
- <view class="module-box">
- <!-- 评测 -->
- <view class="card" style="background-color: #4169E1;" v-if="current == 0">
- <view class="box">
- <view class="flex">
- <text class="card-title">今日评测:</text>
- <view class="flex-line">
- <text class="card-title" style="margin-left: 20rpx;">{{testData.length}}</text>
- <text class="card-title"
- style="margin-left: 10rpx;font-size: 36rpx;opacity: 0.8;">份</text>
- </view>
- </view>
- <view class="box" style="margin: 10rpx 0 0 0;">
- <view class="flex">
- <view class="index-box"></view>
- <text class="card-subtitle">已完成:</text>
- <view class="flex-line">
- <text class="card-subtitle"
- style="margin-left: 20rpx;font-size: 36rpx;">{{testFinish}}</text>
- <text class="card-subtitle"
- style="margin-left: 10rpx;font-size: 30rpx;opacity: 0.8;">份</text>
- </view>
- </view>
- <view class="flex">
- <view class="index-box"></view>
- <text class="card-subtitle">完成情况:</text>
- <text class="card-subtitle"
- style="margin-left: 20rpx;font-size: 34rpx;">{{list[0].level}}</text>
- </view>
- </view>
- </view>
- <view class="image" :style="{backgroundImage:`url(${list[0].image})`}"></view>
- </view>
- <!-- 作业 -->
- <view class="card" style="background-color: #ff8caf;" v-if="current == 1">
- <view class="box">
- <view class="flex">
- <text class="card-title">今日作业:</text>
- <view class="flex-line">
- <text class="card-title" style="margin-left: 20rpx;">{{homeworkData.length}}</text>
- <text class="card-title"
- style="margin-left: 10rpx;font-size: 36rpx;opacity: 0.8;">份</text>
- </view>
- </view>
- <view class="box" style="margin: 10rpx 0 0 0;">
- <view class="flex">
- <view class="index-box"></view>
- <text class="card-subtitle">已完成:</text>
- <view class="flex-line">
- <text class="card-subtitle"
- style="margin-left: 20rpx;font-size: 36rpx;">{{homeworkFinish}}</text>
- <text class="card-subtitle"
- style="margin-left: 10rpx;font-size: 30rpx;opacity: 0.8;">份</text>
- </view>
- </view>
- <view class="flex">
- <view class="index-box"></view>
- <text class="card-subtitle">完成情况:</text>
- <text class="card-subtitle"
- style="margin-left: 20rpx;font-size: 34rpx;">{{list[1].level}}</text>
- </view>
- </view>
- </view>
- <view class="image" :style="{backgroundImage:`url(${list[1].image})`}"></view>
- </view>
- <!-- 活动 -->
- <view class="card" style="background-color: #f9c752;" v-if="current == 2">
- <view class="box">
- <view class="flex">
- <text class="card-title">今日活动:</text>
- <view class="flex-line">
- <text class="card-title" style="margin-left: 20rpx;">{{activityData.length}}</text>
- <text class="card-title"
- style="margin-left: 10rpx;font-size: 36rpx;opacity: 0.8;">例</text>
- </view>
- </view>
- <view class="box" style="margin: 10rpx 0 0 0;">
- <view class="flex">
- <view class="index-box"></view>
- <text class="card-subtitle">已完成:</text>
- <view class="flex-line">
- <text class="card-subtitle"
- style="margin-left: 20rpx;font-size: 36rpx;">{{activityFinish}}</text>
- <text class="card-subtitle"
- style="margin-left: 10rpx;font-size: 30rpx;opacity: 0.8;">例</text>
- </view>
- </view>
- <view class="flex">
- <view class="index-box"></view>
- <text class="card-subtitle">完成情况:</text>
- <text class="card-subtitle"
- style="margin-left: 20rpx;font-size: 34rpx;">{{list[2].level}}</text>
- </view>
- </view>
- </view>
- <view class="image" :style="{backgroundImage:`url(${list[2].image})`}"></view>
- </view>
- <!-- 列表 -->
- <view class="detail-box">
- <!-- 图表模块 -->
- <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="assignment.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="assignment.homeworkData" :loadingType="4"
- :canvas2d='true' tooltipFormat='HomeworkPercent' canvasId='canvans0933511'
- :opts="{color:['#ff8caf']}" />
- </view>
- <view class="charts-box" v-if="current == 2">
- <qiun-data-charts type="fin-area" :chartData="assignment.activityData" :loadingType="4"
- :canvas2d='true' tooltipFormat='HomeworkPercent' canvasId='canvans0531032'
- :opts="{color:['#f9c752']}" />
- </view>
- </view>
- <!-- 详情列表 -->
- <!-- 评测 -->
- <view class="detail-box-item" v-if="current == 0">
- <view class="item-info">
- <view class="t-icon t-icon-daiban"></view>
- <view class="item-text">评测列表</view>
- <view class="btn" @click="navListData">
- <view class="t-icon t-icon-fenlei"></view>
- <view class="msg">详情列表</view>
- </view>
- </view>
- <view style="margin-bottom: 20rpx;">
- <view class="block-box" v-for="(item,i) in testData" :key="i" @click="navSingleData(item)">
- <view class="index"
- :style="{backgroundColor: item.examInfo.progress === 'finish'? '#23b46c':'#4169E1'}">
- </view>
- <view class="class-block" style="width: 85%;">
- <view style="width: 40%;">
- <view class="list-item-title">{{item.examInfo.name}}</view>
- </view>
- <view style=" display: flex; justify-content: space-between; width: 50%;">
- <view class="block-tag-box"
- :style="{borderColor: item.examInfo.progress === 'finish'? '#23b46c':'#4169E1'}">
- <view class="block-tag"
- :style="{color: item.examInfo.progress === 'finish'? '#23b46c':'#4169E1'}">
- {{item.examInfo.subjects[0].name}}</view>
- </view>
- <view class="block-tag-box"
- :style="{borderColor: item.examInfo.progress === 'finish'? '#23b46c':'#4169E1'}">
- <view class="block-tag"
- :style="{color: item.examInfo.progress === 'finish'? '#23b46c':'#4169E1'}">
- {{item.examInfo.examType.name}}</view>
- </view>
- <view class="block-tag-box"
- :style="{borderColor: item.examInfo.progress === 'finish'? '#23b46c':'#4169E1'}">
- <view class="block-tag"
- :style="{color: item.examInfo.progress === 'finish'? '#23b46c':'#4169E1'}">
- {{item.examInfo.progress === 'finish' ? '已完成' : '进行中'}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 作业 -->
- <view class="detail-box-item" v-if="current == 1">
- <view class="item-info">
- <view class="t-icon t-icon-daiban"></view>
- <view class="item-text">作业列表</view>
- <view class="btn" @click="navListData">
- <view class="t-icon t-icon-fenlei"></view>
- <view class="msg">详情列表</view>
- </view>
- </view>
- <view style="margin-bottom: 20rpx;">
- <view class="block-box" v-for="(item,i) in homeworkData" :key="i"
- @click="navSingleData(item)">
- <view class="index"
- :style="{backgroundColor: item.work.progress === 'finish'? '#23b46c':'#ff8caf'}">
- </view>
- <view class="class-block" style="width: 85%;justify-content: flex-start;">
- <view style="display: flex; flex-direction: column;">
- <view style="display: flex;margin-left: 30rpx;align-items: center;">
- <view class="list-item-title">{{item.work.name}}</view>
- <view class="block-tag-box"
- :style="{marginLeft: 40+'rpx',borderColor: item.work.progress === 'finish'? '#23b46c':'#ff8caf'}">
- <view class="block-tag"
- :style="{color: item.work.progress === 'finish'? '#23b46c':'#ff8caf'}">
- {{item.work.scope === 'private' ? '个人':'学校'}}作业
- </view>
- </view>
- <view class="block-tag-box"
- :style="{marginLeft: 20+'rpx',borderColor: item.work.progress === 'finish'? '#23b46c':'#ff8caf'}">
- <view class="block-tag"
- :style="{color: item.work.progress === 'finish'? '#23b46c':'#ff8caf'}">
- {{item.work.progress === 'finish' ? '已完成' : '进行中'}}
- </view>
- </view>
- </view>
- <rich-text class="block-subtitle" style="margin:10rpx 0 0 30rpx;"
- :nodes="item.work.description"></rich-text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 活动 -->
- <view class="detail-box-item" v-if="current == 2">
- <view class="item-info">
- <view class="t-icon t-icon-daiban"></view>
- <view class="item-text">活动列表</view>
- <view class="btn" @click="navListData">
- <view class="t-icon t-icon-fenlei"></view>
- <view class="msg">详情列表</view>
- </view>
- </view>
- <view style="margin-bottom: 20rpx;">
- <view class="block-box" v-for="(item,i) in activityData" :key="i"
- @click="navSingleData(item)">
- <view class="index"
- :style="{ backgroundColor: item.survey.progress === 'finish' || item.vote.progress === 'finish'? '#23b46c':'#f9c752'}">
- </view>
- <view class="class-block" style="width: 85%;justify-content: flex-start;">
- <view style="display: flex; flex-direction: column;">
- <view style="display: flex;margin-left: 30rpx;align-items: center;">
- <view class="list-item-title">
- {{item.survey.name || item.vote.name}}
- </view>
- <view class="block-tag-box"
- :style="{ marginLeft: 40+'rpx',borderColor: item.survey.progress === 'finish' || item.vote.progress === 'finish'? '#23b46c':'#f9c752'}">
- <view class="block-tag"
- :style="{color: item.survey.progress === 'finish' || item.vote.progress === 'finish'? '#23b46c':'#f9c752'}">
- {{item.survey.scope === 'private' ? '个人':'学校' || item.vote.scope === 'private' ? '个人':'学校'}}活动
- </view>
- </view>
- <view class="block-tag-box"
- :style="{ marginLeft: 20+'rpx',borderColor: item.survey.progress === 'finish' || item.vote.progress === 'finish'? '#23b46c':'#f9c752'}">
- <view class="block-tag"
- :style="{color: item.survey.progress === 'finish' || item.vote.progress === 'finish'? '#23b46c':'#f9c752'}">
- {{item.survey.progress === 'finish' || item.vote.progress === 'finish' ? '已完成' : '进行中'}}
- </view>
- </view>
- </view>
- <rich-text class="block-subtitle" style="margin:10rpx 0 0 30rpx;"
- :nodes="item.vote.description || item.survey.description"></rich-text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex'
- export default {
- computed: {
- ...mapState('m_chart', ['assignment']),
- },
- data() {
- return {
- //模块名
- list: [{
- name: '评测详情',
- level: '',
- image: 'https://ouch-cdn2.icons8.com/yFl5NWU3aVehLBlQf9ctvnZPqtm5U0hqM3IzWvFDCaQ/rs:fit:912:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9wbmcvNzY5/LzY1ZTQxZmZjLTg1/YWQtNDYyMi1hYzU0/LWQ3NDEzZmY2NGI1/YS5wbmc.png',
- // image: 'https://ouch-cdn2.icons8.com/Fc-Mi2ntM_Ixcp_lS3XI6bUS2YaAyfiX2vlyWGtt7lU/rs:fit:1186:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9zdmcvOTk1/L2FkZjRlMGQzLTg3/N2ItNGMwYy04ZjY5/LWQxODUwOGRjMWMy/NC5zdmc.png'
- }, {
- name: '作业详情',
- level: '',
- image: 'https://ouch-cdn2.icons8.com/AVOwJ9emg_ZOeHvQaunQAZlgeLsG-b1cGhiYvgoJ06g/rs:fit:912:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9wbmcvNTAw/LzI5YjU1YWQ4LWMw/YTEtNDE1MS1iYmQw/LWIyMDdhYmRkOTE0/Mi5wbmc.png',
- // image: 'https://ouch-cdn2.icons8.com/HHFusNSROgWCPTuBkHHGmsnUa6MIJA1AxYfCtXQg310/rs:fit:1094:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9zdmcvMzYx/LzlhM2NmMWQzLTg5/NTgtNDNmMi1hYTc1/LTk5NmY0M2U2NTc4/MC5zdmc.png'
- }, {
- name: '活动详情',
- level: '',
- image: 'https://ouch-cdn2.icons8.com/LW70TMgW1cGfYeGNSTEp7__kiKVgIhwdZwUmykdLYMY/rs:fit:912:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9wbmcvOTI0/LzU3MWU4ZDZkLTg0/NzEtNGM5YS04MDJk/LTEzNTM5YmZmZTM2/YS5wbmc.png',
- // image: 'https://ouch-cdn2.icons8.com/2OQwTztN6Gf0XXjbHCAS3a1Qa9CWEr2EG759oTb7MFM/rs:fit:1216:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9zdmcvNzgw/LzdhNTk3OThlLTU2/ZmEtNGY3OC05Mjdm/LTRhMmQ0NWNhOWY3/MC5zdmc.png'
- }],
- //当前模块
- current: 0,
- //页面数据内容
- testData: {},
- homeworkData: {},
- activityData: {},
- //完成内容
- testFinish: '',
- homeworkFinish: '',
- activityFinish: '',
- //历史数据
- historyData: {
- test: [50, 55, 60],
- homework: [10, 60, 50, 88, 100],
- activity: [70, 19, 28, 40, 60, 100, 83]
- },
- //时间戳
- timeStamp: '',
- };
- },
- 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', ['updateDetailList', 'updateDetail']),
- //初始化页面
- init() {
- this.timeStamp = (new Date()).format("hh:mm")
- this.$initHomework()
- this.saveToStudyChart()
- this.getLevel()
- },
- //更改模块
- changeModule(e) {
- this.current = e.index
- },
- //获得评判信息
- getLevel() {
- let testArr = this.historyData.test
- let homeworkArr = this.historyData.homework
- let activityArr = this.historyData.activity
- this.list[0].level = testArr[testArr.length - 1] >= 40 ?
- (testArr[testArr.length - 1] >= 70 ? '优秀' : '良好') : '较差'
- this.list[1].level = homeworkArr[homeworkArr.length - 1] >= 40 ?
- (homeworkArr[homeworkArr.length - 1] >= 70 ? '优秀' : '良好') : '较差'
- this.list[2].level = activityArr[activityArr.length - 1] >= 40 ?
- (activityArr[activityArr.length - 1] >= 70 ? '优秀' : '良好') : '较差'
- },
- //记录完成率到图表
- saveToStudyChart() {
- let temp = {
- categories: [],
- series: [{
- "name": "",
- "data": []
- }]
- }
- // 测试
- this.historyData.test.push(parseInt(this.testFinish * 100 / this.testData.length))
- if (this.historyData.test.length > 7)
- this.historyData.test.shift()
- temp.categories = this.$getRecentDateArray(this.historyData.test.length)
- //数据
- //解除对象指向同一块内存(拷贝)
- temp.series[0].data = this.historyData.test
- let testDataTemp = JSON.parse(JSON.stringify(temp))
- this.updateTestArea(testDataTemp)
- //作业
- this.historyData.homework.push(parseInt(this.homeworkFinish * 100 / this.homeworkData
- .length))
- if (this.historyData.homework.length > 7)
- this.historyData.homework.shift()
- temp.categories = this.$getRecentDateArray(this.historyData.homework.length)
- temp.series[0].data = this.historyData.homework
- let homeworkDataTemp = JSON.parse(JSON.stringify(temp))
- this.updateHomeworkArea(homeworkDataTemp)
- //活动
- this.historyData.activity.push(parseInt(this.activityFinish * 100 / this.activityData
- .length))
- if (this.historyData.activity.length > 7)
- this.historyData.activity.shift()
- temp.categories = this.$getRecentDateArray(this.historyData.activity.length)
- temp.series[0].data = this.historyData.activity
- let activityDataTemp = JSON.parse(JSON.stringify(temp))
- this.updateActivityArea(activityDataTemp)
- },
- //导航到详情页面
- navListData() {
- if (this.current === 0) {
- this.updateDetailList(this.testData)
- uni.navigateTo({
- url: `/subpkg/detaillist/examlist`
- })
- }
- if (this.current === 1) {
- this.updateDetailList(this.homeworkData)
- uni.navigateTo({
- url: `/subpkg/detaillist/homeworklist`
- })
- }
- if (this.current === 2) {
- this.updateDetailList(this.activityData)
- uni.navigateTo({
- url: `/subpkg/detaillist/activitylist`
- })
- }
- },
- //导航到单条数据页面
- navSingleData(item) {
- if (this.current === 0) {
- this.updateDetail(item)
- console.log(item);
- uni.navigateTo({
- url: `/subpkg/detail/exam`
- })
- }
- if (this.current === 1) {
- this.updateDetail(item)
- console.log(item);
- uni.navigateTo({
- url: `/subpkg/detail/homework`
- })
- }
- if (this.current === 2) {
- this.updateDetail(item)
- console.log(item);
- uni.navigateTo({
- url: `/subpkg/detail/activity`
- })
- }
- }
- }
- }
- </script>
- <style lang="scss">
- @import '@/pages/common/blockmsg.scss';
- .list-item-title {
- font-size: 30rpx;
- font-weight: bold;
- color: $color-title;
- }
- .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: 710rpx;
- // background: linear-gradient(to right, #ff95007a,#ff8419);
- border-radius: $card-border-radius;
- .card-title {
- font-size: 50rpx;
- font-weight: bold;
- color: #FFF;
- }
- .card-subtitle {
- margin-left: 20rpx;
- font-size: 30rpx;
- color: #FFF;
- }
- .border-bottom {
- height: 10rpx;
- width: 100%;
- border-radius: $card-border-radius;
- background-color: #FFF;
- margin: 5rpx 0 5rpx 0;
- }
- .image {
- position: relative;
- top: -90rpx;
- right: -35rpx;
- 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: 30rpx 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;
- }
- }
- }
- }
- }
- .index-box {
- background-color: #FFF;
- height: 30rpx;
- width: 10rpx;
- border-radius: 100rpx;
- margin-left: 10rpx;
- }
- //图表
- .charts-box {
- width: 100%;
- height: 300rpx;
- }
- .flex {
- display: flex;
- align-items: center;
- margin-left: 20rpx;
- }
- .msg {
- color: $color-mixblue;
- margin-left: 10rpx;
- font-size: 30rpx;
- }
- .btn {
- display: flex;
- align-items: center;
- margin: 0 5rpx 0 auto;
- }
- .flex-line {
- display: flex;
- align-items: baseline;
- }
- </style>
|