diff --git a/src/pages/base/components/XkkcList/index.vue b/src/pages/base/components/XkkcList/index.vue index a05389a..d7955ef 100644 --- a/src/pages/base/components/XkkcList/index.vue +++ b/src/pages/base/components/XkkcList/index.vue @@ -148,6 +148,49 @@ const goToDetail = (xkkc: any) => { const switchXk = (xk: any) => { 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) { return; } @@ -229,6 +272,12 @@ if (props.xk && props.xk.xkkcs) { color: #333; flex: 1; 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 { diff --git a/src/pages/base/jc/pay/index.vue b/src/pages/base/jc/pay/index.vue index d6c2f9b..aff727d 100644 --- a/src/pages/base/jc/pay/index.vue +++ b/src/pages/base/jc/pay/index.vue @@ -150,13 +150,14 @@ const payNow = async () => { openId: getUser.openId, }); if (res.resultCode === 1 && res.result) { - setData({ + window.open(res.result.cashierPayHtml, '_blank'); + /* setData({ ...getData, ...res.result }); uni.redirectTo({ url: `/pages/base/jc/pay/wait?payUrl=${encodeURIComponent(res.result.cashierPayHtml)}` - }); + });*/ } } catch (error) { console.log(error); diff --git a/src/pages/base/xk/pay/index.vue b/src/pages/base/xk/pay/index.vue index 9c5086b..8a664ee 100644 --- a/src/pages/base/xk/pay/index.vue +++ b/src/pages/base/xk/pay/index.vue @@ -132,13 +132,14 @@ const payNow = async () => { openId: getUser.openId, }); if (res.resultCode === 1 && res.result) { - setData({ + window.open(res.result.cashierPayHtml, '_blank'); + /* setData({ ...getData, ...res.result }); uni.redirectTo({ url: `/pages/base/xk/pay/wait?payUrl=${encodeURIComponent(res.result.cashierPayHtml)}` - }); + });*/ } } catch (error: any) { console.log(error);