2025-10-15

添加字体
项目描述
聊天记录加载修改
This commit is contained in:
2025-10-15 17:22:54 +08:00
parent f53ec45c51
commit ad2ce26c08
29 changed files with 310 additions and 45 deletions

View File

@@ -563,16 +563,21 @@
userId.value = uni.getStorageSync("user").id
// 获取标题
groupAPI.getById(groupId.value).then(res => {
chatTitle.value = res.data.program.linkman.username + "(" + res.data.program.name + ")"
// chatTitle.value = res.data.program.linkman.username + "(" + res.data.program.name + ")"
chatTitle.value = res.data.program.name
})
loadHistoryData() // 最近10条
setTimeout(()=>{
scrollToBottom()
}, 1000)
// 未读变已读
let data = { groupId: groupId.value, userId: userId.value }
messageAPI.unread(data).then(res => {
if (res.code == 200) {
dataList.value = dataList.value.concat(res.data)
}
})
// let data = { groupId: groupId.value, userId: userId.value }
// messageAPI.unread(data).then(res => {
// if (res.code == 200) {
// dataList.value = dataList.value.concat(res.data)
// }
// })
messageAPI.read({ groupId: groupId.value, userId: userId.value })
}
@@ -584,10 +589,10 @@
const loadFix = ref(true)
// 历史记录
const loadHistoryData = () => {
const loadHistoryData = async () => {
params.value.groupId = groupId.value
messageAPI.list(params.value).then(res => {
console.log(res);
await messageAPI.list(params.value).then(res => {
// console.log(res);
if (res.data.list.length != 0) {
res.data.list.forEach(item => {
dataList.value.unshift(item)
@@ -793,6 +798,7 @@
.img-content {
margin-left: 10rpx;
height: 200rpx;
margin-bottom: 30rpx;
}
}

View File

@@ -1,12 +1,59 @@
<template>
<view class="my-container">
<scroll-view scroll-y="true" style="height: 100%;">
<view v-if="user!=null">
<view class="header">
<view class="header-user">
<view class="header-avatar">
<u-avatar :src="getImageUrl(user.avatar)"></u-avatar>
</view>
<view class="header-username u-m-l-10">
{{user.real_name}}
</view>
</view>
<view class="header-setting">
<image src="/static/icon/Settings.png" style="width: 100%;height: 100%;" mode=""></image>
</view>
</view>
<view class="statistics">
<view class="item">
<view class="count">
111
</view>
<view class="title">
积分
</view>
</view>
<view class="item">
<view class="count">
5
</view>
<view class="title">
优惠券
</view>
</view>
<view class="item">
<view class="count">
10
</view>
<view class="title">
我的兑换
</view>
</view>
<view class="item">
<view class="count">
283
</view>
<view class="title">
我的收藏
</view>
</view>
</view>
<view v-if="user!=null">
{{user.real_name}}
</view>
<u-button @click="loginOut">退出登录</u-button>
<u-button @click="loginOut">退出登录</u-button>
</view>
</scroll-view>
</view>
<Tabbar></Tabbar>
</template>
@@ -14,10 +61,13 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { getImageUrl } from '../../util/common';
const user = ref()
onMounted(() => {
user.value = uni.getStorageSync("user")
console.log(user.value);
})
const loginOut = () => {
@@ -29,5 +79,42 @@
</script>
<style scoped lang="scss">
.my-container {}
.my-container {
width: 100%;
height: 100vh;
background: linear-gradient(180deg, #E3E8FF 0%, #E8EAF4 100%);
background-blend-mode: lighten;
padding: 60rpx 20rpx;
.header {
display: flex;
width: 100%;
justify-content: flex-end;
.header-user {
padding: 20rpx 10rpx;
flex: 1;
display: flex;
align-items: center;
}
.header-setting {
width: 52rpx;
height: 52rpx;
}
}
.statistics{
display: flex;
.item{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 25%;
border: 1rpx solid #000;
}
}
}
</style>

View File

@@ -7,14 +7,14 @@
<u-search :show-action="false" placeholder="输入项目名称、企业名称" v-model="params.keyword" bgColor="#CADBFF"
@search="handleSearch"></u-search>
</view>
<u-dropdown :duration="0" class="dropdown">
<!-- <u-dropdown :duration="0" class="dropdown">
<u-dropdown-item class="u-dropdown" v-model="areaFilter" title="区域筛选"
:options="areaOptions"></u-dropdown-item>
<u-dropdown-item class="u-dropdown" v-model="timeFilter" title="时间筛选"
:options="timeOptions"></u-dropdown-item>
<u-dropdown-item class="u-dropdown" v-model="typeFilter" title="类型筛选"
:options="typeOptions"></u-dropdown-item>
</u-dropdown>
</u-dropdown> -->
</view>
<view class="program-list" :style="'height:'+scrollHeight+'px'">
@@ -37,9 +37,9 @@
<view class="program-contact">
项目联系人{{maskPhoneNumber(item.user.username)}}
</view>
<view class="program-introduction">
项目简介{{item.introduction}}
</view>
<!-- <view class="program-introduction">
项目简介<span v-html="item.introduction"></span>
</view> -->
</view>
</view>
<u-loadmore color="#fff" :status="status" />
@@ -131,7 +131,7 @@
// 列表
const programList = ref([])
const defaultSize = 5
const defaultSize = 10
const params = ref({
page: 1,
size: defaultSize,

View File

@@ -1,5 +1,5 @@
<template>
<view class="detail-contrainer">
<scroll-view class="detail-contrainer" scroll-y="true">
<u-navbar :is-fixed="false" title="项目详情" :background="{background: 'transparent' }" :border-bottom="false"
back-icon-color="#fff" title-color="#fff">
<template v-slot:right>
@@ -47,6 +47,18 @@
</view>
<view class="card">
<view class="card-title">
<view class="icon">
<image style="width: 100%;height: 100%;" src="/static/icon/card-title-icon.png" mode=""></image>
</view>
项目需求<span>4</span>
</view>
<view class="u-m-t-10 editor-content-view">
<view v-html="program.introduction"></view>
</view>
</view>
<!-- <view class="card">
<view class="card-title">
<view class="icon">
<image style="width: 100%;height: 100%;" src="/static/icon/card-title-icon.png" mode=""></image>
@@ -76,7 +88,6 @@
</view>
</view>
<view class="card">
<view class="card-title">
<view class="icon">
@@ -94,7 +105,7 @@
<u-col span="6" class="card-value">5</u-col>
</u-row>
</view>
</view>
</view> -->
<u-row justify="flex-end" class="u-m-r-40 btn-group">
<u-col span="3"><u-button class="btn" type="primary"
@@ -102,7 +113,13 @@
<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>
<view class="change-next u-m-t-60">
<u-link @click="handleChange">不感兴趣换一个</u-link>
</view>
<!-- 占位 -->
<view style="height: 20rpx;">
</view>
<u-modal v-model="showWarning" border-radius="20" ref="warningRef" :mask-close-able="true"
@@ -168,15 +185,29 @@
</u-modal>
<u-toast ref="pdMsgRef" />
</view>
</scroll-view>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { getUserInfo } from '../../util/common';
import { programAPI } from '../../api/program';
import { onLoad } from '@dcloudio/uni-app'
import { groupAPI } from '../../api/group';
<script setup>
import {
onMounted,
ref,
} from 'vue';
import {
getUserInfo
} from '../../util/common';
import {
programAPI
} from '../../api/program';
import {
onLoad
} from '@dcloudio/uni-app'
import {
groupAPI
} from '../../api/group';
// #ifdef APP
import '@/static/css/wangeditor.css'
// #endif
const pdMsgRef = ref()
@@ -266,9 +297,19 @@
})
programAPI.getProgram(programId.value).then(res => {
program.value = res.data
// 解决上传视频宽度问题
program.value.introduction = program.value.introduction.replace(
/<video([^>]*)width\s*=\s*["'][^"']*["']([^>]*)>/gi,
'<video$1width="100%"$2>'
);
// 同时确保没有width属性的video也设置宽度
program.value.introduction = program.value.introduction.replace(
/<video((?!(width))[^>]*)>/gi,
'<video width="100%" $1>'
);
})
}
onLoad((val) => {
programId.value = val.programId
let user = getUserInfo()
@@ -283,7 +324,10 @@
const handleChat = () => {
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) {
// 进入聊天
uni.redirectTo({
@@ -293,7 +337,10 @@
})
} else {
// 开启群组聊天
groupAPI.add({ programId: programId.value, userId: userId.value }).then(res => {
groupAPI.add({
programId: programId.value,
userId: userId.value
}).then(res => {
if (res.code == 200) {
// 创建成功,进入聊天
uni.redirectTo({
@@ -336,6 +383,10 @@
return
}
// TODO 同意协议
pdMsgRef.value.show({
title: '立刻融',
type: 'success'
})
showWarning.value = false
}
@@ -383,6 +434,14 @@
</script>
<style scoped lang="scss">
// @import "../../static/fontsFamily/ht.css";
// @import "../../static/fontsFamily/fs.css";
// @import "../../static/fontsFamily/kt.css";
// @import "../../static/fontsFamily/bkt.css";
// @import "../../static/fontsFamily/hwfs.css";
// @import "../../static/fontsFamily/hwkt.css";
// @import "../../static/fontsFamily/st.css";
// @import "../../static/fontsFamily/wryh.css";
.detail-contrainer {
width: 100%;
height: 100vh;
@@ -515,12 +574,7 @@
}
.change-next {
position: absolute;
bottom: 0%;
left: 0%;
right: 0%;
text-align: center;
margin-bottom: 20rpx;
}
// 按钮设置