diff --git a/.env.dev b/.env.dev index 9ac090e..d7dffbe 100644 --- a/.env.dev +++ b/.env.dev @@ -6,5 +6,5 @@ # serviceHost 留空 → API 走同源相对 /api/*,由 vite proxy 转发到本地后端(规避 CAS 不回 CORS 头) VITE_BASE_HOST=http://base.yunhaixingtong.com VITE_SSO_HOST=http://sso.yunhaixingtong.com -VITE_SERVICE_HOST= +VITE_SERVICE_HOST=http://base.yunhaixingtong.com/userclass VITE_IS_MOCK=false diff --git a/src/App.vue b/src/App.vue index 9fe4c39..5d2f65d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -129,6 +129,7 @@ onMounted(async () => {

暂无权限

如需查看,请联络管理员为您分配权限
+ diff --git a/src/mixins/element_height.js b/src/mixins/element_height.js new file mode 100644 index 0000000..ee16c64 --- /dev/null +++ b/src/mixins/element_height.js @@ -0,0 +1,39 @@ +/** + * 卡片内表格高度实测(Vue3) + * 用法:mixin + 在表格容器上写 class="table-region" ref="tableRegion" + * Table 用 :height="tableRegionHeight" + */ +export const element_height = { + data() { + return { + tableRegionHeight: 0, + }; + }, + mounted() { + this.__measureTableRegion(); + if (typeof ResizeObserver !== "undefined") { + this.__tableRegionRO = new ResizeObserver(() => this.__measureTableRegion()); + const el = this.$refs.tableRegion; + if (el) this.__tableRegionRO.observe(el); + } + window.addEventListener("resize", this.__measureTableRegion); + }, + beforeUnmount() { + if (this.__tableRegionRO) { + this.__tableRegionRO.disconnect(); + this.__tableRegionRO = null; + } + window.removeEventListener("resize", this.__measureTableRegion); + }, + methods: { + __measureTableRegion() { + const el = this.$refs.tableRegion; + if (!el) return; + const h = Math.floor(el.clientHeight); + // 0 常见于隐藏容器/首帧,保留上次有效值 + if (h > 0) this.tableRegionHeight = h; + }, + }, +}; + +export default element_height; diff --git a/src/mixins/self_viewport.js b/src/mixins/self_viewport.js index 63a68fe..506ab89 100644 --- a/src/mixins/self_viewport.js +++ b/src/mixins/self_viewport.js @@ -1,3 +1,6 @@ +// 卡片留白预算(通道 §4.4):.main-container 上下各 16 外边距 + 16 内边距 +const CARD_OVERHEAD = 64; + export const self_viewport = { data() { return { @@ -26,11 +29,16 @@ export const self_viewport = { } }, mounted() { - this.tableHeight = document.body.clientHeight; - window.onresize = () => { - return (() => { - this.tableHeight = document.body.clientHeight; - })(); + const sync = () => { + // 页面已包在 .main-container 卡片内:从视口高度里扣掉卡片留白, + // 否则沿用旧视口基准会多算 64px,表格溢出被卡片裁切 + this.tableHeight = document.body.clientHeight - CARD_OVERHEAD; }; + sync(); + window.addEventListener("resize", sync); + this.__syncTableHeight = sync; + }, + beforeUnmount() { + if (this.__syncTableHeight) window.removeEventListener("resize", this.__syncTableHeight); } }; diff --git a/src/views/areaOperateDaily.vue b/src/views/areaOperateDaily.vue index 54fb15e..ab8cad3 100644 --- a/src/views/areaOperateDaily.vue +++ b/src/views/areaOperateDaily.vue @@ -1,4 +1,6 @@ - - \ No newline at end of file +}; + + + diff --git a/src/views/electiveClassManage.vue b/src/views/electiveClassManage.vue index e12543f..92e7323 100644 --- a/src/views/electiveClassManage.vue +++ b/src/views/electiveClassManage.vue @@ -1,4 +1,6 @@ + +