调整选课查询

This commit is contained in:
ywyonui 2025-06-30 23:44:07 +08:00
parent 829508ba57
commit d20202af6d
7 changed files with 177 additions and 64 deletions

View File

@ -34,6 +34,11 @@ export const xkqddeleteApi = async (params: any) => {
return await post("/api/xkqd/delete?ids=" + params.ids);
};
// 获取配置:家长端是否显示分钟数
export const getJzdShowFs = async (params: any) => {
return await get("/api/comConfig/getJzdShowFs");
};
/**
*
*/
@ -58,15 +63,15 @@ export const drpkkbApi = async (params: any) => {
/**
*
*/
export const xsXkListApi = async (params: any) => {
return await get("/mobile/jz/xsxk/list", params);
export const xsKxApi = async (params: any) => {
return await get("/mobile/jz/xkkc/list", params);
};
/**
*
*
*/
export const xsXkkcListApi = async (params: any) => {
return await get("/mobile/jz/xkkc/list", params);
export const xsYxListApi = async (params: any) => {
return await get("/mobile/jz/xsxk/list", params);
};
/**
@ -83,7 +88,6 @@ export const xsKscjApi = async (params: any) => {
return await get("/mobile/jz/kscj", params);
};
/**
*
*/

View File

@ -4,7 +4,7 @@
<view class="selection-header">
<view class="header-content">
<!-- 选课类型选择部分 -->
<XkPicker title="俱乐部信息" :is-xs="true" xklx-id="816059832" :xs-id="curXs.id" :nj-id="curXs.njId" @change="switchXk" />
<XkPicker title="俱乐部信息" :is-qk="false" xklx-id="816059832" :xs-id="curXs.id" @change="switchXk" />
<!-- 学生选择部分 -->
<XsPicker :is-bar="true" />
</view>
@ -12,7 +12,7 @@
<!-- 可滚动的内容区域 -->
<view class="scrollable-content">
<XkkcList :xk="curXk" :can-selected="false" />
<XkkcList :xk="curXk" />
</view>
</view>

View File

@ -31,15 +31,17 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { xsXkListApi, xsXkkcListApi } from "@/api/base/server";
import { xsKxApi, xsYxListApi } from "@/api/base/server";
import { useUserStore } from "@/store/modules/user";
import { useDataStore } from "@/store/modules/data";
const { getCurXs } = useUserStore();
const { setData } = useDataStore();
//
const props = defineProps<{
isXs: boolean, //
isQk: boolean, //
xsId: string,
njId: string,
xklxId: string, // Id962488654 / 816059832
title: string,
}>();
@ -47,8 +49,6 @@ const props = defineProps<{
// emit
const emit = defineEmits(['change'])
const curXs = computed(() => getCurXs);
//
const xkList = ref<any>([]);
//
@ -65,38 +65,56 @@ const loadXkList = async () => {
uni.showLoading({
title: "加载中...",
});
const func = props.isXs ? xsXkListApi : xsXkkcListApi;
func({
const params = {
xsId: props.xsId,
njId: props.njId,
xklxId: props.xklxId,
})
.then((res) => {
if (res.resultCode == 1) {
if (res.result && res.result.length) {
njmcId: getCurXs.njmcId,
xklxId: props.xklxId
};
if (!props.isQk) {
const res = await xsYxListApi(params);
uni.hideLoading();
if (res.resultCode === 1 && res.result && res.result.length) {
xkList.value = res.result;
curXk.value = res.result[0];
switchXk(res.result[0]);
} else {
if (props.isXs) {
xkList.value = [];
curXk.value = {};
switchXk({});
}
} else {
const res = await xsKxApi(params);
uni.hideLoading();
if (res.resultCode === 1) {
const result = res.result || {};
if (result.type && result.type === 1) {
if (result.xkList && result.xkList.length) {
xkList.value = result.xkList;
switchXk(result.xkList[0]);
} else {
uni.reLaunch({
url: "/pages/base/course-selection/notopen",
});
}
} else if (result.type && result.type === 2) {
//
setData(result);
uni.reLaunch({
url: "/pages/base/course-selection/payment",
});
} else {
uni.reLaunch({
url: "/pages/base/course-selection/notopen",
});
}
} else {
uni.reLaunch({
url: "/pages/base/course-selection/notopen",
});
}
}
switchXk(curXk.value);
uni.hideLoading();
}
})
.catch(() => {
uni.hideLoading();
});
}
//
function switchXk(xk: any) {
const switchXk = (xk: any) => {
curXk.value = xk;
showFlag.value = false;
if (xk && xk.id) {
@ -116,7 +134,7 @@ watch(() => props.xsId, (newVal) => {
});
//
if (props.xsId && props.njId) {
if (props.xsId) {
loadXkList();
}
</script>

View File

@ -43,11 +43,16 @@ import { ref, watch } from "vue";
import { useDataStore } from "@/store/modules/data";
const { setKcData } = useDataStore();
//
const props = defineProps<{
//
const props = withDefaults(defineProps<{
xk: any,
canSelected: boolean,
}>();
multiple: boolean,
}>(), {
xk: () => ({}),
canSelected: false,
multiple: false,
});
// emit
const emit = defineEmits(['change'])
@ -63,23 +68,37 @@ const toggleSelection = (xkkc: any) => {
// ID
let selectedXkkcIds = uni.getStorageSync("selectedXkkcIds") || [];
if (xkkc.isSelected) {
//
xkkc.isSelected = false;
if (props.multiple) {
//
selectedXkkcIds = selectedXkkcIds.filter(
(id: string) => id !== xkkc.id
);
xkkc.isSelected = false;
} else {
//
selectedXkkcIds = [];
}
// xkkc.hasNum--;
} else {
//
const maxNum = xkkc.maxNum || 0;
const hasNum = xkkc.hasNum || 0;
if (maxNum > hasNum) {
xkkc.isSelected = true;
//
if (props.multiple) {
//
if (!selectedXkkcIds.includes(xkkc.id)) {
selectedXkkcIds.push(xkkc.id);
// xkkc.hasNum++;
}
} else {
//
selectedXkkcIds = [xkkc.id];
//
xkkcList.value.forEach((xkkc: any) => {
xkkc.isSelected = false;
});
}
xkkc.isSelected = true;
}
}
//
@ -112,6 +131,7 @@ const switchXk = (xk: any) => {
}
}
uni.setStorageSync("selectedXkkcIds", newSelectedXkkcIds);
emit("change", newSelectedXkkcIds);
}
//

View File

@ -4,7 +4,7 @@
<view class="selection-header">
<view class="header-content">
<!-- 选课类型选择部分 -->
<XkPicker title="俱乐部信息" :is-xs="false" xklx-id="816059832" :xs-id="curXs.id" :nj-id="curXs.njId" @change="switchXk" />
<XkPicker title="俱乐部信息" :is-qk="true" xklx-id="816059832" :xs-id="curXs.id" @change="switchXk" />
<!-- 学生选择部分 -->
<XsPicker :is-bar="true" />
<!-- 倒计时-->
@ -14,7 +14,7 @@
<!-- 可滚动的内容区域 -->
<view class="scrollable-content">
<XkkcList :xk="curXk" :can-selected="true" @change="changeXkkc" />
<XkkcList :xk="curXk" :can-selected="true" :multiple="true" @change="changeXkkc" />
</view>
<!-- 底部报名按钮 - 固定部分 -->
@ -32,9 +32,13 @@ import XsPicker from "@/pages/base/components/XsPicker/index.vue"
import XkPicker from "@/pages/base/components/XkPicker/index.vue"
import XkCountdown from "@/pages/base/components/XkCountdown/index.vue"
import XkkcList from "@/pages/base/components/XkkcList/index.vue"
import { jzXkQkjApi } from "@/api/base/server";
import { useUserStore } from "@/store/modules/user";
import { useDataStore } from "@/store/modules/data";
const { getCurXs } = useUserStore();
const { getCurXs, getUser } = useUserStore();
const { setData, getData } = useDataStore();
const { sign_file } = getData;
const curXs = computed(() => getCurXs);
const curXk = ref<any>({});
@ -51,13 +55,44 @@ const xkTimeOver = (val: any) => {
//
const changeXkkc = (ids: any) => {
console.log(ids);
selectedXkkcIds.value = ids;
}
//
const submit = () => {
console.log(selectedXkkcIds.value);
const submit = async () => {
//
if (selectedXkkcIds.value.length === 0) {
uni.showToast({
title: "请选择课程!",
icon: "none",
});
return;
}
uni.showLoading({
title: "抢课中...",
});
const params = {
xsId: curXs.value.id,
xm: curXs.value.xm,
xkId: curXk.value.id,
xkkcIds: selectedXkkcIds.value,
jzId: getUser.jzId,
qmFile: sign_file ? sign_file.value : "",
};
const res = await jzXkQkjApi(params);
uni.hideLoading();
if (res.resultCode === 1) {
//
setData(res.result);
uni.reLaunch({
url: "/pages/base/course-selection/payment",
});
} else {
uni.showToast({
title: res.message,
icon: "none",
});
}
}
</script>

View File

@ -4,7 +4,7 @@
<view class="selection-header">
<view class="header-content">
<!-- 选课类型选择部分 -->
<XkPicker title="俱乐部信息" :is-xs="false" xklx-id="962488654" :xs-id="curXs.id" :nj-id="curXs.njId" @change="switchXk" />
<XkPicker title="俱乐部信息" :is-qk="true" xklx-id="962488654" :xs-id="curXs.id" @change="switchXk" />
<!-- 学生选择部分 -->
<XsPicker :is-bar="true" />
<!-- 倒计时-->
@ -32,9 +32,14 @@ import XsPicker from "@/pages/base/components/XsPicker/index.vue"
import XkPicker from "@/pages/base/components/XkPicker/index.vue"
import XkCountdown from "@/pages/base/components/XkCountdown/index.vue"
import XkkcList from "@/pages/base/components/XkkcList/index.vue"
import { jzXkQkjApi } from "@/api/base/server";
import { useUserStore } from "@/store/modules/user";
import { useDataStore } from "@/store/modules/data";
const { getCurXs } = useUserStore();
const { getCurXs, getUser } = useUserStore();
const { setData, getData } = useDataStore();
const { sign_file } = getData;
const user = computed(() => getUser);
const curXs = computed(() => getCurXs);
const curXk = ref<any>({});
@ -51,13 +56,44 @@ const xkTimeOver = (val: any) => {
//
const changeXkkc = (ids: any) => {
console.log(ids);
selectedXkkcIds.value = ids;
}
//
const submit = () => {
console.log(selectedXkkcIds.value);
const submit = async () => {
//
if (selectedXkkcIds.value.length === 0) {
uni.showToast({
title: "请选择课程!",
icon: "none",
});
return;
}
uni.showLoading({
title: "抢课中...",
});
const params = {
xsId: curXs.value.id,
xm: curXs.value.xm,
xkId: curXk.value.id,
xkkcIds: selectedXkkcIds.value,
jzId: getUser.jzId,
qmFile: sign_file ? sign_file.value : "",
};
const res = await jzXkQkjApi(params);
uni.hideLoading();
if (res.resultCode === 1) {
//
setData(res.result);
uni.reLaunch({
url: "/pages/base/course-selection/payment",
});
} else {
uni.showToast({
title: res.message,
icon: "none",
});
}
}
</script>

View File

@ -4,7 +4,7 @@
<view class="selection-header">
<view class="header-content">
<!-- 选课类型选择部分 -->
<XkPicker title="兴趣课信息" :is-xs="true" xklx-id="962488654" :xs-id="curXs.id" :nj-id="curXs.njId" @change="switchXk" />
<XkPicker title="兴趣课信息" :is-qk="false" xklx-id="962488654" :xs-id="curXs.id" @change="switchXk" />
<!-- 学生选择部分 -->
<XsPicker :is-bar="true" />
</view>
@ -12,7 +12,7 @@
<!-- 可滚动的内容区域 -->
<view class="scrollable-content">
<XkkcList :xk="curXk" :can-selected="false" />
<XkkcList :xk="curXk" />
</view>
</view>