Merge branch 'develop' into 'sit'

Develop

See merge request K17_AITS/tra-app!149
This commit is contained in:
田岩
2025-09-17 16:01:10 +08:00
36 changed files with 1857 additions and 2197 deletions
+8 -8
View File
@@ -1,18 +1,18 @@
# 开发环境
ENV = 'development'
# 'development'
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
# UAT
# VITE_APP_BASE_API_Url = 'http://25.18.122.78:9786'
# DEV
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
# app入口
#VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
#VITE_APP_BASE_API_Url = 'http://25.16.122.65:7001'
#VITE_APP_BASE_API_Url = 'http://25.16.122.91:9786'
#VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786'
# VITE_APP_BASE_API_Url = 'http://25.16.122.65:7001'
# VITE_APP_BASE_API_Url = 'http://25.16.122.92:9786'
# VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786'
# h5专用地址x2
@@ -24,9 +24,9 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
# dev
# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001'
# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7002'
# sit
#VITE_APP_BASE_H5_API_Url = 'http://25.18.122.91:9786'
# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.92:9786'
# UAT
# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.78:9786'
+10
View File
@@ -31,6 +31,16 @@ export const queryPaperExamScore = (data) => {
data
});
};
// 根据试卷id查询详情
export const queryTraExamPapersByPapersId = (data) => {
return request({
url: base_url + '/traExamPapers/queryTraExamPapersByPapersId',
method: 'post',
toastErrors: true,
data
});
};
// ↑↑↑↑↑↑↑↑↑考试中心考试↑↑↑↑↑↑↑
+2 -2
View File
@@ -21,7 +21,7 @@ export const get_base_url = (url = '') => {
// #endif
} else { // 其他环境,包括生产环境,sit环境,uat环境
return ENV.VITE_APP_BASE_API_Url
}
}
@@ -46,7 +46,7 @@ export const goto_login_fun = (from = 'http') => {
if (page_route === 'pages/login/login') return;
common.hideLoading()
common.show('未登录', '现在去登录', false).then(() => {
common.navigateTo('/pages/login/login')
// common.navigateTo('/pages/login/login')
if (from === 'socket' && page_route !== '') {
common.redirectTo('/pages/login/login?path=' + page_route)
} else {
+1 -1
View File
@@ -5,7 +5,7 @@ import CommonLoading from './components/loading.vue'
uni.$zp = {
config: {
'default-page-size': 15,
'default-page-size': 20,
'show-loading-more-when-reload': true, // 列表刷新时自动显示加载更多view,且为加载中状态
'show-scrollbar': false, // 控制是否出现滚动条
'refresher-refreshing-scrollable': false, // 自定义下拉刷新刷新中状态是否允许列表滚动
+1 -1
View File
@@ -18,7 +18,7 @@
<image class="total-score-icon" src="@/static/images/course/score.png" alt=""></image>
</view>
<view v-for="(item,index) in dataList" :class="['score-item', 'score-item'+(index+1)]">
<view class="score-item-name">{{ item.gradeDimens || item.gradeDimensName }}</view>
<view class="score-item-name">{{ item.gradeDimensName || item.gradeDimens }}</view>
<view class="score-item-score">{{ item.anlyGrade }}</view>
</view>
</view>
+1 -1
View File
@@ -17,7 +17,7 @@
<image class="total-score-icon" src="@/static/images/course/score.png" alt=""></image>
</view>
<view v-for="item,index in props.dataList" :class="['score-item', 'score-item'+(index+1)]">
<view class="score-item-name">{{ item.gradeDimensName }}</view>
<view class="score-item-name">{{ item.gradeDimensName || item.gradeDimens }}</view>
<view class="score-item-score">{{ item.anlyGrade }}</view>
</view>
</view>
+1 -1
View File
@@ -20,7 +20,7 @@
<image class="total-score-icon" src="@/static/images/course/score.png" alt="" ></image>
</view>
<view v-for="item,index in props.dataList" :class="['score-item', 'score-item'+(index+1)]">
<view class="score-item-name">{{ item.gradeDimensName }}</view>
<view class="score-item-name">{{ item.gradeDimensName || item.gradeDimens }}</view>
<view class="score-item-score">{{ item.anlyGrade }}</view>
</view>
</view>
+4 -1
View File
@@ -671,7 +671,7 @@ const initsocketTask = () => {
}
} else {
// if(['0005', 'QQ0005'].includes(res.rtnCode)) {
// goto_login_fun();
// goto_login_fun('socket');
// }
}
})
@@ -722,6 +722,7 @@ const changeAppHeightBottom = height => {
// #endif
}
onHide(() => {
console.log('onHide')
//#ifdef APP-PLUS
uni.offKeyboardHeightChange(setHeight)
// #endif
@@ -733,6 +734,7 @@ onHide(() => {
// }).finally(() => {})
})
onShow(() => {
console.log('onShow')
//#ifdef APP-PLUS
uni.onKeyboardHeightChange(setHeight)
// #endif
@@ -742,6 +744,7 @@ onShow(() => {
})
const watchFlag = ref(1)
onUnload(() => {
console.log('onUnload')
socketStore.closeSocket()
changePlayItemId('')
console.log(typeof teacherVoiceObj);
+6 -7
View File
@@ -272,7 +272,7 @@
});
onLoad((params) => {
crsId.value = params.crsId;
collectId.value = params.collectId || '';
collectId.value = params.collectId || null;
isPreview.value = params.isPreview || '';
});
onShow(() => {
@@ -286,12 +286,11 @@
if (pages.length >= 2) {
const prevPage = pages[pages.length - 2];
if (prevPage.route === 'pages/favorites/index') {
uni.$emit('refresh_favorites_list', {
type: 'course',
state: !!form.value.collectId, //
old: collectId.value, // id
new: form.value.collectId // id
});
// if (prevPage.$vm && typeof prevPage.$vm.$?.exposed?.reload === 'function') {
// prevPage.$vm.$?.exposed?.reload('course', form.value);
// }
uni.$emit('update_course_item', form.value);
}
}
}
@@ -14,7 +14,7 @@
<view class="bottom">历史最高分</view>
</view>
<view class="prompt_div_line"></view>
<view class="prompt_div_right" @click="show_list_click">
<view class="prompt_div_right" @click="show_list_click(item.examCnt)">
<view class="click_text">
{{ item.examCnt || 0 }}
<uv-icon
@@ -1,68 +1,41 @@
<template>
<view class="scroll_div">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" :show-scrollbar="false">
<itemVue :item="item" v-for="(item, index) in data_list"></itemVue>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无记录</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
<z-paging
ref="pagingRef"
v-model="data_list"
@query="queryList"
class="scroll_div"
:auto="false"
empty-view-text="暂无记录"
>
<view class="scroll-Y">
<itemVue :item="item" v-for="item in data_list"></itemVue>
</view>
</z-paging>
</template>
<script setup>
<script setup lang="ts">
import itemVue from './examRecordItem.vue';
import { ref, reactive } from 'vue';
import { ref, reactive, onMounted, watch } from 'vue';
import { queryCrsExamRecordPaging } from '@/api/courseRecord.js';
const status = ref('loading'); // loadmore - loading - nomore -
const limit = 20;
const total = ref(-1);
const page = ref(0);
const data_list = reactive([]);
const getData = (from = '') => {
if (from === 'first') {
if (total.value !== -1) {
return;
}
status.value = 'loading';
total.value = -1;
page.value = 1;
data_list.length = 0;
} else {
if (status.value !== 'loadmore' && status.value !== '') return;
status.value = 'loading';
page.value++;
}
queryCrsExamRecordPaging({
page: page.value,
limit: limit
})
.then((res) => {
total.value = res.total;
data_list.push(...res.body);
})
.finally(() => {
if (data_list.length >= total.value) {
status.value = 'nomore';
} else {
status.value = 'loadmore';
}
});
};
const scrolltolower = () => {
getData();
};
defineExpose({
getData
import useZpaging from '@/composables/useZpaging';
const { pagingRef, queryList, data_list, reload, total } = useZpaging({
fetchFunction: queryCrsExamRecordPaging
});
const props = defineProps<{
tabIndex: number;
currentIndex: number;
}>();
onMounted(() => {
watch(
() => props.currentIndex,
(v) => v === props.tabIndex && total.value === -1 && reload(),
{ immediate: true }
);
});
</script>
<style scoped lang="scss">
.scroll_div {
background-color: #f1f5fa;
}
.scroll-Y {
height: calc(100vh - var(--status-bar-height) - 88rpx - 88rpx - 30rpx);
background-color: #f1f5fa;
height: 100%;
}
</style>
@@ -14,7 +14,7 @@
<view class="bottom">答题正确率</view>
</view>
<view class="prompt_div_line"></view>
<view class="prompt_div_right" @click="show_list_click">
<view class="prompt_div_right" @click="show_list_click(item.exrCnt)">
<view class="click_text">
{{ item.exrCnt || '0' }}
<uv-icon
@@ -1,68 +1,41 @@
<template>
<view class="scroll_div">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" :show-scrollbar="false">
<itemVue :item="item" v-for="(item, index) in data_list"></itemVue>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无记录</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
<z-paging
ref="pagingRef"
v-model="data_list"
@query="queryList"
class="scroll_div"
:auto="false"
empty-view-text="暂无记录"
>
<view class="scroll-Y">
<itemVue :item="item" v-for="item in data_list"></itemVue>
</view>
</z-paging>
</template>
<script setup>
<script setup lang="ts">
import itemVue from './practiceRecordItem.vue';
import { ref, reactive } from 'vue';
import { ref, reactive, onMounted, watch } from 'vue';
import useZpaging from '@/composables/useZpaging';
import { queryPracticeRecordPaging } from '@/api/courseRecord.js';
const status = ref('loading'); // loadmore - loading - nomore -
const limit = 20;
const total = ref(-1);
const page = ref(0);
const data_list = reactive([]);
const getData = (from = '') => {
if (from === 'first') {
if (total.value !== -1) {
return;
}
status.value = 'loading';
total.value = -1;
page.value = 1;
data_list.length = 0;
} else {
if (status.value !== 'loadmore' && status.value !== '') return;
status.value = 'loading';
page.value++;
}
queryPracticeRecordPaging({
page: page.value,
limit: limit
})
.then((res) => {
total.value = res.total;
data_list.push(...res.body);
})
.finally(() => {
if (data_list.length >= total.value) {
status.value = 'nomore';
} else {
status.value = 'loadmore';
}
});
};
const scrolltolower = () => {
getData();
};
defineExpose({
getData
const { pagingRef, queryList, data_list, reload, total } = useZpaging({
fetchFunction: queryPracticeRecordPaging
});
const props = defineProps<{
tabIndex: number;
currentIndex: number;
}>();
onMounted(() => {
watch(
() => props.currentIndex,
(v) => v === props.tabIndex && total.value === -1 && reload(),
{ immediate: true }
);
});
</script>
<style scoped lang="scss">
.scroll_div {
background-color: #f1f5fa;
}
.scroll-Y {
height: calc(100vh - var(--status-bar-height) - 88rpx - 88rpx - 30rpx);
background-color: #f1f5fa;
height: 100%;
}
</style>
@@ -14,7 +14,7 @@
<view class="bottom">学习时长</view>
</view>
<view class="prompt_div_line"></view>
<view class="prompt_div_right" @click="show_list_click">
<view class="prompt_div_right" @click="show_list_click(item.stdyCnt)">
<view class="click_text">
{{ item.stdyCnt || 0 }}
<uv-icon
@@ -58,6 +58,7 @@
</template>
<script setup>
console.log('学习组件');
import { computed } from 'vue';
import common from '@/common/common';
import { queryStdyBatchByCrsId } from '@/api/courseRecord.js';
@@ -1,70 +1,42 @@
<template>
<view class="scroll_div">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" :show-scrollbar="false">
<itemVue :item="item" v-for="(item, index) in data_list" ></itemVue>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无记录</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
<z-paging
ref="pagingRef"
v-model="data_list"
@query="queryList"
class="scroll_div"
:auto="false"
empty-view-text="暂无记录"
>
<view class="scroll-Y">
<itemVue :item="item" v-for="item in data_list"></itemVue>
</view>
</z-paging>
</template>
<script setup>
<script setup lang="ts">
import itemVue from './studyRecordItem.vue';
import { ref, reactive} from 'vue';
import { ref, reactive, onMounted, watch } from 'vue';
import { queryStdyRecordPaging } from '@/api/courseRecord.js';
const status = ref('loading'); // loadmore - loading - nomore -
const limit = 20;
const total = ref(-1);
const page = ref(0);
const data_list = reactive([]);
const getData = (from = '') => {
if (from === 'first') {
if (total.value !== -1) {
return;
}
status.value = 'loading';
total.value = -1;
page.value = 1;
data_list.length = 0;
} else {
if (status.value !== 'loadmore' && status.value !== '') return;
status.value = 'loading';
page.value++;
}
queryStdyRecordPaging({
page: page.value,
limit: limit
})
.then((res) => {
total.value = res.total;
data_list.push(...res.body);
})
.finally(() => {
if (data_list.length >= total.value) {
status.value = 'nomore';
} else {
status.value = 'loadmore';
}
});
};
const scrolltolower = () => {
getData();
};
defineExpose({
getData
import useZpaging from '@/composables/useZpaging';
const { pagingRef, queryList, data_list, reload, total } = useZpaging({
fetchFunction: queryStdyRecordPaging
});
const props = defineProps<{
tabIndex: number;
currentIndex: number;
}>();
onMounted(() => {
watch(
() => props.currentIndex,
(v) => v === props.tabIndex && total.value === -1 && reload(),
{ immediate: true }
);
});
</script>
<style scoped lang="scss">
.scroll_div {
.scroll-Y {
background-color: #f1f5fa;
height: 100%;
}
.scroll-Y {
height: calc(100vh - var(--status-bar-height) - 88rpx - 88rpx - 30rpx);
}
</style>
+51 -71
View File
@@ -1,54 +1,63 @@
<template>
<view class="max_page detail-main">
<nav-bar :is_seat="false"></nav-bar>
<view class="fixed_search_div">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
<z-paging-swiper>
<template #top>
<view class="detail-main">
<nav-bar :is_seat="false"></nav-bar>
<view class="fixed_search_div">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
</view>
<view class="title font_pf">课程记录</view>
</view>
<view class="detail-body">
<view class="body-tab">
<uv-tabs
class="font_pf my_tabs"
:current="tabAct"
:list="tabList"
@change="tabChange"
:scrollable="false"
line-color="#0066FF"
:inactive-style="{ color: '#333333', fontSize: '30rpx', fontWeight: '600' }"
:activeStyle="{ color: '#0066FF', fontSize: '30rpx', fontWeight: '600' }"
:lineColor="`url(${LineBg}) 10% 10%`"
></uv-tabs>
</view>
</view>
</view>
<view class="title font_pf">课程记录</view>
</view>
<view class="detail-body">
<view class="body-tab">
<uv-tabs
class="font_pf my_tabs"
:current="tabAct"
:list="tabList"
@change="tabChange"
:scrollable="false"
line-color="#0066FF"
:inactive-style="{ color: '#333333', fontSize: '30rpx', fontWeight: '600' }"
:activeStyle="{ color: '#0066FF', fontSize: '30rpx', fontWeight: '600' }"
:lineColor="`url(${LineBg}) 10% 10%`"
></uv-tabs>
</view>
<view class="uni-margin-wrap no-overflow">
<swiper class="swiper" :current="tabAct" :indicator-dots="false" @change="swiperChange">
<swiper-item>
<studyRecordList :ref="(el) => (listItemRefs[0] = el)"></studyRecordList>
</swiper-item>
<swiper-item>
<practiceRecordList :ref="(el) => (listItemRefs[1] = el)"></practiceRecordList>
</swiper-item>
<swiper-item>
<examRecordList :ref="(el) => (listItemRefs[2] = el)"></examRecordList>
</swiper-item>
</swiper>
</view>
</view>
</view>
</template>
<swiper class="swiper" :current="tabAct" :indicator-dots="false" @change="swiperChange">
<swiper-item class="swiper-item">
<studyRecordList
:ref="(el) => (listItemRefs[0] = el)"
:tabIndex="0"
:currentIndex="tabAct"
></studyRecordList>
</swiper-item>
<swiper-item class="swiper-item">
<practiceRecordList
:ref="(el) => (listItemRefs[1] = el)"
:tabIndex="1"
:currentIndex="tabAct"
></practiceRecordList>
</swiper-item>
<swiper-item class="swiper-item">
<examRecordList :ref="(el) => (listItemRefs[2] = el)" :tabIndex="2" :currentIndex="tabAct"></examRecordList>
</swiper-item>
</swiper>
</z-paging-swiper>
</template>
<script setup>
import { LineBg } from '@/enum.js';
import studyRecordList from './components/studyRecordList.vue';
import practiceRecordList from './components/practiceRecordList.vue';
import examRecordList from './components/examRecordList.vue';
import { ref, onMounted, watch } from 'vue';
import common from '@/common/common.js';
const listItemRefs = ref([]);
const tabAct = ref(0);
import useIndexList from '@/composables/useIndexList.js';
const { tabAct, listItemRefs, tabChange, swiperChange } = useIndexList();
const tabList = ref([
{
name: '学习记录'
@@ -60,30 +69,10 @@
name: '考试记录'
}
]);
const tabChange = (item) => {
tabAct.value = item.index;
};
const swiperChange = (item) => {
tabAct.value = item.detail.current;
};
onMounted(() => {
watch(
tabAct,
(newValue) => {
typeof listItemRefs.value[newValue]?.getData === 'function' &&
listItemRefs.value[newValue]?.getData('first');
},
{
immediate: true
}
);
});
</script>
<style lang="scss" scoped>
$bg-margin-left: 50rpx;
.my_tabs {
// 穿
:deep(.uv-tabs__wrapper__nav__line) {
@@ -95,21 +84,12 @@
}
.swiper {
/*
状态栏 var(--status-bar-height)
标题高度88rpx
tab切换栏高度88rpx
下方滑动区域上下边距各10共20rpx
**/
height: calc(100vh - var(--status-bar-height) - 88rpx - 88rpx - 30rpx);
height: 100%;
}
.swiper-item {
display: block;
height: 100%;
line-height: 300rpx;
text-align: center;
background-color: #f1f5fa;
}
.detail-body {
+2 -1
View File
@@ -55,7 +55,8 @@ export function useItemList(fetchFunction, item) {
}
});
// 点击获取详情
const show_list_click = () => {
const show_list_click = (num = -1) => {
if (num === 0) return;
show_list_state.value = !show_list_state.value;
if (show_list_state.value) {
nextTick(() => {
@@ -1,16 +1,13 @@
<template>
<view class="item">
<view class="details_div">
<!-- <view class="img_div"> -->
<!-- <image-preview class="img" :src="item.ossAddr" mode="scaleToFill"></image-preview> -->
<!-- </view> -->
<view class="right_div">
<view class="title ellipsis-text">
{{ item.examName }}
</view>
<view class="prompt_div">
<view class="prompt_div_left">
<view class="top">{{ item.flagQuery === 'Y'?item.highestGrade:'--' || 0 }}</view>
<view class="top">{{ item.flagQuery === 'Y' ? item.highestGrade : '--' || 0 }}</view>
<view class="bottom">历史最高分</view>
</view>
<view class="prompt_div_line"></view>
@@ -19,7 +16,7 @@
{{ item.examCnt || 0 }}
<uv-icon
class="click_text_icon"
:class="{click_text_icon_action:show_list_state}"
:class="{ click_text_icon_action: show_list_state }"
name="arrow-right"
color="#0066FF"
size="12"
@@ -40,7 +37,7 @@
</view>
<view class="list_small_item">
<image src="@/static/images/courseRecord/duration.png" class="icon_img"></image>
<view class="prompt">考试得分{{ item_list.flagQuery === 'Y'?item_list.examGrade:'--' }}</view>
<view class="prompt">考试得分{{ item_list.flagQuery === 'Y' ? item_list.examGrade : '--' }}</view>
</view>
</view>
<view class="fl1"></view>
@@ -225,7 +222,7 @@
/* 添加过渡动画,包含延迟效果 */
transition: transform 0.2s ease;
}
.click_text_icon_action{
.click_text_icon_action {
transform: rotate(90deg);
}
}
@@ -1,68 +0,0 @@
<template>
<view class="scroll_div">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" :show-scrollbar="false">
<itemVue :item="item" v-for="(item, index) in data_list"></itemVue>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无记录</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
</template>
<script setup>
import itemVue from './examRecordItem.vue';
import { ref, reactive } from 'vue';
import { queryExamRecordPaging } from '@/api/courseRecord.js';
const status = ref('loading'); // loadmore - loading - nomore -
const limit = 20;
const total = ref(-1);
const page = ref(0);
const data_list = reactive([]);
const getData = (from = '') => {
if (from === 'first') {
if (total.value !== -1) {
return;
}
status.value = 'loading';
total.value = -1;
page.value = 1;
data_list.length = 0;
} else {
if (status.value !== 'loadmore' && status.value !== '') return;
status.value = 'loading';
page.value++;
}
queryExamRecordPaging({
page: page.value,
limit: limit
})
.then((res) => {
total.value = res.total;
data_list.push(...res.body);
})
.finally(() => {
if (data_list.length >= total.value) {
status.value = 'nomore';
} else {
status.value = 'loadmore';
}
});
};
const scrolltolower = () => {
getData();
};
defineExpose({
getData
});
</script>
<style scoped lang="scss">
.scroll_div {
background-color: #f1f5fa;
}
.scroll-Y {
height: calc(100vh - var(--status-bar-height) - 88rpx - 88rpx - 30rpx);
}
</style>
+29 -44
View File
@@ -1,59 +1,34 @@
<template>
<view class="max_page detail-main">
<nav-bar :is_seat="false"></nav-bar>
<view class="fixed_search_div">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
<z-paging ref="pagingRef" v-model="data_list" @query="queryList" class="scroll_div" empty-view-text="暂无记录">
<template #top>
<view class="detail-main">
<nav-bar :is_seat="false"></nav-bar>
<view class="fixed_search_div">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
</view>
<view class="title font_pf">考试记录</view>
</view>
</view>
<view class="title font_pf">考试记录</view>
</template>
<view class="scroll-Y">
<itemVue :item="item" v-for="item in data_list"></itemVue>
</view>
<view class="detail-body">
<examRecordList ref="listItemRef"></examRecordList>
</view>
</view>
</z-paging>
</template>
<script setup>
import examRecordList from './components/examRecordList.vue';
import { ref, onMounted } from 'vue';
import itemVue from './components/examRecordItem.vue';
import { queryExamRecordPaging } from '@/api/courseRecord.js';
import useZpaging from '@/composables/useZpaging.js';
import common from '@/common/common.js';
const listItemRef = ref(null);
onMounted(() => {
listItemRef.value?.getData('first');
const { pagingRef, queryList, data_list, reload, search, total, clear } = useZpaging({
fetchFunction: queryExamRecordPaging
});
</script>
<style lang="scss" scoped>
$bg-margin-left: 50rpx;
.my_tabs {
// 穿
:deep(.uv-tabs__wrapper__nav__line) {
height: 26rpx !important;
left: 60rpx;
background-size: 28rpx !important;
background-repeat: no-repeat !important;
}
}
.swiper {
/*
状态栏 var(--status-bar-height)
标题高度88rpx
tab切换栏高度88rpx
下方滑动区域上下边距各10共20rpx
**/
height: calc(100vh - var(--status-bar-height) - 88rpx - 88rpx - 30rpx);
}
.swiper-item {
display: block;
height: 100%;
line-height: 300rpx;
text-align: center;
}
.detail-body {
background: #ffffff;
border-radius: 15rpx;
@@ -131,4 +106,14 @@
}
}
}
.scroll-Y {
background-color: #f1f5fa;
border-radius: 16rpx;
// padding: 17rpx 12rpx 0 22rpx;
// margin: 17rpx 20rpx;
}
.scroll_div {
background-color: #f1f5fa;
// padding: 22rpx;
}
</style>
@@ -1,52 +1,55 @@
<template>
<view class="scroll_div">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" :show-scrollbar="false">
<uv-swipe-action :autoClose="true">
<uv-swipe-action-item
class="item-swipe-action"
:options="options"
:threshold="40"
:index="index"
:name="index"
v-for="(item, index) in data_list"
@click="swipeActionClick"
>
<view class="item" @touchmove.stop @click="click_item(item)">
<view class="img_div">
<image-preview class="img" :src="item?.ossAddr" mode="scaleToFill"></image-preview>
<view class="subscript">{{ item.evalGrade ?? 0 }}</view>
<z-paging
ref="pagingRef"
v-model="data_list"
@query="queryList"
:auto="false"
empty-view-text="暂无数据"
paging-class="pagingClass"
>
<uv-swipe-action :autoClose="true">
<uv-swipe-action-item
class="item-swipe-action"
:options="options"
:threshold="40"
:index="index"
:name="index"
v-for="(item, index) in data_list"
@click="swipeActionClick"
>
<view class="item" @click="click_item(item)">
<view class="img_div">
<image-preview class="img" :src="item?.ossAddr" mode="scaleToFill"></image-preview>
<view class="subscript">{{ item.evalGrade ?? 0 }}</view>
</view>
<view class="right_div">
<view class="title ellipsis-text">
{{ item.crsName }}
</view>
<view class="right_div">
<view class="title ellipsis-text">
{{ item.crsName }}
</view>
<view class="tag_div">
<view class="tag" v-for="tagItem in item?.tagCataList ?? []">
{{ tagItem?.tagName }}
</view>
</view>
<view class="time_and_num">
<view class="mr-10">发布{{ item.issuTm?.substr(0, 10) }}</view>
<view>已学{{ item.accmStdyCnt }}</view>
<view class="tag_div">
<view class="tag" v-for="tagItem in item?.tagCataList ?? []">
{{ tagItem?.tagName }}
</view>
</view>
<view class="time_and_num">
<view class="mr-10">发布{{ item.issuTm?.substr(0, 10) }}</view>
<view>已学{{ item.accmStdyCnt }}</view>
</view>
</view>
</uv-swipe-action-item>
</uv-swipe-action>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无数据</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
</view>
</uv-swipe-action-item>
</uv-swipe-action>
</z-paging>
</template>
<script setup>
const status = ref('loading'); // loadmore - loading - nomore -
const limit = 20;
const total = ref(-1);
const page = ref(0);
const data_list = reactive([]);
import { ref, reactive} from 'vue';
import { ref, reactive, onMounted, watch } from 'vue';
import { queryTraPersonalCollectionCrsPaging, deleteTraPersonalCollectionById } from '@/api/favorites.js';
import common from '@/common/common';
import useZpaging from '@/composables/useZpaging';
const { pagingRef, queryList, data_list, reload, total } = useZpaging({
fetchFunction: queryTraPersonalCollectionCrsPaging
});
const options = [
{
text: '删除',
@@ -55,39 +58,7 @@
}
}
];
const getData = (from = '') => {
console.log('status.value', status.value);
if (from === 'first') {
if (total.value !== -1) {
return;
}
status.value = 'loading';
total.value = -1;
page.value = 1;
data_list.length = 0;
} else {
if (status.value !== 'loadmore' && status.value !== '') return;
status.value = 'loading';
page.value++;
}
queryTraPersonalCollectionCrsPaging({
page: page.value,
limit: limit
})
.then((res) => {
total.value = res.total;
data_list.push(...res.body);
})
.finally(() => {
if (data_list.length >= total.value) {
status.value = 'nomore';
} else {
status.value = 'loadmore';
}
console.log('status.value', status.value);
});
};
//
const click_item = (item) => {
common.navigateTo(`/pages/courseDetail/index?crsId=${item.crsId}&collectId=${item.collectId}`);
@@ -108,52 +79,43 @@
});
});
};
const scrolltolower = () => {
getData();
};
const refreshData = () => {
total.value = -1;
getData('first');
};
const updateData = (item) => {
console.log('收藏的updateData');
const reloadPage = () => {
total.value == -1;
reload(true);
};
defineExpose({
getData,
updateData,
refreshData
reloadPage
});
const props = defineProps(['tabIndex', 'currentIndex']);
onMounted(() => {
watch(
() => props.currentIndex,
(v) => v === props.tabIndex && total.value === -1 && reload(),
{ immediate: true }
);
});
</script>
<style scoped lang="scss">
.scroll_div {
background-color: #f1f5fa;
padding: 22rpx;
}
.scroll-Y {
height: calc(100vh - var(--status-bar-height) - 54rpx - 88rpx - 20rpx - 44rpx);
.pagingClass {
width: calc(100% - 44rpx);
margin: 22rpx auto;
background-color: #fff;
border-radius: 16rpx;
}
.item-swipe-action {
margin: 32rpx 22rpx;
overflow: hidden;
:deep(.uv-swipe-action-item__right__button__wrapper) {
border-radius: 20rpx !important;
}
}
.scroll-Y .item {
.item {
height: 170rpx;
display: flex;
// background-color: red;
.img_div {
position: relative;
width: 224rpx;
+94 -124
View File
@@ -1,66 +1,69 @@
<template>
<view class="scroll_div">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" :show-scrollbar="false">
<uv-swipe-action :autoClose="true">
<uv-swipe-action-item
class="item-swipe-action"
:options="options"
:threshold="40"
:index="index"
:name="index"
v-for="(item, index) in data_list"
@click="swipeActionClick"
>
<view class="item" :class="getStatusClass(item.isFinish)" @touchmove.stop @click="click_item(item)">
<view class="img_div">
<image-preview class="img" :src="item?.ossAddr" mode="scaleToFill"></image-preview>
<view class="subscript" v-if="item.isFinish === '02'">已完成</view>
<view class="subscript" v-else>未完成</view>
<z-paging
ref="pagingRef"
v-model="data_list"
@query="queryList"
:auto="false"
empty-view-text="暂无数据"
paging-class="pagingClass"
>
<uv-swipe-action :autoClose="true">
<uv-swipe-action-item
class="item-swipe-action"
:options="options"
:threshold="40"
:index="index"
:name="index"
v-for="(item, index) in data_list"
@click="swipeActionClick"
>
<view class="item" :class="getStatusClass(item.isFinish)" @click="click_item(item)">
<view class="img_div">
<image-preview class="img" :src="item?.ossAddr" mode="scaleToFill"></image-preview>
<view class="subscript" v-if="item.isFinish === '02'">已完成</view>
<view class="subscript" v-else>未完成</view>
</view>
<view class="right_div">
<view class="title ellipsis-text">
{{ item.taskName }}
</view>
<view class="right_div">
<view class="title ellipsis-text">
{{ item.taskName }}
<view class="time_div">
起止时间
<text class="blod_color">
{{ item.startTm?.substr(0, 10) }}{{ item.endTm?.substr(0, 10) }}
</text>
</view>
<view class="people_progress_div">
<view class="mr-10">
完成人数
<text class="blod_color">{{ item.taskFinishSums ?? 0 }}/{{ item.taskSums ?? 0 }}</text>
</view>
<view class="time_div">
起止时间
<view>
进度
<text class="blod_color">
{{ item.startTm?.substr(0, 10) }}{{ item.endTm?.substr(0, 10) }}
{{ item.finishCrs ?? item.learnedNumber ?? 0 }}/{{
item.sumCrs ?? item.taskNumber ?? 0
}}门课程
</text>
</view>
<view class="people_progress_div">
<view class="mr-10">
完成人数
<text class="blod_color">{{ item.taskFinishSums ?? 0 }}/{{ item.taskSums ?? 0 }}</text>
</view>
<view>
进度
<text class="blod_color">{{ item.finishCrs ?? item.learnedNumber ?? 0 }}/{{ item.sumCrs ?? item.taskNumber ?? 0 }}门课程</text>
</view>
<!-- <view>
我的进度
<text class="blod_color">{{ item.myProcess ?? 0 }}%</text>
</view> -->
</view>
</view>
</view>
</uv-swipe-action-item>
</uv-swipe-action>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无数据</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
</view>
</uv-swipe-action-item>
</uv-swipe-action>
</z-paging>
</template>
<script setup>
import { ref, reactive} from 'vue';
import { queryTraPersonalCollectionTaskPaging,deleteTraPersonalCollectionById } from '@/api/favorites.js';
import { ref, reactive, onMounted, watch } from 'vue';
import { queryTraPersonalCollectionTaskPaging, deleteTraPersonalCollectionById } from '@/api/favorites.js';
import { setPageCache } from '@/common/common';
import common from '@/common/common';
const status = ref('loading'); // loadmore - loading - nomore -
const limit = 20;
const total = ref(-1);
const page = ref(0);
const data_list = reactive([]);
import useZpaging from '@/composables/useZpaging';
const { pagingRef, queryList, data_list, reload, total } = useZpaging({
fetchFunction: queryTraPersonalCollectionTaskPaging
});
const options = [
{
text: '删除',
@@ -69,115 +72,83 @@
}
}
];
const getData = (from = '') => {
if (from === 'first') {
if (total.value !== -1) {
return;
}
status.value = 'loading';
total.value = -1;
page.value = 1;
data_list.length = 0;
} else {
if (status.value !== 'loadmore' && status.value !== '') return;
status.value = 'loading';
page.value++;
}
setTimeout(() => {
queryTraPersonalCollectionTaskPaging({
page: page.value,
limit: limit
})
.then((res) => {
total.value = res.total;
data_list.push(...res.body);
})
.finally(() => {
if (data_list.length >= total.value) {
status.value = 'nomore';
} else {
status.value = 'loadmore';
}
});
}, 200);
};
const swipeActionClick = (click_item) => {
const index = click_item['name'];
const item = data_list[index];
const item = data_list.value[index];
console.log('item', item);
common.show('提示', '确认删除吗?').then((res) => {
if (!res) return;
common.loading();
deleteTraPersonalCollectionById({ collectId: item.collectionId })
.then(() => {
data_list.splice(index, 1); //
total.value -= 1; //
reload(true);
})
.finally(() => {
common.hideLoading();
});
});
};
//
const click_item = (item) => {
if(item.limitTyp === '02') {
if(item.isTimeOut === '01') {
if (item.limitTyp === '02') {
if (item.isTimeOut === '01') {
return common.msg('任务未开始');
} else if(item.isTimeOut === '02') {
} else if (item.isTimeOut === '02') {
return common.msg('任务已结束');
}
}
setPageCache('learning_tasks_details', item);
common.navigateTo(`/pages/learningTasks/details?collectId=${item.collectionId}`);
common.navigateTo(`/pages/learningTasks/details?collectId=${item.collectionId}&taskId=${item.taskId}`);
};
const getStatusClass = (isFinish) => {
// 010203
// if (isFinish === '00') return 'in_progress';
// if (isFinish === '01') return 'completed';
// return 'expired';
if (isFinish === '02') return 'completed';
return 'expired';
};
const scrolltolower = (item) => {
getData();
};
const refreshData = (params) => {
total.value = -1;
getData('first');
console.log('子组件refreshData');
};
const props = defineProps(['tabIndex', 'currentIndex']);
onMounted(() => {
watch(
() => props.currentIndex,
(v) => v === props.tabIndex && total.value === -1 && reload(),
{ immediate: true }
);
});
const updateData = (item) => {
console.log('收藏的updateData', item);
console.log('收藏的updatedata_list', data_list);
const index = data_list.findIndex((res) => res.taskId === item.taskId);
console.log('updateData', index, item);
if (index !== -1) {
data_list[index] = item;
//
if (item.collectionId === null) {
reload();
} else {
const index = data_list.value.findIndex((res) => res.taskId === item.taskId);
if (index !== -1) {
data_list.value[index] = item;
}
}
};
defineExpose({
getData,
refreshData,
updateData
});
</script>
<style scoped lang="scss">
.scroll_div {
background-color: #f1f5fa;
padding: 22rpx;
}
.scroll-Y {
height: calc(100vh - var(--status-bar-height) - 54rpx - 88rpx - 20rpx - 44rpx);
.pagingClass {
width: calc(100% - 44rpx);
margin: 22rpx auto;
background-color: #fff;
border-radius: 16rpx;
}
.scroll-Y .item.in_progress {
.item-swipe-action {
overflow: hidden;
:deep(.uv-swipe-action-item__right__button__wrapper) {
border-radius: 20rpx !important;
}
}
.item.in_progress {
//
.subscript {
color: #0066ff;
@@ -189,7 +160,7 @@
}
}
.scroll-Y .item.completed {
.item.completed {
//
.subscript {
color: #ffffff;
@@ -201,7 +172,7 @@
}
}
.scroll-Y .item.expired {
.item.expired {
//
.subscript {
color: #ffffff;
@@ -221,9 +192,8 @@
}
}
.scroll-Y .item {
.item {
height: 170rpx;
// margin: 32rpx 22rpx;
display: flex;
.img_div {
+55 -81
View File
@@ -1,57 +1,57 @@
<template>
<view class="max_page detail-main">
<nav-bar :is_seat="false"></nav-bar>
<view class="fixed_search_div">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
<z-paging-swiper>
<template #top>
<view class="detail-main">
<nav-bar :is_seat="false"></nav-bar>
<view class="fixed_search_div">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
</view>
<view class="title font_pf">我的收藏</view>
</view>
<view class="detail-body">
<view class="body-tab">
<uv-tabs
class="font_pf my_tabs"
:current="tabAct"
:list="tabList"
@change="tabChange"
:scrollable="false"
line-color="#0066FF"
:inactive-style="{ color: '#333333', fontSize: '30rpx', fontWeight: '600' }"
:activeStyle="{ color: '#0066FF', fontSize: '30rpx', fontWeight: '600' }"
:lineColor="`url(${LineBg}) 10% 10%`"
></uv-tabs>
</view>
</view>
</view>
<view class="title font_pf">我的收藏</view>
</view>
<view class="detail-body">
<view class="body-tab">
<uv-tabs
class="font_pf my_tabs"
:current="tabAct"
:list="tabList"
@change="tabChange"
:scrollable="false"
line-color="#0066FF"
:inactive-style="{ color: '#333333', fontSize: '30rpx', fontWeight: '600' }"
:activeStyle="{ color: '#0066FF', fontSize: '30rpx', fontWeight: '600' }"
:lineColor="`url(${LineBg}) 10% 10%`"
></uv-tabs>
</view>
<view class="uni-margin-wrap no-overflow">
<swiper
class="swiper"
:current="tabAct"
:indicator-dots="false"
:disable-touch="true"
@change="swiperChange"
>
<swiper-item>
<FavoritesCourse ref="courseRef"></FavoritesCourse>
</swiper-item>
<swiper-item>
<FavoritesTask ref="taskRef"></FavoritesTask>
</swiper-item>
</swiper>
</view>
</view>
</view>
</template>
<swiper class="swiper" :current="tabAct" :indicator-dots="false" :disable-touch="true" @change="swiperChange">
<swiper-item>
<FavoritesCourse
:ref="(el) => (listItemRefs[0] = el)"
:tabIndex="0"
:currentIndex="tabAct"
></FavoritesCourse>
</swiper-item>
<swiper-item>
<FavoritesTask :ref="(el) => (listItemRefs[1] = el)" :tabIndex="1" :currentIndex="tabAct"></FavoritesTask>
</swiper-item>
</swiper>
</z-paging-swiper>
</template>
<script setup>
//
import FavoritesTask from './components/favoritesTask.vue';
import FavoritesCourse from './components/favoritesCourse.vue';
//
import { ref, onMounted, watch } from 'vue';
import { onLoad, onUnload } from '@dcloudio/uni-app';
import { LineBg } from '@/enum.js';
import common from '@/common/common';
const courseRef = ref(null);
const taskRef = ref(null);
const tabAct = ref(0);
import useIndexList from '@/composables/useIndexList.js';
const { tabAct, listItemRefs, tabChange, swiperChange, search } = useIndexList();
const tabList = ref([
{
name: '课程收藏'
@@ -61,50 +61,23 @@
}
]);
const tabChange = (item) => {
tabAct.value = item.index;
};
const swiperChange = (item) => {
tabAct.value = item.detail.current;
};
onMounted(() => {
watch(
tabAct,
(newValue, oldValue) => {
if (newValue === 0) {
courseRef.value?.getData('first');
} else if (newValue === 1) {
taskRef.value?.getData('first');
}
},
{
immediate: true
}
); // immediateonMounted
});
onLoad(() => {
//
uni.$on('refresh_favorites_list', (params) => {
if (params.type === 'course') {
courseRef.value?.refreshData(params);
} else if (params.type === 'task') {
taskRef.value?.refreshData(params);
}
uni.$on('update_tasks_item', (item) => {
setTimeout(() => {
listItemRefs.value[1]?.updateData(item);
}, 100);
});
//
uni.$on('refresh_favorites_data', (res) => {
console.log('列表监听里面学习完成后更新任务历程', res);
if (tabAct.value === 0) {
courseRef.value?.updateData(res);
} else if (tabAct.value === 1) {
taskRef.value?.updateData(res);
}
uni.$on('update_course_item', (item) => {
setTimeout(() => {
listItemRefs.value[0]?.reloadPage();
}, 100);
});
});
onUnload(() => {
uni.$off('refresh_favorites_data');
uni.$off('refresh_favorites_list');
uni.$off('update_tasks_item');
uni.$off('update_course_item');
});
</script>
<style lang="scss" scoped>
@@ -122,6 +95,7 @@
.swiper {
height: calc(100vh - var(--status-bar-height) - 54rpx - 88rpx - 20rpx - 10rpx);
background-color: #f1f5fa;
}
.swiper-item {
+1012 -1005
View File
File diff suppressed because it is too large Load Diff
+14 -3
View File
@@ -19,6 +19,7 @@
<script>
import { getToken } from '@/common/common.js'
import common from '@/common/common'
import {getPhoneEnvBool} from '@/common/common'
import { downloadFile } from '@/api/common.js'
import { get_base_url } from '@/api/request.js'
var wv
@@ -37,15 +38,24 @@ export default {
this.fileId = params.fileId || ''
},
onShow() {
this.openPdfFn({
fileId: this.fileId
})
console.log(getPhoneEnvBool('AND'),111)
if (getPhoneEnvBool('AND')) {
this.openPdfFn({
fileId: this.fileId
})
}else{
const base_url = get_base_url('/traask/traFilePreview/');
let fileUrl = base_url + '/traask/traFilePreview/' + this.fileId;
this.showUrl = 'https://aitstest.jlbank.com.cn:7002/traask/traFilePreview/d0c9e8cf-c862-44e7-bfa8-514a54d4baf2'//fileUrl
console.log(this.showUrl,111)
}
},
onReady() {
//#ifdef APP-PLUS
var currentWebview = this.$scope.$getAppWebview()
setTimeout(() => {
wv = currentWebview.children()[0]
if(!wv) return
wv.setStyle({
top: 80
})
@@ -56,6 +66,7 @@ export default {
methods: {
setHeight(res){
//#ifdef APP-PLUS
if(!wv) return
wv.setStyle({
top: res.height + 20
})
@@ -97,8 +97,6 @@
}
}
.item {
// background-color: red;
// height: 170rpx;
padding-top: 16rpx;
padding-bottom: 16rpx;
display: flex;
@@ -1,4 +1,3 @@
<!-- 在这个文件对每个tab对应的列表进行渲染 -->
<template>
<z-paging
ref="pagingRef"
@@ -46,10 +45,7 @@
}
}
});
console.log('aaa', props.state);
const updateData = (item) => {
console.log('未完成专属逻辑,如果未完成列表出现了已完成状态,就重新加载未完成列表', props.tabIndex, item.isFinish);
//
if(props.tabIndex !== 0 && item.isFinish === '02') {
reload()
} else{
+4 -10
View File
@@ -150,7 +150,6 @@
import { queryAllTraTaskCrsInfo, queryTraTaskInfoByTaskId } from '@/api/learningTasks.js';
import { passTheExamIcon, completeTheExercisesIcon, lockIcon } from '@/common/imgSvg';
import { insertTraPersonalCollectionTask, deleteTraPersonalCollectionById } from '@/api/favorites.js';
import useZpaging from '@/composables/useZpaging.js';
import common from '@/common/common';
import { getPageCache } from '@/common/common';
@@ -307,16 +306,11 @@
const prevPage = pages[pages.length - 2];
if (prevPage.route === 'pages/favorites/index') {
//
uni.$emit('refresh_favorites_list', {
type: 'task',
state: !!detailData.collectionId, //
old: collectId.value, // id
new: detailData.collectionId // id
});
uni.$emit('update_tasks_item', detailData);
} else if (prevPage.route === 'pages/learningTasks/index') {
//
console.log('学习任务页跳入,更新外部列表否则下次列表数据还是老的');
uni.$emit('update_tasks_item', detailData);
console.log('学习任务页跳入,更新外部列表否则下次列表数据还是老的(作废)');
// uni.$emit('update_tasks_item', detailData);
}
}
}
@@ -533,7 +527,7 @@
background-position: top;
background-color: #fff;
}
.detail_div {
height: 250rpx;
z-index: 2;
+1 -24
View File
@@ -1,4 +1,3 @@
<!-- 滑动切换选项卡演示(标准写法) -->
<template>
<z-paging-swiper>
<template #top>
@@ -68,23 +67,9 @@
listItemRefs.value[1]?.updateData(res);
listItemRefs.value[2]?.updateData(res);
});
//
// uni.$on('refresh_tasks_data', (res) => {
// listItemRefs.value[0]?.updateData(res);
// listItemRefs.value[1]?.clear();
// listItemRefs.value[2]?.clear();
// listItemRefs.value[tabAct.value]?.getData('first');
// if (tabAct.value === 0) {
// courseRef.value?.updateData(res);
// } else if (tabAct.value === 1) {
// taskRef.value?.updateData(res);
// }
// });
});
onUnload(() => {
uni.$off('update_tasks_item');
// uni.$off('refresh_tasks_data');
});
</script>
@@ -100,7 +85,7 @@
background-repeat: no-repeat !important;
}
}
.swiper {
height: 100%;
}
@@ -191,13 +176,5 @@
.scroll_div {
background-color: #f1f5fa;
padding: 22rpx;
// height: calc(100vh - var(--status-bar-height) - 88rpx - 80rpx - 88rpx - 20rpx - 30rpx);
.scroll_item_div {
background-color: #fff;
border-radius: 16rpx;
padding: 0 12rpx 0 22rpx;
box-sizing: border-box;
}
}
</style>
+1 -3
View File
@@ -183,9 +183,7 @@
}
};
onLoad(() => {
});
onLoad(() => {});
onMounted(() => {
let loginAccountData = common.getValue('loginAccountData');
if (loginAccountData) {
+36 -67
View File
@@ -1,87 +1,56 @@
<template>
<view class="scroll_div">
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="scrolltolower" :show-scrollbar="false">
<view class="item" v-for="item in data_list" @click="goto_course_detail(item)">
<view class="img_div">
<image-preview class="img" :imgId="item.imgId" mode="scaleToFill"></image-preview>
</view>
<view class="right_div">
<view class="title ellipsis-text">{{ item.crsName }}</view>
<view class="tag_div">
<view class="tag" v-for="tag in item.tagCataList">{{ tag.tagName }}</view>
</view>
<view class="time_and_num"></view>
</view>
<z-paging
ref="pagingRef"
v-model="data_list"
@query="queryList"
:auto="false"
empty-view-text="暂无数据"
paging-class="pagingClass"
>
<view class="item" v-for="item in data_list" @click="goto_course_detail(item)">
<view class="img_div">
<image-preview class="img" :imgId="item.imgId" mode="scaleToFill"></image-preview>
</view>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无数据</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</scroll-view>
</view>
<view class="right_div">
<view class="title ellipsis-text">{{ item.crsName }}</view>
<view class="tag_div">
<view class="tag" v-for="tag in item.tagCataList">{{ tag.tagName }}</view>
</view>
<view class="time_and_num"></view>
</view>
</view>
</z-paging>
</template>
<script setup>
const status = ref('loading'); // loadmore - loading - nomore -
const limit = 20;
const total = ref(-1);
const page = ref(0);
import common from '@/common/common';
const data_list = reactive([]);
import { ref, reactive, onMounted, nextTick } from 'vue';
import { ref, reactive, onMounted, nextTick, watch } from 'vue';
import { queryTraStdyInfoPreviewPaging } from '@/api/preview.js';
const getData = (from = '') => {
if (from == 'first') {
if (total.value !== -1) {
return;
}
status.value = 'loading';
total.value = -1;
page.value = 1;
data_list.length = 0;
} else {
if (status.value !== 'loadmore' && status.value !== '') return;
status.value = 'loading';
page.value++;
}
queryTraStdyInfoPreviewPaging({
page: page.value,
limit: limit
})
.then((res) => {
total.value = res.total;
data_list.push(...res.body);
})
.finally(() => {
if (data_list.length >= total.value) {
status.value = 'nomore';
} else {
status.value = 'loadmore';
}
});
};
const scrolltolower = (item) => {
getData();
};
import useZpaging from '@/composables/useZpaging';
const { pagingRef, queryList, data_list, reload, total } = useZpaging({
fetchFunction: queryTraStdyInfoPreviewPaging
});
const props = defineProps(['tabIndex', 'currentIndex']);
const goto_course_detail = (item) => {
common.navigateTo('/pages/courseDetail/index?isPreview=preview&crsId=' + item.crsId);
};
defineExpose({
getData
onMounted(() => {
watch(
() => props.currentIndex,
(v) => v === props.tabIndex && total.value === -1 && reload(),
{ immediate: true }
);
});
</script>
<style scoped lang="scss">
.scroll_div {
background-color: #f1f5fa;
padding: 22rpx;
}
.scroll-Y {
height: calc(100vh - var(--status-bar-height) - 54rpx - 88rpx - 20rpx - 44rpx);
.pagingClass {
width: calc(100% - 44rpx);
margin: 22rpx auto;
background-color: #fff;
border-radius: 16rpx;
}
.scroll-Y .item {
.item {
height: 170rpx;
margin: 32rpx 22rpx;
display: flex;
+59 -67
View File
@@ -1,80 +1,68 @@
<template>
<view class="max_page detail-main">
<nav-bar :is_seat="false"></nav-bar>
<view class="fixed_search_div">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
<z-paging-swiper>
<template #top>
<view class="detail-main">
<nav-bar :is_seat="false"></nav-bar>
<view class="fixed_search_div">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
</view>
<view class="title font_pf">我的预览</view>
</view>
<view class="detail-body">
<view class="body-tab">
<uv-tabs
class="font_pf my_tabs"
:current="tabAct"
:list="tabList"
@change="tabChange"
:scrollable="false"
line-color="#0066FF"
:inactive-style="{ color: '#333333', fontSize: '30rpx', fontWeight: '600' }"
:activeStyle="{ color: '#0066FF', fontSize: '30rpx', fontWeight: '600' }"
:lineColor="`url(${LineBg}) 10% 10%`"
></uv-tabs>
</view>
</view>
</view>
<view class="title font_pf">我的预览</view>
</view>
<view class="detail-body">
<view class="body-tab">
<uv-tabs class="font_pf my_tabs" :current="tabAct" :list="tabList" @change="tabChange"
:scrollable="false" line-color="#0066FF"
:inactive-style="{ color: '#333333', fontSize: '30rpx', fontWeight:'600'}"
:activeStyle="{color:'#0066FF',fontSize:'30rpx', fontWeight:'600'}"
:lineColor="`url(${LineBg}) 10% 10%`"></uv-tabs>
</view>
<view class="uni-margin-wrap">
<swiper class="swiper" :current="tabAct" :indicator-dots="false" @change="swiperChange">
<swiper-item>
<PreviewCourse ref="courseRef"></PreviewCourse>
</swiper-item>
<swiper-item>
<PreviewAiSparring ref="aiSparringRef"></PreviewAiSparring>
</swiper-item>
</swiper>
</view>
</view>
</view>
</template>
<swiper class="swiper" :current="tabAct" :indicator-dots="false" @change="swiperChange">
<swiper-item>
<PreviewCourse :ref="(el) => (listItemRefs[0] = el)" :tabIndex="0" :currentIndex="tabAct"></PreviewCourse>
</swiper-item>
<swiper-item>
<PreviewAiSparring :ref="(el) => (listItemRefs[1] = el)" :tabIndex="1" :currentIndex="tabAct"></PreviewAiSparring>
</swiper-item>
</swiper>
</z-paging-swiper>
</template>
<script setup>
//
import PreviewAiSparring from './components/previewAiSparring.vue'
import PreviewCourse from './components/previewCourse.vue'
import {
ref,
onMounted,
watch
} from 'vue';
import PreviewAiSparring from './components/previewAiSparring.vue';
import PreviewCourse from './components/previewCourse.vue';
import { ref, onMounted, watch } from 'vue';
import common from '@/common/common';
import {
LineBg
} from '@/enum.js'
const courseRef = ref(null);
const aiSparringRef = ref(null);
const tabAct = ref(0);
const tabList = ref([{
name: '预览课程'
}, {
name: '预览AI陪练'
}]);
const tabChange = (item) => {
tabAct.value = item.index;
};
const swiperChange = (item) => {
tabAct.value = item.detail.current;
};
onMounted(() => {
watch(tabAct, (newValue, oldValue) => {
if (newValue === 0) {
courseRef.value?.getData('first')
} else if (newValue === 1) {
}
}, {
immediate: true
})
})
import { LineBg } from '@/enum.js';
import useIndexList from '@/composables/useIndexList.js';
const { tabAct, listItemRefs, tabChange, swiperChange, search } = useIndexList();
const tabList = ref([
{
name: '预览课程'
},
{
name: '预览AI陪练'
}
]);
</script>
<style lang="scss" scoped>
$bg-margin-left: 50rpx;
.my_tabs {
// 穿
:deep(.uv-tabs__wrapper__nav__line) {
height: 26rpx !important;
@@ -86,6 +74,9 @@
.swiper {
height: calc(100vh - var(--status-bar-height) - 54rpx - 88rpx - 20rpx - 10rpx);
// background-color: red;
// height: 100%;
background-color: #f1f5fa;
}
.swiper-item {
@@ -107,7 +98,7 @@
}
.detail-main {
background-color: #F6F8FF;
background-color: #f6f8ff;
overflow: hidden;
}
@@ -120,7 +111,8 @@
line-height: 34rpx;
}
.swiper {}
.swiper {
}
.fixed_search_div {
padding: calc(20rpx + var(--status-bar-height)) 15rpx 24rpx 30rpx;
@@ -163,4 +155,4 @@
}
}
}
</style>
</style>
@@ -32,6 +32,7 @@
setPageCache('testing_hall_details', item)
common.navigateTo('/pages/testingHall/details');
}
</script>
<style scoped lang="scss">
+77 -97
View File
@@ -1,5 +1,19 @@
<template>
<scroll-view
<z-paging
ref="pagingRef"
v-model="data_list"
@query="queryList"
:fixed="false"
class="scroll_div"
:auto="false"
empty-view-text="暂无考试任务"
>
<view class="scroll-Y">
<!-- 如果当前页已经加载过数据或者当前切换到的tab是当前页才展示当前页数据懒加载 -->
<itemVue :item="item" v-for="(item, index) in data_list"></itemVue>
</view>
</z-paging>
<!-- <scroll-view
ref="scrollRef"
scroll-y="true"
class="scroll-Y"
@@ -7,106 +21,66 @@
:show-scrollbar="false"
@scrolltolower="scrolltolower"
>
<!-- 主体 -->
<view class="content">
<itemVue :item="item" v-for="item in data_list"></itemVue>
<list-no-data v-if="total === 0 && status == 'nomore'">暂无考试任务</list-no-data>
<uv-load-more v-if="total !== 0" :status="status" loadmore-text="轻轻上拉加载" :height="30"></uv-load-more>
</view>
</scroll-view>
</scroll-view> -->
</template>
<script setup>
import { ref, reactive} from 'vue';
import { ref, reactive, computed, onMounted, watch } from 'vue';
import { queryTraExamPapersPage } from '@/api/testingHall.js';
import itemVue from './content-item.vue';
const status = ref('loadmore'); // loadmore - loading - nomore -
const limit = 20;
const total = ref(-1);
const page = ref(0);
const data_list = reactive([]);
const scrollRef = ref(null);
import useZpaging from '@/composables/useZpaging.js';
const examStat = computed(() => ['', 'Y', 'N'][props.tabIndex]);
const fetchFunction = (params) => queryTraExamPapersPage({ examStat: examStat.value, ...params });
const { pagingRef, queryList, data_list, reload, search, total, clear } = useZpaging({
fetchFunction,
searchKey: 'papersName'
});
const props = defineProps({
index: {
tabIndex: {
type: Number,
default: 0
},
currentIndex: {
type: Number,
default: 0
}
});
const getData = (from = '', _searchText = '') => {
if (from === 'first') {
if (total.value !== -1) return;
status.value = 'loading';
total.value = -1;
page.value = 1;
data_list.length = 0;
} else {
if (status.value !== 'loadmore' && status.value !== '') return;
status.value = 'loading';
page.value++;
}
setTimeout(() => {
let params = {
papersName: _searchText || searchText.value,
page: page.value,
limit: limit
};
if (props.index === 1) {
params.examStat = 'Y';
} else if (props.index === 2) {
params.examStat = 'N';
}
queryTraExamPapersPage(params)
.then((res) => {
total.value = res.total;
data_list.push(...res.body);
console.log('total.value', total.value);
})
.catch((res) => {
console.log('resres', res);
})
.finally(() => {
if (data_list.length >= total.value) {
status.value = 'nomore';
} else {
status.value = 'loadmore';
}
});
}, 200);
};
const scrolltolower = () => {
getData();
};
const searchText = ref('');
const search = (value, state) => {
console.log('value', value, state);
total.value = -1;
searchText.value = value;
if (state) {
getData('first', value);
} else {
total.value = -1;
page.value = 1;
data_list.length = 0;
}
};
const clear = (state) => {
total.value = -1;
page.value = 1;
data_list.length = 0;
};
const updateData = (item) => {
// const index = data_list.findIndex((res) => res.taskId === item.taskId);
// console.log('updateData', index, item);
// if (index !== -1) {
// data_list[index] = item;
// }
const updateData = (item) => {
if(props.tabIndex !== 0 && item.examStatText === 'Y') {
reload()
} else{
const index = data_list.value.findIndex((res) => res.taskId === item.taskId);
if (index !== -1) {
Object.assign(data_list.value[index], {
...item
});
}
}
};
onMounted(() => {
watch(
() => props.currentIndex,
(newVal) => {
if (newVal === props.tabIndex && total.value === -1) {
reload();
}
},
{
immediate: true
}
);
});
defineExpose({
getData,
// getData,
search,
updateData,
clear
@@ -114,20 +88,26 @@
</script>
<style scoped lang="scss">
.scroll-Y {
height: calc(100vh - var(--status-bar-height) - 70rpx - 78rpx - 40rpx - 88rpx);
position: relative;
overflow: hidden;
background-color: #f1f5fa;
// .scroll-Y {
// height: calc(100vh - var(--status-bar-height) - 70rpx - 78rpx - 40rpx - 88rpx);
// position: relative;
// overflow: hidden;
// background-color: #f1f5fa;
.content {
width: 100%;
height: 100%;
border-radius: 20rpx 20rpx 0 0;
position: relative;
padding-top: 22rpx;
padding: 0 22rpx;
box-sizing: border-box;
}
// .content {
// width: 100%;
// height: 100%;
// border-radius: 20rpx 20rpx 0 0;
// position: relative;
// padding-top: 22rpx;
// padding: 0 22rpx;
// box-sizing: border-box;
// }
// }
.scroll-Y {
border-radius: 16rpx;
padding: 1rpx 22rpx 0 22rpx;
}
</style>
+173 -131
View File
@@ -1,145 +1,142 @@
<template>
<view class="main_div max_page">
<view class="my-nav-bar"></view>
<view class="body-title">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
</view>
<view>考试详情</view>
</view>
<view class="detail_div" :class="detailData.examStatText == 'Y' ? 'completed' : 'incomplete'">
<view class="subscript" v-if="detailData.examStatText === 'N'">未完成</view>
<view class="subscript" v-if="detailData.examStatText === 'Y'">已完成</view>
<view class="title_div">
<view class="title ellipsis-text">{{ detailData.papersName }}</view>
</view>
<view class="time">
<text class="color_3">起止时间</text>
<text class="color_class">{{ detailData.examStartTm }}{{ detailData.examEndTm }}</text>
</view>
<view class="num_div">
<text class="color_3">完成人数</text>
<text class="color_2">{{ detailData.execPersionNumer }}/{{ detailData.planPersionNumber }}</text>
</view>
</view>
<view class="paper_div">
<view class="paper">
<!-- 试卷信息 -->
<view class="paper_title_div">
<image src="@/static/images/testingHall/testing.png" class="img"></image>
<view class="title">试卷信息</view>
<z-paging ref="pagingRef" @query="query" :loading-more-enabled="false" :refresher-only="true" :aoto="false">
<template #top>
<view class="body-title">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
</view>
<view class="title-note">
考试时长
<text class="bold">{{ detailData.limitTm / 60 }}</text>
分钟
<view>考试详情</view>
</view>
</template>
<view class="main_div max_page">
<view class="detail_div" :class="detailData.examStatText == 'Y' ? 'completed' : 'incomplete'">
<view class="subscript" v-if="detailData.examStatText === 'N'">未完成</view>
<view class="subscript" v-if="detailData.examStatText === 'Y'">已完成</view>
<view class="title_div">
<view class="title ellipsis-text">{{ detailData.papersName }}</view>
</view>
<view class="title-table">
<view class="title-table-item">
<view class="top">
<text class="text_2">{{ detailData.totalGrade }}</text>
<text class="text_1"></text>
</view>
<view class="bottom text_1">试卷总分</view>
<view class="time">
<text class="color_3">起止时间</text>
<text class="color_class">{{ detailData.examStartTm }}{{ detailData.examEndTm }}</text>
</view>
<view class="num_div">
<text class="color_3">完成人数</text>
<text class="color_2">{{ detailData.execPersionNumer }}/{{ detailData.planPersionNumber }}</text>
</view>
</view>
<view class="paper_div">
<view class="paper">
<!-- 试卷信息 -->
<view class="paper_title_div">
<image src="@/static/images/testingHall/testing.png" class="img"></image>
<view class="title">试卷信息</view>
</view>
<view class="title-table-item">
<view class="top">
<text class="text_2">{{ detailData.passGrade }}</text>
<text class="text_1"></text>
<view class="title-note">
考试时长
<text class="bold">{{ detailData.limitTm / 60 }}</text>
分钟
</view>
<view class="title-table">
<view class="title-table-item">
<view class="top">
<text class="text_2">{{ detailData.totalGrade }}</text>
<text class="text_1"></text>
</view>
<view class="bottom text_1">试卷总分</view>
</view>
<view class="title-table-item">
<view class="top">
<text class="text_2">{{ detailData.passGrade }}</text>
<text class="text_1"></text>
</view>
<view class="bottom text_1">通过分数</view>
</view>
<view class="title-table-item">
<view class="top text_2">
{{ detailData.limitTypText }}
<view class="bottom text_1">通过分数</view>
</view>
<view class="bottom text_1">通过次数</view>
</view>
<view class="title-table-item">
<view class="top text_2">
{{ detailData.papersTypText || '随机' }}
<view class="title-table-item">
<view class="top text_2">
{{ detailData.limitTypText }}
</view>
<view class="bottom text_1">通过次数</view>
</view>
<view class="bottom text_1">试卷类型</view>
</view>
</view>
<view class="table">
<view class="table_th">
<view class="table_td">题型</view>
<view class="fl1"></view>
<view class="table_td">数量</view>
<view class="table_td">分值</view>
</view>
<view
class="table_tr"
v-for="(t, t_index) in detailData.papersPlateVos"
:class="{ table_tr_dark: t_index % 2 }"
>
<view class="table_td">
{{ t.plateName }}
</view>
<view class="fl1"></view>
<view class="table_td">
{{ t.qnsNumber }}
</view>
<view class="table_td">
{{ t.tgtGrade }}
<view class="title-table-item">
<view class="top text_2">
{{ detailData.papersTypText || '随机' }}
</view>
<view class="bottom text_1">试卷类型</view>
</view>
</view>
<view class="table_tr">
<view class="table_td">总计</view>
<view class="fl1"></view>
<view class="table_td">
{{ allNumber }}
<view class="table">
<view class="table_th">
<view class="table_td">题型</view>
<view class="fl1"></view>
<view class="table_td">数量</view>
<view class="table_td">分值</view>
</view>
<view class="table_td">
{{ allGrade }}
<view
class="table_tr"
v-for="(t, t_index) in detailData.papersPlateVos"
:class="{ table_tr_dark: t_index % 2 }"
>
<view class="table_td">
{{ t.plateName }}
</view>
<view class="fl1"></view>
<view class="table_td">
{{ t.qnsNumber }}
</view>
<view class="table_td">
{{ t.tgtGrade }}
</view>
</view>
<view class="table_tr">
<view class="table_td">总计</view>
<view class="fl1"></view>
<view class="table_td">
{{ allNumber }}
</view>
<view class="table_td">
{{ allGrade }}
</view>
</view>
</view>
</view>
</view>
</view>
<view class="fixed_button_div" @click="goto_examination()">
<uv-button
type="primary"
class="send_evaluate"
:custom-style="customStyle"
:throttleTime="300"
:hairline="false"
:disabled="isTimeInvalid"
>
开始考试
</uv-button>
</view>
</view>
<template #bottom>
<view class="fixed_button_div" @click="goto_examination()">
<uv-button
type="primary"
class="send_evaluate"
:custom-style="customStyle"
:throttleTime="300"
:hairline="false"
:disabled="isTimeInvalid"
>
开始考试
</uv-button>
</view>
</template>
</z-paging>
</template>
<script setup>
import {
onLoad,
onUnload
} from '@dcloudio/uni-app'
import { reactive, computed } from 'vue';
import { startTraExamPapersInfo } from '@/api/examination.js';
import { onLoad, onUnload } from '@dcloudio/uni-app';
import { reactive, computed, ref } from 'vue';
import { startTraExamPapersInfo, queryTraExamPapersByPapersId } from '@/api/examination.js';
import common from '@/common/common';
import { setPageCache, getPageCache } from '@/common/common';
import useZpaging from '@/composables/useZpaging.js';
const pagingRef = ref(null);
const detailData = reactive({
papersId: '',
papersName: '',
examStartTm: '',
examEndTm: '',
execPersionNumer: '',
planPersionNumber: '',
judgeNumber: 0,
singleNumber: 0,
multiNumber: 0,
essayNumber: 0,
judgeGrade: 0,
singleGrade: 0,
multiGrade: 0,
essayGrade: 0
planPersionNumber: ''
});
const customStyle = {
backgroundColor: '#0066FF',
@@ -171,7 +168,38 @@
// true
return current < start || current > end;
});
const query = () => {
setTimeout(() => {
queryTraExamPapersByPapersId({ papersId: detailData.papersId }).then((res) => {
console.log('水水水水', res.body);
const compareKeys = [
'examId',
'papersName',
'examStartTm',
'examEndTm',
'execPersionNumer',
'planPersionNumber',
'totalGrade',
'execPersionNumer',
'examStatText'
];
const detailsData = res.body;
// //
const needUpdate = compareKeys.some((key) => {
return detailData[key] !== detailsData[key];
});
console.log('检查是否需要更新', needUpdate);
if (needUpdate) {
Object.assign(detailData, {
...detailsData
});
uni.$emit('update_testing_hall_item', detailsData);
}
pagingRef.value.endRefresh();
});
}, 200);
};
const goto_examination = async () => {
if (detailData.limitTyp === 'SG' && detailData.examStatText === 'Y') return common.msg('考试已完成');
const startTime = new Date(detailData.examStartTm);
@@ -204,24 +232,23 @@
Object.assign(detailData, {
...testing_hall_details
});
uni.$on('exam_completed', (res) => { //
console.log('refresh_testing_hall_data');
// contentRefs.value[0]?.updateData(res);
uni.$on('get_result_completed', (res) => {
//
setTimeout(() => {
pagingRef.value.reload();
}, 100);
});
});
onUnload(() => {
uni.$off('exam_completed');
uni.$off('get_result_completed');
});
</script>
<style scoped lang="scss">
.fixed_button_div {
position: fixed;
bottom: 30rpx;
width: calc(100vw - 60rpx);
margin: 0 auto 30rpx auto;
}
.title-table {
@@ -369,21 +396,38 @@
background-color: #337fff;
}
.body-title {
background-color: #337fff;
// background-color: #337fff;
// width: 100%;
// position: relative;
// text-align: center;
// height: 120rpx;
// line-height: 100rpx;
// font-family: PingFangSC;
// font-weight: 500;
// font-size: 38rpx;
// color: #ffffff;
// font-style: normal;
// padding-top: var(--status-bar-height);
}
.body-title {
width: 100%;
position: relative;
text-align: center;
height: 120rpx;
line-height: 100rpx;
height: 180rpx;
padding-top: var(--status-bar-height);
margin-bottom: -10rpx;
line-height: calc(180rpx - var(--status-bar-height) - 10rpx);
font-family: PingFangSC;
font-weight: 500;
font-size: 38rpx;
font-size: 32rpx;
color: #ffffff;
font-style: normal;
background-color: #337fff;
}
.detail_div {
margin-top: -20rpx;
height: 250rpx;
z-index: 2;
width: 100%;
padding: 48rpx 40rpx 20rpx 40rpx;
@@ -481,11 +525,9 @@
.back_div {
position: absolute;
left: 26rpx;
height: 100%;
top: -10rpx;
bottom: 20rpx;
display: flex;
align-items: center;
.back-icon {
position: relative;
width: 50rpx;
+56 -93
View File
@@ -1,128 +1,92 @@
<template>
<view class="main_div max_page">
<view class="body-title">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
<z-paging-swiper>
<template #top>
<view class="main_div">
<view class="body-title">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
</view>
<view>考试中心</view>
</view>
<view class="input-view">
<search-input placeholder="请输入考试名" @search="search"></search-input>
</view>
<view class="body-tab">
<uv-tabs
class="font_pf my_tabs"
:current="tabAct"
:list="tabList"
@change="tabChange"
:scrollable="false"
line-color="#0066FF"
:inactive-style="{ color: '#333333', fontSize: '30rpx', fontWeight: '600' }"
:activeStyle="{ color: '#0066FF', fontSize: '30rpx', fontWeight: '600' }"
:lineColor="`url(${LineBg}) 10% 10%`"
></uv-tabs>
</view>
</view>
<view>考试中心</view>
</view>
<view class="input-view">
<search-input placeholder="请输入考试名" @search="search"></search-input>
<!-- <view class="search_div" @click="search"></view> -->
</view>
<view class="body-tab">
<uv-tabs class="font_pf my_tabs" :current="tabAct" :list="tabList" @change="tabChange" :scrollable="false"
line-color="#0066FF" :inactive-style="{ color: '#333333', fontSize: '30rpx', fontWeight:'600'}"
:activeStyle="{color:'#0066FF',fontSize:'30rpx', fontWeight:'600'}"
:lineColor="`url(${LineBg}) 10% 10%`"></uv-tabs>
</view>
</template>
<swiper class="swiper" :current="tabAct" :indicator-dots="false" @change="swiperChange">
<swiper-item>
<Content :ref="el => contentRefs[0] = el" :index="tabAct"
@gotoDetails="gotoDetails"></Content>
<Content :ref="(el) => (listItemRefs[0] = el)" :tabIndex="0" :currentIndex="tabAct"></Content>
</swiper-item>
<swiper-item>
<Content :ref="el => contentRefs[1] = el" :index="tabAct"
@gotoDetails="gotoDetails"></Content>
<Content :ref="(el) => (listItemRefs[1] = el)" :tabIndex="1" :currentIndex="tabAct"></Content>
</swiper-item>
<swiper-item>
<Content :ref="el => contentRefs[2] = el" :index="tabAct"
@gotoDetails="gotoDetails"></Content>
<Content :ref="(el) => (listItemRefs[2] = el)" :tabIndex="2" :currentIndex="tabAct"></Content>
</swiper-item>
</swiper>
</view>
</z-paging-swiper>
</template>
<script setup>
//
import Content from './components/content.vue'
import {
ref,
reactive,
watch,
onMounted
} from 'vue'
import {
onLoad,
onUnload
} from '@dcloudio/uni-app'
import {
setPageCache
} from '@/common/common';
import Content from './components/content.vue';
import { ref, reactive, watch, onMounted } from 'vue';
import { onLoad, onUnload } from '@dcloudio/uni-app';
import { LineBg } from '@/enum.js';
import common from '@/common/common';
import {
LineBg
} from '@/enum.js'
const tabAct = ref(0);
import useIndexList from '@/composables/useIndexList.js';
const { tabAct, listItemRefs, tabChange, swiperChange, search } = useIndexList();
const tabList = ref([{
name: '全 部'
}, {
name: '已完成'
}, {
name: '完成'
}]);
const tabList = ref([
{
name: '全 部'
},
{
name: '完成'
},
{
name: '未完成'
}
]);
const contentRefs = ref([])
const triggered = ref(false)
const tabChange = (item) => {
tabAct.value = item.index;
};
const swiperChange = (item) => {
tabAct.value = item.detail.current;
};
const search = (value) => {
contentRefs.value[0]?.search(value, tabAct.value === 0);
contentRefs.value[1]?.search(value, tabAct.value === 1);
contentRefs.value[2]?.search(value, tabAct.value === 2);
};
const gotoDetails = (item) => {
setPageCache('testing_hall_details', item)
common.navigateTo('/pages/testingHall/details');
}
onMounted(() => {
triggered.value = true
watch(tabAct, (newValue, oldValue) => {
typeof contentRefs.value[newValue]?.getData === 'function' && contentRefs.value[newValue]
?.getData('first')
}, {
immediate: true
}) // immediateonMounted
})
onLoad(() => {
uni.$on('refresh_testing_hall_data', (res) => {
// console.log('exam_completed');
// contentRefs.value[0]?.updateData(res);
// contentRefs.value[1]?.updateData(res);
// contentRefs.value[2]?.updateData(res);
uni.$on('update_testing_hall_item', (res) => {
listItemRefs.value[0]?.updateData(res);
listItemRefs.value[1]?.updateData(res);
listItemRefs.value[2]?.updateData(res);
});
});
onUnload(() => {
uni.$off('refresh_testing_hall_data');
uni.$off('update_testing_hall_item');
});
</script>
<style scoped lang="scss">
.swiper {
height: calc(100vh - var(--status-bar-height) - 70rpx - 78rpx - 40rpx - 88rpx);
height: 100%;
width: 100%;
background-color: #f1f5fa;
}
.body-tab {
height: 88rpx;
// background-color: red;
width: 100%;
}
.my_tabs {
// 穿
:deep(.uv-tabs__wrapper__nav__line) {
height: 30rpx !important;
@@ -130,7 +94,6 @@
background-size: 24rpx !important;
background-repeat: no-repeat !important;
}
}
.main_div {
@@ -150,7 +113,7 @@
color: #000;
position: relative;
text-align: center;
.delete_div {
position: absolute;
right: 20rpx;
@@ -214,4 +177,4 @@
// background-color: red;
}
}
</style>
</style>