Commit 29123da1 authored by 罗超's avatar 罗超

完善上课消耗表

parent 3790833d
...@@ -277,6 +277,13 @@ export function queryChapterTree(data) { ...@@ -277,6 +277,13 @@ export function queryChapterTree(data) {
}) })
} }
export function queryScheduleCourseStu(data) {
return request({
url: "/ScheduleCourse/GetScheduleCourseStu ",
method: 'post',
data
})
}
/** /**
* 保存课程章节 * 保存课程章节
* @param {JSON参数} data * @param {JSON参数} data
......
<template> <template>
<div class="col"></div> <div class="col scroll-box" id="scrollBox" @scroll="(e)=>scrollHandle(e)">
<div :style="{width: innerW}" id="scrollInnerTemplate"></div>
</div>
</template> </template>
<script> <script>
...@@ -15,26 +17,45 @@ export default { ...@@ -15,26 +17,45 @@ export default {
} }
}, },
data() { data() {
return {}; return {
innerW:'0px',
ratio:0,
boxRatio:0
};
}, },
methods: { methods: {
createResizeObserver() { createResizeObserver() {
this.resizeObserver = new ResizeObserver(entries => { this.resizeObserver = new ResizeObserver(entries => {
for (let entry of entries) { this.calcHandle()
console.log("Element size changed:", entry.contentRect);
// 你可以在这里处理大小变化的逻辑
}
}); });
this.resizeObserver.observe(this.$refs.resizeElement); this.resizeObserver.observe(document.querySelector(`#${this.targetBox}`));
this.resizeObserver.observe(document.querySelector(`#${this.targetWrap}`));
}, },
destroyResizeObserver() { destroyResizeObserver() {
if (this.resizeObserver) { if (this.resizeObserver) {
this.resizeObserver.disconnect(); this.resizeObserver.disconnect();
} }
},
calcHandle(){
const box = document.querySelector('#scrollBox')
const tb = document.querySelector(`#${this.targetBox}`)
const tw = document.querySelector(`#${this.targetWrap}`)
if(box && tb && tw){
this.ratio = tw.offsetWidth/tb.offsetWidth
this.innerW = `${this.ratio * box.offsetWidth}px`
this.boxRatio = tb.offsetWidth/box.offsetWidth
}
},
scrollHandle(e){
const box = document.querySelector('#scrollBox')
const sl = box.scrollLeft*this.boxRatio
this.$emit("scrollChange", sl);
} }
}, },
mounted() { mounted() {
this.createResizeObserver(); this.createResizeObserver();
}, },
beforeDestroy() { beforeDestroy() {
this.destroyResizeObserver(); this.destroyResizeObserver();
...@@ -43,6 +64,11 @@ export default { ...@@ -43,6 +64,11 @@ export default {
</script> </script>
<style> <style>
.scroll-box{
overflow-x: auto;
overflow-y: hidden;
height: 15px;
}
.scroll-box::-webkit-scrollbar { .scroll-box::-webkit-scrollbar {
width: 6px; width: 6px;
height: 6px; height: 6px;
......
This diff is collapsed.
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