|
@@ -157,6 +157,7 @@
|
|
|
<script>
|
|
|
//这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
|
|
//例如:import 《组件名称》from ‘《组件路径》';
|
|
|
+import axios from "axios";
|
|
|
import Header from "../../components/Header.vue";
|
|
|
import BookCard from "@/components/common/BookCard.vue";
|
|
|
import BookPeruseCard from "@/components/common/BookPeruseCard.vue";
|
|
@@ -252,6 +253,8 @@ export default {
|
|
|
loginFlag: false,
|
|
|
toUrl: "",
|
|
|
stopLoad: false,
|
|
|
+ cancelToken: null,
|
|
|
+ source: axios.CancelToken.source(),
|
|
|
};
|
|
|
},
|
|
|
//计算属性 类似于data概念
|
|
@@ -299,7 +302,7 @@ export default {
|
|
|
this.typeValue = null;
|
|
|
this.BookList = [];
|
|
|
}
|
|
|
-
|
|
|
+ this.source.cancel("Operation canceled by the user.");
|
|
|
$(".list").animate(
|
|
|
{
|
|
|
scrollTop: 0,
|
|
@@ -372,6 +375,7 @@ export default {
|
|
|
},
|
|
|
// 查询列表
|
|
|
async getList() {
|
|
|
+ this.cancelToken = this.source.token;
|
|
|
this.loading = true;
|
|
|
let MethodName = "/ShopServer/Client/BookshelfQuery/PageQueryMyGoodsList";
|
|
|
let order_column_list = [];
|
|
@@ -392,7 +396,7 @@ export default {
|
|
|
cur_page: this.pageNumber,
|
|
|
order_column_list: order_column_list,
|
|
|
};
|
|
|
- await getLogin(MethodName, data)
|
|
|
+ await getLogin(MethodName, data, { cancelToken: this.source.token })
|
|
|
.then((res) => {
|
|
|
this.loading = false;
|
|
|
if (res.status === 1) {
|
|
@@ -405,7 +409,7 @@ export default {
|
|
|
res.goods_list.length > 0)
|
|
|
) {
|
|
|
if (res.cur_page === 1) {
|
|
|
- this.BookList = [];
|
|
|
+ // this.BookList = [];
|
|
|
if (this.typeValue === -1 || this.typeValue === 3) {
|
|
|
getLogin(
|
|
|
"/ShopServer/Client/BookshelfQuery/GetMyValidPeriodList_Iread",
|
|
@@ -436,12 +440,17 @@ export default {
|
|
|
this.noMore = true;
|
|
|
}
|
|
|
} else {
|
|
|
- this.BookList = [];
|
|
|
+ // this.BookList = [];
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- .catch(() => {
|
|
|
+ .catch((error) => {
|
|
|
this.loading = false;
|
|
|
+ if (axios.isCancel(error)) {
|
|
|
+ console.log("Request canceled", error.message);
|
|
|
+ } else {
|
|
|
+ console.error("Error occurred:", error);
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
load() {
|