选课与支付调整
This commit is contained in:
parent
fdf951803d
commit
cf6bc42396
@ -148,6 +148,49 @@ const goToDetail = (xkkc: any) => {
|
|||||||
|
|
||||||
const switchXk = (xk: any) => {
|
const switchXk = (xk: any) => {
|
||||||
xkkcList.value = xk.xkkcs;
|
xkkcList.value = xk.xkkcs;
|
||||||
|
|
||||||
|
// 对课程列表进行排序:先按课程名称,再按课程名称中的序号,最后按上课时间
|
||||||
|
xkkcList.value.sort((a: any, b: any) => {
|
||||||
|
// 提取课程名称(去掉序号部分)
|
||||||
|
const getCourseName = (kcmc: string) => {
|
||||||
|
return kcmc.replace(/\d+$/, '');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 提取课程名称中的序号
|
||||||
|
const getCourseNumber = (kcmc: string) => {
|
||||||
|
const match = kcmc.match(/(\d+)$/);
|
||||||
|
return match ? parseInt(match[1]) : 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
const aCourseName = getCourseName(a.kcmc);
|
||||||
|
const bCourseName = getCourseName(b.kcmc);
|
||||||
|
|
||||||
|
// 首先按课程名称排序(最高优先级)
|
||||||
|
if (aCourseName !== bCourseName) {
|
||||||
|
return aCourseName.localeCompare(bCourseName, 'zh-CN');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果课程名称相同,则按课程名称中的序号排序(按数值大小,不是字符串)
|
||||||
|
const aNumber = getCourseNumber(a.kcmc);
|
||||||
|
const bNumber = getCourseNumber(b.kcmc);
|
||||||
|
|
||||||
|
// 如果都有序号,按数值大小排序
|
||||||
|
if (aNumber > 0 && bNumber > 0) {
|
||||||
|
if (aNumber !== bNumber) {
|
||||||
|
return aNumber - bNumber; // 数值排序:3 < 14
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果序号相同或没有序号,则按上课时间排序
|
||||||
|
if (a.studyTime && b.studyTime) {
|
||||||
|
return a.studyTime.localeCompare(b.studyTime, 'zh-CN');
|
||||||
|
}
|
||||||
|
// 如果某个没有上课时间,则排在后面
|
||||||
|
if (a.studyTime && !b.studyTime) return -1;
|
||||||
|
if (!a.studyTime && b.studyTime) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
if (!props.canSelected) {
|
if (!props.canSelected) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -229,6 +272,12 @@ if (props.xk && props.xk.xkkcs) {
|
|||||||
color: #333;
|
color: #333;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
|
line-height: 1.4;
|
||||||
|
min-height: 44px; /* 统一两行高度:16px * 1.4 * 2 ≈ 44px */
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
word-break: break-all;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-btn {
|
.detail-btn {
|
||||||
|
|||||||
@ -150,13 +150,14 @@ const payNow = async () => {
|
|||||||
openId: getUser.openId,
|
openId: getUser.openId,
|
||||||
});
|
});
|
||||||
if (res.resultCode === 1 && res.result) {
|
if (res.resultCode === 1 && res.result) {
|
||||||
setData({
|
window.open(res.result.cashierPayHtml, '_blank');
|
||||||
|
/* setData({
|
||||||
...getData,
|
...getData,
|
||||||
...res.result
|
...res.result
|
||||||
});
|
});
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/base/jc/pay/wait?payUrl=${encodeURIComponent(res.result.cashierPayHtml)}`
|
url: `/pages/base/jc/pay/wait?payUrl=${encodeURIComponent(res.result.cashierPayHtml)}`
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|||||||
@ -132,13 +132,14 @@ const payNow = async () => {
|
|||||||
openId: getUser.openId,
|
openId: getUser.openId,
|
||||||
});
|
});
|
||||||
if (res.resultCode === 1 && res.result) {
|
if (res.resultCode === 1 && res.result) {
|
||||||
setData({
|
window.open(res.result.cashierPayHtml, '_blank');
|
||||||
|
/* setData({
|
||||||
...getData,
|
...getData,
|
||||||
...res.result
|
...res.result
|
||||||
});
|
});
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/base/xk/pay/wait?payUrl=${encodeURIComponent(res.result.cashierPayHtml)}`
|
url: `/pages/base/xk/pay/wait?payUrl=${encodeURIComponent(res.result.cashierPayHtml)}`
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user