处理了兼容的问题

This commit is contained in:
17792275749
2025-06-13 14:20:01 +08:00
parent 3c33aa92d9
commit 529d6fa090
@@ -7,7 +7,7 @@
</div>
<template v-if="personnelType === 'staff'">
<div class="title staffTitle">
<div class="title">
<div></div>
<div>
<div>体重管理行动员工</div>
@@ -63,11 +63,16 @@
</template>
<template v-if="personnelType === 'department'">
<div class="title departmentTitle">
<div class="title">
<div></div>
<div>
<div>体重管理行动部门</div>
<div>{{ currentData }}</div>
<div>
<div>{{ currentData }}</div>
<div>
活动开始第<span>{{ doingDay }}</span>
</div>
</div>
</div>
<div></div>
</div>
@@ -159,11 +164,11 @@ export default {
let url = _this.$route.query.url;
if (url) {
_this.requestConfig.url = url;
_this.requestConfig.url = Array.isArray(url) ? url[0] : url;
}
let code = _this.$route.query.orgCode;
if (code) {
_this.requestConfig.orgCode = code;
_this.requestConfig.orgCode = Array.isArray(code) ? code[0] : code;
}
_this.currentData = getCurrentDate();
@@ -355,9 +360,7 @@ export default {
(res) => {
_this.callAndroidPostLog(`请求返回:${JSON.stringify(res)}`);
if (res.success && res.result && res.result.rankList) {
if (_this.personnelType === "staff") {
_this.doingDay = res.result.doingDay === null ? "-" : res.result.doingDay;
}
_this.doingDay = res.result.doingDay === null ? "-" : res.result.doingDay;
_this.list = res.result.rankList; // 更新列表数据
_this.callAndroidPostLog(`数据加载成功,列表长度:${_this.list.length}`);
@@ -383,10 +386,8 @@ export default {
_this.setTimeoutParams.retryDelay * 1000
);
}
}
)
.catch(
(error) => {
},
(error) => { // 添加错误回调
_this.callAndroidPostLog("请求失败: " + JSON.stringify(error));
_this.list = []; // 请求失败时清空列表
_this.callAndroidPostLog('请求失败,将在 ' + _this.setTimeoutParams.retryDelay + ' 秒后重试/切换。');
@@ -396,12 +397,10 @@ export default {
);
}
)
.finally(
() => {
_this.isRequesting = false;
_this.callAndroidPostLog("请求结束,isRequesting 设置为 false。");
}
);
.then(() => { // 使用 .then() 替代 .finally(),无论成功或失败都会执行
_this.isRequesting = false;
_this.callAndroidPostLog("请求结束,isRequesting 设置为 false。");
});
},
/**
@@ -453,13 +452,10 @@ export default {
// 确保列表项已经渲染,才能获取其高度
if (listWrapperEl.children.length > 0) {
let firstItem = listWrapperEl.children[0];
let itemHeight = firstItem.offsetHeight;
let itemMarginBottom = parseFloat(window.getComputedStyle(firstItem).marginBottom);
// 计算实际总高度(包括所有列表项和它们之间的 margin-bottom
actualListHeight = 0;
for(let i=0; i<listWrapperEl.children.length; i++){
actualListHeight += listWrapperEl.children[i].offsetHeight + parseFloat(window.getComputedStyle(listWrapperEl.children[i]).marginBottom);
let child = listWrapperEl.children[i];
actualListHeight += child.offsetHeight + parseFloat(window.getComputedStyle(child).marginBottom);
}
// 减去最后一个元素的 margin-bottom因为它下面没有其他元素
if (listWrapperEl.children.length > 0) {
@@ -724,6 +720,35 @@ export default {
text-align: center;
margin-bottom: 12px;
}
> div:nth-of-type(2) {
width: 100%;
height: 40px;
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
align-items: flex-end;
> div:nth-of-type(1) {
color: #8d0503;
height: 32px;
font-size: 30px;
line-height: 32px;
}
> div:nth-of-type(2) {
color: #8d0503;
height: 40px;
font-size: 30px;
line-height: 40px;
> span {
margin: 0 6px;
font-size: 40px;
font-weight: bold;
}
}
}
}
> div:nth-of-type(3) {
@@ -734,60 +759,6 @@ export default {
background-position: center;
background-image: url("@/assets/images/dietaryNutritionTips/r.png");
}
&.staffTitle {
> div:nth-of-type(2) {
> div:nth-of-type(1) {
margin-bottom: 12px;
}
> div:nth-of-type(2) {
width: 100%;
height: 40px;
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
align-items: flex-end;
> div:nth-of-type(1) {
color: #8d0503;
height: 32px;
font-size: 30px;
line-height: 32px;
}
> div:nth-of-type(2) {
color: #8d0503;
height: 40px;
font-size: 30px;
line-height: 40px;
> span {
margin: 0 6px;
font-size: 40px;
font-weight: bold;
}
}
}
}
}
&.departmentTitle {
> div:nth-of-type(2) {
> div:nth-of-type(1) {
margin-bottom: 20px;
}
> div:nth-of-type(2) {
color: #8d0503;
width: 100%;
height: 30px;
font-size: 30px;
line-height: 30px;
text-align: center;
}
}
}
}
.content {