|
@@ -155,6 +155,7 @@ import { httpAjax } from "@/plugins/httpAjax"
|
|
|
import queryParams from "@/queryParams"
|
|
|
import scActImg from "./imgs/scAct.png"
|
|
|
import scImg from "./imgs/sc.png"
|
|
|
+import { CODE_ERR_CANCELED } from "@/libs/auth"
|
|
|
|
|
|
const emits = defineEmits<{
|
|
|
(event: "update", id: string, name: string): void
|
|
@@ -307,6 +308,8 @@ function handleQuery() {
|
|
|
queryData.rows = 21
|
|
|
handleGetQuery()
|
|
|
}
|
|
|
+
|
|
|
+let controller: AbortController
|
|
|
function handleGetQuery() {
|
|
|
loading.value = true
|
|
|
let { sourceType, subject, audioPlayTypes, name, page, rows, bookVersionId } = queryData
|
|
@@ -373,7 +376,15 @@ function handleGetQuery() {
|
|
|
audioPlayTypes: audioPlayTypesParams
|
|
|
}
|
|
|
}
|
|
|
- httpAjax(getMaterialQueryPage, params).then(res => {
|
|
|
+ if (controller) {
|
|
|
+ controller.abort()
|
|
|
+ }
|
|
|
+ controller = new AbortController()
|
|
|
+ httpAjax(getMaterialQueryPage, params, controller).then(res => {
|
|
|
+ // 自己关闭的时候不取消加载
|
|
|
+ if (res.code === CODE_ERR_CANCELED) {
|
|
|
+ return
|
|
|
+ }
|
|
|
if (res.code === 200) {
|
|
|
musicList.value = res.data.rows.map((item: any) => {
|
|
|
item.name = highlightedText(item.name, queryData.name)
|