This commit is contained in:
lnn19986213 2024-05-15 16:17:48 +08:00
parent 50dc1510fa
commit dfeb3f467e
4 changed files with 170 additions and 122 deletions

View File

@ -36,7 +36,7 @@
<view class="art_item" v-for="(v, i) in workList" :key="i"> <view class="art_item" v-for="(v, i) in workList" :key="i">
<view class="art_item_top"> <view class="art_item_top">
<image :src="v.file" mode="" @click="toDetail(v.id,v.goodsId)"></image> <image :src="v.file" mode="" @click="toDetail(v.id,v.goodsId)"></image>
<view class="like" @click="like(v.id, v.isGreat)"> <view class="like" @click="like(v.id, v.isGreat,i)">
<view :class="v.isGreat ? 'img_selected' : 'img'"> <view :class="v.isGreat ? 'img_selected' : 'img'">
<!-- 红心 --> <!-- 红心 -->
</view> </view>
@ -86,6 +86,7 @@
pages: 1, pages: 1,
size: 20, size: 20,
lineBg: '../../static/scrollLine.png', lineBg: '../../static/scrollLine.png',
likeBtn: true,
}; };
}, },
onLoad(option) { onLoad(option) {
@ -189,32 +190,42 @@
}) })
}, },
// //
like(val1, val2) { like(val1, val2, num) {
if(this.likeBtn){
this.likeBtn = false
if (val2) { if (val2) {
this.http.request('/worksGreat/delGreat?type=1&workId=' + val1, "POST").then(res => { this.http.request('/worksGreat/delGreat?type=1&workId=' + val1, "POST").then(res => {
if (res.code == 200) { if (res.code == 200) {
this.pages = 1 this.workList[num].isGreat = false
this.getData() this.workList[num].likes--
this.load = false
this.likeBtn = true
} }
}).catch(e => { }).catch(e => {
uni.showToast({ uni.showToast({
title: e.data.message, title: e.data.message,
icon: "none", icon: "none",
}); });
this.likeBtn = true
}) })
} else { } else {
this.http.request('/worksGreat/addGreat?type=1&workId=' + val1, "POST").then(res => { this.http.request('/worksGreat/addGreat?type=1&workId=' + val1, "POST").then(res => {
if (res.code == 200) { if (res.code == 200) {
this.pages = 1 this.workList[num].isGreat = true
this.getData() this.workList[num].likes++
this.load = false
this.likeBtn = true
} }
}).catch(e => { }).catch(e => {
uni.showToast({ uni.showToast({
title: e.data.message, title: e.data.message,
icon: "none", icon: "none",
}); });
this.likeBtn = true
}) })
} }
}
}, },
// //
toDetail(val1,val2){ toDetail(val1,val2){

View File

@ -136,7 +136,8 @@
scrollTop: 0, scrollTop: 0,
old: { old: {
scrollTop: 0 scrollTop: 0
} },
likeBtn: true,
}; };
}, },
onReady() { onReady() {
@ -330,33 +331,45 @@
}, },
// //
like(val1, val2, num) { like(val1, val2, num) {
if (this.likeBtn) {
this.likeBtn = false
if (val2) { if (val2) {
this.workList[num].isGreat = false
this.http.request('/worksGreat/delGreat?type=1&workId=' + val1, "POST").then(res => { this.http.request('/worksGreat/delGreat?type=1&workId=' + val1, "POST").then(res => {
if (res.code == 200) { if (res.code == 200) {
this.workList[num].isGreat = false
this.workList[num].likes-- this.workList[num].likes--
this.load = false this.load = false
this.likeBtn = true
} }
}).catch(e => { }).catch(e => {
uni.showToast({ uni.showToast({
title: e.data.message, title: e.data.message,
icon: "none", icon: "none",
}); });
this.likeBtn = true
}) })
} else { } else {
this.workList[num].isGreat = true
this.http.request('/worksGreat/addGreat?type=1&workId=' + val1, "POST").then(res => { this.http.request('/worksGreat/addGreat?type=1&workId=' + val1, "POST").then(res => {
if (res.code == 200) { if (res.code == 200) {
this.workList[num].isGreat = true
this.workList[num].likes++ this.workList[num].likes++
this.load = false this.load = false
this.likeBtn = true
} }
}).catch(e => { }).catch(e => {
uni.showToast({ uni.showToast({
title: e.data.message, title: e.data.message,
icon: "none", icon: "none",
}); });
this.likeBtn = true
}) })
} }
}
}, },
// //
toDetail(val, num) { toDetail(val, num) {

View File

@ -146,7 +146,9 @@
contractUrl: '', contractUrl: '',
isFollow: '', isFollow: '',
userId: '', userId: '',
cover: '' cover: '',
likeBtn: true,
colBtn: true
} }
}, },
onLoad(op) { onLoad(op) {
@ -228,6 +230,8 @@
this.userId = this.detailData.user.id this.userId = this.detailData.user.id
} }
_this.load = false _this.load = false
this.likeBtn = true
this.colBtn = true
} }
}).catch(e => { }).catch(e => {
uni.showToast({ uni.showToast({
@ -238,6 +242,8 @@
}, },
// //
clickHeart() { clickHeart() {
if(this.likeBtn){
this.likeBtn = false
if (this.detailData.isGreat) { if (this.detailData.isGreat) {
this.http.request('/worksGreat/delGreat?type=1&workId=' + this.detailData.id, "POST").then(res => { this.http.request('/worksGreat/delGreat?type=1&workId=' + this.detailData.id, "POST").then(res => {
if (res.code == 200) { if (res.code == 200) {
@ -248,6 +254,7 @@
title: e.data.message, title: e.data.message,
icon: "none", icon: "none",
}); });
this.likeBtn = true
}) })
} else { } else {
this.http.request('/worksGreat/addGreat?type=1&workId=' + this.detailData.id, "POST").then(res => { this.http.request('/worksGreat/addGreat?type=1&workId=' + this.detailData.id, "POST").then(res => {
@ -259,11 +266,16 @@
title: e.data.message, title: e.data.message,
icon: "none", icon: "none",
}); });
this.likeBtn = true
}) })
} }
}
}, },
// //
clickStar() { clickStar() {
if(this.colBtn){
this.colBtn = false
if (this.detailData.isColl) { if (this.detailData.isColl) {
this.http.request('/worksCollection/delCollection?workId=' + this.detailData.id, "POST").then(res => { this.http.request('/worksCollection/delCollection?workId=' + this.detailData.id, "POST").then(res => {
if (res.code == 200) { if (res.code == 200) {
@ -274,6 +286,7 @@
title: e.data.message, title: e.data.message,
icon: "none", icon: "none",
}); });
this.colBtn = true
}) })
} else { } else {
this.http.request('/worksCollection/addCollection?workId=' + this.detailData.id, "POST").then(res => { this.http.request('/worksCollection/addCollection?workId=' + this.detailData.id, "POST").then(res => {
@ -285,8 +298,11 @@
title: e.data.message, title: e.data.message,
icon: "none", icon: "none",
}); });
this.colBtn = true
}) })
} }
}
}, },
toUser(val1,val2,val3,val4){ toUser(val1,val2,val3,val4){
uni.navigateTo({ uni.navigateTo({

View File

@ -237,6 +237,7 @@
shopCarId: '', shopCarId: '',
}], }],
buyType: '', buyType: '',
colBtn: true
} }
}, },
onLoad(option) { onLoad(option) {
@ -292,6 +293,7 @@
this.scores = res.data.scores this.scores = res.data.scores
} }
this.load = false this.load = false
this.colBtn = true
} }
}).catch(e => { }).catch(e => {
uni.showToast({ uni.showToast({
@ -333,6 +335,8 @@
}, },
// //
ClickStart() { ClickStart() {
if(this.colBtn){
this.colBtn = false
if (this.serveList.follow) { if (this.serveList.follow) {
this.http.request('/worksCollection/delCollection?workId=' + this.serveList.domainInfo.id, "POST") this.http.request('/worksCollection/delCollection?workId=' + this.serveList.domainInfo.id, "POST")
.then(res => { .then(res => {
@ -344,6 +348,7 @@
title: e.data.message, title: e.data.message,
icon: "none", icon: "none",
}); });
this.colBtn = true
}) })
} else { } else {
this.http.request('/worksCollection/addCollection?workId=' + this.serveList.domainInfo.id, "POST") this.http.request('/worksCollection/addCollection?workId=' + this.serveList.domainInfo.id, "POST")
@ -356,8 +361,11 @@
title: e.data.message, title: e.data.message,
icon: "none", icon: "none",
}); });
this.colBtn = true
}) })
} }
}
}, },
// //
goAllPingjia() { goAllPingjia() {