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

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
@@ -121,9 +121,6 @@
const popup = ref(null); const popup = ref(null);
const popup_input_bottom = ref('0px'); const popup_input_bottom = ref('0px');
const inputValue = ref('');
const placeholder = ref('');
const message_list = reactive([]); const message_list = reactive([]);
const status = ref(''); // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref(''); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 20; const limit = 20;
@@ -182,7 +179,7 @@
}; };
const getData = (from = '') => { const getData = (from = '') => {
if (from == 'submit') { if (from === 'submit') {
status.value = ''; status.value = '';
total.value = -1; total.value = -1;
page.value = 1; page.value = 1;
@@ -48,7 +48,6 @@
</template> </template>
<script setup> <script setup>
import common from '@/common/common';
const props = defineProps({ const props = defineProps({
modelValue: Object modelValue: Object
}); });
@@ -27,12 +27,12 @@
modelValue: Object modelValue: Object
}) })
const min_no_success_id = computed(() => { const min_no_success_id = computed(() => {
const find_item = props.modelValue?.pgrphData.find(res => (res.pgrphStdyStateName == '未学习' || res.pgrphStdyStateName == '学习中')) const find_item = props.modelValue?.pgrphData.find(res => (res.pgrphStdyStateName === '未学习' || res.pgrphStdyStateName === '学习中'))
return find_item?.pgrphId || '' return find_item?.pgrphId || ''
}) })
const toDetail = (item) => { const toDetail = (item) => {
if (item.pgrphStdyStateName == '已学习' || item.pgrphStdyStateName == '学习中' || min_no_success_id.value == item.pgrphId) { if (item.pgrphStdyStateName === '已学习' || item.pgrphStdyStateName === '学习中' || min_no_success_id.value === item.pgrphId) {
emit('toStudyPrgh', item) emit('toStudyPrgh', item)
} else { } else {
common.msg('请按顺序学习知识点') common.msg('请按顺序学习知识点')
+4 -8
View File
@@ -76,15 +76,15 @@
</view> </view>
</uv-sticky> </uv-sticky>
<!-- <swiper class="body-swiper" @change="swiper_change" :current="tabAct"><swiper-item> --> <!-- <swiper class="body-swiper" @change="swiper_change" :current="tabAct"><swiper-item> -->
<view class="course-info" v-if="tabAct == 0"> <view class="course-info" v-if="tabAct === 0">
<introduceVue v-model="form"></introduceVue> <introduceVue v-model="form"></introduceVue>
</view> </view>
<!--</swiper-item><swiper-item>--> <!--</swiper-item><swiper-item>-->
<view class="point" v-if="tabAct == 1"> <view class="point" v-if="tabAct === 1">
<knowledge v-model="form" @toStudyPrgh="toStudyPrgh"></knowledge> <knowledge v-model="form" @toStudyPrgh="toStudyPrgh"></knowledge>
</view> </view>
<!--</swiper-item><swiper-item>--> <!--</swiper-item><swiper-item>-->
<view class="evaluate" v-if="tabAct == 2 && form"> <view class="evaluate" v-if="tabAct === 2 && form">
<comment ref="commentRef" :crsId="crsId" :imgId="form.imgId"></comment> <comment ref="commentRef" :crsId="crsId" :imgId="form.imgId"></comment>
</view> </view>
<!--</swiper-item></swiper>--> <!--</swiper-item></swiper>-->
@@ -120,7 +120,7 @@
</template> </template>
<script setup> <script setup>
import { reactive, ref, computed, onMounted } from 'vue'; import { ref, computed, onMounted } from 'vue';
import { onShow, onLoad, onUnload } from '@dcloudio/uni-app'; import { onShow, onLoad, onUnload } from '@dcloudio/uni-app';
import { getCourseDetailApi } from '@/api/courseDetail.js'; import { getCourseDetailApi } from '@/api/courseDetail.js';
import { startExamByCrs } from '@/api/examination.js'; import { startExamByCrs } from '@/api/examination.js';
@@ -185,10 +185,6 @@
scrollTop.value = e.detail.scrollTop; scrollTop.value = e.detail.scrollTop;
}; };
const swiper_change = (res) => {
tabAct.value = res.detail.current;
};
// 去考试 // 去考试
const goto_examination = async () => { const goto_examination = async () => {
if (isPreview.value === 'preview') return common.msg('预览课程不允许考试'); if (isPreview.value === 'preview') return common.msg('预览课程不允许考试');
+1 -2
View File
@@ -72,7 +72,6 @@
<script setup> <script setup>
import { reactive, ref, nextTick } from 'vue'; import { reactive, ref, nextTick } from 'vue';
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import { publishCrsEvaluation } from '@/api/courseDetail.js'; import { publishCrsEvaluation } from '@/api/courseDetail.js';
import common from '@/common/common'; import common from '@/common/common';
@@ -92,7 +91,7 @@
const submit = () => { const submit = () => {
if (formData.bbsContent === '') { if (formData.bbsContent === '') {
if (formData.bbsTag == 'SUG') { if (formData.bbsTag === 'SUG') {
return common.msg('请输入你的建议'); return common.msg('请输入你的建议');
} else { } else {
return common.msg('请输入你的问题'); return common.msg('请输入你的问题');
@@ -57,7 +57,7 @@
</template> </template>
<script setup> <script setup>
import { computed, ref, reactive, nextTick } from 'vue'; import { computed, ref, reactive } from 'vue';
import common from '@/common/common'; import common from '@/common/common';
import { queryCrsExamHisByExamId } from '@/api/courseRecord.js'; import { queryCrsExamHisByExamId } from '@/api/courseRecord.js';
const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
@@ -98,7 +98,6 @@
// 跳转到详情 // 跳转到详情
const click_list_item = (list_item) => { const click_list_item = (list_item) => {
console.log('list_item', list_item); console.log('list_item', list_item);
const examLenTm = 666;
const papersName = item.value.examName; const papersName = item.value.examName;
common.navigateTo( common.navigateTo(
@@ -9,17 +9,16 @@
</template> </template>
<script setup> <script setup>
import itemVue from './examRecordItem.vue'; import itemVue from './examRecordItem.vue';
import common from '@/common/common'; import { ref, reactive } from 'vue';
import { ref, reactive, onMounted, nextTick } from 'vue';
import { queryCrsExamRecordPaging } from '@/api/courseRecord.js'; import { queryCrsExamRecordPaging } from '@/api/courseRecord.js';
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 15; const limit = 20;
const total = ref(-1); const total = ref(-1);
const page = ref(0); const page = ref(0);
const data_list = reactive([]); const data_list = reactive([]);
const getData = (from = '') => { const getData = (from = '') => {
if (from == 'first') { if (from === 'first') {
if (total.value !== -1) { if (total.value !== -1) {
return; return;
} }
@@ -49,14 +48,7 @@
}); });
}; };
const getStatusClass = (isFinish) => { const scrolltolower = () => {
// 00进行中、01已完成、02已超时
if (isFinish === '00') return 'in_progress';
if (isFinish === '01') return 'completed';
return 'expired';
};
const scrolltolower = (item) => {
getData(); getData();
}; };
@@ -57,7 +57,7 @@
</template> </template>
<script setup> <script setup>
import { computed, ref, reactive, nextTick } from 'vue'; import { computed, ref, reactive } from 'vue';
import common from '@/common/common'; import common from '@/common/common';
import { queryPracticeHis } from '@/api/courseRecord.js'; import { queryPracticeHis } from '@/api/courseRecord.js';
const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
@@ -9,17 +9,16 @@
</template> </template>
<script setup> <script setup>
import itemVue from './practiceRecordItem.vue'; import itemVue from './practiceRecordItem.vue';
import common from '@/common/common'; import { ref, reactive } from 'vue';
import { ref, reactive, onMounted } from 'vue';
import { queryPracticeRecordPaging } from '@/api/courseRecord.js'; import { queryPracticeRecordPaging } from '@/api/courseRecord.js';
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 15; const limit = 20;
const total = ref(-1); const total = ref(-1);
const page = ref(0); const page = ref(0);
const data_list = reactive([]); const data_list = reactive([]);
const getData = (from = '') => { const getData = (from = '') => {
if (from == 'first') { if (from === 'first') {
if (total.value !== -1) { if (total.value !== -1) {
return; return;
} }
@@ -49,7 +48,7 @@
}); });
}; };
const scrolltolower = (item) => { const scrolltolower = () => {
getData(); getData();
}; };
@@ -81,7 +81,6 @@
} }
}); });
const secondsToHours = (seconds) => { const secondsToHours = (seconds) => {
console.log('typeof seconds', typeof seconds);
if (typeof seconds === 'number') { if (typeof seconds === 'number') {
// 转换为小时并保留一位小数 // 转换为小时并保留一位小数
return (seconds / 3600).toFixed(1); return (seconds / 3600).toFixed(1);
@@ -9,17 +9,16 @@
</template> </template>
<script setup> <script setup>
import itemVue from './studyRecordItem.vue'; import itemVue from './studyRecordItem.vue';
import common from '@/common/common'; import { ref, reactive} from 'vue';
import { ref, reactive, onMounted, nextTick } from 'vue';
import { queryStdyRecordPaging } from '@/api/courseRecord.js'; import { queryStdyRecordPaging } from '@/api/courseRecord.js';
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 15; const limit = 20;
const total = ref(-1); const total = ref(-1);
const page = ref(0); const page = ref(0);
const data_list = reactive([]); const data_list = reactive([]);
const getData = (from = '') => { const getData = (from = '') => {
if (from == 'first') { if (from === 'first') {
if (total.value !== -1) { if (total.value !== -1) {
return; return;
} }
@@ -50,37 +49,11 @@
}); });
}; };
const getStatusClass = (isFinish) => {
// 00进行中、01已完成、02已超时
if (isFinish === '00') return 'in_progress';
if (isFinish === '01') return 'completed';
return 'expired';
};
const scrolltolower = (item) => { const scrolltolower = () => {
getData(); getData();
}; };
// 计算两个时间的时间差
const formatDuration = (startTm, endTm) => {
// 解析时间字符串为时间戳(毫秒)
const startTime = new Date(startTm).getTime();
const endTime = new Date(endTm).getTime();
// 计算时间差(秒),确保为正数
const seconds = Math.abs(Math.floor((endTime - startTime) / 1000));
// 计算时、分、秒
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const remainingSeconds = seconds % 60;
// 补零格式化函数(统一处理所有单位)
const formatNumber = (num) => num.toString().padStart(2, '0');
// 小时、分钟、秒均保持两位数格式
return `${formatNumber(hours)}:${formatNumber(minutes)}:${formatNumber(remainingSeconds)}`;
}
defineExpose({ defineExpose({
getData getData
}); });
@@ -19,15 +19,12 @@
<script setup> <script setup>
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import { ref, reactive, computed, onMounted, nextTick, getCurrentInstance } from 'vue'; import { ref, reactive } from 'vue';
import Subject from '@/components/examination/subject.vue'; import Subject from '@/components/examination/subject.vue';
import common from '@/common/common'; import common from '@/common/common';
import { queryPracticeRecordByExrId } from '@/api/courseRecord.js'; import { queryPracticeRecordByExrId } from '@/api/courseRecord.js';
const exrId = ref(''); const exrId = ref('');
const pass_status = ref(0);
const topicList = reactive([]); const topicList = reactive([]);
const get_result = () => { const get_result = () => {
+2 -8
View File
@@ -45,11 +45,9 @@
import studyRecordList from './components/studyRecordList.vue'; import studyRecordList from './components/studyRecordList.vue';
import practiceRecordList from './components/practiceRecordList.vue'; import practiceRecordList from './components/practiceRecordList.vue';
import examRecordList from './components/examRecordList.vue'; import examRecordList from './components/examRecordList.vue';
import { ref, onMounted, watch } from 'vue';
import { reactive, ref, computed, nextTick, onMounted, watch } from 'vue';
import common from '@/common/common.js'; import common from '@/common/common.js';
const listItemRefs = ref([]); const listItemRefs = ref([]);
const taskRef = ref(null);
const tabAct = ref(0); const tabAct = ref(0);
const tabList = ref([ const tabList = ref([
{ {
@@ -69,14 +67,10 @@
const swiperChange = (item) => { const swiperChange = (item) => {
tabAct.value = item.detail.current; tabAct.value = item.detail.current;
}; };
const search = (value) => {
listItemRefs.value[tabAct.value]?.search(value);
};
onMounted(() => { onMounted(() => {
watch( watch(
tabAct, tabAct,
(newValue, oldValue) => { (newValue) => {
typeof listItemRefs.value[newValue]?.getData === 'function' && typeof listItemRefs.value[newValue]?.getData === 'function' &&
listItemRefs.value[newValue]?.getData('first'); listItemRefs.value[newValue]?.getData('first');
}, },
@@ -21,10 +21,6 @@
<script setup> <script setup>
import { import {
ref, ref,
reactive,
computed,
onMounted,
nextTick,
} from 'vue'; } from 'vue';
const props = defineProps({ const props = defineProps({
@@ -43,7 +43,7 @@
</template> </template>
<script setup> <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 { optionErrorIcon } from '@/common/imgSvg';
import { saveTraQnsFeedback } from '@/api/examination.js'; import { saveTraQnsFeedback } from '@/api/examination.js';
import common from '@/common/common'; import common from '@/common/common';
@@ -104,7 +104,7 @@
await new Promise((resolve) => setTimeout(resolve, delayTime)); await new Promise((resolve) => setTimeout(resolve, delayTime));
} }
common.hideLoading(); common.hideLoading();
nextTick(() => { await nextTick(() => {
feedbackInfo.type = []; feedbackInfo.type = [];
feedbackInfo.text = ''; feedbackInfo.text = '';
feedbackInfo.qnsId = ''; feedbackInfo.qnsId = '';
+8 -31
View File
@@ -112,7 +112,7 @@
mark: markList.includes(item.qnsId), mark: markList.includes(item.qnsId),
completed: completedListStatus[index] completed: completedListStatus[index]
}" }"
@click="clikc_sheet_item(index)" @click="click_sheet_item(index)"
> >
<view class="circle"> <view class="circle">
{{ index + 1 }} {{ index + 1 }}
@@ -143,16 +143,14 @@
import Feedback from './components/feedback.vue'; import Feedback from './components/feedback.vue';
import Dialog from './components/dialog.vue'; import Dialog from './components/dialog.vue';
import Subject from '@/components/examination/subject.vue'; import Subject from '@/components/examination/subject.vue';
import CharactersSubject from '@/components/examination/characters-subject.vue';
import TouchBtn from '@/components/examination/touchBtn.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 { onLoad } from '@dcloudio/uni-app';
import common from '@/common/common'; import common from '@/common/common';
import { getPageCache } from '@/common/common'; import { getPageCache, setupKeyboardHeightListener } from '@/common/common';
import { commonUploadVoiceFile } from '@/api/common.js'; import { commonUploadVoiceFile } from '@/api/common.js';
import { optionErrorIcon, examinationSheetIcon } from '@/common/imgSvg'; 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 answerIsOver = ref(true);
const feedbackRef = ref(null); const feedbackRef = ref(null);
const dialogRef = ref(null); const dialogRef = ref(null);
@@ -215,8 +213,6 @@
// 弹出框配置 // 弹出框配置
const dialogConfiguration = reactive({}); const dialogConfiguration = reactive({});
const activeVoiceId = ref('');
const swiperChange = (item) => { const swiperChange = (item) => {
questionNumber.value = item.detail.current; questionNumber.value = item.detail.current;
}; };
@@ -243,7 +239,7 @@
const openSheet = (status) => (status ? popupRef.value.open('bottom') : popupRef.value.close()); const openSheet = (status) => (status ? popupRef.value.open('bottom') : popupRef.value.close());
// 点击答题卡按钮 // 点击答题卡按钮
const clikc_sheet_item = (index) => { const click_sheet_item = (index) => {
questionNumber.value = index; questionNumber.value = index;
}; };
@@ -260,8 +256,6 @@
} }
}; };
const voicePathValue = ref('');
// 录音按钮提交 // 录音按钮提交
const touchBtnSubmit = (type, submitObj) => { const touchBtnSubmit = (type, submitObj) => {
const old_text = touchBtnRef.value?.clearinputText(); // 清除发送框数据 const old_text = touchBtnRef.value?.clearinputText(); // 清除发送框数据
@@ -317,24 +311,12 @@
my_answer: [] my_answer: []
})) }))
); );
setupKeyboardHeightListener((height) => {
// #ifdef APP-PLUS popup_input_bottom.value = `${height}px`;
// 安全区域底部到屏幕底部的高度(即底部安全区域高度) })
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
}); });
const result_click = ({ key }) => { const result_click = ({ key }) => {
console.log('res', key);
if (key === 'hand_in_paper') { if (key === 'hand_in_paper') {
// 现在交卷 // 现在交卷
hand_in_paper(); hand_in_paper();
@@ -406,7 +388,6 @@
// 执行交卷 // 执行交卷
const hand_in_paper = () => { const hand_in_paper = () => {
const answerDtoList = topicList.map((res) => { const answerDtoList = topicList.map((res) => {
console.log('resres', res);
let answerItem = { let answerItem = {
examId: paperData.examId, examId: paperData.examId,
papersId: paperData.papersId, papersId: paperData.papersId,
@@ -430,12 +411,9 @@
}; };
} }
}); });
console.log('提交的', answerDtoList);
console.log('answerDtoList', answerDtoList);
// 计算当前时间与开始时间的毫秒差值,再转换为整数秒 // 计算当前时间与开始时间的毫秒差值,再转换为整数秒
const examLenTm = Math.floor((new Date().getTime() - examinationStartTime) / 1000); const examLenTm = Math.floor((new Date().getTime() - examinationStartTime) / 1000);
dialogRef.value.close(); dialogRef.value.close();
console.log('examLenTm', examLenTm);
common.loading('正在提交'); common.loading('正在提交');
// 这里通过是否存在examId来判断是考试中心的考试还是课程的考试 // 这里通过是否存在examId来判断是考试中心的考试还是课程的考试
let func; let func;
@@ -457,7 +435,6 @@
}); });
} }
func.then((res) => { func.then((res) => {
console.log('提交成功', res);
// 判断是否需要查分 // 判断是否需要查分
if (res.body.flagQuery === 'Y') { if (res.body.flagQuery === 'Y') {
// 需要查分 // 需要查分
@@ -9,17 +9,16 @@
</template> </template>
<script setup> <script setup>
import itemVue from './examRecordItem.vue'; import itemVue from './examRecordItem.vue';
import common from '@/common/common'; import { ref, reactive } from 'vue';
import { ref, reactive, onMounted, nextTick } from 'vue';
import { queryExamRecordPaging } from '@/api/courseRecord.js'; import { queryExamRecordPaging } from '@/api/courseRecord.js';
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 15; const limit = 20;
const total = ref(-1); const total = ref(-1);
const page = ref(0); const page = ref(0);
const data_list = reactive([]); const data_list = reactive([]);
const getData = (from = '') => { const getData = (from = '') => {
if (from == 'first') { if (from === 'first') {
if (total.value !== -1) { if (total.value !== -1) {
return; return;
} }
@@ -49,7 +48,7 @@
}); });
}; };
const scrolltolower = (item) => { const scrolltolower = () => {
getData(); getData();
}; };
+1 -26
View File
@@ -9,40 +9,15 @@
</view> </view>
<view class="detail-body"> <view class="detail-body">
<examRecordList ref="listItemRef"></examRecordList> <examRecordList ref="listItemRef"></examRecordList>
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup>
import examRecordList from './components/examRecordList.vue'; import examRecordList from './components/examRecordList.vue';
import { ref, onMounted } from 'vue';
import { reactive, ref, computed, nextTick, onMounted, watch } from 'vue';
import common from '@/common/common.js'; import common from '@/common/common.js';
const listItemRef = ref(null); const listItemRef = ref(null);
const taskRef = ref(null);
const tabAct = ref(0);
const tabList = ref([
{
name: '学习记录'
},
{
name: '练习记录'
},
{
name: '考试记录'
}
]);
const tabChange = (item) => {
tabAct.value = item.index;
};
const swiperChange = (item) => {
tabAct.value = item.detail.current;
};
onMounted(() => { onMounted(() => {
listItemRef.value?.getData('first'); listItemRef.value?.getData('first');
}); });
@@ -40,11 +40,11 @@
</template> </template>
<script setup> <script setup>
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 15; const limit = 20;
const total = ref(-1); const total = ref(-1);
const page = ref(0); const page = ref(0);
const data_list = reactive([]); const data_list = reactive([]);
import { ref, reactive, onMounted, nextTick } from 'vue'; import { ref, reactive} from 'vue';
import { queryTraPersonalCollectionCrsPaging, deleteTraPersonalCollectionById } from '@/api/favorites.js'; import { queryTraPersonalCollectionCrsPaging, deleteTraPersonalCollectionById } from '@/api/favorites.js';
import common from '@/common/common'; import common from '@/common/common';
const options = [ const options = [
@@ -57,7 +57,7 @@
]; ];
const getData = (from = '') => { const getData = (from = '') => {
console.log('status.value', status.value); console.log('status.value', status.value);
if (from == 'first') { if (from === 'first') {
if (total.value !== -1) { if (total.value !== -1) {
return; return;
} }
@@ -108,10 +108,10 @@
}); });
}); });
}; };
const scrolltolower = (item) => { const scrolltolower = () => {
getData(); getData();
}; };
const refreshData = (params) => { const refreshData = () => {
total.value = -1; total.value = -1;
getData('first'); getData('first');
}; };
@@ -47,13 +47,13 @@
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted, nextTick } from 'vue'; import { ref, reactive} from 'vue';
import { queryTraPersonalCollectionTaskPaging,deleteTraPersonalCollectionById } from '@/api/favorites.js'; import { queryTraPersonalCollectionTaskPaging,deleteTraPersonalCollectionById } from '@/api/favorites.js';
import { setPageCache } from '@/common/common'; import { setPageCache } from '@/common/common';
import common from '@/common/common'; import common from '@/common/common';
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 15; const limit = 20;
const total = ref(-1); const total = ref(-1);
const page = ref(0); const page = ref(0);
const data_list = reactive([]); const data_list = reactive([]);
@@ -66,7 +66,7 @@
} }
]; ];
const getData = (from = '') => { const getData = (from = '') => {
if (from == 'first') { if (from === 'first') {
if (total.value !== -1) { if (total.value !== -1) {
return; return;
} }
@@ -104,7 +104,6 @@
common.show('提示', '确认删除吗?').then((res) => { common.show('提示', '确认删除吗?').then((res) => {
if (!res) return; if (!res) return;
common.loading(); common.loading();
const collectId = '11';
deleteTraPersonalCollectionById({ collectId: item.collectionId }) deleteTraPersonalCollectionById({ collectId: item.collectionId })
.then(() => { .then(() => {
data_list.splice(index, 1); // 从列表移除 data_list.splice(index, 1); // 从列表移除
@@ -118,7 +117,6 @@
// 跳转到详情 // 跳转到详情
const click_item = (item) => { const click_item = (item) => {
// tudo
if (item.isTimeOut === '00') { if (item.isTimeOut === '00') {
common.msg('任务已结束'); common.msg('任务已结束');
return; return;
+2 -3
View File
@@ -45,11 +45,10 @@
import FavoritesTask from './components/favoritesTask.vue'; import FavoritesTask from './components/favoritesTask.vue';
import FavoritesCourse from './components/favoritesCourse.vue'; import FavoritesCourse from './components/favoritesCourse.vue';
// 我的收藏 // 我的收藏
import { reactive, ref, computed, nextTick, onMounted, watch } from 'vue'; import { ref, onMounted, watch } from 'vue';
import { onShow, onLoad, onUnload } from '@dcloudio/uni-app'; import { onLoad, onUnload } from '@dcloudio/uni-app';
import { LineBg } from '@/enum.js'; import { LineBg } from '@/enum.js';
import common from '@/common/common'; import common from '@/common/common';
const statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
const courseRef = ref(null); const courseRef = ref(null);
const taskRef = ref(null); const taskRef = ref(null);
const tabAct = ref(0); const tabAct = ref(0);
@@ -9,7 +9,7 @@
</template> </template>
<script setup> <script setup>
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 15; const limit = 20;
const total = ref(-1); const total = ref(-1);
const page = ref(0); const page = ref(0);
const data_list = reactive([]); const data_list = reactive([]);
-1
View File
@@ -180,7 +180,6 @@
common.navigateTo('/pages/courseDetail/index?crsId=' + item.crsId); common.navigateTo('/pages/courseDetail/index?crsId=' + item.crsId);
}; };
const collect_click = async (id) => { const collect_click = async (id) => {
console.log('学习', id);
try { try {
if (!id) { if (!id) {
common.loading('收藏中'); common.loading('收藏中');
+1 -2
View File
@@ -44,10 +44,9 @@
<script setup> <script setup>
import { LineBg } from '@/enum.js'; import { LineBg } from '@/enum.js';
import content from './components/content.vue'; import content from './components/content.vue';
import { reactive, ref, computed, nextTick, onMounted, watch } from 'vue'; import { ref, onMounted, watch } from 'vue';
import common from '@/common/common.js'; import common from '@/common/common.js';
const listItemRefs = ref([]); const listItemRefs = ref([]);
const taskRef = ref(null);
const tabAct = ref(0); const tabAct = ref(0);
const tabList = ref([ const tabList = ref([
{ {
+1 -1
View File
@@ -98,7 +98,7 @@
]; ];
const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 15; const limit = 20;
const total = ref(-1); const total = ref(-1);
const page = ref(0); const page = ref(0);
const data_list = reactive([]); const data_list = reactive([]);
-1
View File
@@ -152,7 +152,6 @@
const isLastTopic = computed( const isLastTopic = computed(
() => topicList.length === finishCurrent.value + 1 && finishCurrent.value === questionNumber.value () => topicList.length === finishCurrent.value + 1 && finishCurrent.value === questionNumber.value
); );
const transition = (event) => { const transition = (event) => {
if (isTriggered.value) return; if (isTriggered.value) return;
const dx = event.detail.dx; const dx = event.detail.dx;
@@ -20,7 +20,7 @@
</template> </template>
<script setup> <script setup>
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 15; const limit = 20;
const total = ref(-1); const total = ref(-1);
const page = ref(0); const page = ref(0);
import common from '@/common/common'; import common from '@/common/common';
-9
View File
@@ -34,20 +34,11 @@
import PreviewAiSparring from './components/previewAiSparring.vue' import PreviewAiSparring from './components/previewAiSparring.vue'
import PreviewCourse from './components/previewCourse.vue' import PreviewCourse from './components/previewCourse.vue'
import { import {
reactive,
ref, ref,
computed,
nextTick,
onMounted, onMounted,
watch watch
} from 'vue'; } from 'vue';
import {
queryTraCrsBbsInfoByCrsId,
replyTraCrsBbsInfo,
qryChildTraCrsBbsInfo
} from '@/api/courseDetail.js';
import common from '@/common/common'; import common from '@/common/common';
const statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
import { import {
LineBg LineBg
} from '@/enum.js' } from '@/enum.js'
+2 -3
View File
@@ -102,7 +102,6 @@
label: "否", label: "否",
} }
] // 性别 ] // 性别
const base_url = get_base_url()
// 去选择百禄 // 去选择百禄
const gotoMascot = () => { const gotoMascot = () => {
@@ -137,7 +136,7 @@
} }
// 显示性别的计算属性 // 显示性别的计算属性
const showGenderText = computed(() => { const showGenderText = computed(() => {
const item = sexOptions.find((item) => item.value == userInfo.value.gender) const item = sexOptions.find((item) => item.value === userInfo.value.gender)
if (item) { if (item) {
return item.label return item.label
} else { } else {
@@ -147,7 +146,7 @@
// 显示是否匿名的计算属性 // 显示是否匿名的计算属性
const showAnonymousText = computed(() => { const showAnonymousText = computed(() => {
const item = anonymousOptions.find((item) => item.value == userInfo.value?.anonymous) const item = anonymousOptions.find((item) => item.value === userInfo.value?.anonymous)
if (item) { if (item) {
return item.label return item.label
} else { } else {
+5 -17
View File
@@ -17,19 +17,14 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, nextTick, onMounted } from 'vue'; import { ref, reactive} from 'vue';
import { queryTraExamPapersPage } from '@/api/testingHall.js'; import { queryTraExamPapersPage } from '@/api/testingHall.js';
import { queryTraCrsBbsInfoByCrsId } from '@/api/courseDetail.js';
import itemVue from './content-item.vue'; import itemVue from './content-item.vue';
const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 20; const limit = 20;
const total = ref(-1); const total = ref(-1);
const page = ref(0); const page = ref(0);
const data_list = reactive([]); const data_list = reactive([]);
const triggered = ref(false);
const _freshing = ref(false);
const offset = ref(0);
const scrollRef = ref(null); const scrollRef = ref(null);
const props = defineProps({ const props = defineProps({
index: { index: {
@@ -37,16 +32,9 @@
default: 0 default: 0
} }
}); });
const onRefresh = () => {
if (_freshing.value) return;
_freshing.value = true;
setTimeout(() => {
triggered.value = false;
_freshing.value = false;
}, 1000);
};
const getData = (from = '', searchText = '') => { const getData = (from = '', searchText = '') => {
if (from == 'first') { if (from === 'first') {
if (total.value !== -1) return; if (total.value !== -1) return;
status.value = 'loading'; status.value = 'loading';
total.value = -1; total.value = -1;
@@ -64,9 +52,9 @@
page: page.value, page: page.value,
limit: limit limit: limit
}; };
if (props.index == 1) { if (props.index === 1) {
params.examStat = 'Y'; params.examStat = 'Y';
} else if (props.index == 2) { } else if (props.index === 2) {
params.examStat = 'N'; params.examStat = 'N';
} }
queryTraExamPapersPage(params) queryTraExamPapersPage(params)
-1
View File
@@ -120,7 +120,6 @@
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import { reactive, computed } from 'vue'; import { reactive, computed } from 'vue';
import { startTraExamPapersInfo } from '@/api/examination.js'; import { startTraExamPapersInfo } from '@/api/examination.js';
import common from '@/common/common'; import common from '@/common/common';
import { setPageCache, getPageCache } from '@/common/common'; import { setPageCache, getPageCache } from '@/common/common';
const detailData = reactive({ const detailData = reactive({
-8
View File
@@ -65,13 +65,6 @@
}]); }]);
const contentRefs = ref([]) const contentRefs = ref([])
const status = ref('loadmore') // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 20;
const total = ref(-1)
const page = ref(0)
const data_list = reactive([])
const triggered = ref(false) const triggered = ref(false)
const tabChange = (item) => { const tabChange = (item) => {
tabAct.value = item.index; tabAct.value = item.index;
@@ -80,7 +73,6 @@
tabAct.value = item.detail.current; tabAct.value = item.detail.current;
}; };
const search = (value) => { const search = (value) => {
console.log('value', value);
contentRefs.value[tabAct.value]?.search(value); contentRefs.value[tabAct.value]?.search(value);
} }
const gotoDetails = (item) => { const gotoDetails = (item) => {
+1 -1
View File
@@ -40,7 +40,7 @@ const animationfinish = () => {
indexNowNow.value = indexNow.value indexNowNow.value = indexNow.value
} }
const swiperTransition = (e) => { const swiperTransition = (e) => {
if (e.dx > 30 && indexNowNow.value == 2) { if (e.dx > 30 && indexNowNow.value === 2) {
common.navigateBack() common.navigateBack()
} }
} }
+4 -7
View File
@@ -79,19 +79,17 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, computed, onMounted, nextTick, onUnmounted } from 'vue'; import { ref, reactive, computed, nextTick} from 'vue';
import { onLoad, onHide, onShow, onUnload } from '@dcloudio/uni-app'; import { onLoad, onHide, onShow, onUnload } from '@dcloudio/uni-app';
import Feedback from '@/pages/examination/components/feedback.vue'; import Feedback from '@/pages/examination/components/feedback.vue';
import Dialog from '@/pages/examination/components/dialog.vue'; import Dialog from '@/pages/examination/components/dialog.vue';
import Subject from '@/components/examination/subject.vue'; import Subject from '@/components/examination/subject.vue';
import CharactersSubject from '@/components/examination/characters-subject.vue';
import TouchBtn from '@/components/examination/touchBtn.vue'; import TouchBtn from '@/components/examination/touchBtn.vue';
import common from '@/common/common'; import common from '@/common/common';
import { setPageCache, getPageCache, setupKeyboardHeightListener } from '@/common/common'; import {getPageCache, setupKeyboardHeightListener } from '@/common/common';
import { commonUploadVoiceFile } from '@/api/common.js'; import { commonUploadVoiceFile } from '@/api/common.js';
import { optionErrorIcon, examinationSheetIcon, practiceExitIcon } from '@/common/imgSvg'; import {practiceExitIcon } from '@/common/imgSvg';
import { practiceAnswer, practiceCommit, queryCrsPracticeAnswerResult } from '@/api/practice.js'; import {practiceCommit, queryCrsPracticeAnswerResult } from '@/api/practice.js';
import { queryMistakesAnswerByMisId, mistakesCorrect } from '@/api/wrongQuestionRecord.js'; import { queryMistakesAnswerByMisId, mistakesCorrect } from '@/api/wrongQuestionRecord.js';
const feedbackRef = ref(null); const feedbackRef = ref(null);
@@ -109,7 +107,6 @@
const questionNumber = ref(0); // 题号 const questionNumber = ref(0); // 题号
// 根据课程ID获取课程的题目 undefined为没有, 00为加载中, 02为加载失败 // 根据课程ID获取课程的题目 undefined为没有, 00为加载中, 02为加载失败
const topic = computed({ const topic = computed({
get: () => topicList[questionNumber.value], get: () => topicList[questionNumber.value],
set: (val) => (topicList[questionNumber.value] = val) set: (val) => (topicList[questionNumber.value] = val)
+1 -2
View File
@@ -58,14 +58,13 @@
// 我的收藏 // 我的收藏
import { reactive, ref, computed, nextTick, onMounted, watch } from 'vue'; import { reactive, ref, computed, nextTick, onMounted, watch } from 'vue';
import { LineBg } from '@/enum.js'; import { LineBg } from '@/enum.js';
import { queryMistakesAnswerByMisId, queryTraMistakesCollection } from '@/api/wrongQuestionRecord.js'; import { queryTraMistakesCollection } from '@/api/wrongQuestionRecord.js';
import common from '@/common/common'; import common from '@/common/common';
import { setPageCache } from '@/common/common'; import { setPageCache } from '@/common/common';
const customStyle = { const customStyle = {
borderRadius: '16rpx' borderRadius: '16rpx'
}; };
const statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
const courseRef = ref(null); const courseRef = ref(null);
const correctRef = ref(null); const correctRef = ref(null);