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 (val2) { if(this.likeBtn){
this.http.request('/worksGreat/delGreat?type=1&workId=' + val1, "POST").then(res => { this.likeBtn = false
if (res.code == 200) { if (val2) {
this.pages = 1 this.http.request('/worksGreat/delGreat?type=1&workId=' + val1, "POST").then(res => {
this.getData() if (res.code == 200) {
} this.workList[num].isGreat = false
}).catch(e => { this.workList[num].likes--
uni.showToast({ this.load = false
title: e.data.message, this.likeBtn = true
icon: "none", }
}); }).catch(e => {
}) uni.showToast({
} else { title: e.data.message,
this.http.request('/worksGreat/addGreat?type=1&workId=' + val1, "POST").then(res => { icon: "none",
if (res.code == 200) { });
this.pages = 1 this.likeBtn = true
this.getData() })
} } else {
}).catch(e => { this.http.request('/worksGreat/addGreat?type=1&workId=' + val1, "POST").then(res => {
uni.showToast({ if (res.code == 200) {
title: e.data.message, this.workList[num].isGreat = true
icon: "none", this.workList[num].likes++
}); this.load = false
}) this.likeBtn = true
}
}).catch(e => {
uni.showToast({
title: e.data.message,
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 (val2) { if (this.likeBtn) {
this.workList[num].isGreat = false this.likeBtn = false
this.http.request('/worksGreat/delGreat?type=1&workId=' + val1, "POST").then(res => { if (val2) {
if (res.code == 200) { this.http.request('/worksGreat/delGreat?type=1&workId=' + val1, "POST").then(res => {
this.workList[num].likes-- if (res.code == 200) {
this.load = false this.workList[num].isGreat = false
} this.workList[num].likes--
}).catch(e => { this.load = false
uni.showToast({ this.likeBtn = true
title: e.data.message,
icon: "none", }
}); }).catch(e => {
}) uni.showToast({
} else { title: e.data.message,
this.workList[num].isGreat = true icon: "none",
this.http.request('/worksGreat/addGreat?type=1&workId=' + val1, "POST").then(res => { });
if (res.code == 200) { this.likeBtn = true
this.workList[num].likes++
this.load = false })
} } else {
}).catch(e => { this.http.request('/worksGreat/addGreat?type=1&workId=' + val1, "POST").then(res => {
uni.showToast({ if (res.code == 200) {
title: e.data.message, this.workList[num].isGreat = true
icon: "none", this.workList[num].likes++
}); this.load = false
}) this.likeBtn = true
}
}).catch(e => {
uni.showToast({
title: e.data.message,
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,55 +242,67 @@
}, },
// //
clickHeart() { clickHeart() {
if (this.detailData.isGreat) { if(this.likeBtn){
this.http.request('/worksGreat/delGreat?type=1&workId=' + this.detailData.id, "POST").then(res => { this.likeBtn = false
if (res.code == 200) { if (this.detailData.isGreat) {
this.getData() this.http.request('/worksGreat/delGreat?type=1&workId=' + this.detailData.id, "POST").then(res => {
} if (res.code == 200) {
}).catch(e => { this.getData()
uni.showToast({ }
title: e.data.message, }).catch(e => {
icon: "none", uni.showToast({
}); title: e.data.message,
}) icon: "none",
} else { });
this.http.request('/worksGreat/addGreat?type=1&workId=' + this.detailData.id, "POST").then(res => { this.likeBtn = true
if (res.code == 200) { })
this.getData() } else {
} this.http.request('/worksGreat/addGreat?type=1&workId=' + this.detailData.id, "POST").then(res => {
}).catch(e => { if (res.code == 200) {
uni.showToast({ this.getData()
title: e.data.message, }
icon: "none", }).catch(e => {
}); uni.showToast({
}) title: e.data.message,
icon: "none",
});
this.likeBtn = true
})
}
} }
}, },
// //
clickStar() { clickStar() {
if (this.detailData.isColl) { if(this.colBtn){
this.http.request('/worksCollection/delCollection?workId=' + this.detailData.id, "POST").then(res => { this.colBtn = false
if (res.code == 200) { if (this.detailData.isColl) {
this.getData() this.http.request('/worksCollection/delCollection?workId=' + this.detailData.id, "POST").then(res => {
} if (res.code == 200) {
}).catch(e => { this.getData()
uni.showToast({ }
title: e.data.message, }).catch(e => {
icon: "none", uni.showToast({
}); title: e.data.message,
}) icon: "none",
} else { });
this.http.request('/worksCollection/addCollection?workId=' + this.detailData.id, "POST").then(res => { this.colBtn = true
if (res.code == 200) { })
this.getData() } else {
} this.http.request('/worksCollection/addCollection?workId=' + this.detailData.id, "POST").then(res => {
}).catch(e => { if (res.code == 200) {
uni.showToast({ this.getData()
title: e.data.message, }
icon: "none", }).catch(e => {
}); uni.showToast({
}) title: e.data.message,
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,31 +335,37 @@
}, },
// //
ClickStart() { ClickStart() {
if (this.serveList.follow) { if(this.colBtn){
this.http.request('/worksCollection/delCollection?workId=' + this.serveList.domainInfo.id, "POST") this.colBtn = false
.then(res => { if (this.serveList.follow) {
if (res.code == 200) { this.http.request('/worksCollection/delCollection?workId=' + this.serveList.domainInfo.id, "POST")
this.getData() .then(res => {
} if (res.code == 200) {
}).catch(e => { this.getData()
uni.showToast({ }
title: e.data.message, }).catch(e => {
icon: "none", uni.showToast({
}); title: e.data.message,
}) icon: "none",
} else { });
this.http.request('/worksCollection/addCollection?workId=' + this.serveList.domainInfo.id, "POST") this.colBtn = true
.then(res => { })
if (res.code == 200) { } else {
this.getData() this.http.request('/worksCollection/addCollection?workId=' + this.serveList.domainInfo.id, "POST")
} .then(res => {
}).catch(e => { if (res.code == 200) {
uni.showToast({ this.getData()
title: e.data.message, }
icon: "none", }).catch(e => {
}); uni.showToast({
}) title: e.data.message,
icon: "none",
});
this.colBtn = true
})
}
} }
}, },
// //
goAllPingjia() { goAllPingjia() {