mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-student.git
synced 2025-12-13 04:46:48 +08:00
feat:增加帖子列表收藏点赞
This commit is contained in:
@@ -90,7 +90,7 @@
|
|||||||
<span
|
<span
|
||||||
class="iconfont icon-shoucang"
|
class="iconfont icon-shoucang"
|
||||||
:style="{
|
:style="{
|
||||||
color: d.collected ? 'red' : '#b3bdc4',
|
color: d.collectionInfo ? 'red' : '#b3bdc4',
|
||||||
marginLeft: '19px',
|
marginLeft: '19px',
|
||||||
}"
|
}"
|
||||||
></span>
|
></span>
|
||||||
@@ -199,7 +199,8 @@ const state = reactive({
|
|||||||
|
|
||||||
postList: [], //帖子列表
|
postList: [], //帖子列表
|
||||||
total:0, // 帖子总条数
|
total:0, // 帖子总条数
|
||||||
currentPage: 1
|
currentPage: 1,
|
||||||
|
content: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -249,7 +250,8 @@ function getPostList(discussId) {
|
|||||||
console.log('获取帖子参数', {
|
console.log('获取帖子参数', {
|
||||||
"discussId": discussId,
|
"discussId": discussId,
|
||||||
"pageNo": state.pageNo,
|
"pageNo": state.pageNo,
|
||||||
"pageSize": state.pageSize
|
"pageSize": state.pageSize,
|
||||||
|
"content": 1
|
||||||
})
|
})
|
||||||
|
|
||||||
request(
|
request(
|
||||||
@@ -269,6 +271,7 @@ function getPostList(discussId) {
|
|||||||
|
|
||||||
// 最新
|
// 最新
|
||||||
function nowPost(discussId) {
|
function nowPost(discussId) {
|
||||||
|
state.content = 1;
|
||||||
state.searchType = 1;
|
state.searchType = 1;
|
||||||
state.pageNo = 1;
|
state.pageNo = 1;
|
||||||
state.currentPage = 1;
|
state.currentPage = 1;
|
||||||
@@ -276,6 +279,7 @@ function nowPost(discussId) {
|
|||||||
}
|
}
|
||||||
// 最热
|
// 最热
|
||||||
function hotPost(discussId) {
|
function hotPost(discussId) {
|
||||||
|
state.content = 2;
|
||||||
state.searchType = 2;
|
state.searchType = 2;
|
||||||
state.pageNo = 1;
|
state.pageNo = 1;
|
||||||
state.currentPage = 1;
|
state.currentPage = 1;
|
||||||
@@ -296,10 +300,10 @@ function comment({ discussId: id, id: postID }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function like(d) {
|
function like(d) {
|
||||||
d.praised ? ((d.praiseNum) -= 1) : (d.praiseNum += 1);
|
d.praised ? ((d.praiseNum) -= 1) : ((d.praiseNum) += 1);
|
||||||
d.praised = !d.praised;
|
d.praised = !d.praised;
|
||||||
console.log('我是点赞传递的参数', { targetId: d.discussId, type: 2 })
|
console.log('我是点赞传递的参数', { targetId: d.id, type: 2 })
|
||||||
request(PostPraise, { targetId: d.discussId, type: 2 }).then(res=>{
|
request(PostPraise, { targetId: d.id, type: 2 }).then(res=>{
|
||||||
console.log('我是点赞的操作',res)
|
console.log('我是点赞的操作',res)
|
||||||
}).catch(err=>{
|
}).catch(err=>{
|
||||||
console.log(err)
|
console.log(err)
|
||||||
@@ -307,10 +311,10 @@ function like(d) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function collection(d) {
|
function collection(d) {
|
||||||
d.collected ? (d.collectionNum -= 1) : (d.collectionNum += 1);
|
d.collectionInfo ? ((d.collectionNum) -= 1) : ((d.collectionNum) += 1);
|
||||||
d.collected = !d.collected;
|
d.collectionInfo = !d.collectionInfo;
|
||||||
console.log('我是收藏传递的参数', { targetId: d.discussId, type: 2 })
|
console.log('我是收藏传递的参数', { targetId: d.id, type: 2 })
|
||||||
request(PostCollection, { targetId: d.discussId, type: 2 }).then(res=>{
|
request(PostCollection, { targetId: d.id, type: 2 }).then(res=>{
|
||||||
console.log('我是收藏的操作',res)
|
console.log('我是收藏的操作',res)
|
||||||
}).catch(err=>{
|
}).catch(err=>{
|
||||||
console.log(err)
|
console.log(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user