代码格式优化,去除多余的引入
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, reactive, nextTick } from 'vue';
|
||||
import { computed, ref, reactive } from 'vue';
|
||||
import common from '@/common/common';
|
||||
import { queryCrsExamHisByExamId } from '@/api/courseRecord.js';
|
||||
const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
|
||||
@@ -98,7 +98,6 @@
|
||||
// 跳转到详情
|
||||
const click_list_item = (list_item) => {
|
||||
console.log('list_item', list_item);
|
||||
const examLenTm = 666;
|
||||
const papersName = item.value.examName;
|
||||
|
||||
common.navigateTo(
|
||||
|
||||
@@ -9,17 +9,16 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import itemVue from './examRecordItem.vue';
|
||||
import common from '@/common/common';
|
||||
import { ref, reactive, onMounted, nextTick } from 'vue';
|
||||
import { ref, reactive } from 'vue';
|
||||
import { queryCrsExamRecordPaging } from '@/api/courseRecord.js';
|
||||
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
|
||||
const limit = 15;
|
||||
const limit = 20;
|
||||
const total = ref(-1);
|
||||
const page = ref(0);
|
||||
const data_list = reactive([]);
|
||||
|
||||
const getData = (from = '') => {
|
||||
if (from == 'first') {
|
||||
if (from === 'first') {
|
||||
if (total.value !== -1) {
|
||||
return;
|
||||
}
|
||||
@@ -48,15 +47,8 @@
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
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();
|
||||
};
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, reactive, nextTick } from 'vue';
|
||||
import { computed, ref, reactive } from 'vue';
|
||||
import common from '@/common/common';
|
||||
import { queryPracticeHis } from '@/api/courseRecord.js';
|
||||
const status = ref('loadmore'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
|
||||
|
||||
@@ -9,17 +9,16 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import itemVue from './practiceRecordItem.vue';
|
||||
import common from '@/common/common';
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { ref, reactive } from 'vue';
|
||||
import { queryPracticeRecordPaging } from '@/api/courseRecord.js';
|
||||
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
|
||||
const limit = 15;
|
||||
const limit = 20;
|
||||
const total = ref(-1);
|
||||
const page = ref(0);
|
||||
const data_list = reactive([]);
|
||||
|
||||
const getData = (from = '') => {
|
||||
if (from == 'first') {
|
||||
if (from === 'first') {
|
||||
if (total.value !== -1) {
|
||||
return;
|
||||
}
|
||||
@@ -49,7 +48,7 @@
|
||||
});
|
||||
};
|
||||
|
||||
const scrolltolower = (item) => {
|
||||
const scrolltolower = () => {
|
||||
getData();
|
||||
};
|
||||
|
||||
|
||||
@@ -81,7 +81,6 @@
|
||||
}
|
||||
});
|
||||
const secondsToHours = (seconds) => {
|
||||
console.log('typeof seconds', typeof seconds);
|
||||
if (typeof seconds === 'number') {
|
||||
// 转换为小时并保留一位小数
|
||||
return (seconds / 3600).toFixed(1);
|
||||
|
||||
@@ -9,17 +9,16 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import itemVue from './studyRecordItem.vue';
|
||||
import common from '@/common/common';
|
||||
import { ref, reactive, onMounted, nextTick } from 'vue';
|
||||
import { ref, reactive} from 'vue';
|
||||
import { queryStdyRecordPaging } from '@/api/courseRecord.js';
|
||||
const status = ref('loading'); // loadmore - 加载前,loading - 加载中,nomore - 没有数据
|
||||
const limit = 15;
|
||||
const limit = 20;
|
||||
const total = ref(-1);
|
||||
const page = ref(0);
|
||||
const data_list = reactive([]);
|
||||
|
||||
const getData = (from = '') => {
|
||||
if (from == 'first') {
|
||||
if (from === 'first') {
|
||||
if (total.value !== -1) {
|
||||
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();
|
||||
};
|
||||
|
||||
// 计算两个时间的时间差
|
||||
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({
|
||||
getData
|
||||
});
|
||||
|
||||
@@ -19,15 +19,12 @@
|
||||
|
||||
<script setup>
|
||||
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 common from '@/common/common';
|
||||
import { queryPracticeRecordByExrId } from '@/api/courseRecord.js';
|
||||
|
||||
const exrId = ref('');
|
||||
const pass_status = ref(0);
|
||||
|
||||
const topicList = reactive([]);
|
||||
|
||||
const get_result = () => {
|
||||
|
||||
@@ -45,11 +45,9 @@
|
||||
import studyRecordList from './components/studyRecordList.vue';
|
||||
import practiceRecordList from './components/practiceRecordList.vue';
|
||||
import examRecordList from './components/examRecordList.vue';
|
||||
|
||||
import { reactive, ref, computed, nextTick, onMounted, watch } from 'vue';
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import common from '@/common/common.js';
|
||||
const listItemRefs = ref([]);
|
||||
const taskRef = ref(null);
|
||||
const tabAct = ref(0);
|
||||
const tabList = ref([
|
||||
{
|
||||
@@ -69,14 +67,10 @@
|
||||
const swiperChange = (item) => {
|
||||
tabAct.value = item.detail.current;
|
||||
};
|
||||
const search = (value) => {
|
||||
listItemRefs.value[tabAct.value]?.search(value);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
watch(
|
||||
tabAct,
|
||||
(newValue, oldValue) => {
|
||||
(newValue) => {
|
||||
typeof listItemRefs.value[newValue]?.getData === 'function' &&
|
||||
listItemRefs.value[newValue]?.getData('first');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user