1、修复静态资源文件加载失败的问题

2、添加抢课成功补选的功能
This commit is contained in:
ywyonui 2025-09-04 23:01:58 +08:00
parent 95fba54fac
commit 5fef0a1855
6 changed files with 114 additions and 48 deletions

View File

@ -15,7 +15,7 @@
<view class="course-name">{{ item.kcmc }}</view> <view class="course-name">{{ item.kcmc }}</view>
<view class="course-teacher">开课老师{{ item.jsName }}</view> <view class="course-teacher">开课老师{{ item.jsName }}</view>
<view class="course-location">上课地点{{ item.kcdd }}</view> <view class="course-location">上课地点{{ item.kcdd }}</view>
<view class="course-price" <view class="course-price" v-if="(item.kcje || item.jfje) > 0"
>金额<text class="price-value">¥{{ item.kcje || item.jfje }}</text></view >金额<text class="price-value">¥{{ item.kcje || item.jfje }}</text></view
> >
</view> </view>

View File

@ -26,7 +26,7 @@
</view> </view>
<view v-if="xkkc.isSelected" class="selected-mark"> <view v-if="xkkc.isSelected" class="selected-mark">
<uni-icons <uni-icons
type="checkbox-filled" :type="xkkc.isDisabled ? 'locked' : 'checkbox-filled'"
color="#3FBF72" color="#3FBF72"
size="22" size="22"
></uni-icons> ></uni-icons>
@ -47,7 +47,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue"; import { ref, watch } from "vue";
import { useDataStore } from "@/store/modules/data"; import { useDataStore } from "@/store/modules/data";
const { setKcData } = useDataStore(); const { setKcData, getQk } = useDataStore();
// //
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
@ -64,9 +64,12 @@ const emit = defineEmits(['change'])
// //
const xkkcList = ref<any>([]); const xkkcList = ref<any>([]);
//
const xkQdList = ref<any>([]);
// //
const toggleSelection = (xkkc: any) => { const toggleSelection = (xkkc: any) => {
if (!props.canSelected) { if (!props.canSelected || xkkc.isDisabled) {
return; return;
} }
// ID // ID
@ -191,22 +194,33 @@ const switchXk = (xk: any) => {
return; return;
} }
// ID
let selectedXkkcIds = uni.getStorageSync("selectedXkkcIds") || [];
let newSelectedXkkcIds: string[] = []; let newSelectedXkkcIds: string[] = [];
if (xkQdList.value.length > 0) {
for (let i = 0; i < xkkcList.value.length; i++) { for (let i = 0; i < xkkcList.value.length; i++) {
const xkkc = xkkcList.value[i]; const xkkc = xkkcList.value[i];
//
// if (xkQdList.value.includes(xkkc.id)) {
if (selectedXkkcIds.includes(xkkc.id)) { xkkc.isSelected = true;
xkkc.isSelected = true; xkkc.isDisabled = true;
newSelectedXkkcIds.push(xkkc.id); } else {
} else { xkkc.isSelected = false;
xkkc.isSelected = false; xkkc.isDisabled = false;
}
}
} else {
// ID
let selectedXkkcIds = uni.getStorageSync("selectedXkkcIds") || [];
for (let i = 0; i < xkkcList.value.length; i++) {
const xkkc = xkkcList.value[i];
//
if (selectedXkkcIds.includes(xkkc.id)) {
xkkc.isSelected = true;
newSelectedXkkcIds.push(xkkc.id);
} else {
xkkc.isSelected = false;
}
} }
} }
uni.setStorageSync("selectedXkkcIds", newSelectedXkkcIds); uni.setStorageSync("selectedXkkcIds", newSelectedXkkcIds);
emit("change", newSelectedXkkcIds); emit("change", newSelectedXkkcIds);
} }
@ -218,10 +232,19 @@ watch(() => props.xk, (newVal) => {
} }
}); });
//
if (props.xk && (props.xk.xkkcs || props.xk.xkkcList)) { onMounted(() => {
switchXk(props.xk); const qk = getQk || {};
} const qkQdList = qk.xkqdList || [];
xkQdList.value = [];
qkQdList.forEach((qd: any) => {
xkQdList.value.push(qd.xkkcId);
});
//
if (props.xk && (props.xk.xkkcs || props.xk.xkkcList)) {
switchXk(props.xk);
}
});
</script> </script>

View File

@ -25,16 +25,32 @@
</view> </view>
<template #bottom> <template #bottom>
<!-- <view class="white-bg-color py-5"> <view class="white-bg-color py-5">
<view class="flex-row items-center pb-10 pt-5"> <view class="flex-row items-center pb-10 pt-5">
<u-button <u-button v-if="showFlag"
text="返回" text="返回"
class="ml-15 mr-7" class="ml-15 mr-7"
:plain="true" :plain="true"
@click="" @click="goBack"
/>
<u-button v-else
text="返回"
class="ml-15 mr-15"
:plain="true"
color="#2879ff"
text-color="#ffffff"
@click="goBack"
/>
<u-button v-if="showFlag"
text="补选报名"
class="ml-7 mr-15"
:plain="true"
color="#2879ff"
text-color="#ffffff"
@click="goXk"
/> />
</view> </view>
</view> --> </view>
</template> </template>
</BasicLayout> </BasicLayout>
</template> </template>
@ -47,6 +63,7 @@ import { getXsXkListApi } from "@/api/base/xkApi";
import { useUserStore } from "@/store/modules/user"; import { useUserStore } from "@/store/modules/user";
import { useDataStore } from "@/store/modules/data"; import { useDataStore } from "@/store/modules/data";
import { useCommonStore } from "@/store/modules/common"; import { useCommonStore } from "@/store/modules/common";
import dayjs from 'dayjs';
const { getCurXs } = useUserStore(); const { getCurXs } = useUserStore();
const { getQk } = useDataStore(); const { getQk } = useDataStore();
@ -54,16 +71,38 @@ const { getAllXkkcLx } = useCommonStore();
const dataList = ref<any>([]); const dataList = ref<any>([]);
const qk = computed(() => getQk || {});
const showFlag = ref(false);
// //
const goBack = () => { const goBack = () => {
uni.reLaunch({ url: "/pages/base/home/index" }); 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 loadYxXkList = async (xklxId:string) => {
const qk = getQk || {}; showFlag.value = false;
if (qk.xklxId === xklxId) { const now = dayjs();
dataList.value = qk.xkqdList; if (qk.value.xklxId === xklxId) {
console.log('loadYxXkList', qk.xkqdList); 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 { } else {
const resLx = await getAllXkkcLx(); const resLx = await getAllXkkcLx();
const lxList = resLx.result; const lxList = resLx.result;

View File

@ -204,6 +204,12 @@ onLoad((options:any) => {
uni.hideLoading(); uni.hideLoading();
if (dataObj.code === 1 && dataObj.data === "qk") { if (dataObj.code === 1 && dataObj.data === "qk") {
PageUtils.toHome(xklxId.value); PageUtils.toHome(xklxId.value);
} else if (dataObj.code === 2) { //
uni.showToast({
title: dataObj.message,
icon: "none",
duration: 3000
});
} else { } else {
uni.showToast({ uni.showToast({
title: dataObj.message, title: dataObj.message,

View File

@ -1,5 +1,4 @@
import { BASE_WS_URL } from "@/config"; import { BASE_WS_URL } from "@/config";
import { hideLoading, showLoading } from "@/utils/uniapp";
export interface WebSocketReturn { export interface WebSocketReturn {
reconnect: () => void, reconnect: () => void,
@ -11,13 +10,25 @@ let isLoading = false
function heartbeatState(state: boolean) { function heartbeatState(state: boolean) {
if (!state) { if (!state) {
if (!isLoading) { if (isLoading) {
showLoading({ title: '网络异常,重新连接中' }) // 使用顶部提示代替中间loading
uni.showToast({
title: '网络异常,重新连接中...',
icon: 'none',
position: 'top',
duration: 2000
});
} }
isLoading = true isLoading = true
} }
if (state) { if (state && isLoading) {
hideLoading() // 隐藏提示
uni.showToast({
title: '连接已恢复',
icon: 'success',
position: 'top',
duration: 1000
});
isLoading = false isLoading = false
} }
} }

View File

@ -7,7 +7,6 @@ import AutoStylePlugin from "./plugin/vite-plugin-autoStyle";
import {HOMEAGENT} from "./src/config"; import {HOMEAGENT} from "./src/config";
export default defineConfig({ export default defineConfig({
base: './', // 添加这行,确保使用相对路径
server: { server: {
proxy: { proxy: {
"/base": { "/base": {
@ -17,7 +16,6 @@ export default defineConfig({
}, },
}, },
port: 5139, port: 5139,
host: true, // 允许外部访问
}, },
plugins: [ plugins: [
//c 为class 例如 class="wi-10" //c 为class 例如 class="wi-10"
@ -61,16 +59,5 @@ export default defineConfig({
'@': resolve(__dirname, './src'), '@': resolve(__dirname, './src'),
'#': resolve(__dirname, './types') '#': resolve(__dirname, './types')
} }
},
// 添加构建优化配置
build: {
rollupOptions: {
output: {
manualChunks: {
'vendor': ['vue', 'pinia'],
'uni': ['@dcloudio/uni-app', '@dcloudio/uni-h5']
}
}
}
} }
}); });