|
@@ -42,7 +42,8 @@ export const useSubjectList = (type: ExerciseType.ListType) => {
|
|
|
let ids = userWrongIds.map(item => {
|
|
|
return item.id
|
|
|
})
|
|
|
- const result = testModel.getBatchList({
|
|
|
+ ids.sort((a, b) => a - b)
|
|
|
+ testModel.getBatchList({
|
|
|
ids: ids
|
|
|
}).then(res => {
|
|
|
subjectList.value = res.list;
|
|
@@ -53,42 +54,20 @@ export const useSubjectList = (type: ExerciseType.ListType) => {
|
|
|
// const questionList.value.push(...result.rows)
|
|
|
}
|
|
|
else if (type == "collection") {
|
|
|
- const collectionModel = new CollectionModel(type);
|
|
|
- const result = await collectionModel.getList({
|
|
|
- carType: query.vehicle as CollectionAndWrongType.CarType,
|
|
|
- km: query.name as CollectionAndWrongType.Km,
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 50
|
|
|
- });
|
|
|
- console.log(result.collectionList)
|
|
|
- if (result.rows.length == 0) {
|
|
|
- return
|
|
|
- }
|
|
|
- result.rows.forEach(item => {
|
|
|
- item.isTrue = null
|
|
|
- if (typeof item.opts == "string") {
|
|
|
- item.opts = item.opts.split("-")
|
|
|
- }
|
|
|
- })
|
|
|
- let questionItem: Test.QuestionInfo = result.rows[0]
|
|
|
- let questionIndex = 0
|
|
|
- //排序
|
|
|
- if (query.questionId) {
|
|
|
- result.rows.forEach((item, index) => {
|
|
|
- if (item.id == Number(query.questionId)) {
|
|
|
- questionIndex = index
|
|
|
- questionItem = item
|
|
|
- }
|
|
|
- })
|
|
|
- result.rows.splice(questionIndex, 1)
|
|
|
- result.rows.unshift(questionItem)
|
|
|
-
|
|
|
- }
|
|
|
- res = {
|
|
|
- total: result.total,
|
|
|
- list: result.rows
|
|
|
- }
|
|
|
+ let localVuex = JSON.parse(window.localStorage.getItem('vuex') || '{}')
|
|
|
+ let userCollectKey = localVuex.userData.openid + "_用户收藏id_" + subject;
|
|
|
+ let userCollectIds: { id: number, timestamp: number }[] = JSON.parse(window.localStorage.getItem(userCollectKey) || "[]")
|
|
|
|
|
|
+ let ids = userCollectIds.map(item => {
|
|
|
+ return item.id
|
|
|
+ })
|
|
|
+ ids.sort((a, b) => a - b)
|
|
|
+ testModel.getBatchList({
|
|
|
+ ids: ids
|
|
|
+ }).then(res => {
|
|
|
+ subjectList.value = res.list;
|
|
|
+ subjectTotal.value = res.total;
|
|
|
+ })
|
|
|
}
|
|
|
else {
|
|
|
res = await testModel.getFreeList({
|