Merge branch 'develop' of http://25.13.9.101:9000/K17_AITS/tra-app into develop

This commit is contained in:
杨航
2025-09-04 16:42:17 +08:00
17 changed files with 186 additions and 94 deletions
+5 -1
View File
@@ -56,9 +56,13 @@
inputValue.value = newVal;
}
);
const clearText = () => {
console.log('清除搜索结果');
inputValue.value = ''
};
const search = () => {
emits('search', inputValue.value);
};
defineExpose({clearText})
</script>
<style scoped lang="scss"></style>
+18 -12
View File
@@ -239,22 +239,29 @@
try {
if (!id) {
common.loading('收藏中');
const result = await insertTraPersonalCollectionTask({
insertTraPersonalCollectionTask({
collectTyp: '01',
collectBusId: crsId.value
});
console.log('result.body', result.body);
form.value.collectId = result.body;
common.msg('收藏成功');
})
.then((result) => {
form.value.collectId = result.body;
common.msg('收藏成功');
})
.catch(() => {
common.hideLoading();
});
} else {
common.loading('取消收藏中');
await deleteTraPersonalCollectionById({
deleteTraPersonalCollectionById({
collectId: id
});
form.value.collectId = null;
common.msg('取消成功');
})
.then(() => {
form.value.collectId = null;
common.msg('取消成功');
})
.catch(() => {
common.hideLoading();
});
}
} catch (e) {
common.hideLoading();
@@ -277,7 +284,6 @@
});
onUnload(() => {
uni.$off('refresh_comment_data');
// 如果收藏变了,并且上一页是收藏页,更新收藏列表
if (form.value.collectId !== collectId.value) {
const pages = getCurrentPages();
@@ -26,7 +26,7 @@
:bold="true"
></uv-icon>
</view>
<view class="bottom">考试次数</view>
<view class="bottom">考试记录</view>
</view>
</view>
</view>
@@ -26,7 +26,7 @@
:bold="true"
></uv-icon>
</view>
<view class="bottom">练习次数</view>
<view class="bottom">练习记录</view>
</view>
</view>
</view>
@@ -26,7 +26,7 @@
:bold="true"
></uv-icon>
</view>
<view class="bottom">学习次数</view>
<view class="bottom">学习记录</view>
</view>
</view>
</view>
+11 -6
View File
@@ -1,5 +1,5 @@
<template>
<uni-popup ref="feedbackPopupRef" class="popup">
<uni-popup ref="feedbackPopupRef" class="popup" :mask-click="false">
<view class="feedback_popup_div" :style="{ marginBottom: feedback_popup_bottom }">
<view class="title_div">
<view class="text">反馈</view>
@@ -104,11 +104,8 @@
await new Promise((resolve) => setTimeout(resolve, delayTime));
}
common.hideLoading();
await nextTick(() => {
feedbackInfo.type = [];
feedbackInfo.text = '';
feedbackInfo.qnsId = '';
feedbackInfo.examId = '';
await nextTick(() => {
reset()
feedbackPopupRef.value.close();
setTimeout(() => {
common.msg('反馈信息提交成功');
@@ -119,10 +116,18 @@
common.hideLoading();
});
};
const reset = () => {
feedbackInfo.type = [];
feedbackInfo.text = '';
feedbackInfo.qnsId = '';
feedbackInfo.examId = '';
}
const openFeedback = (status) => {
if (status) {
feedbackPopupRef.value.open('bottom');
} else {
reset()
feedbackPopupRef.value.close();
}
};
+48 -19
View File
@@ -5,7 +5,9 @@
<view class="title ellipsis-text" @click="hand_in_paper_button_click()">
{{ paperData.papersName }}
</view>
<view class="back_div"></view>
<view class="back_div" @click="exit_examination">
<image :src="practiceExitIcon()" class="img"></image>
</view>
</view>
<view class="countdown-and-question-number-div">
<view class="top">
@@ -158,7 +160,7 @@
import common from '@/common/common';
import { getPageCache, setupKeyboardHeightListener } from '@/common/common';
import { commonUploadVoiceFile } from '@/api/common.js';
import { optionErrorIcon, examinationSheetIcon } from '@/common/imgSvg';
import { optionErrorIcon, examinationSheetIcon, practiceExitIcon } from '@/common/imgSvg';
import { commitPaperExam, commitCrsExam } from '@/api/examination.js';
const answerIsOver = ref(true);
const feedbackRef = ref(null);
@@ -167,7 +169,18 @@
const touchBtnRef = ref(null);
const countDownRef = ref(null);
let examinationStartTime = 0; // 考试开始时间
const style_button_1 = {
color: '#FFFFFF',
fontSize: '30rpx',
backgroundColor: '#0066FF',
borderRadius: '8rpx'
};
const style_button_2 = {
color: '#0066FF',
fontSize: '30rpx',
backgroundColor: '#E2EDFF',
borderRadius: '8rpx'
};
const mode = 'examination'; // 考试 examination 练习practice
const paperData = reactive({
crsId: '', // 课程ID,通过课程id是否为空字符串判断这个试卷是课程考试还是考试中心考试
@@ -334,15 +347,37 @@
countDownRef.value.start();
}, 500);
});
const exit_examination = () => {
dialogRef.value.open({
title: '确认现在退出吗?',
buttonList: [
{
key: 'revert',
name: '继续答题',
style: style_button_1
},
{
key: 'exit',
name: '退出考试',
style: style_button_2
}
]
});
};
const result_click = ({ key }) => {
console.log('杀杀杀', key);
if (key === 'hand_in_paper') {
// 现在交卷
hand_in_paper('弹窗确认交卷');
} else if (key === 'continue') {
// 继续考试
dialogRef.value.close();
} else if (key === 'exit') {
// 中途退出
dialogRef.value.close();
common.navigateBack();
} else if (key === 'revert') {
// 返回
dialogRef.value.close();
}
};
@@ -367,18 +402,6 @@
c: !!res.my_answer
}));
const style_button_1 = {
color: '#FFFFFF',
fontSize: '30rpx',
backgroundColor: '#0066FF',
borderRadius: '8rpx'
};
const style_button_2 = {
color: '#0066FF',
fontSize: '30rpx',
backgroundColor: '#E2EDFF',
borderRadius: '8rpx'
};
const incompleteNumber = topicList.length - completeList.length;
console.log('incompleteNumber', incompleteNumber);
console.log('completeList', completeList);
@@ -470,7 +493,7 @@
}
func.then((res) => {
// 考试完成事件
uni.$emit('exam_completed')
uni.$emit('exam_completed');
// 判断是否需要查分
const flagQueryDetail = res.body.flagQueryDetail === '' ? res.body.flagQuery : res.body.flagQueryDetail;
common.redirectTo(
@@ -772,7 +795,13 @@
top: 0;
width: 70rpx;
height: 70rpx;
// background-color: red;
display: flex;
align-items: center;
justify-content: flex-end;
.img {
width: 32rpx;
height: 32rpx;
}
}
}
@@ -26,7 +26,7 @@
:bold="true"
></uv-icon>
</view>
<view class="bottom">考试次数</view>
<view class="bottom">考试记录</view>
</view>
</view>
</view>
@@ -33,9 +33,13 @@
<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>
</view>
@@ -145,7 +149,8 @@
};
const updateData = (item) => {
console.log('收藏的updateData');
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) {
+4 -3
View File
@@ -47,14 +47,14 @@
</view>
<!-- 滚动通知 -->
<view class="notice_div">
<uv-notice-bar
<!-- <uv-notice-bar
v-show="notice_text.length"
:text="notice_text"
:bgColor="null"
color="rgba(255,255,255,0.7)"
:speed="40"
direction="column"
></uv-notice-bar>
></uv-notice-bar> -->
</view>
<!-- 学习时长和飞天兔子为了挡住部分兔子只能多一个盒子 -->
<view class="study_duration_and_profile_div">
@@ -720,7 +720,8 @@
// margin-top: 10rpx;
margin-left: $bg-margin-left;
width: 400rpx;
height: 74rpx;
// height: 74rpx;
height: 34rpx;
font-weight: 500;
color: rgba(255, 255, 255, 0.7);
text-align: left;
+18 -9
View File
@@ -8,15 +8,16 @@
</view>
</template>
<script setup>
import common from '@/common/common';
import { ref, reactive, onMounted, nextTick, watch } from 'vue';
import itemVue from './content-item.vue';
import { queryAllTraTaskInfoByUserId } from '@/api/learningTasks.js';
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 20;
const total = ref(-1);
const page = ref(0);
const data_list = reactive([]);
import common from '@/common/common';
import { ref, reactive, onMounted, nextTick } from 'vue';
import itemVue from './content-item.vue';
import { queryAllTraTaskInfoByUserId } from '@/api/learningTasks.js';
const props = defineProps({
state: {
type: String,
@@ -24,7 +25,7 @@
}
});
const getData = (from = '', searchText = '') => {
const getData = (from = '', _searchText = '') => {
if (from == 'first') {
if (total.value !== -1) {
return;
@@ -43,7 +44,7 @@
state: props.state,
page: page.value,
limit: limit,
taskName: searchText
taskName: _searchText || searchText.value
})
.then((res) => {
total.value = res.total;
@@ -62,10 +63,18 @@
const scrolltolower = (item) => {
getData();
};
const search = (value) => {
const searchText = ref('');
const search = (value, state) => {
console.log('value', value, state);
total.value = -1;
console.log('value', value);
getData('first', value);
searchText.value = value;
if (state) {
getData('first', value);
} else {
total.value = -1;
page.value = 1;
data_list.length = 0;
}
};
const updateData = (item) => {
const index = data_list.findIndex((res) => res.taskId === item.taskId);
+36 -22
View File
@@ -159,7 +159,7 @@
taskId: detailData.taskId
})
.then((res) => {
data_list.length = 0
data_list.length = 0;
data_list.push(...res.body);
})
.finally(() => {
@@ -184,20 +184,29 @@
try {
if (!id) {
common.loading('收藏中');
const res = await insertTraPersonalCollectionTask({
insertTraPersonalCollectionTask({
collectTyp: '02',
collectBusId: detailData.taskId
});
detailData.collectionId = res.body;
common.msg('收藏成功');
})
.then((res) => {
detailData.collectionId = res.body;
common.msg('收藏成功');
})
.catch(() => {
common.hideLoading();
});
} else {
common.loading('取消收藏中');
await deleteTraPersonalCollectionById({
deleteTraPersonalCollectionById({
collectId: id
});
detailData.collectionId = null;
common.msg('取消成功');
})
.then(() => {
detailData.collectionId = null;
common.msg('取消成功');
})
.catch(() => {
common.hideLoading();
});
}
} catch (e) {
common.hideLoading();
@@ -211,21 +220,22 @@
});
getData();
const updateFun = () => {
console.log('详情监听里面学习完成后更新任务历程');
queryTraTaskInfoByTaskId({taskId:detailData.taskId}).then(({body}) => {
uni.$emit('refresh_favorites_data', body)
Object.assign(detailData, {
...body
setTimeout(() => {
console.log('详情监听里面学习完成后更新任务历程');
queryTraTaskInfoByTaskId({ taskId: detailData.taskId }).then(({ body }) => {
uni.$emit('refresh_favorites_data', body);
Object.assign(detailData, {
...body
});
});
})
getData();
}
getData();
}, 4000);
};
// 监听里面学习完成后更新任务历程,执行更新函数
uni.$on('refresh_course_list', () => updateFun())
uni.$on('refresh_course_list', () => updateFun());
// 监听考试完成事件,执行更新函数
uni.$on('exam_completed', () => updateFun())
uni.$on('exam_completed', () => updateFun());
});
onUnload(() => {
uni.$off('refresh_course_list');
@@ -236,12 +246,16 @@
if (pages.length >= 2) {
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
});
} else if (prevPage.route === 'pages/learningTasks/index') {
// 学习任务页跳入,更新外部列表否则下次列表数据还是老的
uni.$emit('refresh_tasks_list', detailData);
}
}
}
+12 -7
View File
@@ -49,6 +49,7 @@
import common from '@/common/common.js';
const listItemRefs = ref([]);
const tabAct = ref(0);
const searchText = ref('');
const tabList = ref([
{
name: '全 部'
@@ -68,7 +69,11 @@
tabAct.value = item.detail.current;
};
const search = (value) => {
listItemRefs.value[tabAct.value]?.search(value);
listItemRefs.value[0]?.search(value, tabAct.value === 0);
listItemRefs.value[1]?.search(value, tabAct.value === 1);
listItemRefs.value[2]?.search(value, tabAct.value === 2);
};
onMounted(() => {
@@ -81,15 +86,15 @@
{
immediate: true
}
); // 这里的immediate会在onMounted之后执行
);
});
onLoad(() => {
uni.$on('refresh_tasks_list', (res) => {
console.log('列表监听里面学习完成后更新任务历程', res);
if(typeof listItemRefs.value[tabAct.value]?.updateData === 'function') {
listItemRefs.value[tabAct.value]?.updateData(res);
}
// 更新列表内单挑item数据
if (typeof listItemRefs.value[tabAct.value]?.updateData === 'function') {
listItemRefs.value[tabAct.value]?.updateData(res);
}
});
});
onUnload(() => {
-1
View File
@@ -760,7 +760,6 @@
width: 32rpx;
height: 32rpx;
}
// background-color: red;
}
}
+14 -4
View File
@@ -33,7 +33,7 @@
}
});
const getData = (from = '', searchText = '') => {
const getData = (from = '', _searchText = '') => {
if (from === 'first') {
if (total.value !== -1) return;
status.value = 'loading';
@@ -48,7 +48,7 @@
setTimeout(() => {
let params = {
papersName: searchText,
papersName: _searchText || searchText.value,
page: page.value,
limit: limit
};
@@ -76,10 +76,20 @@
const scrolltolower = () => {
getData();
};
const search = (value) => {
const searchText = ref('');
const search = (value, state) => {
console.log('value', value, state);
total.value = -1;
getData('first', value);
searchText.value = value;
if (state) {
getData('first', value);
} else {
total.value = -1;
page.value = 1;
data_list.length = 0;
}
};
defineExpose({
getData,
search
+6 -2
View File
@@ -72,9 +72,13 @@
const swiperChange = (item) => {
tabAct.value = item.detail.current;
};
const search = (value) => {
contentRefs.value[tabAct.value]?.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');