代码格式优化,去除多余的引入

This commit is contained in:
田岩
2025-09-01 10:54:27 +08:00
parent 828186c1d4
commit 4eebd75345
36 changed files with 100 additions and 250 deletions
@@ -21,10 +21,6 @@
<script setup>
import {
ref,
reactive,
computed,
onMounted,
nextTick,
} from 'vue';
const props = defineProps({
@@ -43,7 +43,7 @@
</template>
<script setup>
import { ref, reactive, computed, onMounted, onUnmounted, nextTick } from 'vue';
import { ref, reactive, onMounted, onUnmounted, nextTick } from 'vue';
import { optionErrorIcon } from '@/common/imgSvg';
import { saveTraQnsFeedback } from '@/api/examination.js';
import common from '@/common/common';
@@ -104,7 +104,7 @@
await new Promise((resolve) => setTimeout(resolve, delayTime));
}
common.hideLoading();
nextTick(() => {
await nextTick(() => {
feedbackInfo.type = [];
feedbackInfo.text = '';
feedbackInfo.qnsId = '';
+8 -31
View File
@@ -112,7 +112,7 @@
mark: markList.includes(item.qnsId),
completed: completedListStatus[index]
}"
@click="clikc_sheet_item(index)"
@click="click_sheet_item(index)"
>
<view class="circle">
{{ index + 1 }}
@@ -143,16 +143,14 @@
import Feedback from './components/feedback.vue';
import Dialog from './components/dialog.vue';
import Subject from '@/components/examination/subject.vue';
import CharactersSubject from '@/components/examination/characters-subject.vue';
import TouchBtn from '@/components/examination/touchBtn.vue';
import { ref, reactive, computed, onMounted, nextTick } from 'vue';
import { ref, reactive, computed} from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import common from '@/common/common';
import { getPageCache } from '@/common/common';
import { getPageCache, setupKeyboardHeightListener } from '@/common/common';
import { commonUploadVoiceFile } from '@/api/common.js';
import { optionErrorIcon, examinationSheetIcon } from '@/common/imgSvg';
import { commitPaperExam, queryPaperExamScore, startExamByCrs, commitCrsExam } from '@/api/examination.js';
import { commitPaperExam, commitCrsExam } from '@/api/examination.js';
const answerIsOver = ref(true);
const feedbackRef = ref(null);
const dialogRef = ref(null);
@@ -215,8 +213,6 @@
// 弹出框配置
const dialogConfiguration = reactive({});
const activeVoiceId = ref('');
const swiperChange = (item) => {
questionNumber.value = item.detail.current;
};
@@ -243,7 +239,7 @@
const openSheet = (status) => (status ? popupRef.value.open('bottom') : popupRef.value.close());
// 点击答题卡按钮
const clikc_sheet_item = (index) => {
const click_sheet_item = (index) => {
questionNumber.value = index;
};
@@ -260,8 +256,6 @@
}
};
const voicePathValue = ref('');
// 录音按钮提交
const touchBtnSubmit = (type, submitObj) => {
const old_text = touchBtnRef.value?.clearinputText(); // 清除发送框数据
@@ -317,24 +311,12 @@
my_answer: []
}))
);
// #ifdef APP-PLUS
// 安全区域底部到屏幕底部的高度(即底部安全区域高度)
const safeAreaBottomHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom;
uni.onKeyboardHeightChange((res) => {
let keyboardHeight = res.height;
// 仅在iOS端补偿安全区域高度
if (systemInfo.platform === 'ios') {
keyboardHeight = Math.max(0, keyboardHeight - safeAreaBottomHeight); // 避免负数
}
popup_input_bottom.value = `${keyboardHeight}px`;
console.log('端补偿安全区域高度', popup_input_bottom.value);
});
// #endif
setupKeyboardHeightListener((height) => {
popup_input_bottom.value = `${height}px`;
})
});
const result_click = ({ key }) => {
console.log('res', key);
if (key === 'hand_in_paper') {
// 现在交卷
hand_in_paper();
@@ -406,7 +388,6 @@
// 执行交卷
const hand_in_paper = () => {
const answerDtoList = topicList.map((res) => {
console.log('resres', res);
let answerItem = {
examId: paperData.examId,
papersId: paperData.papersId,
@@ -430,12 +411,9 @@
};
}
});
console.log('提交的', answerDtoList);
console.log('answerDtoList', answerDtoList);
// 计算当前时间与开始时间的毫秒差值,再转换为整数秒
const examLenTm = Math.floor((new Date().getTime() - examinationStartTime) / 1000);
dialogRef.value.close();
console.log('examLenTm', examLenTm);
common.loading('正在提交');
// 这里通过是否存在examId来判断是考试中心的考试还是课程的考试
let func;
@@ -457,7 +435,6 @@
});
}
func.then((res) => {
console.log('提交成功', res);
// 判断是否需要查分
if (res.body.flagQuery === 'Y') {
// 需要查分