1、修复跳转不到登录界面,2、修复点名界面显示数据问题

This commit is contained in:
ywyonui 2025-06-23 15:35:55 +08:00
parent a068cd122b
commit 3fd776b750
2 changed files with 51 additions and 38 deletions

View File

@ -13,8 +13,8 @@
<!-- 考勤统计 --> <!-- 考勤统计 -->
<view class="attendance-stats flex-row"> <view class="attendance-stats flex-row">
<view class="stat-item flex-col items-center"> <view class="stat-item flex-col items-center">
<text class="font-18 font-bold">{{ numInfo.yd }}</text> <text class="font-18 font-bold">{{ numInfo.zg }}</text>
<text class="font-12 cor-666 mt-3">应到</text> <text class="font-12 cor-666 mt-3">总人数</text>
</view> </view>
<view class="stat-item flex-col items-center"> <view class="stat-item flex-col items-center">
<text class="font-18 font-bold cor-primary">{{ numInfo.sd }}</text> <text class="font-18 font-bold cor-primary">{{ numInfo.sd }}</text>
@ -28,10 +28,6 @@
<text class="font-18 font-bold cor-danger">{{ numInfo.qq }}</text> <text class="font-18 font-bold cor-danger">{{ numInfo.qq }}</text>
<text class="font-12 cor-666 mt-3">缺勤</text> <text class="font-12 cor-666 mt-3">缺勤</text>
</view> </view>
<view class="stat-circle flex-col flex-center ml-auto">
<text class="font-20 font-bold">{{ numInfo.zg }}</text>
<text class="font-10 cor-666">总人数</text>
</view>
</view> </view>
</view> </view>
@ -81,6 +77,7 @@
<!-- 状态选择弹窗 --> <!-- 状态选择弹窗 -->
<u-picker <u-picker
:defaultIndex="defSel"
:show="statusPickerVisible" :show="statusPickerVisible"
:columns="[statusOptions]" :columns="[statusOptions]"
@confirm="confirmStatus" @confirm="confirmStatus"
@ -138,6 +135,7 @@ const xsList = ref<any>([
const statusPickerVisible = ref(false); const statusPickerVisible = ref(false);
const statusOptions = ref<Array<{ text: string, value: string }>>([]); const statusOptions = ref<Array<{ text: string, value: string }>>([]);
const curXs = ref<any>(null); const curXs = ref<any>(null);
const defSel = ref<any>([]);
// //
const getStatusClass = (status: string) => { const getStatusClass = (status: string) => {
@ -183,39 +181,49 @@ const loadXsList = async () => {
}); });
if (res && res.resultCode === 1) { if (res && res.resultCode === 1) {
xsList.value = res.result || []; xsList.value = res.result || [];
let sd = 0; rebuildNumInfo();
let qj = 0;
let qq = 0;
//
for (let i = 0; i < xsList.value.length; i++) {
const xs = xsList.value[i];
switch (xs.xszt) {
case "正常":
sd++;
break;
case "请假":
qj++;
break;
case "缺勤":
qq++;
break;
default:
break;
}
}
numInfo.value = {
zg: xsList.value.length,
yd: xsList.value.length - qj,
sd: sd,
qj: qj,
qq: qj
};
} }
}; };
const rebuildNumInfo = () => {
let sd = 0;
let qj = 0;
let qq = 0;
//
for (let i = 0; i < xsList.value.length; i++) {
const xs = xsList.value[i];
switch (xs.xszt) {
case "正常":
sd++;
break;
case "请假":
qj++;
break;
case "缺勤":
qq++;
break;
default:
break;
}
}
numInfo.value = {
zg: xsList.value.length,
yd: xsList.value.length - qj,
sd: sd,
qj: qj,
qq: qq
};
}
// //
const openStatusPicker = (xs: any) => { const openStatusPicker = (xs: any) => {
curXs.value = xs; curXs.value = xs;
for (let i = 0; i < statusOptions.value.length; i++) {
if (statusOptions.value[i].text === xs.xszt) {
defSel.value = [i];
break;
}
}
statusPickerVisible.value = true; statusPickerVisible.value = true;
}; };
@ -230,6 +238,7 @@ const confirmStatus = (e: any) => {
// //
curXs.value.xszt = selectedStatus.text; curXs.value.xszt = selectedStatus.text;
} }
rebuildNumInfo();
} }
statusPickerVisible.value = false; statusPickerVisible.value = false;
}; };

View File

@ -59,14 +59,18 @@ onLoad(async (data: any) => {
afterLoginAction(res.result); afterLoginAction(res.result);
// //
goByJs(res.result.js) goByJs(res.result.js)
} else { return;
uni.reLaunch({
url: "/pages/system/login/login",
});
} }
} }
uni.reLaunch({
url: "/pages/system/login/login",
});
}) })
.catch((err) => {}); .catch((err) => {
uni.reLaunch({
url: "/pages/system/login/login"
})
});
} else { } else {
uni.reLaunch({ uni.reLaunch({
url: "/pages/system/login/login" url: "/pages/system/login/login"