Commit 3d58f9e3 by kyle

Merge branch '20221123' into dev

parents 87e265dc 878981fd
<template>
<view class="charts-box">
<qiun-data-charts type="column" :opts="opts" :chartData="chartData" :ontouch="true" :tooltipShow="false" @getIndex="tap"/>
</view>
</template>
<script>
import { ref } from "vue";
export default {
props:['chartData'],
data() {
return {
opts: { },
};
},
setup(props,content) {
const chartData = ref(props.chartData);
const tap = (e)=>{
const index = e.currentIndex.index;
console.log(e)
content.emit('getIndex',index)
}
return {chartData,tap}
},
mounted() {
this.opts = {
color:['#5F83FF'],
touchMoveLimit: 24,
enableScroll: true,
xAxis: {
fontSize:10,
scrollShow: true,
itemCount: 12,
format:'xAxisDemo3',
},
yAxis:{
showTitle:true,
data:[{
title:'(分钟)',
titleFontSize:10,
titleOffsetY:-5
}]
},
legend:{
show:false
},
series:{
},
extra:{
tootip:{
showBox:false,
showArrow:false
},
column:{
barBorderRadius:[5,5,0,0],
width: 15,
activeBgColor:'#000',
activeBgOpacity:0.05
}
}
};
},
methods: {
}
};
</script>
<style scoped>
/* 请根据实际需求修改父元素尺寸,组件自动识别宽高 */
.charts-box {
width: 100%;
height: 600rpx;
}
</style>
\ No newline at end of file
...@@ -34,8 +34,12 @@ ...@@ -34,8 +34,12 @@
name:'announcement_detail', name:'announcement_detail',
components:{ components:{
}, },
<<<<<<< Updated upstream
onLoad(options){ onLoad(options){
this.id = options.id; this.id = options.id;
=======
onLoad(option){
>>>>>>> Stashed changes
this.getAnnouncementDetail(); this.getAnnouncementDetail();
}, },
methods:{ methods:{
......
...@@ -44,10 +44,14 @@ ...@@ -44,10 +44,14 @@
</view> </view>
<!-- 相关课程列表 --> <!-- 相关课程列表 -->
<view class="relationCourseListsContent" v-show="tabType===2"> <view class="relationCourseListsContent" v-show="tabType===2">
<<<<<<< Updated upstream
<view class="totalCourseCount"> <view class="totalCourseCount">
<text v-if="requiredCount">{{requiredCount}}节必修</text> <text v-if="requiredCount">{{requiredCount}}节必修</text>
<text v-if="nonRequiredCount"> + {{nonRequiredCount}}节必修</text> <text v-if="nonRequiredCount"> + {{nonRequiredCount}}节必修</text>
</view> </view>
=======
<view class="totalCourseCount">{{requiredCount}}节必修 + {{nonRequiredCount}}节选修</view>
>>>>>>> Stashed changes
<view class="courseItemContent" v-for="(item,index) in relatedCoursesLists" :key="item.fileId"> <view class="courseItemContent" v-for="(item,index) in relatedCoursesLists" :key="item.fileId">
<view class="courseInfoContent"> <view class="courseInfoContent">
<h4>{{index + 1}}.{{item.fileTitle}}<text class="courseType">{{item.fileType=='1' ? '必修' : '选修'}}</text></h4> <h4>{{index + 1}}.{{item.fileTitle}}<text class="courseType">{{item.fileType=='1' ? '必修' : '选修'}}</text></h4>
...@@ -106,6 +110,7 @@ ...@@ -106,6 +110,7 @@
shareCode:'', shareCode:'',
shareReadId:'', shareReadId:'',
dataSource:'1', dataSource:'1',
<<<<<<< Updated upstream
requiredCount:0, requiredCount:0,
nonRequiredCount:0, nonRequiredCount:0,
videoPlaybackInfo:{}, videoPlaybackInfo:{},
...@@ -115,6 +120,10 @@ ...@@ -115,6 +120,10 @@
viewTime:0, viewTime:0,
timer:null, timer:null,
loginType:'' loginType:''
=======
nonRequiredCount:0,
requiredCount:0
>>>>>>> Stashed changes
}; };
}, },
methods:{ methods:{
...@@ -197,8 +206,12 @@ ...@@ -197,8 +206,12 @@
console.log('相关课程详情',res); console.log('相关课程详情',res);
if(res['success']){ if(res['success']){
this.relatedCoursesLists = res['data']['data']['relatedCourseList']; this.relatedCoursesLists = res['data']['data']['relatedCourseList'];
<<<<<<< Updated upstream
this.nonRequiredCount = res['data']['data']['nonRequiredCount']; this.nonRequiredCount = res['data']['data']['nonRequiredCount'];
this.requiredCount = res['data']['data']['requiredCount']; this.requiredCount = res['data']['data']['requiredCount'];
=======
console.log(this.relatedCoursesLists)
>>>>>>> Stashed changes
} }
}) })
}, },
......
...@@ -84,10 +84,42 @@ ...@@ -84,10 +84,42 @@
<view class="studyDetailBox"> <view class="studyDetailBox">
<h4>学习明细</h4> <h4>学习明细</h4>
<view class="lineChartBox"> <view class="lineChartBox">
<view v-if="studyInfos && chartData">
<charts :chartData="chartData" @getIndex="tap"></charts>
<view class="chartTips">
<view class="imgBox">
<image src="../../static/point.png" mode="widthFix"></image>
</view>
<text>点击可查看对应数据</text>
</view>
</view>
<view class="noListTip" v-if="!studyInfos">
暂无学习明细
</view>
</view> </view>
<view class="calendarBox"> <view class="calendarBox">
<!-- 以防页面闪烁。日历提示需要刷新dom -->
<template v-if="showCalendar">
<view><uni-calendar
:date="currentDate"
:insert="true"
:lunar="true"
:start-date="'2022-01-01'"
:end-date="'2099-12-31'"
:selected="calendarSelected"
@monthSwitch="monthSwitch"
@change="calendarChange"
/></view>
</template>
<template v-if="!showCalendar">
<view><uni-calendar
:date="currentDate"
:insert="true"
:lunar="true"
:start-date="'2022-01-01'"
:end-date="'2099-12-31'"
/></view>
</template>
</view> </view>
</view> </view>
</view> </view>
...@@ -95,7 +127,9 @@ ...@@ -95,7 +127,9 @@
<script> <script>
import api from "@/api/api"; import api from "@/api/api";
import charts from "@/components/charts/charts.vue";
export default { export default {
components:{charts},
data() { data() {
return { return {
userId:'1', userId:'1',
...@@ -104,9 +138,15 @@ ...@@ -104,9 +138,15 @@
userStudyTimeList:{}, userStudyTimeList:{},
month:'', month:'',
state:{ state:{
package:false, package:false
file:false },
} chartData:{},
studyInfos:[],
calendarSelected:[],
index:0,
categoriesArr:[],
currentDate:new Date().toDateString(),
showCalendar:false
}; };
}, },
methods:{ methods:{
...@@ -114,6 +154,19 @@ ...@@ -114,6 +154,19 @@
api.userStudyCount({userId:this.userId}).then(res=>{ api.userStudyCount({userId:this.userId}).then(res=>{
if(res['success']){ if(res['success']){
this.userStudyCountList = res['data']; this.userStudyCountList = res['data'];
this.studyInfos = res['data']['studyInfos'];
let categories=[];
let data = [];
if(this.studyInfos.length >0){
for(let j=0;j<this.studyInfos.length;j++){
categories.push(this.studyInfos[j].month.split('-')[1]);
data.push({value:this.studyInfos[j]['studyTime'],color:'#9EB4FF'});
}
}
this.currentDate = this.month = this.studyInfos[this.studyInfos.length - 1].month;
this.chartData.categories = categories;
this.chartData.series = [{name:'月',data:data}];
this.userStudyTime()
} }
}) })
}, },
...@@ -130,9 +183,34 @@ ...@@ -130,9 +183,34 @@
userStudyTime(){ userStudyTime(){
api.userStudyTime({userId:this.userId,month:this.month}).then(res=>{ api.userStudyTime({userId:this.userId,month:this.month}).then(res=>{
if(res['success']){ if(res['success']){
this.userStudyTimeList = res['data']; this.userStudyTimeList = res['data']['studyInfos'];
this.$nextTick(() => {
this.showCalendar = true
})
if(this.userStudyTimeList){
for(let i=0;i<this.userStudyTimeList.length;i++){
let arr = {date:'',info:''}
arr.date = this.userStudyTimeList[i]['day'];
arr.info = this.userStudyTimeList[i]['studyTime'] + '分';
this.calendarSelected.push(arr)
}
}
} }
}) })
},
monthSwitch(e){
// console.log(e)
},
calendarChange(e){
// console.log(e)
},
tap(e){
this.index = e;
this.month = this.studyInfos[this.index].month;
this.calendarSelected = [];
this.currentDate = this.month;
this.showCalendar = false;
this.userStudyTime();
} }
}, },
mounted() { mounted() {
...@@ -296,5 +374,29 @@ ...@@ -296,5 +374,29 @@
} }
} }
} }
.studyDetailBox{
background-color: #fff;
margin-top: 20rpx;
.calendarBox{
margin: 20rpx;
box-shadow: 0px 0px 22px 0px rgba(0,0,0,0.1);
border-radius: 10rpx;
}
.lineChartBox{
width: 100%;
.chartTips{
text-align: center;
font-size: 20rpx;
color: #c1c1c1;
display: flex;
justify-content: center;
padding-top: 10rpx;
background: #fff;
.imgBox{
width: 30rpx;
}
}
}
}
} }
</style> </style>
...@@ -58,6 +58,7 @@ const cfu = { ...@@ -58,6 +58,7 @@ const cfu = {
"yAxisDemo2":function(val, index, opts){return val.toFixed(2)}, "yAxisDemo2":function(val, index, opts){return val.toFixed(2)},
"xAxisDemo1":function(val, index, opts){return val+'年';}, "xAxisDemo1":function(val, index, opts){return val+'年';},
"xAxisDemo2":function(val, index, opts){return formatDateTime(val,'h:m')}, "xAxisDemo2":function(val, index, opts){return formatDateTime(val,'h:m')},
"xAxisDemo3":function(val, index, opts){return val + '月'},
"seriesDemo1":function(val, index, series, opts){return val+'元'}, "seriesDemo1":function(val, index, series, opts){return val+'元'},
"tooltipDemo1":function(item, category, index, opts){ "tooltipDemo1":function(item, category, index, opts){
if(index==0){ if(index==0){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment