update 接口联调

This commit is contained in:
zengBin 2024-09-29 09:32:27 +08:00
parent d82b478e14
commit 9d2bec920f
15 changed files with 676 additions and 409 deletions

View File

@ -214,8 +214,8 @@
</view>
<view v-else class="ui-discuss-box">
<block v-for="(item,index) in list" :key="index">
<view @longpress="commentsOperation(item.id)" class="~ui-relative ~ui-mt-36 {{operationId == item.id ? 'activeItem' : ''}}">
<view class="operation_box ~font_26 ~color-999" v-if="operationId == item.id">
<view @longpress="commentsOperation(item.comment_id)" class="~ui-relative ~ui-mt-36 {{operationId == item.comment_id ? 'activeItem' : ''}}">
<view class="operation_box ~font_26 ~color-999" v-if="operationId == item.comment_id">
<view class="~f-fcc">
<view class="~font_28 ~white" @tap="copy(item.comment)">复制</view>
<block v-if="item.publish == 1">
@ -229,29 +229,28 @@
</view>
</view>
<view class="~f-fl">
<view class="ui-user-pic" v-if="item.User.photo" style="{{'background-image:url(' + item.User.photo + ');'}}"></view>
<view class="ui-user-pic" v-else style="background-image:url(https://image.fulllinkai.com/202203/09/cc1c73eb1a4941fef25a15cd1ff2f9df.png);"></view>
<view class="ui-user-pic" style="{{'background-image:url(' + (item.photo || 'https://image.fulllinkai.com/202203/09/cc1c73eb1a4941fef25a15cd1ff2f9df.png') + ');'}}" @tap="jumpPath(`/pages/home/information?id=${item.id}`)"></view>
<view class="~ui-pl-16" @tap="changeReply(item)">
<view class="~f-fcl">
<view class="ui-name">{{ item.User.nickname || '未设置名称' }}</view>
<image v-if="item.User.sex == 1" class="ui-sex-icon ~ui-ml-10" src="https://images.ufutx.com/202103/23/3e7ac93e7bff26a9b62fe3232c776a96.png" lazy-load="false"></image>
<view class="ui-name">{{ item.nickname || '未设置名称' }}</view>
<image v-if="item.user.sex == 1" class="ui-sex-icon ~ui-ml-10" src="https://images.ufutx.com/202103/23/3e7ac93e7bff26a9b62fe3232c776a96.png" lazy-load="false"></image>
<image v-else class="ui-sex-icon ~ui-ml-10" src="https://images.ufutx.com/202103/23/4fd7a85e7073152fde91190b8957910e.png" lazy-load="false"></image>
<image class="referencesIcon" src="https://image.fulllinkai.com/202207/19/7e78a1dd367f1250d4cba4e85bfd60f1.png" mode="widthFix" v-if="item.User.type != 'single'"></image>
<!-- <image class="referencesIcon" src="https://image.fulllinkai.com/202207/19/7e78a1dd367f1250d4cba4e85bfd60f1.png" mode="widthFix" v-if="item.user.type != 'single'"></image>-->
</view>
<view class="~color999 ~font_24 ~f-fb ~ui-pt-4">{{ item.create_time }}</view>
<view class="~color999 ~font_24 ~f-fb ~ui-pt-4">{{ item.created_at }}</view>
<view class="~color333 ~font_30 ui-content">
<span v-if="item.Replyer">回复 {{item.Replyer.nickname}}</span>
<span v-if="item.reply_id">回复 {{item.reply_nickname}}</span>
{{ item.comment }}
</view>
</view>
<view class="ui-like-icon-box">
<view class="~f-fcr" v-if="item.isLker == false">
<view class="ui-like-icon-box" @tap.stop="commentLiker(item,index)">
<view class="~f-fcr" v-if="!item.is_liker">
<image lazy-load="true" class="ui-like-icon-v2" src="https://images.ufutx.com/202106/10/a97c7c76f3aaf7065e7f7a5fe2abc081.png"></image>
{{ item.likerCount }}
{{ item.liker_count }}
</view>
<view class="~f-fr" v-else>
<image class="ui-img2_gif" src="{{item.isLker ? gifurl : 'https://images.ufutx.com/202106/07/b227f3ecf9cbd080fb814450b667b5ce.gif'}}"></image>
{{ item.likerCount }}
<image class="ui-img2_gif" src="{{item.likeGif}}"></image>
{{ item.liker_count }}
</view>
</view>
</view>
@ -289,6 +288,10 @@
detail: {
type: Object,
default: {}
},
type: {
type: String,
default: ''
}
},
data: {
@ -298,7 +301,7 @@
defaultAvatar: 'https://images.ufutx.com/202007/01/e0de60525143427d4dd19515a5b387ba.png',
gifurl: 'https://images.ufutx.com/202106/11/d40b92e053a693f30eb197bf6374af95.gif',
name: '',
replyId: '',
replyId: 0,
inputVal: '',
showReplyView: true,
inputBoxH: 86
@ -310,23 +313,31 @@
let vm = this
let comment = vm.replyId ? vm.inputVal.split(`回复@${vm.name}`)[1] : vm.inputVal
let data = {
reply_id: vm.replyId || '',
reply_id: vm.replyId || 0,
comment: vm.replyId ? vm.inputVal.split(`回复@${vm.name}`)[1] : vm.inputVal
}
if (!comment) {
vm.$showToast('请输入评论内容')
return
}
let url = ''
if (vm.type == 'vote') {
// 投票动态评论
url = `${service.host}/vote/${vm.detail.id}/comment`
} else {
// 正常动态评论
url = `${service.host}/moment/${vm.detail.id}/comment`
}
if (vm.throttle) {
vm.throttle = false
vm.$post({url: `${service.host}/moment/${vm.detail.id}/comment`, data}).then(({code}) => {
vm.$post({url: url, data}).then(({code}) => {
wx.hideLoading()
if (code == 0) {
vm.$emit('getList')
vm.replyContent = ''
vm.name = ''
vm.inputVal = ''
vm.replyId = ''
vm.replyId = 0
}
vm.throttle = true
}).catch(() => {
@ -335,12 +346,29 @@
})
}
},
// 评论点赞
commentLiker(e, index) {
let vm = this
if (vm.throttle) {
vm.throttle = false
vm.$post({url: `${service.host}/moment/comment/${e.comment_id}/like`}).then(({code, data}) => {
if (code == 0) {
vm.$emit('changLiker', index)
}
wx.hideLoading()
vm.throttle = true
}).catch(() => {
vm.throttle = true
wx.hideLoading()
})
}
},
// 点击评论内容回复
changeReply(e) {
let vm = this
vm.replyId = e.User.id
vm.name = e.User.nickname
vm.inputVal = `回复@${e.User.nickname}`
vm.replyId = e.id
vm.name = e.nickname
vm.inputVal = `回复@${e.nickname}`
},
// 长按评论内容弹框复制等操作
commentsOperation(id) {
@ -370,7 +398,7 @@
vm.replyContent = ''
vm.name = ''
vm.inputVal = ''
vm.replyId = ''
vm.replyId = 0
}
vm.changeInputHeight()
},
@ -394,6 +422,9 @@
vm.$showToast('复制成功')
}
})
},
jumpPath(url) {
wx.navigateTo({url: url})
}
},
created() {}

View File

@ -134,8 +134,7 @@ scroll-view {
.ui-img {
width: 32rpx;
height: 32rpx;
margin-right: 10rpx;
margin-left: 8rpx;
margin: 0 10rpx;
}
}
@ -216,7 +215,7 @@ scroll-view {
{{item.work_user_tag}}
</view>
</view>
<image class="referencesIcon" src="https://image.fulllinkai.com/202207/19/7e78a1dd367f1250d4cba4e85bfd60f1.png" mode="widthFix" v-if="item.user.type != 'single'"></image>
<!-- <image class="referencesIcon" src="https://image.fulllinkai.com/202207/19/7e78a1dd367f1250d4cba4e85bfd60f1.png" mode="widthFix" v-if="item.user.type != 'single'"></image>-->
<view class="~font_24 ~ui-ml-24 ~color-theme" v-if="item.vote_id > 0">
参与了投票:
</view>
@ -234,7 +233,7 @@ scroll-view {
<view class="~ui-pt-14">
<view class="ui-dynamic-content substance ~color333 ~ui-mb-10 ~font_30 {{item.readmore.status == false ? 'ui-active-content' : ''}}">{{item.content}}</view>
<block v-if="item.vote_id > 0">
<view class="ui-voteItem ~f-fl" @tap="jumpPath(`/pages/dynamic/voteDetail?id=${item.vote_id}`)">
<view class="ui-voteItem ~f-fl" @tap.stop="jumpPath(`/pages/dynamic/voteDetail?id=${item.vote_id}`, 'vote')">
<image class="ui-vote-icon" src="https://image.fulllinkai.com/202206/29/7fd07d9687390a58d25ac92b55d9a9dd.png" mode="widthFix"></image>
<view class="~font_28">{{item.vote.title}}</view>
</view>
@ -253,10 +252,10 @@ scroll-view {
<video id="video" :src="item.play_url" v-if="videoIndex == index" play-btn-position="center" show-fullscreen-btn="{{false}}" controls direction="0" object-fit="{{videoIndex == index ? 'contain' : 'cover'}}" referrer-policy="origin" bindfullscreenchange="leaveVideo" class="videoCenter ui-video-r-box" :style="{width: item.video_width > item.video_height ? '480rpx' : '320rpx', height: item.video_width > item.video_height ? '270rpx' : '480rpx'}" :key="item.id">
</video>
</view>
<view class="~font_24 ~f-fb ~ui-mt-10" v-if="item.mt_name">
<view class="~font_24 ~f-fb ~ui-mt-10" v-if="item.topic && item.topic.name" @tap="jumpPath(`/pages/dynamic/hotTopic?id=${item.topic.id}`)">
<view class="ui-tags ~f-fcc ~color-theme ~font_24 ~ui-pr-16">
<image lazy-load="true" class="ui-img" src="https://images.ufutx.com/202102/04/dc3043df7d265ae0b2401e589405a239.png" alt=""/>
{{ item.mt_name }}
{{ item.topic.name }}
</view>
</view>
<view v-if="item.address" class="~color666 ~font_24 ~f-fl ~ui-mt-16">
@ -409,14 +408,14 @@ scroll-view {
vm.videoIndex = -1
}
},
jumpPath(url) {
jumpPath(url, type) {
let vm = this
// 校验是否完成注册资料
if (!vm.$signInVerify()) {
vm.$emit('signInVerify')
return
}
if (vm.from != 'dynamic') {
if (vm.from != 'dynamic' && type != 'vote') {
return
}
wx.navigateTo({url: url})

View File

@ -25,20 +25,20 @@
<view class="~cu-dialog dialog">
<!--管理员才有的操作功能 && 父组件来自首页动态列表时才有-->
<block v-if="admin == 1 && from == 'dynamic'">
<view @tap="deleteDynamic">删除</view>
<view @tap="conceal">隐藏动态</view>
<view v-if="dynamicTabsIndex == 1" @tap="hotDynamic(1)">设置为推荐动态</view>
<view v-else @tap="hotDynamic(0)">取消推荐</view>
<view v-if="selectData.is_top == 0" @tap="topDynamic(1)">设置为置顶</view>
<view v-else @tap="topDynamic(0)">取消置顶</view>
<view @tap.stop="deleteDynamic">删除</view>
<view @tap.stop="conceal">隐藏动态</view>
<view v-if="selectData.is_hot == 0" @tap.stop="hotDynamic(1)">设置为推荐动态</view>
<view v-else @tap.stop="hotDynamic(0)">取消推荐</view>
<view v-if="selectData.is_top == 0" @tap.stop="topDynamic(1)">设置为置顶</view>
<view v-else @tap.stop="topDynamic(0)">取消置顶</view>
</block>
<!--来自个人中心我的发布-->
<view v-if="from == 'myDynamic'" @tap="deleteDynamic">删除</view>
<view v-if="from == 'myDynamic'" @tap.stop="deleteDynamic">删除</view>
<block v-else>
<view @tap="lose">不感兴趣</view>
<view @tap="jumpPath(`/pages/user/report?id=${selectData.id}&type=dynamic`)">举报</view>
<view @tap.stop="lose">不感兴趣</view>
<view @tap.stop="jumpPath(`/pages/users/report?id=${selectData.id}&type=dynamic`)">举报</view>
</block>
<view @tap="hideModal">取消</view>
<view @tap.stop="hideModal">取消</view>
</view>
</view>
</template>
@ -103,13 +103,16 @@
// 隐藏动态
conceal() {
let vm = this
let data = {
is_show: 0
}
wx.showModal({
title: '温馨提示',
content: '是否确认隐藏该动态?',
success: function (res) {
if (res.confirm) {
vm.$showLoading('')
vm.$post({url: `${service.host}/moment/${vm.selectData.id}/hidden`}).then(({code, data}) => {
vm.$post({url: `${service.host}/moment/${vm.selectData.id}/hidden`, data}).then(({code, data}) => {
if (code == 0) {
vm.$showToast('动态已隐藏')
vm.$emit('changeOperation', 'conceal')
@ -140,9 +143,7 @@
vm.$post({url: `${service.host}/moment/${vm.selectData.id}/hot`, data}).then(({code, data}) => {
if (code == 0) {
vm.$showToast(`${e == 1 ? '设置成功' : '取消成功'}`)
if (e == 0) {
vm.$emit('changeOperation', 'hot')
}
vm.$emit('changeOperation', 'hot')
vm.hideModal()
}
wx.hideLoading()
@ -213,6 +214,7 @@
})
},
jumpPath(url) {
console.log(url, '*********')
wx.navigateTo({url: url})
},
hideModal() {

View File

@ -15,7 +15,7 @@ const getTime = (time) => {
if (yea == year) {
return argument.slice(5, 11) + (timeS.slice(0, 2) >= 12 ? '下午' + (timeS.slice(0, 2) == 12 ? 12 : timeS.slice(0, 2) - 12) + timeS.slice(2, 5) : '上午' + timeS.slice(0, 5))
} else {
return timeS.slice(0, 2) >= 12 ? '下午' + (timeS.slice(0, 2) == 12 ? 12 : timeS.slice(0, 2) - 12) + timeS.slice(2, 5) : '上午' + timeS.slice(0, 5)
return argument
}
}
if (timeCha > todayT && timeCha < yestodayT) {
@ -51,6 +51,37 @@ const format = (timestamp) => {
return y + '-' + add0(m) + '-' + add0(d) + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s)
}
// 倒计时传递对象
const formatRemainTimeData = (endTime) => {
let startDateV2 = new Date() // 开始时间
let endTimeArrV2 = endTime.replace(/-/g, '/')
let endDateV2 = new Date(endTimeArrV2) // 结束时间
let tV2 = endDateV2.getTime() - startDateV2.getTime() // 时间差
let dV2 = 0,
hV2 = 0,
mV2 = 0,
sV2 = 0
if (tV2 >= 0) {
dV2 = Math.floor(tV2 / 1000 / 3600 / 24)
hV2 = Math.floor((tV2 / 1000 / 60 / 60) % 24)
mV2 = Math.floor((tV2 / 1000 / 60) % 60)
sV2 = Math.floor((tV2 / 1000) % 60)
}
// 修改小时格式
if (hV2 >= 0 && hV2 <= 9) {
hV2 = '0' + hV2
}
// 修改分钟格式
if (mV2 >= 0 && mV2 <= 9) {
mV2 = '0' + mV2
}
// 修改秒格式
if (sV2 >= 0 && sV2 <= 9) {
sV2 = '0' + sV2
}
return { d: dV2, h: hV2, m: mV2, s: sV2 }
}
const timeContrast = (startTime, endTime) => {
let dateEnd = new Date(endTime.replace(/-/g, '/'))
let dateBegin = new Date(startTime.replace(/-/g, '/'))
@ -305,6 +336,7 @@ const getElement_WH = (element) => { // 获取元素位置
module.exports = {
getTime,
formatRemainTimeData,
format,
timeContrast,
getVideoTime,

View File

@ -11,7 +11,7 @@ page {
<!--动态操作功能selectData选择的动态数据、selectIndex选中的动态下标、admin是否管理员、from来自哪个父组件-->
<dynamicOperation :selectData="selectData" :chooseShow.sync="chooseShow" :selectIndex="selectIndex" :admin="admin" :from="'home'" @hideModal="hideModal" @changeOperation="changeOperation"></dynamicOperation>
<!--评论数据-->
<dynamicDiscuss :list="list" :detail="detail" @getList="getList"></dynamicDiscuss>
<dynamicDiscuss :list="list" :detail="detail" @getList="getList" @changLiker="changLiker" :type="'dynamic'"></dynamicDiscuss>
</template>
<script>
@ -67,8 +67,9 @@ wepy.page({
vm.$get({url: `${service.host}/moment/${vm.id}/comment/list?type=moment&nopage=1`}).then(({code, data}) => {
if (code === 0) {
data.forEach((item) => {
item.create_time = commentTimeHandle(item.create_time)
item.created_at = commentTimeHandle(item.created_at)
item.comment = item.comment.split('?')[0]
item.likeGif = 'https://images.ufutx.com/202106/07/b227f3ecf9cbd080fb814450b667b5ce.gif'
})
vm.list = data
console.log(vm.list, '////')
@ -79,6 +80,14 @@ wepy.page({
console.log(err)
})
},
// 评论点赞回调
changLiker(index) {
let vm = this
let nowTime = new Date()
vm.list[index].is_liker = !vm.list[index].is_liker
vm.list[index].liker_count = vm.list[index].liker_count + (vm.list[index].is_liker ? 1 : -1)
vm.list[index].likeGif = `${vm.list[index].likeGif}?${nowTime}`
},
// 选择某条动态操作弹框
changeSelect(e, index) {
let vm = this

View File

@ -114,7 +114,7 @@ page {
</scroll-view>
</view>
<!--动态操作功能selectData选择的动态数据、selectIndex选中的动态下标、admin是否管理员、from来自哪个父组件-->
<dynamicOperation :selectData="selectData" :chooseShow.sync="chooseShow" :selectIndex="selectIndex" :admin="admin" :from="'hotTopic'" @hideModal="hideModal" @operation="changeOperation"></dynamicOperation>
<dynamicOperation :selectData="selectData" :chooseShow.sync="chooseShow" :selectIndex="selectIndex" :admin="admin" :from="'hotTopic'" @hideModal="hideModal" @changeOperation="changeOperation"></dynamicOperation>
<pageScroll ref="pageScroll" @BackTop="BackTop"></pageScroll>
</template>

View File

@ -329,7 +329,7 @@ wepy.page({
data: {
id: '',
title: '',
hot: '',
hot: 0,
value: '',
throttle: true,
placeholder: '用视频/图片分享记录,能获得更多好友点赞',
@ -356,6 +356,10 @@ wepy.page({
vm.$post({url: `${service.host}/moment/add`, data}).then(({code}) => {
wx.hideLoading()
if (code == 0) {
vm.$showToast('动态已发布')
setTimeout(() => {
wx.navigateBack({delta: 1})
}, 1200)
}
vm.throttle = true
}).catch(() => {
@ -447,6 +451,10 @@ wepy.page({
},
ChooseImage() {
let vm = this
if (vm.imgList.length >= 9) {
vm.$showToast('最多可上传9张')
return
}
vm.choosePicsShow = true
},
chooseVideo() {

View File

@ -116,10 +116,10 @@ page {
<view class="wrapper">
<view class="f-fc">
<image src="https://image.fulllinkai.com/202206/28/7fd07d9687390a58d25ac92b55d9a9dd.png" mode="widthFix" class="_icon"></image>
<view class="font_32 color333 bold">{{ detail.title }}</view>
<view class="font_32 color333 bold">{{ detail.votes.title }}</view>
</view>
<view class="sb_title color999">{{ detail.content || '如题'}}</view>
<block v-for="(item,index) in detail.option" :key="index">
<block v-for="(item,index) in detail.options" :key="index">
<view class="text-right ui-ml-40">
<view v-if="!detail.is_vote" class="vote_item text-center" @tap="selectFn(item)">{{ item.title }}</view>
<view v-else class="vote_item_a f-fbc ellipsis_1 {{item.checked == 1 ? '' : '_active'}}">
@ -143,7 +143,7 @@ page {
<view class="ui-line"></view>
</view>
<!--评论数据-->
<dynamicDiscuss :list="list" :detail="detail"></dynamicDiscuss>
<dynamicDiscuss :list="list" :detail="detail" @getList="getList" @changLiker="changLiker" :type="'vote'"></dynamicDiscuss>
</template>
<script>
@ -169,10 +169,11 @@ wepy.page({
vm.$get({url: `${service.host}/vote/${vm.id}`}).then(({code, data}) => {
if (code === 0) {
let result = data
result.comment_count = result.momentCommentCount
result.like_count = result.momentLikerCount
result.is_like = result.isLkerMoment
result.created_at = commentTimeHandle(result.created_at)
result.commenter_count = result.comment_count
result.like_count = result.liker_count
result.is_like = result.is_liker
result.create_time = commentTimeHandle(result.votes.create_time)
result.id = result.votes.id
for (let index in data.option) {
data.option[index].rate = vm.getPercentage(data.option[index].rate)
}
@ -188,11 +189,12 @@ wepy.page({
getList() {
let vm = this
vm.$showLoading('加载中...')
vm.$get({url: `${service.host}/moment/comments?id=${vm.id}&type=vote&nopage=1`}).then(({code, data}) => {
vm.$get({url: `${service.host}/vote/${vm.id}/comment/list`}).then(({code, data}) => {
if (code === 0) {
data.forEach((item) => {
item.created_at = commentTimeHandle(item.created_at)
item.comment = item.comment.split('?')[0]
item.likeGif = 'https://images.ufutx.com/202106/07/b227f3ecf9cbd080fb814450b667b5ce.gif'
})
vm.list = data
console.log(vm.list, '////')
@ -206,15 +208,14 @@ wepy.page({
selectFn(e) {
let vm = this
vm.$showLoading('投票中...')
vm.$post({url: `${service.host}/moment/vote/${e.id}`}).then(({code, data}) => {
vm.$post({url: `${service.host}/vote/${e.id}/push`}).then(({code, data}) => {
if (code == 0) {
vm.$showToast('动态已删除')
vm.$showToast('已投票')
for (let index in data.option) {
vm.detail.option[index].rate = vm.getPercentage(data.option[index].rate)
vm.detail.option[index].checked = data.option[index].checked
vm.detail.option[index].count = data.option[index].count
}
vm.hideModal()
}
wx.hideLoading()
}).catch(() => {
@ -225,7 +226,7 @@ wepy.page({
upvote() {
let vm = this
let nowTime = new Date()
vm.$post({url: `${service.host}/like/vote/${vm.id}`}).then(({code}) => {
vm.$post({url: `${service.host}/vote/${vm.id}/like`}).then(({code}) => {
wx.hideLoading()
if (code == 0) {
vm.detail.is_like = !vm.detail.is_like
@ -238,6 +239,14 @@ wepy.page({
wx.hideLoading()
})
},
// 评论点赞回调
changLiker(index) {
let vm = this
let nowTime = new Date()
vm.list[index].is_liker = !vm.list[index].is_liker
vm.list[index].liker_count = vm.list[index].liker_count + (vm.list[index].is_liker ? 1 : -1)
vm.list[index].likeGif = `${vm.list[index].likeGif}?${nowTime}`
},
// 计算投票百分比
getPercentage(val) {
return Math.round((val) * 10000) / 100

View File

@ -537,7 +537,7 @@ page {
<image src="https://images.ufutx.com/202101/30/e3a22a60849c3910e680d932772432b4.png" v-if="userInfo.base_profile.is_rank" mode="widthFix" class="VIPIcon"></image>
<image src="https://images.ufutx.com/202101/30/004a146ad71658aaa2ad0f0263f960b8.png" mode="widthFix" v-else class="VIPIcon"></image>
</view>
<image :src="userInfo.base_profile.photo" @tap="previewImageV2(userInfo.base_profile.photo)" class="_photo flo_r" mode="aspectFill"></image>
<image :src="userInfo.base_profile.photo" class="_photo flo_r" mode="aspectFill"></image>
<view class="clearfloat"></view>
<view class="ui-sex-box">
<view class="sexBox">{{userInfo.base_profile.fans_count}} 粉丝</view>
@ -642,7 +642,7 @@ page {
<view class="ui-bottom-operation">
<image class="ui-mask-icon" src="https://image.fulllinkai.com/202407/30/dca7024d347433e1aa893ce15a056b10.png" mode="widthFix"></image>
<view class="f-fbc ui-operation">
<button class="m_share_img btn">
<button class="m_share_img btn" open-type="share">
<image class="ui-share-icon" src="https://image.fulllinkai.com/202407/30/a0c06b508211c748a046e22626627b5a.png" mode="widthFix"></image>
</button>
<view class="u_boBu f-fbc">
@ -965,7 +965,7 @@ wepy.page({
if (data.self_is_real_approved == 1) { num = num + 50 }
vm.pairedScore = num
if (data.photo) {
if (data.base_profile.photo) {
let year = '', city = '', degree = '', industry_sub = data.base_profile.industry_sub
if (data.base_profile) {
year = data.base_profile.year || ''
@ -988,6 +988,7 @@ wepy.page({
{url: 'https://image.fulllinkai.com/202206/20/bd732960011f55fed0e5e7d623118494.png', width: 136, height: 40, y: 276, x: 264}
]
}
console.log(vm.posterConfig, '7777777777777')
vm.$nextTick(() => {
setTimeout(() => {
vm.$wx.selectComponent('#poster').onCreate(true, vm)
@ -1167,7 +1168,7 @@ wepy.page({
vm.$showToast('打招呼消息不能为空')
return
}
vm.$post({url: `${service.host}/friend/users/${vm.id}/v3`, data}).then(({code, data}) => {
vm.$post({url: `${service.host}/other/user/${vm.id}/friend`, data}).then(({code, data}) => {
if (code == 0) {
vm.modalName = ''
vm.$showToast('消息已发送')
@ -1212,7 +1213,6 @@ wepy.page({
onPosterSuccess(e) {
let vm = this
vm.shareImg = e.$wx.detail
// vm.modalName = 'showPic'
wx.hideLoading()
console.log(vm.shareImg)
},
@ -1235,6 +1235,30 @@ wepy.page({
vm.loginShow = false
}
},
onShareAppMessage() {
let vm = this
let openid = wx.getStorageSync('openid')
let url = `/pages/home/information?id=${vm.id}&from_openid=${openid}&share_user_id=${vm.id}&from_user_id=${vm.id}`
return {
title: '觉得Ta很不错可以认识一下',
path: url,
imageUrl: vm.shareImg,
success: function(res) {
wx.showToast({
title: '转发成功',
icon: 'success',
duration: 1500
})
let shareTickets = res.shareTickets
if (shareTickets.length == 0) {
return false
}
},
fail: function(res) {
// 转发失败
}
}
},
onHide() {
let vm = this
clearTimeout(this.timer)

View File

@ -582,7 +582,7 @@ page {
<image v-if="item.isSelf && item.isSend == 2" class="ui-error-icon" src="https://image.fulllinkai.com/202408/16/26bce9092cd2c703f7d5b2d56ef9d132.png" mode="widthFix"></image>
<image v-if="!item.isSelf && item.isSend == 2" class="ui-error-icon-v2" src="https://image.fulllinkai.com/202408/16/26bce9092cd2c703f7d5b2d56ef9d132.png" mode="widthFix"></image>
<image v-if="!item.isSelf" class="ui-user-pic" :src="item.avatar" mode="aspectFill"></image>
<view class="ui-pl-12">
<view class="{{item.isSelf ? 'ui-pr-12' : 'ui-pl-12'}}">
<view class="ui-relative">
<!--文本加表情信息-->
<view class="{{!item.isSelf ? 'ui-left-msg-radius ui-msg-left color3' : 'ui-right-msg-radius ui-msg-right white'}} font_28" v-if="item.msgType == 'text'">
@ -749,6 +749,7 @@ wepy.page({
toView: '',
uploadState: false,
progressValue: 0, // 上传进度
lastId: '', // 历史记录分页数据最后一条id
lastTime: '', // 历史记录分页数据最后一条的时间戳
lastMsgId: '', // 历史记录分页数据最后一条的id
beginTime: '', // 历史记录分页数据最后一条的时间
@ -780,11 +781,6 @@ wepy.page({
send() {
let vm = this
let timeData = new Date().getTime()
let data = {
other_user_id: vm.otherUserId,
field_7: vm.msg,
field_6: 'text'
}
if (!vm.msg) {
vm.$showToast('请输入聊天内容')
return
@ -803,108 +799,86 @@ wepy.page({
isSend: 0,
msgType: 'text'
})
vm.emojiShow = false
vm.msg = ''
vm.replyContent = ''
vm.toView = `id_${timeData}`
let msgIndex = 0
let msgNewObj = {}
msgIndex = vm.msgList.findIndex((e) => e.timestamp == timeData)
vm.$post({url: `${service.host}/chat/message/send`, data}).then(({code, data}) => {
if (code == 0) {
app.globalData.nim.msg.sendTextMsg({
scene: 'p2p',
to: vm.otherUserId,
body: data.content,
isSend: 0,
onSendBefore: function (msg) {
console.log('get msg before', msg)
if (/\[[^\]]+\]/.test(data.content)) {
data.content = vm.transitionMsg(data.content)
}
msgNewObj = {
text: data.content,
attach: '',
id: `id_${msg.time}`,
isSelf: true,
avatar: vm.myAvatar,
time: getTime(format(msg.time)),
showTime: timeContrast(format(msg.time), vm.lastTime),
name: vm.myName,
userId: msg.from,
isSend: 1,
msgType: 'text'
}
vm.msgList.splice(msgIndex, 1, msgNewObj)
vm.lastTime = format(msg.time)
}
})
} else {
vm.msgList[msgIndex].isSend = 2
app.globalData.nim.msg.sendTextMsg({
scene: 'p2p',
to: vm.otherUserId,
body: vm.msg,
isSend: 0,
onSendBefore: function (msg) {
console.log('get msg before', msg)
if (/\[[^\]]+\]/.test(vm.msg)) {
vm.msg = vm.transitionMsg(vm.msg)
}
msgNewObj = {
text: vm.msg,
attach: '',
id: `id_${msg.time}`,
isSelf: true,
avatar: vm.myAvatar,
time: getTime(format(msg.time)),
showTime: timeContrast(format(msg.time), vm.lastTime),
name: vm.myName,
userId: msg.from,
isSend: 1,
msgType: 'text'
}
vm.msgList.splice(msgIndex, 1, msgNewObj)
vm.lastTime = format(msg.time)
vm.callbackSend('text')
}
wx.hideLoading()
}).catch(() => {
vm.msgList[msgIndex].isSend = 2
wx.hideLoading()
})
},
// 发送图片消息
sendPictures(file) {
let vm = this
let data = {
other_user_id: vm.otherUserId,
field_7: vm.msg,
field_6: 'picture'
}
vm.openShow = false
vm.uploadState = true
vm.progressValue = 5
vm.$post({url: `${service.host}/chat/message/send`, data}).then(({code, data}) => {
if (code == 0) {
app.globalData.nim.msg.sendImageMsg({
scene: 'p2p',
to: vm.otherUserId,
type: 'image',
filePath: file,
onUploadProgress: function (progress) {
console.log(progress, '上传进度')
vm.progressValue = progress.percentage
},
onSendBefore: function (msg) {
console.log(msg, '上传完成, 图片信息')
vm.msgList.push({
text: '',
attach: vm.calculatePic(msg.attach, msg.type),
id: `id_${msg.time}`,
isSelf: true,
avatar: vm.myAvatar,
time: getTime(format(msg.time)),
showTime: timeContrast(format(msg.time), vm.lastTime),
name: msg.fromNick,
userId: msg.from,
isSend: msg.status == 'sendFailed' ? 2 : 1, // sendFailed 发送失败
msgType: 'image'
})
vm.lastTime = format(msg.time)
vm.$nextTick(() => {
vm.toView = `id_${msg.time}`
})
// 防止图片撑开触发加载历史数据
vm.$nextTick(() => {
setTimeout(() => {
vm.uploadState = false
}, 500)
})
}
})
} else {
vm.sendFileError()
}
wx.hideLoading()
}).catch(() => {
vm.uploadState = false
wx.hideLoading()
})
try {
app.globalData.nim.msg.sendImageMsg({
scene: 'p2p',
to: vm.otherUserId,
type: 'image',
filePath: file,
onUploadProgress: function (progress) {
console.log(progress, '上传进度')
vm.progressValue = progress.percentage
},
onSendBefore: function (msg) {
console.log(msg, '上传完成, 图片信息')
vm.msgList.push({
text: '',
attach: vm.calculatePic(msg.attach, msg.type),
id: `id_${msg.time}`,
isSelf: true,
avatar: vm.myAvatar,
time: getTime(format(msg.time)),
showTime: timeContrast(format(msg.time), vm.lastTime),
name: msg.fromNick,
userId: msg.from,
isSend: msg.status == 'sendFailed' ? 2 : 1, // sendFailed 发送失败
msgType: 'image'
})
vm.lastTime = format(msg.time)
vm.callbackSend('picture')
vm.$nextTick(() => {
vm.toView = `id_${msg.time}`
})
// 防止图片撑开触发加载历史数据
vm.$nextTick(() => {
setTimeout(() => {
vm.uploadState = false
}, 500)
})
}
})
} catch (err) {
vm.sendFileError()
}
},
// 发送视频
sendVideos(file) {
@ -912,44 +886,49 @@ wepy.page({
vm.openShow = false
vm.uploadState = true
vm.progressValue = 5
app.globalData.nim.msg.sendVideoMsg({
scene: 'p2p',
to: vm.otherUserId,
type: 'video',
filePath: file,
onUploadProgress: function (progress) {
console.log(progress, '上传进度')
vm.progressValue = progress.percentage
},
onSendBefore: function (msg) {
console.log(msg, '上传完成,视频信息')
vm.msgList.push({
text: '',
attach: vm.calculatePic(msg.attach, msg.type),
id: `id_${msg.time}`,
timestamp: msg.time,
isSelf: true,
avatar: vm.myAvatar,
time: getTime(format(msg.time)),
showTime: timeContrast(format(msg.time), vm.lastTime),
videoDur: getVideoTime(msg.attach.dur),
name: msg.fromNick,
userId: msg.from,
isSend: 1,
msgType: 'video'
})
vm.lastTime = format(msg.time)
vm.$nextTick(() => {
vm.toView = `id_${msg.time}`
})
// 防止视频撑开触发加载历史数据
vm.$nextTick(() => {
setTimeout(() => {
vm.uploadState = false
}, 500)
})
}
})
try {
app.globalData.nim.msg.sendVideoMsg({
scene: 'p2p',
to: vm.otherUserId,
type: 'video',
filePath: file,
onUploadProgress: function (progress) {
console.log(progress, '上传进度')
vm.progressValue = progress.percentage
},
onSendBefore: function (msg) {
console.log(msg, '上传完成,视频信息')
vm.msgList.push({
text: '',
attach: vm.calculatePic(msg.attach, msg.type),
id: `id_${msg.time}`,
timestamp: msg.time,
isSelf: true,
avatar: vm.myAvatar,
time: getTime(format(msg.time)),
showTime: timeContrast(format(msg.time), vm.lastTime),
videoDur: getVideoTime(msg.attach.dur),
name: msg.fromNick,
userId: msg.from,
isSend: 1,
msgType: 'video'
})
vm.lastTime = format(msg.time)
vm.callbackSend('video')
vm.$nextTick(() => {
vm.toView = `id_${msg.time}`
})
// 防止视频撑开触发加载历史数据
vm.$nextTick(() => {
setTimeout(() => {
vm.uploadState = false
}, 500)
})
}
})
} catch (err) {
vm.sendFileError()
}
},
// 发送语音
sendAudio(file) {
@ -960,7 +939,7 @@ wepy.page({
app.globalData.nim.msg.sendAudioMsg({
scene: 'p2p',
to: vm.otherUserId,
type: 'video',
type: 'audio',
filePath: file,
onUploadProgress: function (progress) {
console.log(progress, '上传进度')
@ -985,6 +964,7 @@ wepy.page({
msgType: 'audio'
})
vm.lastTime = format(msg.time)
vm.callbackSend('audio')
vm.$nextTick(() => {
vm.toView = `id_${msg.time}`
// 防止音频撑开触发加载历史数据
@ -1019,6 +999,24 @@ wepy.page({
}, 500)
})
},
// 发送信息后回调
callbackSend(type) {
let vm = this
let data = {
other_user_id: vm.otherUserId * 1,
field_7: vm.msg,
field_6: type
}
vm.$post({url: `${service.host}/chat/message/send`, data}).then(() => {
wx.hideLoading()
vm.msg = ''
vm.emojiShow = false
vm.replyContent = ''
}).catch(() => {
vm.uploadState = false
wx.hideLoading()
})
},
// 标记信息已读
sendMsgReceipt(e) {
app.globalData.nim.msg.sendMsgReceipt({
@ -1029,7 +1027,7 @@ wepy.page({
reception(e) {
let vm = this
vm.sendMsgReceipt(e)
vm.getChatInfo()
// vm.getChatInfo()
if (e.type == 'text' && /\[[^\]]+\]/.test(e.body)) {
e.body = vm.transitionMsg(e.body)
}
@ -1055,83 +1053,161 @@ wepy.page({
// 获取历史消息数据
getHistoryMsg() {
let vm = this
let data = {}
let data = {
min_id: vm.lastId
}
if (vm.uploadState || vm.videoState) {
return
}
if (!vm.lastMsgId) {
data = {
scene: 'p2p',
to: vm.otherUserId,
limit: 15
}
} else {
data = {
scene: 'p2p',
to: vm.otherUserId,
limit: 15,
reverse: false,
endTime: vm.beginTime,
lastMsgId: vm.lastMsgId
}
}
if (vm.finished) {
return
}
vm.$showLoading('')
app.globalData.nim.msgLog.getHistoryMsgs(data).then((object) => {
console.log(object, '222222222222222222')
if (object && object.length > 0) {
if (vm.msgList && vm.msgList.length == 0) {
vm.sendMsgReceipt(object[0])
}
object.forEach((item, index) => {
item.showTime = timeContrast(format(item.time), vm.lastTime)
item.timing = getTime(format(item.time))
if (item.showTime && index > 0) {
object[index].showTime = false
object[index - 1].showTime = true
}
if (item.type == 'text' && /\[[^\]]+\]/.test(item.body)) {
item.body = vm.transitionMsg(item.body)
}
vm.lastTime = format(item.time)
})
vm.$get({url: `${service.host}/chat/user/${vm.otherUserId}/message/list`, data}).then(({code, data}) => {
if (code === 0) {
console.log(data, '-------------------')
if (data && data.length > 0) {
// if (vm.msgList && vm.msgList.length == 0) {
// vm.sendMsgReceipt(data[0])
// }
data.forEach((item, index) => {
item.time = new Date(item.create_time.replace(/[-]/g, '/').replace(/[-]/, '')).getTime()
item.attach = item.attach ? JSON.parse(item.attach) : ''
item.showTime = timeContrast(format(item.time), vm.lastTime)
item.timing = getTime(format(item.time))
if (item.showTime && index > 0) {
data[index].showTime = false
data[index - 1].showTime = true
}
if (item.content_type == 'text' && /\[[^\]]+\]/.test(item.content)) {
item.body = vm.transitionMsg(item.content)
}
vm.lastTime = format(item.time)
})
vm.lastMsgId = object[object.length - 1].idServer
vm.beginTime = object[object.length - 1].time
vm.lastMsgId = data[data.length - 1].id
vm.beginTime = data[data.length - 1].time
setTimeout(() => {
object.forEach((item) => {
vm.msgList.unshift({
text: item.body,
attach: vm.calculatePic(item.attach, item.type),
id: `id_${item.time}`,
timestamp: item.time,
isSelf: item.flow == 'in' ? false : true,
avatar: item.flow == 'in' ? vm.otherAvatar : vm.myAvatar,
time: item.timing,
showTime: item.showTime,
videoDur: item.type == 'video' ? getVideoTime(item.attach.dur) : '',
audioDur: item.type == 'audio' ? (item.attach.dur / 1000).toFixed(0) : '',
name: item.fromNick,
isSend: 1,
userId: item.from,
msgType: item.type
setTimeout(() => {
data.forEach((item) => {
vm.msgList.unshift({
text: item.content,
attach: vm.calculatePic(item.attach, item.content_type),
id: `id_${item.time}`,
timestamp: item.time,
isSelf: item.is_mine == 0 ? false : true,
avatar: item.is_mine == 0 ? vm.otherAvatar : vm.myAvatar,
time: item.timing,
showTime: item.showTime,
videoDur: item.content_type == 'video' ? getVideoTime(item.attach.dur) : '',
audioDur: item.content_type == 'audio' ? (item.attach.dur / 1000).toFixed(0) : '',
name: item.fromNick,
isSend: 1,
userId: item.from,
msgType: item.content_type
})
})
console.log(vm.msgList, data[0].time, '88888888888888888')
vm.$nextTick(() => {
if (vm.msgList.length < 8) {
vm.toView = `id_${data[0].time}`
}
vm.lastId = `${data[data.length - 1].id}`
vm.loading = true
// 防止撑开触发加载历史数据
setTimeout(() => {
vm.uploadState = false
}, 500)
})
})
console.log(vm.msgList, '88888888888888888')
vm.toView = `id_${object[0].time}`
} else {
vm.loading = true
})
} else {
vm.loading = true
}
if (object && object.length < 15) {
vm.finished = true
}
if (data && data.length < 7) {
vm.finished = true
}
}
}).catch(err => {
wx.hideLoading()
console.log(err)
})
// let data = {}
// if (vm.uploadState || vm.videoState) {
// return
// }
// if (!vm.lastMsgId) {
// data = {
// scene: 'p2p',
// to: vm.otherUserId,
// limit: 15
// }
// } else {
// data = {
// scene: 'p2p',
// to: vm.otherUserId,
// limit: 15,
// reverse: false,
// endTime: vm.beginTime,
// lastMsgId: vm.lastMsgId
// }
// }
// if (vm.finished) {
// return
// }
// vm.$showLoading('')
// app.globalData.nim.msgLog.getHistoryMsgs(data).then((object) => {
// console.log(object, '222222222222222222')
// if (object && object.length > 0) {
// if (vm.msgList && vm.msgList.length == 0) {
// vm.sendMsgReceipt(object[0])
// }
// object.forEach((item, index) => {
// item.showTime = timeContrast(format(item.time), vm.lastTime)
// item.timing = getTime(format(item.time))
// if (item.showTime && index > 0) {
// object[index].showTime = false
// object[index - 1].showTime = true
// }
// if (item.type == 'text' && /\[[^\]]+\]/.test(item.body)) {
// item.body = vm.transitionMsg(item.body)
// }
// vm.lastTime = format(item.time)
// })
//
// vm.lastMsgId = object[object.length - 1].idServer
// vm.beginTime = object[object.length - 1].time
//
// setTimeout(() => {
// object.forEach((item) => {
// vm.msgList.unshift({
// text: item.body,
// attach: vm.calculatePic(item.attach, item.type),
// id: `id_${item.time}`,
// timestamp: item.time,
// isSelf: item.flow == 'in' ? false : true,
// avatar: item.flow == 'in' ? vm.otherAvatar : vm.myAvatar,
// time: item.timing,
// showTime: item.showTime,
// videoDur: item.type == 'video' ? getVideoTime(item.attach.dur) : '',
// audioDur: item.type == 'audio' ? (item.attach.dur / 1000).toFixed(0) : '',
// name: item.fromNick,
// isSend: 1,
// userId: item.from,
// msgType: item.type
// })
// })
// console.log(vm.msgList, '88888888888888888')
// vm.toView = `id_${object[0].time}`
// vm.loading = true
// })
// } else {
// vm.loading = true
// }
// if (object && object.length < 15) {
// vm.finished = true
// }
// wx.hideLoading()
// })
},
// 删除好友
deleteFriends() {
@ -1526,7 +1602,7 @@ wepy.page({
vm.myType = wx.getStorageSync('userInfo').type
vm.myName = wx.getStorageSync('userInfo').name
vm.myAvatar = wx.getStorageSync('userInfo').avatar
vm.getChatInfo()
// vm.getChatInfo()
},
onLoad(e) {
let vm = this

View File

@ -724,7 +724,7 @@ wepy.page({
// 获取群成员信息
getMembers() {
let vm = this
vm.$post({url: `${service.host}/team/${vm.otherUserId}/detail`}).then(({code, data}) => {
vm.$post({url: `${service.host}/chat/group/detail?team_id=${vm.otherUserId}`}).then(({code, data}) => {
if (code === 0) {
// 第一次进入页面的时候才请求历史消息
if (!vm.membersData.id) {
@ -1028,91 +1028,170 @@ wepy.page({
// 获取历史消息数据
getHistoryMsg() {
let vm = this
let data = {}
let vm = this
let data = {
min_id: vm.lastId
}
if (vm.uploadState || vm.videoState) {
return
}
if (!vm.lastMsgId) {
data = {
scene: 'team',
to: vm.otherUserId,
limit: 15
}
} else {
data = {
scene: 'team',
to: vm.otherUserId,
limit: 15,
reverse: false,
endTime: vm.beginTime,
lastMsgId: vm.lastMsgId
}
}
if (vm.finished) {
return
}
vm.$showLoading('')
app.globalData.nim.msgLog.getHistoryMsgs(data).then((object) => {
if (object && object.length > 0) {
if (vm.msgList && vm.msgList.length == 0) {
// 标记IM消息已读
vm.sendMsgReceipt()
}
object.forEach((item, index) => {
item.avatar = 'https://image.fulllinkai.com/202307/18/449c3253ca2bbed9314d39977a486d0e.png',
item.showTime = timeContrast(format(item.time), vm.lastTime)
item.timing = getTime(format(item.time))
if (item.showTime && index > 0) {
object[index].showTime = false
object[index - 1].showTime = true
}
if (item.type == 'text' && /\[[^\]]+\]/.test(item.body)) {
item.body = vm.transitionMsg(item.body)
}
vm.lastTime = format(item.time)
// 获取成员头像后再循环获取数据
app.globalData.nim.user.getUsersNameCardFromServer({
accounts: [item.from]
}).then((res) => {
item.avatar = res[0].avatar
if (index + 1 == object.length) {
vm.lastMsgId = object[object.length - 1].idServer
vm.beginTime = object[object.length - 1].time
setTimeout(() => {
object.forEach((item) => {
vm.msgList.unshift({
text: item.body,
attach: vm.calculatePic(item.attach, item.type),
id: `id_${item.time}`,
timestamp: item.time,
isSelf: item.flow == 'in' ? false : true,
avatar: item.flow == 'in' ? item.avatar : vm.myAvatar,
time: item.timing,
showTime: item.showTime,
videoDur: item.type == 'video' ? getVideoTime(item.attach.dur) : '',
audioDur: item.type == 'audio' ? (item.attach.dur / 1000).toFixed(0) : '',
name: item.fromNick,
userId: item.from,
msgType: item.type,
tips: vm.groupNotification(item)
})
})
console.log(vm.msgList, '88888888888888888')
vm.toView = `id_${object[0].time}`
vm.loading = true
})
vm.$get({url: `${service.host}/chat/user/${vm.otherUserId}/message/list`, data}).then(({code, data}) => {
if (code === 0) {
console.log(data, '-------------------')
if (data && data.length > 0) {
// if (vm.msgList && vm.msgList.length == 0) {
// vm.sendMsgReceipt(data[0])
// }
data.forEach((item, index) => {
item.time = new Date(item.create_time.replace(/[-]/g, '/').replace(/[-]/, '')).getTime()
item.attach = item.attach ? JSON.parse(item.attach) : ''
item.showTime = timeContrast(format(item.time), vm.lastTime)
item.timing = getTime(format(item.time))
if (item.showTime && index > 0) {
data[index].showTime = false
data[index - 1].showTime = true
}
if (item.content_type == 'text' && /\[[^\]]+\]/.test(item.content)) {
item.body = vm.transitionMsg(item.content)
}
vm.lastTime = format(item.time)
})
})
} else {
vm.loading = true
}
if (object && object.length < 15) {
vm.finished = true
vm.lastMsgId = data[data.length - 1].id
vm.beginTime = data[data.length - 1].time
setTimeout(() => {
data.forEach((item) => {
vm.msgList.unshift({
text: item.content,
attach: vm.calculatePic(item.attach, item.content_type),
id: `id_${item.time}`,
timestamp: item.time,
isSelf: item.is_mine == 0 ? false : true,
avatar: item.is_mine == 0 ? vm.otherAvatar : vm.myAvatar,
time: item.timing,
showTime: item.showTime,
videoDur: item.content_type == 'video' ? getVideoTime(item.attach.dur) : '',
audioDur: item.content_type == 'audio' ? (item.attach.dur / 1000).toFixed(0) : '',
name: item.fromNick,
isSend: 1,
userId: item.from,
msgType: item.content_type
})
})
console.log(vm.msgList, data[0].time, '88888888888888888')
vm.$nextTick(() => {
if (vm.msgList.length < 8) {
vm.toView = `id_${data[0].time}`
}
vm.lastId = `${data[data.length - 1].id}`
vm.loading = true
// 防止撑开触发加载历史数据
setTimeout(() => {
vm.uploadState = false
}, 500)
})
})
} else {
vm.loading = true
}
if (data && data.length < 7) {
vm.finished = true
}
}
}).catch(err => {
wx.hideLoading()
console.log(err)
})
// let data = {}
// if (vm.uploadState || vm.videoState) {
// return
// }
// if (!vm.lastMsgId) {
// data = {
// scene: 'team',
// to: vm.otherUserId,
// limit: 15
// }
// } else {
// data = {
// scene: 'team',
// to: vm.otherUserId,
// limit: 15,
// reverse: false,
// endTime: vm.beginTime,
// lastMsgId: vm.lastMsgId
// }
// }
// if (vm.finished) {
// return
// }
// vm.$showLoading('')
// app.globalData.nim.msgLog.getHistoryMsgs(data).then((object) => {
// if (object && object.length > 0) {
// if (vm.msgList && vm.msgList.length == 0) {
// // 标记IM消息已读
// vm.sendMsgReceipt()
// }
// object.forEach((item, index) => {
// item.avatar = 'https://image.fulllinkai.com/202307/18/449c3253ca2bbed9314d39977a486d0e.png',
// item.showTime = timeContrast(format(item.time), vm.lastTime)
// item.timing = getTime(format(item.time))
// if (item.showTime && index > 0) {
// object[index].showTime = false
// object[index - 1].showTime = true
// }
// if (item.type == 'text' && /\[[^\]]+\]/.test(item.body)) {
// item.body = vm.transitionMsg(item.body)
// }
// vm.lastTime = format(item.time)
// // 获取成员头像后再循环获取数据
// app.globalData.nim.user.getUsersNameCardFromServer({
// accounts: [item.from]
// }).then((res) => {
// item.avatar = res[0].avatar
// if (index + 1 == object.length) {
// vm.lastMsgId = object[object.length - 1].idServer
// vm.beginTime = object[object.length - 1].time
//
// setTimeout(() => {
// object.forEach((item) => {
// vm.msgList.unshift({
// text: item.body,
// attach: vm.calculatePic(item.attach, item.type),
// id: `id_${item.time}`,
// timestamp: item.time,
// isSelf: item.flow == 'in' ? false : true,
// avatar: item.flow == 'in' ? item.avatar : vm.myAvatar,
// time: item.timing,
// showTime: item.showTime,
// videoDur: item.type == 'video' ? getVideoTime(item.attach.dur) : '',
// audioDur: item.type == 'audio' ? (item.attach.dur / 1000).toFixed(0) : '',
// name: item.fromNick,
// userId: item.from,
// msgType: item.type,
// tips: vm.groupNotification(item)
// })
// })
// console.log(vm.msgList, '88888888888888888')
// vm.toView = `id_${object[0].time}`
// vm.loading = true
// })
// }
// })
// })
// } else {
// vm.loading = true
// }
// if (object && object.length < 15) {
// vm.finished = true
// }
// wx.hideLoading()
// })
},
// 监听底部输入框的高度
changeInputHeight(e) {
@ -1482,7 +1561,7 @@ wepy.page({
// 底部输入框高度
vm.changeInputHeight(true)
// 标记消息已读
vm.groupIsRead()
// vm.groupIsRead()
vm.teamsSessions()
wx.setNavigationBarTitle({
title: vm.otherUserName,

View File

@ -89,6 +89,10 @@ page {
overflow: hidden;
}
}
.ui-filter{
filter: blur(4px) contrast(.8);
}
}
.m_fans_lst {
@ -234,29 +238,25 @@ page {
<block v-else>
<view class="m_vc_lst">
<block v-for="(item,index) in list" :key="index">
<view v-if="item.other_user" class="u_vc_lst" :style="{'filter:blur(4px) contrast(.8)' : index >= 3 && userInfo.rank_id == 0}" @longpress="deleteRecord(item, index)" @tap="jumpPath(item, index)">
<view class="u_vc_lst {{index >= 3 && !userInfo.rank_id ? 'ui-filter' : ''}}" @longpress="deleteRecord(item, index)" @tap="jumpPath(item, index)">
<view class="f-fc u_box">
<view class="f-fc">
<image class="u_vclst_img" :src="item.other_user.avatar || item.other_user.photo" mode="aspectFill" @tap.stop="gotofriends(item, index)"></image>
<image class="u_vclst_img" :src="item.photo" mode="aspectFill" @tap.stop="gotofriends(item, index)"></image>
<view class="u_vclst_t_box">
<view class="f-fc">
<view class="u_vclst_name">{{item.other_user.nickname}}</view>
<view class="u_vclst_a_box f-fc age_g font_22" v-if="item.other_user.sex === 2">
<image class="a_sex_img" src="https://image.fulllinkai.com/202208/09/dfed05b3e1e1880a3a6f81806d99e9de.png" mode="widthFix"></image>
<view>{{item.other_user.year}}</view>
</view>
<view class="u_vclst_a_box f-fc age_b font_22" v-if="item.other_user.sex === 1">
<image class="a_sex_img" src="https://image.fulllinkai.com/202208/09/77cd63f40e622e54a859e751269eb920.png" mode="widthFix"></image>
<view>{{item.other_user.age}}</view>
<view class="u_vclst_name">{{item.nickname}}</view>
<view class="u_vclst_a_box f-fc {{item.sex === 2 ? 'age_g' : 'age_b'}} font_22">
<image v-if="item.sex === 2" class="a_sex_img" src="https://image.fulllinkai.com/202208/09/dfed05b3e1e1880a3a6f81806d99e9de.png" mode="widthFix"></image>
<image v-else class="a_sex_img" src="https://image.fulllinkai.com/202208/09/77cd63f40e622e54a859e751269eb920.png" mode="widthFix"></image>
<view>{{item.year}}</view>
</view>
</view>
<view class="f-fc">
<view class="u_state">{{item.other_user.stature || ''}} {{item.other_user.city || ''}}</view>
<view class="u_state">{{item.stature || ''}} {{item.city || ''}}</view>
</view>
</view>
</view>
<view class="color999">{{item.created_at}}</view>
<view class="ui-visitor-detail-btn font_26 color999" v-if="userInfo.rank_id == 9 && type != 'review' && type !='fans'">来访{{item.count}}次</view>
</view>
<view class="u_vertical"></view>
</view>
@ -265,7 +265,7 @@ page {
</block>
</view>
</view>
<view class="m_unl_bu f-fcc" v-if="list.length > 3 && userInfo.rank_id == 0">
<view class="m_unl_bu f-fcc" v-if="list.length > 3 && !userInfo.rank_id">
<image class="u_unl_img" @tap="handleVip" :src="buImg" mode="aspectFit" lazy-load="false"></image>
</view>
<view class="cu-modal" :class="{'show' : tipsShow}">
@ -288,7 +288,6 @@ page {
import wepy from '@wepy/core'
import https from '../../mixins/https'
import base from '../../mixins/base'
import utils from '../../utils/util'
import {service} from '../../config'
wepy.page({
@ -313,28 +312,15 @@ wepy.page({
methods: {
getList() {
let vm = this
let url = ``
if (vm.type == 'fans') {
url = `${service.host}/follow/fans/list`
} else if (vm.type == 'friend') {
url = `${service.host}/friends/v2`
} else if (vm.type == 'review') {
url = `${service.host}/my/preview/histroies`
} else if (vm.type == 'visitor') {
url = `${service.host}/user/preview/list`
} else {
url = `${service.host}/followers`
}
let data = {
page: vm.page,
type: 'single',
size: 15
type: 'single'
}
vm.$showLoading('加载中...')
vm.$get({url: url, data}).then(({code, data}) => {
vm.$get({url: `${service.host}/preview/other/list`, data}).then(({code, data}) => {
if (code === 0) {
data.data.forEach((item) => {
item.created_at = item.updated_at ? utils.commentTimeHandle(item.updated_at) : utils.commentTimeHandle(item.created_at)
// item.created_at = item.updated_at ? utils.commentTimeHandle(item.updated_at) : utils.commentTimeHandle(item.created_at)
})
if (vm.list.length === 0 || vm.page === 1) {
vm.list = data.data
@ -366,10 +352,10 @@ wepy.page({
// 跳转用户详情没有vip时点击第四个用户弹框提示
jumpPath(e, index) {
let vm = this
if (index >= 3 && vm.userInfo.rank_id == 0) {
vm.pic = e.other_user.photo || e.other_user.avatar
vm.city = e.other_user.city
vm.age = e.other_user.year
if (index >= 3 && !vm.userInfo.rank_id) {
vm.pic = e.photo
vm.city = e.city
vm.age = e.year
vm.tipsShow = true
return
}
@ -400,20 +386,8 @@ wepy.page({
onLoad(e) {
let vm = this
vm.type = e.type
if (vm.type == 'fans') { // 我的粉丝
vm.buImg = 'https://images.ufutx.com/202106/21/b056766538c70151dc2d37b118ea6ce4.png'
vm.dialogIng = 'https://images.ufutx.com/202106/21/f678acbbde4c175bef005b960de0f6c3.png'
} else if (vm.type == 'review') { // 回看
vm.buImg = 'https://images.ufutx.com/202106/21/42c2796abf4217cd79871c29ec794ca4.png'
vm.dialogIng = 'https://images.ufutx.com/202106/21/0e7d701cd1280a9b2ecffd1287c9abd1.png'
} else if (vm.type == 'visitor') { // 访客
vm.buImg = 'https://images.ufutx.com/202106/21/efbb981085024321ef3ff0a1c7999ab4.png'
vm.dialogIng = 'https://images.ufutx.com/202103/19/d50225289964b293f34ded71a30ae691.png'
}
wx.setNavigationBarTitle({
title: e.title,
success: function () {}
})
vm.buImg = 'https://images.ufutx.com/202106/21/42c2796abf4217cd79871c29ec794ca4.png'
vm.dialogIng = 'https://images.ufutx.com/202106/21/0e7d701cd1280a9b2ecffd1287c9abd1.png'
vm.getList()
vm.userInfo = wx.getStorageSync('userInfo')
}
@ -421,7 +395,7 @@ wepy.page({
</script>
<config>
{
navigationBarTitleText: '',
navigationBarTitleText: '我看过谁',
enablePullDownRefresh: true,
backgroundColorTop: '#ffffff',
backgroundColorBottom: '#ffffff',

View File

@ -207,7 +207,7 @@ page {
<image class="u_returnTop_img" @tap.stop="BackTop" src="https://images.ufutx.com/202106/23/f0d10551dc5d3399cc7f15805cf04f4f.png" mode="scaleToFill" lazy-load="false"></image>
</view>
<!--动态操作功能selectData选择的动态数据、selectIndex选中的动态下标、admin是否管理员、from来自哪个父组件-->
<dynamicOperation :selectData="selectData" :chooseShow.sync="chooseShow" :selectIndex="selectIndex" :admin="admin" :from="'dynamic'" @hideModal="hideModal" @operation="changeOperation" @signInVerify="signInVerify"></dynamicOperation>
<dynamicOperation :selectData="selectData" :chooseShow.sync="chooseShow" :selectIndex="selectIndex" :admin="admin" :from="'dynamic'" @hideModal="hideModal" @changeOperation="changeOperation" @signInVerify="signInVerify"></dynamicOperation>
<loginDialog :loginShow="loginShow" @hiddenLogin="hiddenLogin"></loginDialog>
</template>

View File

@ -100,9 +100,13 @@ page {
swiper-item{
width: 640rpx !important;
left: 30rpx;
left: 60rpx;
padding: 0 12zrpx;
}
.ui-swiper-item{
left: 30rpx!important;
}
}
.card-swiper swiper-item.cur .swiper-item, .swiper-item{
@ -230,7 +234,7 @@ page {
</view>
<view class="box_swiper">
<swiper class="card-swiper" bindchange="cardSwiper" :current="cardCur" previousMargin="-2px" nextMargin="10px">
<swiper-item v-for="(item,index) in referrals" :key="index" class="{{cardCur==index?'cur':'noneBor'}} {{cardCur==index+1?'lastPic':''}} {{cardCur==index-1?'nextPic':''}}">
<swiper-item v-for="(item,index) in referrals" :key="index" class="{{cardCur==index?'cur':'noneBor'}} {{cardCur==index+1?'lastPic':''}} {{cardCur==index-1?'nextPic':''}} {{cardCur == 0 ? 'ui-swiper-item' : ''}}">
<block v-if="item.type && item.type == 'time'">
<view class="swiper-item radius shadow">
<view class="t_title color999 font_26">福恋会在每天 12 点为你推荐 7 个用户</view>
@ -258,17 +262,17 @@ page {
</view>
</block>
<block v-else-if="item.type && item.type == 'activity'">
<view class="swiper-item radius shadow activityCard" @tap="goto_2(item.path, item.type)">
<view class="bc_img" :style="{backgroundImage:'url('+(item.pic)+');'}"></view>
<view class="swiper-item radius shadow activityCard">
<view class="bc_img" :style="{backgroundImage:'url('+(item.photo)+');'}"></view>
</view>
</block>
<block v-else>
<view class="swiper-item radius shadow" @tap="jumpPath(`/pages/home/information?id=${item.id}`)">
<view class="bc_img" :style="{backgroundImage:'url('+(item.pic)+');'}" @tap="goto_3('/pages/home/information?id={{item.id}}','user')"></view>
<view class="bc_img" :style="{backgroundImage:'url('+(item.photo)+');'}"></view>
<view class="f-fbc d_user_data ui-mt-18">
<view class="f-fbc ">
<span class="bold color333 font_32 ellipsis_1" style="max-width: 30vw;">{{ item.nickname }}</span>
<image src="https://image.fulllinkai.com/202206/10/d0913df8b234057229ab3dd102497a50.png" class="vip_icon" mode="widthFix" v-if="item.rank_id> 0"></image>
<span class="bold color333 font_32 ellipsis_1" style="max-width: 30vw;">{{ item.nickname }}{{cardCur}}</span>
<image src="https://image.fulllinkai.com/202206/10/d0913df8b234057229ab3dd102497a50.png" class="vip_icon" mode="widthFix" v-if="item.rank_id"></image>
<image src="https://image.fulllinkai.com/202206/10/bfad7e2a8e86cf7912ff280234a35606.png" class="vip_icon" mode="widthFix" v-else></image>
<image src="https://image.fulllinkai.com/202206/10/5cb84879a0dc81757dc526ebeb61bc0e.png" class="real_icon" mode="widthFix" v-if="item.is_approved == 1"></image>
<image src="https://image.fulllinkai.com/202206/10/279ade8a42810a91eb80a0717823dffa.png" class="reality_icon" mode="widthFix" v-if="item.is_real_approved == 1"></image>
@ -279,7 +283,7 @@ page {
</view>
</view>
<view class="f-fbc d_user_data ui-mt-8">
<span class="color333 font_28 ellipsis_1">{{ item.year + ' · ' }}{{item.stature + 'cm · '}}{{ item.degree ? item.degree + ' · ' : '' }}{{ item.industry_sub ? item.industry_sub : '' }}</span>
<span class="color333 font_28 ellipsis_1">{{ item.year + ' · ' }}{{item.stature + ' · '}}{{ item.degree ? item.degree + ' · ' : '' }}{{ item.industry_sub ? item.industry_sub : '' }}</span>
</view>
<view class="f-fbc d_user_data ui-mt-6">
<span class="color666 font_28 ellipsis_1" style="width: 80vw;">{{ item.introduction || '介绍:未填写' }}</span>
@ -325,6 +329,7 @@ import wepy from '@wepy/core'
import https from '../../mixins/https'
import base from '../../mixins/base'
import {service} from '../../config'
import {formatRemainTimeData} from '../../mixins/plugins'
wepy.page({
config: {},
@ -340,15 +345,9 @@ wepy.page({
squarePage: 1,
no_more: false,
cardCur: 0, // 为你推荐轮播下标
referrals: [ // 为你推荐
{name: '焉然', pic: 'https://image.fulllinkai.com/202409/24/ccd8c3e29b9bdfc89907d92584497154.jpeg'},
{name: 'Sady', pic: 'https://image.fulllinkai.com/202409/24/ccd8c3e29b9bdfc89907d92584497154.jpeg'},
{name: 'Sunny', pic: 'https://image.fulllinkai.com/202409/24/ccd8c3e29b9bdfc89907d92584497154.jpeg'},
{name: '焉然', pic: 'https://image.fulllinkai.com/202409/24/ccd8c3e29b9bdfc89907d92584497154.jpeg'},
{name: '智锋', pic: 'https://image.fulllinkai.com/202409/24/ccd8c3e29b9bdfc89907d92584497154.jpeg'},
{name: '志辉', pic: 'https://image.fulllinkai.com/202409/24/ccd8c3e29b9bdfc89907d92584497154.jpeg'},
{name: '焉然', pic: 'https://image.fulllinkai.com/202409/24/ccd8c3e29b9bdfc89907d92584497154.jpeg'}
]
referrals: [], // 为你推荐
countdown: {d: '0', h: '00', m: '00', s: '00'},
timer: null
},
methods: {
// 获取置顶推荐用户
@ -382,7 +381,8 @@ wepy.page({
let vm = this
vm.$get({url: `${service.host}/other/user/recommend`}).then(({code, data}) => {
if (code === 0) {
// vm.topList = data || []
vm.referrals = data
vm.referrals.push({type: 'time'})
}
wx.hideLoading()
}).catch(err => {
@ -458,6 +458,28 @@ wepy.page({
}
})
},
getTimeFn() {
let vm = this
let date = new Date()
date.setDate(date.getDate() + 1)// 获取明天的日期
let year = date.getFullYear()
let month = date.getMonth() + 1
if (month < 10) {
month = '0' + month
}
let day = date.getDate()
if (day < 10) {
day = '0' + day
}
let time = `${year}-${month}-${day} 12:00:00`
vm.timer = setInterval(() => {
vm.countdown = formatRemainTimeData(time)
if (vm.countdown.d == 0 && vm.countdown.h == '00' && vm.countdown.m == '00' && vm.countdown.s == '00') {
clearInterval(vm.timer)
vm.timer = null
}
}, 1000)
},
cardSwiper(e) {
let vm = this
let source = e.$wx.detail.source
@ -494,6 +516,8 @@ wepy.page({
vm.getSquare()
},
onShow() {
let vm = this
vm.getTimeFn()
},
onLoad() {
let vm = this

View File

@ -362,11 +362,11 @@ wepy.page({
let vm = this
wx.showModal({
title: '温馨提示',
content: `是否确认退出${e.title}群聊`,
content: `是否确认删除`,
success: function (res) {
if (res.confirm) {
vm.$showLoading('')
vm.$post({url: `${service.host}/team/${e.id}/leave`}).then(({code, data}) => {
vm.$delete({url: `${service.host}/chat/linkmen/${e.id}`}).then(({code, data}) => {
if (code == 0) {
vm.$showToast(`已删除`)
vm.list.splice(index, 1)