coursesucai.vue
3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<template>
<div class="container">
<div class="flextwo sharetopk" @click="back">
<div class="leftrow leftrowkimg">
<img src="../../../assets/leftrow.png" alt />
</div>
<div class="sharemiddle">{{sort_name}}</div>
<div class="sharebtn">
<!-- <img src="../../../assets/sharebtn.png" alt /> -->
</div>
</div>
<div class>
<van-list
class="coursebox courseboxk flexone"
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
>
<div
class="courseboxitem"
v-for="(item, index) in sucailist"
:key="index"
@click="videodetail(item)"
>
<div class="coursenameimg">
<img :src="item.content_image" alt />
<img src="../../../assets/anniu.png" alt class="rediaoplay" />
</div>
<div class="coursetext">
<div class="coursename">{{ item.name }}</div>
<div class="courseteacher">{{ item.tag.name }}</div>
</div>
</div>
</van-list>
</div>
</div>
</template>
<script>
export default {
data() {
return {
sucailist: [],
finished: "",
loading: false,
page: 1,
this_page: "",
total_page: "",
sort_id: '',
sort_name: ''
}
},
created() {
this.sort_id = this.$route.query.sort_id;
document.title = "唐元集公众号";
this.sort_name = this.$route.query.sort_name;
this.getsucai()
},
methods: {
back() {
this.$router.go(-1)
},
getsucai() {
let that = this;
var url = "/api/user/material";
let param = {
keyword: that.keyword,
sort_id: that.sort_id,
page: that.page
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
that.sucailist = that.sucailist.concat(res.data.material);
})
.catch(function (err) {
console.log(err);
});
},
// 素材详情
videodetail(item) {
this.$router.push({
path: "/videosucaidetail",
query: {
id: item.id
}
});
},
// 视频上拉加载
onLoad() {
let that = this;
// 异步更新数据
// setTimeout 仅做示例,真实场景中一般为 ajax 请求
setTimeout(() => {
console.log(3434);
let newpage = that.page;
newpage++;
that.page = newpage;
console.log(that.videopage);
that.getsucai();
// 加载状态结束
this.loading = false;
// 数据全部加载完成
if (that.this_page == that.total_page) {
this.finished = true;
}
}, 1000);
},
}
}
</script>
<style scoped>
@import "../../../style/usercenter.css";
.sucaicourse {
margin-top: 2rem;
}
.courseboxitem {
background: #fff;
}
.searchhead {
padding: 0.2rem 0.32rem 0;
}
.coursenav {
margin-top: 0.32rem;
}
.keywordk {
padding: 0.32rem;
box-sizing: border-box;
margin-top: 0.8rem;
background: #fff;
}
</style>