|
@@ -1,6 +1,20 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<van-nav-bar title="收藏" left-arrow @click-left="onClickLeft" />
|
|
|
+ <van-list
|
|
|
+ v-model="loading"
|
|
|
+ :finished="finished"
|
|
|
+ finished-text="没有更多了"
|
|
|
+ @load="onLoad"
|
|
|
+ >
|
|
|
+ <van-cell
|
|
|
+ v-for="(item, index) in favorites"
|
|
|
+ :key="index"
|
|
|
+ :title="item"
|
|
|
+ @click="toMaterialDetail(item)"
|
|
|
+ >
|
|
|
+ </van-cell>
|
|
|
+ </van-list>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -9,14 +23,41 @@ export default {
|
|
|
name: "collection",
|
|
|
components: {},
|
|
|
data() {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ favorites: [],
|
|
|
+ loading: false,
|
|
|
+ finished: false
|
|
|
+ };
|
|
|
},
|
|
|
mounted() {
|
|
|
console.log("--收藏--");
|
|
|
+ this.getFavorites();
|
|
|
},
|
|
|
methods: {
|
|
|
+ getFavorites() {
|
|
|
+ let path = {
|
|
|
+ userName: "testuser-zirKBELIlg"
|
|
|
+ };
|
|
|
+ this.$_http
|
|
|
+ .get(this.$pathParams(this.$_API.JTXT_GET_USER_FAVORITES, path))
|
|
|
+ .then(res => {
|
|
|
+ this.favorites = res.data.materials;
|
|
|
+ console.log("--collection--" + JSON.stringify(this.favorites));
|
|
|
+ this.finished = true;
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$store.commit("toggleLoading", false);
|
|
|
+ });
|
|
|
+ },
|
|
|
onClickLeft() {
|
|
|
this.$router.back();
|
|
|
+ },
|
|
|
+ onLoad() {},
|
|
|
+ toMaterialDetail(item) {
|
|
|
+ this.$router.push({
|
|
|
+ name: "learn-content",
|
|
|
+ params: { materialId: item }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|