2025-10-10
项目收藏
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
<u-navbar :is-fixed="false" title="项目详情" :background="{background: 'transparent' }" :border-bottom="false"
|
||||
back-icon-color="#fff" title-color="#fff">
|
||||
<template v-slot:right>
|
||||
<image class="collection" src="/static/icon/Bookmark.png" mode=""></image>
|
||||
<image @click="handleCollect" class="collection"
|
||||
:src="isCollect?'/static/icon/Bookmark-active.png':'/static/icon/Bookmark.png'" mode=""></image>
|
||||
</template>
|
||||
</u-navbar>
|
||||
|
||||
@@ -101,6 +102,8 @@
|
||||
<u-col span="3"><u-button class="btn" type="success" @click="handleOpen">立刻融</u-button></u-col>
|
||||
</u-row>
|
||||
|
||||
<u-link class="change-next" @click="handleChange">不感兴趣?换一个</u-link>
|
||||
|
||||
|
||||
<u-modal v-model="showWarning" border-radius="20" ref="warningRef" :mask-close-able="true"
|
||||
:show-confirm-button="false" :show-title="false">
|
||||
@@ -174,7 +177,7 @@
|
||||
import { programAPI } from '../../api/program';
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { groupAPI } from '../../api/group';
|
||||
|
||||
|
||||
const pdMsgRef = ref()
|
||||
|
||||
const userId = ref()
|
||||
@@ -193,6 +196,64 @@
|
||||
createDate: '',
|
||||
user: {}
|
||||
})
|
||||
const isCollect = ref(false)
|
||||
|
||||
// 是否收藏项目
|
||||
const isCollectMethod = () => {
|
||||
let params = {
|
||||
programId: programId.value,
|
||||
userId: userId.value
|
||||
}
|
||||
programAPI.isCollect(params).then(res => {
|
||||
if (res.code == 200) {
|
||||
isCollect.value = res.data.isCollect
|
||||
} else {
|
||||
pdMsgRef.value.show({
|
||||
title: res.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 收藏项目
|
||||
const handleCollect = () => {
|
||||
let data = {
|
||||
programId: programId.value,
|
||||
userId: userId.value
|
||||
}
|
||||
if (isCollect.value) {
|
||||
programAPI.unCollect(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
isCollect.value = false
|
||||
pdMsgRef.value.show({
|
||||
title: "取消收藏",
|
||||
type: 'success'
|
||||
})
|
||||
} else {
|
||||
pdMsgRef.value.show({
|
||||
title: res.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
programAPI.collect(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
isCollect.value = true
|
||||
pdMsgRef.value.show({
|
||||
title: "收藏成功",
|
||||
type: 'success'
|
||||
})
|
||||
} else {
|
||||
pdMsgRef.value.show({
|
||||
title: res.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const loadData = () => {
|
||||
programAPI.isChat({
|
||||
@@ -215,14 +276,15 @@
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
isCollectMethod()
|
||||
loadData()
|
||||
})
|
||||
|
||||
const handleChat = () => {
|
||||
if (isChat.value) {
|
||||
// 继续聊
|
||||
groupAPI.getOne({programId: programId.value, userId: userId.value}).then(res=>{
|
||||
if(res.code==200){
|
||||
groupAPI.getOne({ programId: programId.value, userId: userId.value }).then(res => {
|
||||
if (res.code == 200) {
|
||||
// 进入聊天
|
||||
uni.redirectTo({
|
||||
url: '/pages/message/chat?groupId=' + res.data.groupId
|
||||
@@ -232,13 +294,12 @@
|
||||
} else {
|
||||
// 开启群组聊天
|
||||
groupAPI.add({ programId: programId.value, userId: userId.value }).then(res => {
|
||||
console.log(res);
|
||||
if(res.code==200){
|
||||
if (res.code == 200) {
|
||||
// 创建成功,进入聊天
|
||||
uni.redirectTo({
|
||||
url: '/pages/message/chat?groupId=' + res.data.groupId
|
||||
})
|
||||
}else{
|
||||
} else {
|
||||
pdMsgRef.value.show({
|
||||
title: res.msg,
|
||||
type: 'error'
|
||||
@@ -271,7 +332,6 @@
|
||||
// 立刻融 确认选择
|
||||
const handleChose = () => {
|
||||
if (!is_agree.value) {
|
||||
console.log("change");
|
||||
showErrMsg.value = true
|
||||
return
|
||||
}
|
||||
@@ -299,6 +359,27 @@
|
||||
showFile.value = false
|
||||
showWarning.value = true
|
||||
}
|
||||
|
||||
// 不感兴趣,换一个
|
||||
const handleChange = () => {
|
||||
const params = {
|
||||
userId: userId.value,
|
||||
programId: programId.value
|
||||
}
|
||||
programAPI.randomNext(params).then(res => {
|
||||
if (res.code == 200) {
|
||||
const nextPid = res.data.id
|
||||
uni.redirectTo({
|
||||
url: '/pages/program/programDetail?programId=' + nextPid
|
||||
})
|
||||
} else {
|
||||
pdMsgRef.value.show({
|
||||
title: res.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -433,6 +514,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
.change-next {
|
||||
position: absolute;
|
||||
bottom: 0%;
|
||||
left: 0%;
|
||||
right: 0%;
|
||||
text-align: center;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
// 按钮设置
|
||||
.btn-group {
|
||||
font-family: Work Sans;
|
||||
|
||||
Reference in New Issue
Block a user