update聊天修改、人脸核身

This commit is contained in:
zengBin 2024-09-06 10:09:34 +08:00
parent f99c7866aa
commit ea8ce09324
25 changed files with 950 additions and 31 deletions

5
package-lock.json generated
View File

@ -4841,6 +4841,11 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true "dev": true
}, },
"nim-web-sdk-ng": {
"version": "10.4.0",
"resolved": "https://registry.npmmirror.com/nim-web-sdk-ng/-/nim-web-sdk-ng-10.4.0.tgz",
"integrity": "sha512-eJCIE7/VlnqLDZb81wF8NDvep9WKfHeL7PH8OeFn7AmN2G/nFGuNkl6tcGEw635U6mitLwCV0CBdQ6tSF16mEA=="
},
"node-releases": { "node-releases": {
"version": "2.0.10", "version": "2.0.10",
"resolved": "https://registry.npmmirror.com/node-releases/-/node-releases-2.0.10.tgz", "resolved": "https://registry.npmmirror.com/node-releases/-/node-releases-2.0.10.tgz",

View File

@ -14,6 +14,9 @@
import wepy from '@wepy/core' import wepy from '@wepy/core'
import vuex from '@wepy/x' import vuex from '@wepy/x'
import promisify from '@wepy/use-promisify' import promisify from '@wepy/use-promisify'
import { wx_login } from './utils/util'
import { IM } from './utils/im'
import {service} from './config'
wepy.use(promisify) wepy.use(promisify)
wepy.use(vuex) wepy.use(vuex)
@ -33,6 +36,7 @@ wepy.app({
navRight: 0, // 胶囊距右方间距(方保持左、右间距一致) navRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
navTop: 0, // 胶囊距顶部间距 navTop: 0, // 胶囊距顶部间距
navHeight: 0, // 胶囊高度(自定义内容可与胶囊高度保证一致) navHeight: 0, // 胶囊高度(自定义内容可与胶囊高度保证一致)
windowHeight: 0,
userInfo: null, userInfo: null,
uploadData: null, uploadData: null,
nim: null, nim: null,
@ -42,6 +46,7 @@ wepy.app({
onLaunch() { onLaunch() {
let vm = this let vm = this
vm.appLogin()
wx.getSystemInfo({ wx.getSystemInfo({
success: res => { success: res => {
vm.$options.globalData.bottomHeight = res.screenHeight - res.safeArea.bottom vm.$options.globalData.bottomHeight = res.screenHeight - res.safeArea.bottom
@ -67,6 +72,7 @@ wepy.app({
vm.$options.globalData.navRight = systemInfo.screenWidth - menuButtonInfo.right vm.$options.globalData.navRight = systemInfo.screenWidth - menuButtonInfo.right
vm.$options.globalData.navTop = menuButtonInfo.top vm.$options.globalData.navTop = menuButtonInfo.top
vm.$options.globalData.navHeight = menuButtonInfo.height vm.$options.globalData.navHeight = menuButtonInfo.height
vm.$options.globalData.windowHeight = systemInfo.windowHeight - vm.$options.globalData.navBarHeight
}, },
onShow(options) { onShow(options) {
@ -91,13 +97,36 @@ wepy.app({
onHide() {}, onHide() {},
methods: {} methods: {
appLogin() {
let vm = this
wx_login().then((e) => {
wx.hideLoading()
let {accid, token} = e.data.user.wyy_user
vm.$options.globalData.nim = IM(accid, token)
}).catch((msg) => {
wx.showModal({ // 使用模态框提示用户进行操作
title: '温馨提示:',
content: `${msg}`,
showCancel: false,
success: function (res) {
if (res.confirm) {
wx.navigateBack({
delta: 1
})
}
}
})
})
}
}
}) })
</script> </script>
<config> <config>
{ {
pages: [ pages: [
'pages/tabBar/welcome', 'pages/tabBar/welcome',
'pages/tabBar/dynamic',
'pages/tabBar/home', 'pages/tabBar/home',
'pages/tabBar/news', 'pages/tabBar/news',
'pages/tabBar/user', 'pages/tabBar/user',
@ -151,18 +180,23 @@ borderStyle: 'black',
list: [ list: [
{ {
pagePath: 'pages/tabBar/home', pagePath: 'pages/tabBar/home',
iconPath: './images/tabbar/inactiveHome.png', selectedIconPath: './images/tabbar/homeActive.png',
selectedIconPath: './images/tabbar/activeHome.png', iconPath: './images/tabbar/home.png',
text: '健康' text: '推荐'
}, {
pagePath: 'pages/tabBar/dynamic',
selectedIconPath: './images/tabbar/attentionActive.png',
iconPath: './images/tabbar/attention.png',
text: '发现'
}, { }, {
pagePath: 'pages/tabBar/news', pagePath: 'pages/tabBar/news',
iconPath: './images/tabbar/inactiveServe.png', selectedIconPath: './images/tabbar/messageActive.png',
selectedIconPath: './images/tabbar/activeServe.png', iconPath: './images/tabbar/message.png',
text: '商城' text: '消息'
}, { }, {
pagePath: 'pages/tabBar/user', pagePath: 'pages/tabBar/user',
iconPath: './images/tabbar/inactiveMy.png', selectedIconPath: './images/tabbar/myActive.png',
selectedIconPath: './images/tabbar/activeMy.png', iconPath: './images/tabbar/my.png',
text: '我的' text: '我的'
}] }]
}, },
@ -170,10 +204,6 @@ useExtendedLib: {
'weui': true 'weui': true
}, },
plugins: { plugins: {
"QNBleApi": {
"version": "4.7.1",
"provider": "wx2a4ca48ed5e96748"
},
"FL-plugin": { "FL-plugin": {
"version": "0.0.3", "version": "0.0.3",
"provider": "wxc41491431733671e" "provider": "wxc41491431733671e"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
src/images/tabbar/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
src/images/tabbar/my.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -12,7 +12,6 @@ export default {
$get({url = '', headers = {}, data = {}, timeout = 8000}) { $get({url = '', headers = {}, data = {}, timeout = 8000}) {
let vm = this let vm = this
const methods = 'GET' const methods = 'GET'
vm.$showLoading('')
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.$ajax({url, headers, methods, data, timeout}).then(({code, data}) => { this.$ajax({url, headers, methods, data, timeout}).then(({code, data}) => {
resolve({code, data}) resolve({code, data})

View File

@ -193,6 +193,105 @@ const getDiffTime = (recordTime, yearsFlag) => {
return '数据异常' return '数据异常'
} }
const commentTimeHandle = (dateStr, typ) => {
let time = dateStr
let type = typ
let repTime = time.replace(/-/g, '/')// 用正则兼容ios
let targetDate = new Date(repTime)
let year = targetDate.getFullYear()
let month = targetDate.getMonth() + 1
let day = targetDate.getDate()
let nowDate = new Date()
let timeTamp = Date.parse(repTime)
let publishTime = timeTamp / 1000, // 获取dataStr的秒数
date = new Date(publishTime * 1000), // 获取dateStr的标准格式
// 获取date 中的 月 日 时 分 秒
M = date.getMonth() + 1,
D = date.getDate(),
H = date.getHours(),
m = date.getMinutes(),
s = date.getSeconds()
// 对 月 日 时 分 秒 小于10时, 加0显示 例如: 09-09 09:01
if (M < 10) {
M = '0' + M
}
if (D < 10) {
D = '0' + D
}
if (H < 10) {
H = '0' + H
}
if (m < 10) {
m = '0' + m
}
if (s < 10) {
s = '0' + s
}
let nowTime = new Date().getTime() / 1000, // 获取此时此刻日期的秒数
diffValue = nowTime - publishTime, // 获取此时 秒数 与 要处理的日期秒数 之间的差值
diff_days = parseInt(diffValue / 86400), // 一天86400秒 获取相差的天数 取整
diff_hours = parseInt(diffValue / 3600), // 一时3600秒
diff_minutes = parseInt(diffValue / 60),
diff_secodes = parseInt(diffValue)
if (type == 3) {
if (diff_days <= 0) {
return '今天' + ' ' + H + ':' + m
} else if (diff_days > 0 && diff_days < 2) {
return '昨天' + ' ' + H + ':' + m
} else if (year == nowDate.getFullYear()) {
return month + '-' + day + ' ' + H + ':' + m
} else {
return year + '-' + month
}
}
if (type == 2) {
if (diff_days <= 0) {
return '今天'
} else if (diff_days > 0 && diff_days < 2) {
return '昨天'
} else if (year == nowDate.getFullYear()) {
if (day > 9) {
return month + '/' + day
} else {
return month + '/' + 0 + day
}
} else {
if (day > 9) {
return month + '/' + day
} else {
return month + '/' + 0 + day
}
}
} else {
if (diff_days > 0 && diff_days < 2) { // 相差天数 0 < diff_days < 2 时, 直接返出
return diff_days + '天前'
} else if (diff_days <= 0 && diff_hours > 0) {
return diff_hours + '小时前'
} else if (diff_hours <= 0 && diff_minutes > 0) {
return diff_minutes + '分钟前'
} else if (diff_secodes < 60) {
if (diff_secodes <= 0) {
return '刚刚'
} else {
return diff_secodes + '秒前'
}
} else if (year == nowDate.getFullYear()) {
if (day > 9) {
return month + '-' + day
} else {
return month + '-' + 0 + day
}
} else {
if (day > 9) {
return year + '-' + month + '-' + day
} else {
return year + '-' + month + '-' + 0 + day
}
}
}
}
const getElement_WH = (element) => { // 获取元素位置 const getElement_WH = (element) => { // 获取元素位置
return new Promise((resolve) => { return new Promise((resolve) => {
let query = wx.createSelectorQuery() let query = wx.createSelectorQuery()
@ -210,5 +309,6 @@ module.exports = {
timeContrast, timeContrast,
getVideoTime, getVideoTime,
getDiffTime, getDiffTime,
commentTimeHandle,
getElement_WH getElement_WH
} }

View File

@ -69,6 +69,20 @@ page {
float: right; float: right;
} }
.ui-error-icon, .ui-error-icon-v2{
width: 40rpx;
height: 40rpx;
position: absolute;
top: 50%;
left: -50rpx;
transform: translateY(-50%);
}
.ui-error-icon-v2{
left: initial;
right: -60rpx
}
.ui-user-pic { .ui-user-pic {
width: 86rpx; width: 86rpx;
height: 86rpx; height: 86rpx;
@ -102,7 +116,6 @@ page {
} }
.ui-msg-left-pic, .ui-msg-right-pic{ .ui-msg-left-pic, .ui-msg-right-pic{
border: 2rpx solid #eaeaea;
max-width: 200rpx; max-width: 200rpx;
max-height: 200rpx; max-height: 200rpx;
border-radius: 20rpx; border-radius: 20rpx;
@ -565,7 +578,9 @@ page {
<!-- <view class="text-center font_2 ui-pb-24 color666" v-if="finished">没有更多消息了</view>--> <!-- <view class="text-center font_2 ui-pb-24 color666" v-if="finished">没有更多消息了</view>-->
<view v-for="(item, index) in msgList" :key="index" class="ui-msg-data" id="{{item.id}}"> <view v-for="(item, index) in msgList" :key="index" class="ui-msg-data" id="{{item.id}}">
<view class="text-center color999 font_24 ui-pb-16" v-if="item.showTime">{{item.time}}</view> <view class="text-center color999 font_24 ui-pb-16" v-if="item.showTime">{{item.time}}</view>
<view class="{{!item.isSelf ? 'ui-left-msg-box f-fl' : 'ui-right-msg-box f-fr'}}"> <view class="ui-relative {{!item.isSelf ? 'ui-left-msg-box f-fl' : 'ui-right-msg-box f-fr'}}">
<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> <image v-if="!item.isSelf" class="ui-user-pic" :src="item.avatar" mode="aspectFill"></image>
<view class="ui-pl-12"> <view class="ui-pl-12">
<view class="ui-relative"> <view class="ui-relative">
@ -867,7 +882,7 @@ wepy.page({
showTime: timeContrast(format(msg.time), vm.lastTime), showTime: timeContrast(format(msg.time), vm.lastTime),
name: msg.fromNick, name: msg.fromNick,
userId: msg.from, userId: msg.from,
isSend: 1, isSend: msg.status == 'sendFailed' ? 2 : 1, // sendFailed 发送失败
msgType: 'image' msgType: 'image'
}) })
vm.lastTime = format(msg.time) vm.lastTime = format(msg.time)
@ -882,9 +897,12 @@ wepy.page({
}) })
} }
}) })
} else {
vm.sendFileError()
} }
wx.hideLoading() wx.hideLoading()
}).catch(() => { }).catch(() => {
vm.uploadState = false
wx.hideLoading() wx.hideLoading()
}) })
}, },
@ -933,6 +951,7 @@ wepy.page({
} }
}) })
}, },
// 发送语音
sendAudio(file) { sendAudio(file) {
let vm = this let vm = this
vm.openShow = false vm.openShow = false
@ -968,9 +987,7 @@ wepy.page({
vm.lastTime = format(msg.time) vm.lastTime = format(msg.time)
vm.$nextTick(() => { vm.$nextTick(() => {
vm.toView = `id_${msg.time}` vm.toView = `id_${msg.time}`
})
// 防止音频撑开触发加载历史数据 // 防止音频撑开触发加载历史数据
vm.$nextTick(() => {
setTimeout(() => { setTimeout(() => {
vm.uploadState = false vm.uploadState = false
}, 500) }, 500)
@ -978,6 +995,30 @@ wepy.page({
} }
}) })
}, },
// 发送图片或视频失败
sendFileError() {
let vm = this
let timeData = new Date().getTime()
vm.msgList.push({
text: '',
attach: {url: 'https://image.fulllinkai.com/202408/19/fc68d5ba0d7c952f08e2ae3f04ed70a9.png', w: 200, h: 162},
id: `id_${timeData}`,
isSelf: true,
avatar: vm.myAvatar,
name: vm.myName,
userId: vm.myUserId,
isSend: 2,
msgType: 'image'
})
vm.lastTime = format(timeData)
vm.$nextTick(() => {
vm.toView = `id_${timeData}`
// 防止音频撑开触发加载历史数据
setTimeout(() => {
vm.uploadState = false
}, 500)
})
},
// 标记信息已读 // 标记信息已读
sendMsgReceipt(e) { sendMsgReceipt(e) {
app.globalData.nim.msg.sendMsgReceipt({ app.globalData.nim.msg.sendMsgReceipt({
@ -1039,6 +1080,7 @@ wepy.page({
} }
vm.$showLoading('') vm.$showLoading('')
app.globalData.nim.msgLog.getHistoryMsgs(data).then((object) => { app.globalData.nim.msgLog.getHistoryMsgs(data).then((object) => {
console.log(object, '222222222222222222')
if (object && object.length > 0) { if (object && object.length > 0) {
if (vm.msgList && vm.msgList.length == 0) { if (vm.msgList && vm.msgList.length == 0) {
vm.sendMsgReceipt(object[0]) vm.sendMsgReceipt(object[0])
@ -1073,6 +1115,7 @@ wepy.page({
videoDur: item.type == 'video' ? getVideoTime(item.attach.dur) : '', videoDur: item.type == 'video' ? getVideoTime(item.attach.dur) : '',
audioDur: item.type == 'audio' ? (item.attach.dur / 1000).toFixed(0) : '', audioDur: item.type == 'audio' ? (item.attach.dur / 1000).toFixed(0) : '',
name: item.fromNick, name: item.fromNick,
isSend: 1,
userId: item.from, userId: item.from,
msgType: item.type msgType: item.type
}) })
@ -1502,13 +1545,23 @@ wepy.page({
// 底部输入框高度 // 底部输入框高度
vm.changeInputHeight(true) vm.changeInputHeight(true)
vm.$nextTick(() => { vm.$nextTick(() => {
setTimeout(() => {
// 获取历史消息 // 获取历史消息
vm.getHistoryMsg() vm.getHistoryMsg()
// 实时获取对方发送的消息 // 实时获取对方发送的消息
app.globalData.nim.on('msg', function (e) { app.globalData.nim.on('msg', function (e) {
vm.reception(e) vm.reception(e)
}) })
}, 3000)
}) })
// vm.$nextTick(() => {
// // 获取历史消息
// vm.getHistoryMsg()
// // 实时获取对方发送的消息
// app.globalData.nim.on('msg', function (e) {
// vm.reception(e)
// })
// })
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: vm.otherUserName, title: vm.otherUserName,
success: function () {} success: function () {}

View File

@ -0,0 +1,733 @@
<style lang="less" scoped>
@import url(../../styles/theme.less);
page {
background-color: #ffffff;
}
scroll-view {
height: 100%;
box-sizing: border-box;
}
.ui-tabBar-item{
padding-right: 64rpx;
}
.ui-topicTitle {
display: flex;
margin: 16rpx 30rpx;
justify-content: space-between;
align-items: center;
.ui-hot {
width: 136rpx;
height: 48rpx;
font-size: 34rpx;
font-weight: 600;
color: #333333;
line-height: 48rpx;
}
.ui-more {
width: 125rpx;
height: 34rpx;
font-size: 24rpx;
font-weight: 400;
color: #f33b6c;
line-height: 34rpx;
.ui-rig {
width: 10rpx;
height: 20rpx;
margin-left: 5rpx;
}
}
}
.ui-hotTopic-box{
margin-bottom: 48rpx;
.ui-scroll {
width: 100%;
height: 144rpx;
display: flex;
white-space: nowrap;
.ui-main {
width: 216rpx;
height: 144rpx;
line-height: 144rpx;
border-radius: 16rpx;
display: inline-flex;
margin-right: 12rpx;
position: relative;
flex-direction: column;
justify-content: center;
view:nth-of-type(1) {
width: 100%;
height: 36rpx;
text-align: center;
line-height: 36rpx;
font-size: 26rpx;
font-weight: 500;
color: #FFFFFF;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 0 30rpx;
position: relative;
z-index: 2;
}
view:nth-of-type(2) {
width: 100%;
text-align: center;
height: 32rpx;
line-height: 32rpx;
font-size: 22rpx;
font-weight: 400;
color: #FFFFFF;
position: relative;
z-index: 2;
}
}
.ui-main:nth-of-type(1) {
margin-left: 30rpx;
}
.ui-mask {
width: 216rpx;
height: 144rpx;
border-radius: 16rpx;
position: absolute;
top: 0;
left: 0;
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 100%);
}
}
}
.ui-dynamicTabs {
margin-right: 24rpx;
width: 116rpx;
height: 52rpx;
border-radius: 26rpx;
}
.ui-activeDynamic {
color: #f33b6c;
background: #FFF4F7;
}
.ui-inactiveDynamic {
color: #c2c2c2;
background: #F8F8F8;
}
.ui-user-pic {
width: 80rpx;
min-width: 80rpx;
height: 80rpx;
border-radius: 50%;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
.ui-time {
position: absolute;
right: 30rpx;
top: 30rpx;
}
.ui-name {
width: auto;
max-width: 300rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
height: 40rpx;
font-size: 30rpx;
font-weight: 600;
color: #333333;
line-height: 40rpx;
}
.ui-identification{
color: #f3903b;
padding: 4rpx 12rpx;
line-height: 32rpx;
border-radius: 20rpx;
background: #fff9f4;
margin-left: 14rpx;
.ui-identification-icon{
width: 24rpx;
height: 24rpx;
display: block;
}
}
.referencesIcon {
width: 124rpx;
height: 36rpx;
display: block;
margin-left: 16rpx;
margin-top: 2rpx;
}
.ui-dynamic-content{
white-space: pre-line;
word-break: break-all;
display: -webkit-box;
}
.ui-active-content{
overflow: hidden;
margin-bottom: 15rpx;
white-space: pre-line;
word-wrap: break-word;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
.ui-voteItem{
width: calc(100vw - 156rpx);
background: #f8f8f8;
padding: 16rpx 18rpx;
border-radius: 8rpx;
.ui-vote-icon{
width: 32rpx;
min-width: 32rpx;
margin: 8rpx 8rpx 0 0;
display: block;
}
}
.ui-dynamic-pic-box{
.ui-only-img, .ui-grid-square{
width: 400rpx;
height: 400rpx;
border-radius: 16rpx;
margin-bottom: 10rpx;
display: block;
}
.ui-grid-square{
width: 192rpx;
height: 192rpx;
}
}
.ui-dynamic-pic-box:after{
content: '';
width: 192rpx;
}
.liveImg {
position: relative;
border-radius: 10rpx;
.playImg {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: 72rpx;
height: 72rpx;
}
}
.ui-tags{
width: auto;
height: 50rpx;
background: #fff1f5;
border-radius: 26rpx;
.ui-img {
width: 32rpx;
height: 32rpx;
margin-right: 10rpx;
margin-left: 8rpx;
}
}
.ui-address-icon{
width: 20rpx;
min-width: 20rpx;
height: 24rpx;
margin-right: 4rpx;
}
.ui-like-box{
width: calc(100vw - 156rpx);
display: flex;
justify-content: flex-end;
align-items: center;
margin-top: 20rpx;
padding-bottom: 20rpx;
.ui-like-icon-box{
display: inline-flex;
align-items: center;
height: 30rpx;
font-size: 24rpx;
color: #666666;
position: relative;
margin-right: 50rpx;
.ui-like-icon{
width: 30rpx;
height: 30rpx;
margin-right: 8rpx;
display: block;
}
.ui-like-icon-v2{
width: 32rpx;
height: 32rpx;
margin-right: 6rpx;
margin-top: -8rpx;
display: block;
}
.ui-img2_gif {
position: absolute;
left: -14rpx;
top: -26rpx;
width: 64rpx;
height: 62rpx;
margin-right: 6rpx;
}
}
.ui-cuIcon-moreandroid{
width: 6rpx;
height: 26rpx;
}
}
.ui-line{
margin: 0 30rpx;
height: 2rpx;
background: #f5f5f5;
}
.m_returnTop {
position: fixed;
right: 62rpx;
bottom: 200rpx;
z-index: 99;
-webkit-transition: opacity 1s;
transition: opacity 1s;
.u_returnTop_img {
width: 92rpx;
height: 92rpx;
border-radius: 50%;
box-shadow: 0 0 12rpx 6rpx rgba(0, 0, 0, .06);
}
}
@keyframes opacity{
0%{opacity: 0}
100%{
opacity: 1;
}
}
.hide{
opacity:0;
}
.show{
opacity:1;
}
.dialog {
width: 100%;
background: white;
height: auto;
z-index: 1111;
border-radius: 30rpx 30rpx 0rpx 0rpx;
view {
height: 90rpx;
text-align: center;
line-height: 100rpx;
margin: 0 30rpx;
color: #333333;
}
view:last-of-type {
border-top: 1rpx solid #f5f5f5;
color: #999999;
}
}
</style>
<template>
<view class="ui-dynamic">
<view class="cu-custom">
<view class="cu-bar fixed" :style="{height: CustomBar + 'px', paddingTop: StatusBar + 'px',zIndex: 999}">
<view class="f-fcl ui-ml-30">
<view class="ui-tabBar-item {{tabBarIndex == index ? 'font_34 color-theme bold' : 'font_30 color333'}}" v-for="(item,index) in tabBarList" :key="index" @tap="tabChange(index)">{{item}}</view>
</view>
</view>
</view>
<view :style="{height: navHeight + 'px'}"></view>
<view :style="{height: windowHeight + 'px',backround: '#ffffff'}">
<swiper :style="{height: tabBarIndex == 0 ? '100%' : '92%'}" current="{{tabBarIndex}}" duration="300" bindchange="switchTab">
<swiper-item wx:key="id" style="-webkit-overflow-scrolling:touch">
<scroll-view scroll-top="{{scrollTopHandle}}" scroll-with-animation="true" scroll-anchoring="{{true}}" refresher-enabled="{{true}}" refresher-triggered="{{triggered}}" bindrefresherpulling="onPulling" bindrefresherrefresh="onRefresh" style="height:100%;-webkit-overflow-scrolling: touch" lower-threshold="300" bindscrolltolower="handleScroll" bindscroll="scrollToUpper" scroll-y>
<view class="ui-topicTitle">
<view class="ui-hot">热门话题</view>
<view class="ui-more">更多话题
<image class="ui-rig" src="https://images.ufutx.com/202101/27/aac7d6a4cdd90938d7bcfb378705058c.png" mode="widthFix"></image>
</view>
</view>
<view class="ui-hotTopic-box">
<scroll-view scroll-x="true" class="ui-scroll">
<block v-for="(item,index) in hotTopics" :key="index">
<view v-if="item.is_hot == 1" class="cu-avatar ui-main" @tap.stop="hotTopic(item.id)" style="background-image:url({{ item.back_image }});">
<view>#{{ item.name }}</view>
<view>{{ item.moment_count }} 动态</view>
<view class="ui-mask"></view>
</view>
</block>
</scroll-view>
</view>
<block v-if="item.type != 'vote'">
<view class="f-fcl ui-ml-30">
<view class="font_28 ui-dynamicTabs f-fcc {{dynamicTabsIndex == index ? 'ui-activeDynamic' : 'ui-inactiveDynamic'}}" v-for="(item,index) in dynamicTabs" :key="index" @tap.stop="dynamicTabChange(index)">
{{ item }}
</view>
</view>
<block v-for="(item,index) in dynamicList" :key="index">
<view class="f-fl ui-pl-30 ui-pr-30 ui-pt-30 ui-relative">
<view class="ui-user-pic" v-if="item.u_photo" style="{{'background-image:url(' + item.u_photo + ');'}}"></view>
<view class="ui-user-pic" v-else style="background-image:url(https://image.fulllinkai.com/202203/09/cc1c73eb1a4941fef25a15cd1ff2f9df.png);"></view>
<view class="color999 font_24 ui-time">{{ item.created_at }}</view>
<view class="ui-pl-16">
<view class="f-fc">
<view class="f-fcl">
<view class="ui-name">{{ item.u_nickname || '未设置名称' }}</view>
<view v-if="item.work_user_tag" class="ui-identification font_22 f-fcc">
<image class="ui-identification-icon" src="https://image.fulllinkai.com/202307/21/eb5c30d676eac58af4235bad8e6d8c43.png" mode="widthFix"></image>
{{item.work_user_tag}}
</view>
</view>
<image class="referencesIcon" src="https://image.fulllinkai.com/202207/19/7e78a1dd367f1250d4cba4e85bfd60f1.png" mode="widthFix" v-if="item.u_type != 'single'"></image>
<view class="font_24 ui-ml-24 color-theme" v-if="item.vote_id > 0">
参与了投票:
</view>
</view>
<view class="font_24 f-fbc">
<view class="f-fcl">
<view class="font_24 color-999">{{ item.u_year }}</view>
<view class="font_24 color-999" v-if="item.u_stature"> · {{ item.u_stature }}cm
</view>
<view class="font_24 color-999" v-if="item.u_degree"> · {{ item.u_degree }}</view>
</view>
<view class="color-theme" v-if="item.is_audited == 0">审核中</view>
<view class="color-theme" v-if="item.is_audited == -1">审核失败</view>
</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">
<image class="ui-vote-icon" src="https://image.fulllinkai.com/202206/29/7fd07d9687390a58d25ac92b55d9a9dd.png" mode="widthFix"></image>
<view class="font_28">{{item.v_title}}</view>
</view>
</block>
<block v-else>
<view class="color-theme font_30 ui-mb-10" v-if="item.readmore.auto" @tap.stop="toggle" data-index="{{index}}">{{ item.readmore.tip }}</view>
<view v-if="item.photos.length > 0" class="ui-wrap ui-dynamic-pic-box {{item.photos.length == 2 ? 'f-fl' : 'f-fb'}}">
<image v-for="(itemV2,indexV2) in item.photos" :key="indexV2" @tap.stop="$previewImages(itemV2, item.photos)" class="{{item.photos.length == 1 ? 'ui-only-img':''}} {{item.photos.length > 1 ? 'ui-grid-square' : ''}} {{item.photos.length == 2 ? 'ui-mr-10' : ''}}" :src="itemV2" mode="aspectFill"></image>
</view>
<view v-if="item.play_url">
<view class="liveImg bg-img only-img" data-img_url="{{item.play_url}}" style="display:{{ videoIndex == index ? 'none' : 'block' }};{{'background-image:url(' + item.cover_url + ');'}};{{item.video_width>item.video_height?'width:480rpx;height:270rpx;':'width:320rpx;height:480rpx;'}}">
<image lazy-load="true" class="playImg" src="https://images.ufutx.com/202103/06/8c94ccedcd19252ebf788f422fbdd22d.png" mode="widthFix"></image>
<video id="video{{index}}" referrer-policy="origin" v-if="videoIndex == index" autoplay="{{videoIndex == index ? true : false}}" src="{{item.play_url}}" direction="0" controls="{{true}}" bindfullscreenchange="leaveVideo" class="videoCenter" style="{{item.video_width>item.video_height?'width:480rpx;height:270rpx;':'width:300rpx;height:480rpx;'}}"></video>
</view>
</view>
<view class="font_24 f-fb ui-mt-10" v-if="item.mt_name != null || item.mt_name == ''">
<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 }}
</view>
</view>
<view v-if="item.address != null || item.address == ''" class="color666 font_24 f-fcl ui-mt-16">
<image lazy-load="true" class="ui-address-icon" src="https://images.ufutx.com/202102/04/817a393539ee854226eef79defef2fc4.png" alt=""/>
<view>{{ item.address }}</view>
</view>
</block>
</view>
<view class="color666 font_28 ui-like-box">
<view class="ui-like-icon-box" data-id="{{item.id}}">
<image lazy-load="true" class="ui-like-icon" src="https://images.ufutx.com/202102/04/ab432de170b4e8ca1a1a59e34af9aa25.png"></image>
{{ item.comment_count }}
</view>
<view class="ui-like-icon-box" style="{{item.is_like ? 'ui-pr-38':''}}" bindtap="likeFeed" data-typ="1" data-type="{{item.type}}" data-id="{{item.id}}">
<image v-if="item.is_like == false" lazy-load="true" class="ui-like-icon-v2" src="https://images.ufutx.com/202106/10/a97c7c76f3aaf7065e7f7a5fe2abc081.png"></image>
<image v-else class="ui-img2_gif" src="{{item.id == likeId ? gifurl:'https://images.ufutx.com/202106/07/b227f3ecf9cbd080fb814450b667b5ce.gif'}}"></image>
{{ item.like_count }}
</view>
<image class="ui-cuIcon-moreandroid" src="https://image.fulllinkai.com/202409/05/fdb58839d1909d75f636941d6aea6cb5.png" mode="widthFix"></image>
</view>
</view>
</view>
<view class="ui-line"></view>
</block>
</block>
</scroll-view>
</swiper-item>
<swiper-item wx:key="id" style="-webkit-overflow-scrolling:touch"></swiper-item>
<swiper-item wx:key="id" style="-webkit-overflow-scrolling:touch"></swiper-item>
</swiper>
</view>
</view>
<view class="cu-modal bottom-modal {{modalName=='delete'?'show':''}}" bindtap="hideModal">
<view class="cu-dialog dialog">
<view>删除</view>
<view @tap="conceal" v-if="admin == 1">隐藏动态</view>
<block v-if="dynamicTabsIndex == 1">
<view @tap="hotdt(1)" v-if="admin == 1">设置为推荐动态</view>
</block>
<block v-else>
<view @tap="hotdt(0)" v-if="admin == 1">取消推荐</view>
</block>
<block v-if="ycTop == 0">
<view @tap="topDynamic(1)" v-if="admin == 1">设置为置顶</view>
</block>
<block v-else>
<view @tap="topDynamic(0)" v-if="admin == 1">取消置顶</view>
</block>
<view bindtap="hideModal">取消</view>
</view>
</view>
<view class="m_returnTop {{ showBackTopBtn ? 'show' : 'hide'}}">
<image class="u_returnTop_img" @tap.stop="BackTop" src="https://images.ufutx.com/202106/23/f0d10551dc5d3399cc7f15805cf04f4f.png" mode="scaleToFill" lazy-load="false"></image>
</view>
</template>
<script>
import wepy from '@wepy/core'
import https from '../../mixins/https'
import base from '../../mixins/base'
import {service} from '../../config'
import {commentTimeHandle} from '../../mixins/plugins'
wepy.page({
config: {},
mixins: [https, base],
data: {
modalName: '',
no_more: false,
loading: false,
page: 1,
list: [], // 列表数据
hotTopics: [], // 热门话题
tabBarList: ['动态', '活动', '服务'],
tabBarIndex: 0,
dynamicTabs: ['推荐', '最新'],
dynamicTabsIndex: 0,
dynamicList: [],
scrollTopHandle: -1,
videoIndex: -1,
showBackTopBtn: false,
triggered: false,
navHeight: 0,
StatusBar: 0,
CustomBar: 0,
Custom: 0,
windowHeight: 0
},
methods: {
// 获取动态列表数据
getList() {
let vm = this
let data = {
page: vm.page
}
vm.$showLoading('加载中')
vm.$get({url: `${service.host}/moments/v2?is_hot=${vm.dynamicTabsIndex == 0 ? 1 : 0}`, data}).then(({code, data}) => {
if (code === 0) {
if (data.data && data.data.length > 0) {
data.data.forEach((item, index) => {
item.created_at = commentTimeHandle(item.created_at)
let sty = typeof (item.photos)
if (sty == 'string') {
item.photos = JSON.parse(item.photos)
}
if ((item.is_audited == 0 || item.is_audited == -1) && item.is_self == 0) {
data.data.splice(index--, 1)
}
})
}
if (vm.dynamicList.length === 0 || vm.page === 1) {
vm.dynamicList = data.data
} else {
data.data.map(function (item) {
vm.dynamicList.push(item)
})
}
if (vm.dynamicList.length < 15 || data.data.length < 15) {
vm.no_more = true
}
setTimeout(() => {
vm.loading = true
}, 500)
vm.triggered = false
if (vm.dynamicList.length > 0) {
vm.textAll(vm.dynamicList)
}
}
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
console.log(err)
})
},
// 文字超出展示全文
textAll(e) {
let vm = this
setTimeout(() => {
const query = wx.createSelectorQuery()
query.selectAll('.substance').boundingClientRect()
query.exec(function (res) {
let num = res[0].slice(-15)
for (let i = 0; i < num.length; i++) {
if (num[i].height > 75) {
e.slice(-15)[i].readmore = {
status: false,
auto: true,
tip: '全文'
}
}
}
vm.dynamicList = JSON.parse(JSON.stringify(e))
})
}, 100)
},
// 获取热门话题
getHotTopics() {
let vm = this
vm.$get({url: `${service.host}/moment/topics`}).then(({code, data}) => {
if (code === 0) {
vm.hotTopics = data.data
}
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
console.log(err)
})
},
// 展开全文或收起
toggle(e) {
let vm = this
let index = e.$wx.currentTarget.dataset.index
let status = vm.dynamicList[index].readmore.status
vm.dynamicList[index].readmore.status = !status
vm.dynamicList[index].readmore.tip = status ? '全文' : '收起'
},
// 顶部动态、活动、服务切换tab
tabChange(index) {
let vm = this
vm.tabBarIndex = index
},
// swiper手势滑动切换tab
switchTab(e) {
let vm = this
if (e.$wx.detail.source === 'touch') {
vm.currentTab = e.$wx.detail.current
}
},
// 动态推荐、最新切换
dynamicTabChange(index) {
let vm = this
vm.dynamicTabsIndex = index
vm.page = 1
vm.getList(1)
},
// 下拉加载中
onPulling() {
let vm = this
vm.triggered = true
},
// 初始化数据
onRefresh() {
let vm = this
vm.page = 1
vm.getList()
vm.getHotTopics()
},
// 动态列表上拉加载更多数据
handleScroll() {
let vm = this
vm.page += 1
vm.getList()
},
// 动态滚动距离超出380展示回到顶部按钮
scrollToUpper(e) {
let vm = this
let top = e.$wx.detail.scrollTop
vm.showBackTopBtn = top > 380
},
// 动态回到顶部
BackTop() {
let vm = this
vm.scrollTopHandle = 0
vm.showBackTopBtn = false
}
},
// 上拉获取更多数据
onReachBottom() {
let vm = this
if (!vm.no_more) {
vm.getList()
}
},
// 下拉刷新
onPullDownRefresh() {
let vm = this
vm.page = 1
vm.no_more = false
vm.getList()
},
onPageScroll(res) {
let vm = this
let top = res.scrollTop
vm.$refs.pageScroll.showBackTopBtn = top > 380
},
onShow() {
let vm = this
let app = vm.$app.$options
vm.navHeight = app.globalData.navBarHeight
vm.StatusBar = app.globalData.StatusBar
vm.CustomBar = app.globalData.CustomBar
vm.Custom = app.globalData.Custom
vm.windowHeight = app.globalData.windowHeight
},
onLoad() {
let vm = this
vm.getList()
vm.getHotTopics()
}
})
</script>
<config>
{
navigationBarTitleText: '',
navigationStyle: 'custom',
enablePullDownRefresh: false,
backgroundColorTop: '#ffffff',
backgroundColorBottom: '#ffffff',
usingComponents: {
pageScroll: '~@/components/pageScroll'
}
}
</config>

View File

@ -78,7 +78,8 @@ wepy.page({
onShow() { onShow() {
}, },
onLoad() { onLoad() {
this.getList() let vm = this
vm.getList()
} }
}) })
</script> </script>

View File

@ -139,7 +139,7 @@
} }
} }
no_border { .no_border {
border: none !important; border: none !important;
} }

View File

@ -2,7 +2,6 @@ import NIM from 'nim-web-sdk-ng/dist/v2/NIM_MINIAPP_SDK'
import { service } from '../config.js' import { service } from '../config.js'
const IM = (account, token) => { const IM = (account, token) => {
console.log(account, token, '8888888888888888')
let nim = NIM.getInstance({ let nim = NIM.getInstance({
debugLevel: 'off', debugLevel: 'off',
appkey: '9bc3ed1f7d8197b6b69f8f5b742824b1', appkey: '9bc3ed1f7d8197b6b69f8f5b742824b1',
@ -20,7 +19,7 @@ const IM = (account, token) => {
eventList.forEach((key) => { eventList.forEach((key) => {
nim.on(key, (res) => { nim.on(key, (res) => {
console.log(`Receive ${key} event`, res ? JSON.parse(JSON.stringify(res)) : res) // console.log(`Receive ${key} event`, res ? JSON.parse(JSON.stringify(res)) : res)
}) })
}) })
@ -171,7 +170,6 @@ const IM = (account, token) => {
}) })
nim.on('myTeamMembers', function (e) { nim.on('myTeamMembers', function (e) {
console.log(e, nim.session, '/////////////')
let muteNotList = [] let muteNotList = []
if (e && e.length > 0) { if (e && e.length > 0) {
e.forEach((i) => { e.forEach((i) => {