2025-10-10

项目收藏
This commit is contained in:
2025-10-10 14:16:01 +08:00
parent 793bf62680
commit f53ec45c51
6 changed files with 153 additions and 35 deletions

View File

@@ -2,7 +2,7 @@ import {
http http
} from "../util/api" } from "../util/api"
const baseURL = "http://192.168.0.15:3007" const baseURL = "http://192.168.0.12:3005/chat"
// 项目相关API // 项目相关API
export const messageAPI = { export const messageAPI = {

View File

@@ -2,14 +2,19 @@ import {
http http
} from "../util/api" } from "../util/api"
const baseURL = "http://192.168.0.15:3006" const baseURL = "http://192.168.0.12:3005/term"
// 项目相关API // 项目相关API
export const programAPI = { export const programAPI = {
// 列表 // 列表
getList: (params) => http.get(baseURL + '/program/list', params), getList: (params) => http.get(baseURL + '/program/list', params),
isChat: (params) => http.get(baseURL + "/program/isChat", params), isChat: (params) => http.get(baseURL + "/program/isChat", params),
getProgram: (id) => http.get(baseURL + "/program/" + id) getProgram: (id) => http.get(baseURL + "/program/" + id),
collect: (data) => http.post(baseURL + '/program/collect', data), // 收藏
unCollect: (data) => http.post(baseURL + '/program/uncollect', data), // 取消收藏
collectList: (params) => http.get(baseURL + '/program/collectList', params), // 收藏列表
isCollect: (params) => http.get(baseURL + '/program/isCollect', params), // 是否收藏
randomNext: (params) => http.get(baseURL + '/program/random',params)
} }
export default { export default {

View File

@@ -4,7 +4,7 @@
<!-- 可滚动的内容区域 --> <!-- 可滚动的内容区域 -->
<view class="content-container"> <view class="content-container">
<view> <view>
<view id="fixedHeadId" style="padding: 32rpx 32rpx 0;"> <view id="fixedHeadId" style="padding: 32rpx 32rpx 0;" class="u-m-b-20">
<view class="head-box1"> <view class="head-box1">
<view class="title"> <view class="title">
容讯聊天室 容讯聊天室
@@ -49,7 +49,8 @@
</view> </view>
</view> </view>
<view class="menu-list"> <!-- 全部/已投资/未读/不感兴趣 -->
<!-- <view class="menu-list">
<view class="menu-item" v-for="(item,index) in menuList" @click="handleMenuChange(index)"> <view class="menu-item" v-for="(item,index) in menuList" @click="handleMenuChange(index)">
<view class="menu-title">{{item.name + '(' + item.count +')'}} <view class="menu-title">{{item.name + '(' + item.count +')'}}
</view> </view>
@@ -57,11 +58,12 @@
:src="currentMenu==index?'/static/icon/Chevron down.png':'/static/icon/Chevron right Menu.png'" :src="currentMenu==index?'/static/icon/Chevron down.png':'/static/icon/Chevron right Menu.png'"
mode=""></image> mode=""></image>
</view> </view>
</view> </view> -->
</view> </view>
<scroll-view scroll-y="true" class="message-list" :style="'height:'+height+'px'"> <scroll-view scroll-y="true" class="message-list" :style="'height:'+height+'px'"
<view class="message-item" v-for="item in messageList"> @scrolltolower="loadData">
<view class="message-item" v-for="(item, index) in messageList">
<u-swipe-action bgColor="#F8FBFF" :index="item.groupId" class="other-program" <u-swipe-action bgColor="#F8FBFF" :index="item.groupId" class="other-program"
@content-click="handleChat(item)" v-if="item.program.linkmanId !== params.userId" @content-click="handleChat(item)" v-if="item.program.linkmanId !== params.userId"
:options="options"> :options="options">
@@ -75,7 +77,7 @@
{{ item.program.startDate + "至" + item.program.endDate }} {{ item.program.startDate + "至" + item.program.endDate }}
</view> --> </view> -->
<view class="item-unread" v-if="item.userUnread.length!=0"> <view class="item-unread" v-if="item.userUnread.length!=0">
未读 {{item.userUnread.length}} 消息未读 {{item.userUnread.length}}
</view> </view>
</u-swipe-action> </u-swipe-action>
<u-swipe-action bgColor="#F8FBFF" class="my-program" @content-click="handleChat(item)" v-else <u-swipe-action bgColor="#F8FBFF" class="my-program" @content-click="handleChat(item)" v-else
@@ -87,10 +89,11 @@
{{'咨询人:' + maskPhoneNumber(item.user.username) }} {{'咨询人:' + maskPhoneNumber(item.user.username) }}
</view> </view>
<view class="item-unread" v-if="item.chargeUnread.length!=0"> <view class="item-unread" v-if="item.chargeUnread.length!=0">
未读 {{item.chargeUnread.length}} 消息未读 {{item.chargeUnread.length}}
</view> </view>
</u-swipe-action> </u-swipe-action>
</view> </view>
<u-loadmore :status="status" color="#fff" />
<view class="placeholder-box"></view> <view class="placeholder-box"></view>
</scroll-view> </scroll-view>
</view> </view>
@@ -128,11 +131,11 @@
// 搜索 // 搜索
const keyword = ref('') const keyword = ref('')
// 系统消息 // 系统消息
const handleNavigateTo = () => { const handleNavigateTo = () => {
uni.navigateTo({ uni.navigateTo({
url:'/pages/message/systemMessage' url: '/pages/message/systemMessage'
}) })
} }
@@ -157,6 +160,13 @@
currentMenu.value = val currentMenu.value = val
} }
// 进入聊天
const handleChat = (item) => {
uni.navigateTo({
url: '/pages/message/chat?groupId=' + item.groupId
})
}
// 消息 // 消息
const messageList = ref([]) const messageList = ref([])
const user = ref() const user = ref()
@@ -167,6 +177,8 @@
userId: '', userId: '',
customerId: '', customerId: '',
}) })
const pages = ref(0)
const status = ref('loadmore')
const options = [ const options = [
{ {
text: '收藏', text: '收藏',
@@ -182,21 +194,24 @@
} }
] ]
const handleChat = (item) => {
uni.navigateTo({
url: '/pages/message/chat?groupId=' + item.groupId
})
}
const loadData = () => { const loadData = () => {
if (status.value == 'nomore') return
groupAPI.getList(params.value).then((res) => { groupAPI.getList(params.value).then((res) => {
messageList.value = res.data.list pages.value = res.data.pages
console.log(messageList.value); messageList.value = messageList.value.concat(res.data.list)
params.value.page++
if (params.value.page > pages.value) {
status.value = 'nomore'
}
}) })
} }
onPullDownRefresh(async () => { onPullDownRefresh(async () => {
await loadData() // 重新刷新,将参数初始化
params.value.page = 1
messageList.value = []
status.value = 'loadmore'
loadData()
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}) })
@@ -319,26 +334,34 @@
} }
.message-list { .message-list {
margin-top: 10rpx; margin-top: 20rpx;
.message-item { .message-item {
// border: 1px solid #000; // border: 1px solid #000;
.other-message { .other-program {
padding: 20rpx 0rpx 20rpx 20rpx; padding: 20rpx 0rpx 20rpx 20rpx;
background-color: #F8FBFF; background-color: #F8FBFF;
; border-bottom: 2rpx solid #f1f4ff;
.item-unread{
color: red;
}
} }
.my-program { .my-program {
padding: 20rpx 0rpx 20rpx 20rpx; padding: 20rpx 0rpx 20rpx 20rpx;
background-color: #F8FBFF; background-color: #F8FBFF;
border-bottom: 2rpx solid #f1f4ff; border-bottom: 2rpx solid #f1f4ff;
.item-unread{
color: red;
}
} }
} }
.placeholder-box{ .placeholder-box {
width: 100%; width: 100%;
height: 50rpx; height: 50rpx;
} }

View File

@@ -42,7 +42,7 @@
</view> </view>
</view> </view>
</view> </view>
<u-loadmore :status="status" /> <u-loadmore color="#fff" :status="status" />
<view class="box-div"></view> <view class="box-div"></view>
</scroll-view> </scroll-view>

View File

@@ -3,7 +3,8 @@
<u-navbar :is-fixed="false" title="项目详情" :background="{background: 'transparent' }" :border-bottom="false" <u-navbar :is-fixed="false" title="项目详情" :background="{background: 'transparent' }" :border-bottom="false"
back-icon-color="#fff" title-color="#fff"> back-icon-color="#fff" title-color="#fff">
<template v-slot:right> <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> </template>
</u-navbar> </u-navbar>
@@ -101,6 +102,8 @@
<u-col span="3"><u-button class="btn" type="success" @click="handleOpen">立刻融</u-button></u-col> <u-col span="3"><u-button class="btn" type="success" @click="handleOpen">立刻融</u-button></u-col>
</u-row> </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" <u-modal v-model="showWarning" border-radius="20" ref="warningRef" :mask-close-able="true"
:show-confirm-button="false" :show-title="false"> :show-confirm-button="false" :show-title="false">
@@ -174,7 +177,7 @@
import { programAPI } from '../../api/program'; import { programAPI } from '../../api/program';
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { groupAPI } from '../../api/group'; import { groupAPI } from '../../api/group';
const pdMsgRef = ref() const pdMsgRef = ref()
const userId = ref() const userId = ref()
@@ -193,6 +196,64 @@
createDate: '', createDate: '',
user: {} 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 = () => { const loadData = () => {
programAPI.isChat({ programAPI.isChat({
@@ -215,14 +276,15 @@
}) })
onMounted(() => { onMounted(() => {
isCollectMethod()
loadData() loadData()
}) })
const handleChat = () => { const handleChat = () => {
if (isChat.value) { if (isChat.value) {
// 继续聊 // 继续聊
groupAPI.getOne({programId: programId.value, userId: userId.value}).then(res=>{ groupAPI.getOne({ programId: programId.value, userId: userId.value }).then(res => {
if(res.code==200){ if (res.code == 200) {
// 进入聊天 // 进入聊天
uni.redirectTo({ uni.redirectTo({
url: '/pages/message/chat?groupId=' + res.data.groupId url: '/pages/message/chat?groupId=' + res.data.groupId
@@ -232,13 +294,12 @@
} else { } else {
// 开启群组聊天 // 开启群组聊天
groupAPI.add({ programId: programId.value, userId: userId.value }).then(res => { groupAPI.add({ programId: programId.value, userId: userId.value }).then(res => {
console.log(res); if (res.code == 200) {
if(res.code==200){
// 创建成功,进入聊天 // 创建成功,进入聊天
uni.redirectTo({ uni.redirectTo({
url: '/pages/message/chat?groupId=' + res.data.groupId url: '/pages/message/chat?groupId=' + res.data.groupId
}) })
}else{ } else {
pdMsgRef.value.show({ pdMsgRef.value.show({
title: res.msg, title: res.msg,
type: 'error' type: 'error'
@@ -271,7 +332,6 @@
// 立刻融 确认选择 // 立刻融 确认选择
const handleChose = () => { const handleChose = () => {
if (!is_agree.value) { if (!is_agree.value) {
console.log("change");
showErrMsg.value = true showErrMsg.value = true
return return
} }
@@ -299,6 +359,27 @@
showFile.value = false showFile.value = false
showWarning.value = true 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> </script>
<style scoped lang="scss"> <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 { .btn-group {
font-family: Work Sans; font-family: Work Sans;

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B