diff --git a/src/pages/base/xk/components/XkPaySuccessXkkc/index.vue b/src/pages/base/xk/components/XkPaySuccessXkkc/index.vue
index b3f3fd1..1b40b81 100644
--- a/src/pages/base/xk/components/XkPaySuccessXkkc/index.vue
+++ b/src/pages/base/xk/components/XkPaySuccessXkkc/index.vue
@@ -15,7 +15,7 @@
{{ item.kcmc }}
开课老师:{{ item.jsName }}
上课地点:{{ item.kcdd }}
- 金额:¥{{ item.kcje || item.jfje }}
diff --git a/src/pages/base/xk/components/XkkcList/index.vue b/src/pages/base/xk/components/XkkcList/index.vue
index 12e8cd7..fe307bd 100644
--- a/src/pages/base/xk/components/XkkcList/index.vue
+++ b/src/pages/base/xk/components/XkkcList/index.vue
@@ -26,7 +26,7 @@
@@ -47,7 +47,7 @@
diff --git a/src/pages/base/xk/pay/success.vue b/src/pages/base/xk/pay/success.vue
index 01fd4ca..678c3ef 100644
--- a/src/pages/base/xk/pay/success.vue
+++ b/src/pages/base/xk/pay/success.vue
@@ -25,16 +25,32 @@
-
+
@@ -47,6 +63,7 @@ import { getXsXkListApi } from "@/api/base/xkApi";
import { useUserStore } from "@/store/modules/user";
import { useDataStore } from "@/store/modules/data";
import { useCommonStore } from "@/store/modules/common";
+import dayjs from 'dayjs';
const { getCurXs } = useUserStore();
const { getQk } = useDataStore();
@@ -54,16 +71,38 @@ const { getAllXkkcLx } = useCommonStore();
const dataList = ref([]);
+const qk = computed(() => getQk || {});
+const showFlag = ref(false);
+
// 返回首页
const goBack = () => {
uni.reLaunch({ url: "/pages/base/home/index" });
};
+// 跳转到抢课
+const goXk = () => {
+ uni.reLaunch({
+ url: "/pages/base/xk/qk/index?xklxId=" + qk.value.xklxId,
+ });
+};
+
const loadYxXkList = async (xklxId:string) => {
- const qk = getQk || {};
- if (qk.xklxId === xklxId) {
- dataList.value = qk.xkqdList;
- console.log('loadYxXkList', qk.xkqdList);
+ showFlag.value = false;
+ const now = dayjs();
+ if (qk.value.xklxId === xklxId) {
+ dataList.value = qk.value.xkqdList || [];
+ const xkList = qk.value.xkList || [];
+ xkList.forEach((xk:any) => {
+ // 检查当前时间是否在选课时间范围内
+ const startTime = dayjs(xk.xkkstime);
+ const endTime = dayjs(xk.xkjstime);
+ if (xk.kxNum > dataList.value.length
+ && now.isAfter(startTime)
+ && now.isBefore(endTime)) {
+ qk.value.xsXkStatus = "KQK";
+ showFlag.value = true;
+ }
+ });
} else {
const resLx = await getAllXkkcLx();
const lxList = resLx.result;
diff --git a/src/pages/base/xk/qk/index.vue b/src/pages/base/xk/qk/index.vue
index 2fe73b7..4235123 100644
--- a/src/pages/base/xk/qk/index.vue
+++ b/src/pages/base/xk/qk/index.vue
@@ -204,6 +204,12 @@ onLoad((options:any) => {
uni.hideLoading();
if (dataObj.code === 1 && dataObj.data === "qk") {
PageUtils.toHome(xklxId.value);
+ } else if (dataObj.code === 2) { // 课程提示
+ uni.showToast({
+ title: dataObj.message,
+ icon: "none",
+ duration: 3000
+ });
} else {
uni.showToast({
title: dataObj.message,
diff --git a/src/utils/webSocket/webSocket.ts b/src/utils/webSocket/webSocket.ts
index 2843cf7..6d000d2 100644
--- a/src/utils/webSocket/webSocket.ts
+++ b/src/utils/webSocket/webSocket.ts
@@ -1,5 +1,4 @@
import { BASE_WS_URL } from "@/config";
-import { hideLoading, showLoading } from "@/utils/uniapp";
export interface WebSocketReturn {
reconnect: () => void,
@@ -11,13 +10,25 @@ let isLoading = false
function heartbeatState(state: boolean) {
if (!state) {
- if (!isLoading) {
- showLoading({ title: '网络异常,重新连接中' })
+ if (isLoading) {
+ // 使用顶部提示代替中间loading
+ uni.showToast({
+ title: '网络异常,重新连接中...',
+ icon: 'none',
+ position: 'top',
+ duration: 2000
+ });
}
isLoading = true
}
- if (state) {
- hideLoading()
+ if (state && isLoading) {
+ // 隐藏提示
+ uni.showToast({
+ title: '连接已恢复',
+ icon: 'success',
+ position: 'top',
+ duration: 1000
+ });
isLoading = false
}
}
diff --git a/vite.config.ts b/vite.config.ts
index 4f7d89c..b67c884 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -7,7 +7,6 @@ import AutoStylePlugin from "./plugin/vite-plugin-autoStyle";
import {HOMEAGENT} from "./src/config";
export default defineConfig({
- base: './', // 添加这行,确保使用相对路径
server: {
proxy: {
"/base": {
@@ -17,7 +16,6 @@ export default defineConfig({
},
},
port: 5139,
- host: true, // 允许外部访问
},
plugins: [
//c 为class 例如 class="wi-10"
@@ -61,16 +59,5 @@ export default defineConfig({
'@': resolve(__dirname, './src'),
'#': resolve(__dirname, './types')
}
- },
- // 添加构建优化配置
- build: {
- rollupOptions: {
- output: {
- manualChunks: {
- 'vendor': ['vue', 'pinia'],
- 'uni': ['@dcloudio/uni-app', '@dcloudio/uni-h5']
- }
- }
- }
}
});