Explorar el Código

收藏和错题的模式更改2(修复排序问题1)

JXDS18FUJT hace 2 años
padre
commit
192ad5e228
Se han modificado 1 ficheros con 3 adiciones y 3 borrados
  1. 3 3
      src/hooks/exercise/list.ts

+ 3 - 3
src/hooks/exercise/list.ts

@@ -38,7 +38,7 @@ export const useSubjectList = (type: ExerciseType.ListType) => {
 			let localVuex = JSON.parse(window.localStorage.getItem('vuex') || '{}')
 			let userWrongKey = localVuex.userData.openid + "_用户错题id_" + subject;
 			let userWrongIds: { id: number, timestamp: number }[] = JSON.parse(window.localStorage.getItem(userWrongKey) || "[]")
-			userWrongIds.sort((a,b)=>a.timestamp-b.timestamp)
+			userWrongIds.sort((a,b)=>b.timestamp-a.timestamp)
 			let ids = userWrongIds.map(item => {
 				return item.id
 			})
@@ -57,11 +57,11 @@ export const useSubjectList = (type: ExerciseType.ListType) => {
 			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) || "[]")
-			userCollectIds.sort((a,b)=>a.timestamp-b.timestamp)
+			userCollectIds.sort((a,b)=>b.timestamp-a.timestamp)
 			let ids = userCollectIds.map(item => {
 				return item.id
 			})
-			ids.sort((a, b) => a - b)
+		
 			testModel.getBatchList({
 				ids: ids
 			}).then(res => {