diff --git a/index.html b/index.html index b6ca5d2..06c7bc7 100644 --- a/index.html +++ b/index.html @@ -11,6 +11,7 @@ <%= VITE_APP_TITLE %> + diff --git a/src/components/pc/exam/examHome.vue b/src/components/pc/exam/examHome.vue index a4c008d..dd31eeb 100644 --- a/src/components/pc/exam/examHome.vue +++ b/src/components/pc/exam/examHome.vue @@ -12,348 +12,373 @@ import 'swiper/css/scrollbar' import 'swiper/css/lazy' import 'swiper/css/autoplay' - const router = useRouter() -const modules = [Navigation, Pagination, Scrollbar, A11y, Lazy, Autoplay] -const onSwiper = (swiper) => { -}; +const modules = [Navigation, Pagination, Scrollbar, A11y, Autoplay, Lazy] +const onSwiper = (swiper) => {}; -const swiperList = ref( [ - - ]) -//类型 +const swiperList = ref([]) const typeIndex = ref(0) const typeList = ref([ - { - id:'all', - name:'全部课程' - }, + { id:'all', name:'全部课程' }, ]) -const examList = ref([ -]) -// 展示联系二维码 +const examList = ref([]) const flag = ref(false) +const searchKeyword = ref('') -const changeType =(item,index) => { +const changeType = (item, index) => { typeIndex.value = index getList() } -const goToBannerPath = (path,index) => { - console.log(path,'ppp') - if (path){ - location.href = path - } + +const goToBannerPath = (path, index) => { + if (path) location.href = path } -const goToPath = (path,row) => { - localStorage.setItem('examType',typeIndex.value) - router.push({ - name: path, - query:{id:row.id} - }) + +const goToPath = (path, row) => { + localStorage.setItem('examType', typeIndex.value) + router.push({ name: path, query:{id:row.id} }) } + const getTypeList = () => { request.get(`/go/api/app/v2/exam/home`) .then(res => { let result = res.data - // examList.value = res.data - swiperList.value =result.carousel_list - typeList.value = [...typeList.value,...result.paper_cate_list] - if (localStorage.getItem('searchHome')){ + swiperList.value = result.carousel_list + typeList.value = [...typeList.value, ...result.paper_cate_list] + + if (localStorage.getItem('searchHome')) { searchKeyword.value = localStorage.getItem('searchHome') - console.log(searchKeyword.value,'searchKeyword') localStorage.removeItem('searchHome') } - if (localStorage.getItem('examType')){ - typeIndex.value = localStorage.getItem('examType') * 1 - console.log(searchKeyword.value,'searchKeyword') + if (localStorage.getItem('examType')) { + typeIndex.value = Number(localStorage.getItem('examType')) localStorage.removeItem('examType') - }else { + } else { typeIndex.value = 0 } getList() - }) } -const searchKeyword = ref('') + const changeSearch = (e) => { searchKeyword.value = e getList() } + const getList = () => { - request.get(`/go/api/app/v2/exam/paper/list?category_id=${typeIndex.value == 0 ? '' : typeList.value[typeIndex.value].id}&keyword=${searchKeyword.value}`) + let cid = typeIndex.value === 0 ? '' : typeList.value[typeIndex.value].id + request.get(`/go/api/app/v2/exam/paper/list?category_id=${cid}&keyword=${searchKeyword.value}`) .then(res => { - let result = res.data examList.value = res.data - // swiperList.value =result.carousel_list - // typeList.value = [...typeList.value,...result.paper_cate_list] }) } -// 新增时间格式化函数 -// 优化后的时间格式化函数 + const formatExamTime = (start, end) => { if (!start || !end) return null; - const startDate = new Date(start); const endDate = new Date(end); - - // 日期格式化为两位数 const format = n => n.toString().padStart(2, '0'); - // 分解日期组件 const s = { y: startDate.getFullYear(), m: format(startDate.getMonth() + 1), d: format(startDate.getDate()), - t: startDate.toTimeString().substr(0,5) + t: startDate.toTimeString().slice(0,5) }; - const e = { y: endDate.getFullYear(), m: format(endDate.getMonth() + 1), d: format(endDate.getDate()), - t: endDate.toTimeString().substr(0,5) + t: endDate.toTimeString().slice(0,5) }; - // 构建日期部分 let datePart = ''; if (s.y !== e.y) { datePart = `${s.y}-${s.m}-${s.d} ${s.t} 至 ${e.y}-${e.m}-${e.d} ${e.t}`; - } else if (s.m !== e.m) { - datePart = `${s.y}-${s.m}-${s.d} ${s.t} 至 ${e.m}-${e.d} ${e.t}`; - } else if (s.d !== e.d) { + } else if (s.m !== e.m || s.d !== e.d) { datePart = `${s.y}-${s.m}-${s.d} ${s.t} 至 ${e.m}-${e.d} ${e.t}`; } else { datePart = `${s.y}-${s.m}-${s.d} ${s.t}-${e.t}`; } - - return `${datePart}`; + return datePart; } + onMounted(() => { window.addEventListener("scroll", () => { - // 获取滚动元素的滚动距离 - let scrollTop = - window.pageYOffset || document.documentElement.scrollTop ||document.body.scrollTop; - // 判断回到顶部按钮的显示条件,如果滚动距离大于1000就显示 - scrollTop > 300 ? (flag.value= true) : (flag.value = false); + let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; + flag.value = scrollTop > 300; }, true); - typeIndex.value = -1 + typeIndex.value = 0 getTypeList() }) diff --git a/src/components/pc/exam/examHomeReport.vue b/src/components/pc/exam/examHomeReport.vue index e460f65..caf04c1 100644 --- a/src/components/pc/exam/examHomeReport.vue +++ b/src/components/pc/exam/examHomeReport.vue @@ -1,5 +1,5 @@ diff --git a/src/components/pc/exam/onlineTest.vue b/src/components/pc/exam/onlineTest.vue index 29c2729..0415e33 100644 --- a/src/components/pc/exam/onlineTest.vue +++ b/src/components/pc/exam/onlineTest.vue @@ -527,454 +527,589 @@ onBeforeUnmount(() => { diff --git a/src/components/pc/exam/reportCard.vue b/src/components/pc/exam/reportCard.vue index ea29d3f..189f5eb 100644 --- a/src/components/pc/exam/reportCard.vue +++ b/src/components/pc/exam/reportCard.vue @@ -1,5 +1,4 @@ diff --git a/src/components/upload/imageUpload.vue b/src/components/upload/imageUpload.vue index 64aaa51..d9b7be1 100644 --- a/src/components/upload/imageUpload.vue +++ b/src/components/upload/imageUpload.vue @@ -149,7 +149,7 @@ const triggerUpload = () => { .upload-btn { position: relative; width: 230px; - height: 144px; + height: 154px; background-size: contain; /* 新增背景图适配 */ background-repeat: no-repeat; } diff --git a/src/utils/request.js b/src/utils/request.js index edbb3c2..c872914 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -16,7 +16,7 @@ const openFullScreen2 = () => { } const service = axios.create({ - baseURL: window.location.href.includes('//www.ufutx.com') ? 'https://health.ufutx.com/' :'http://health.ufutx.net/', + baseURL: window.location.href.includes('//www.ufutx.com') ? 'https://health.ufutx.com/' :'https://health.ufutx.com/', timeout: 8000, withCredentials: false, headers: {