提交 d7ab01c9 编写于 作者: guangjun.yang's avatar guangjun.yang

process有一点问题

上级 a3de7c1b
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
课程总时长 课程总时长
<span>(所有课程数 {{totalSize}}门)</span> <span>(所有课程数 {{totalSize}}门)</span>
</p> </p>
<ProcessBar :maxValue="maxDuration" :value="maxDuration"></ProcessBar> <ProcessBar :processDataObj="processDataObj" :maxValue="maxDuration" :value="maxDuration"></ProcessBar>
</li> </li>
<li> <li>
<p>平均学习时长</p> <p>平均学习时长</p>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
课程总时长 课程总时长
<span>(所有课程数 {{totalSize}}门)</span> <span>(所有课程数 {{totalSize}}门)</span>
</p> </p>
<ProcessBar :maxValue="avgDuration" :value="avgDuration"></ProcessBar> <ProcessBar :processDataObj="processDataObj" :maxValue="avgDuration" :value="avgDuration"></ProcessBar>
</li> </li>
<li> <li>
<p>平均学习时长</p> <p>平均学习时长</p>
...@@ -44,8 +44,17 @@ export default { ...@@ -44,8 +44,17 @@ export default {
avgDuration: { avgDuration: {
type: Number | String, type: Number | String,
default: 100 default: 100
},
processDataObj: {
type: Object,
default: () => {
return {
maxValue: 100,
value: 0
}
} }
}, },
},
components: { components: {
ProcessBar ProcessBar
}, },
......
...@@ -115,6 +115,7 @@ export default { ...@@ -115,6 +115,7 @@ export default {
position: absolute; position: absolute;
left: 0px; left: 0px;
top: 15px; top: 15px;
z-index: 2010;
display: inline-block; display: inline-block;
width: 50px; width: 50px;
height: 60px; height: 60px;
...@@ -131,12 +132,13 @@ export default { ...@@ -131,12 +132,13 @@ export default {
background: #fff; background: #fff;
color: #333; color: #333;
position: relative; position: relative;
z-index: 109; z-index: 2009;
.nav-back { .nav-back {
display: inline-block; display: inline-block;
position: absolute; position: absolute;
left: 0px; left: 0px;
top: 0; top: 0;
z-index: 2010;
height: 25px; height: 25px;
width: 55px; width: 55px;
padding-left: 15px; padding-left: 15px;
...@@ -164,6 +166,7 @@ export default { ...@@ -164,6 +166,7 @@ export default {
position: absolute; position: absolute;
right: 16px; right: 16px;
top: 0; top: 0;
z-index: 2010;
height: 20px; height: 20px;
width: 20px; width: 20px;
} }
...@@ -171,6 +174,7 @@ export default { ...@@ -171,6 +174,7 @@ export default {
position: relative; position: relative;
top: 10px; top: 10px;
left: 0; left: 0;
z-index: 2010;
display: inline-block; display: inline-block;
width: 100%; width: 100%;
/* padding:0 33px;*/ /* padding:0 33px;*/
...@@ -197,6 +201,7 @@ export default { ...@@ -197,6 +201,7 @@ export default {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
z-index: 2010;
border-bottom: 0px solid #e7e7e7; border-bottom: 0px solid #e7e7e7;
background: #fff; background: #fff;
/* height: 25px;*/ /* height: 25px;*/
......
...@@ -15,6 +15,15 @@ export default { ...@@ -15,6 +15,15 @@ export default {
type: Number | String, type: Number | String,
default: 0 default: 0
}, },
processDataObj: {
type: Object,
default: () => {
return {
maxValue: 100,
value: 0
}
}
},
valueDescWidth: { valueDescWidth: {
type: Number | String, type: Number | String,
default: 120 default: 120
...@@ -30,25 +39,49 @@ export default { ...@@ -30,25 +39,49 @@ export default {
}, },
data() { data() {
return { return {
maxPocessWidth: false maxPocessWidth: '0px'
} }
}, },
mounted() { // computed: {
// let maxWidth = window.clien // test() {
// scrollWidth offsetWidth
this.$nextTick(() => { // }
// },
watch: {
valueObj: {
handler(newVal) {
if(process.client) {
let clientWidth = window.outerWidth || document.body.clientWidth || document.documentElement.clientWidth; let clientWidth = window.outerWidth || document.body.clientWidth || document.documentElement.clientWidth;
let maxWidth = clientWidth - this.valueDescWidth; let maxWidth = clientWidth - this.valueDescWidth;
let ratio = 1; let ratio = 1;
if(this.value && this.value < this.maxValue) { if(this.processDataObj.value && this.processDataObj.value < this.processDataObj.maxValue) {
ratio = this.value / this.maxValue; ratio = this.processDataObj.value / this.processDataOb.maxValue;
} }
if(!this.value) { if(!this.processDataObj.value) {
ratio = 0.01; ratio = 0.01;
} }
this.maxPocessWidth = Math.round(ratio * maxWidth) + 'px' this.maxPocessWidth = Math.round(ratio * maxWidth) + 'px'
}) }
},
deep: true
}
},
mounted() {
// let maxWidth = window.clien
// scrollWidth offsetWidth
// this.$nextTick(() => {
// let clientWidth = window.outerWidth || document.body.clientWidth || document.documentElement.clientWidth;
// let maxWidth = clientWidth - this.valueDescWidth;
// let ratio = 1;
// if(this.value && this.value < this.maxValue) {
// ratio = this.value / this.maxValue;
// }
// if(!this.value) {
// ratio = 0.01;
// }
// this.maxPocessWidth = Math.round(ratio * maxWidth) + 'px'
// })
}, },
methods: {} methods: {}
}; };
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<!-- 课程分析 --> <!-- 课程分析 -->
<article v-show="(cIndex === 2) && (projectInfo.existCourse == 1)" style="padding-top: 8px;"> <article v-show="(cIndex === 2) && (projectInfo.existCourse == 1)" style="padding-top: 8px;">
<CourseTimesStat :totalSize="courseInfo.totalSize" :maxDuration="courseInfo.pCourseTotalTime" :avgDuration="courseInfo.pCourseAvg"></CourseTimesStat> <CourseTimesStat ::processDataObj="processDataObj" :totalSize="courseInfo.totalSize" :maxDuration="courseInfo.pCourseTotalTime" :avgDuration="courseInfo.pCourseAvg"></CourseTimesStat>
<CommonSplitLine></CommonSplitLine> <CommonSplitLine></CommonSplitLine>
<CommonTitle title="课程列表"></CommonTitle> <CommonTitle title="课程列表"></CommonTitle>
<CourseTimesList :dataList="courseInfo.pCourseList"></CourseTimesList> <CourseTimesList :dataList="courseInfo.pCourseList"></CourseTimesList>
...@@ -296,7 +296,9 @@ export default { ...@@ -296,7 +296,9 @@ export default {
educationEffectList: [], educationEffectList: [],
knowledgeEffectList: [] knowledgeEffectList: []
}, },
processDataObj: {
}
}; };
}, },
computed: { computed: {
...@@ -466,6 +468,13 @@ export default { ...@@ -466,6 +468,13 @@ export default {
async getGeneralCourse(params) { async getGeneralCourse(params) {
await getGeneralCourse(params).then(res => { await getGeneralCourse(params).then(res => {
if (res.code === "000000") { if (res.code === "000000") {
this.processDataObj = {
maxDuration: res.data.pCourseTotalTime,
avgDuration: res.data.pCourseAvg
}
this.processDataObj.maxDuration = res.data.pCourseTotalTime;
this.processDataObj.avgDuration = res.data.pCourseAvg;
// :totalSize="courseInfo.totalSize" :maxDuration="courseInfo.pCourseTotalTime"
this.courseInfo = res.data; this.courseInfo = res.data;
} }
}); });
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册