合并代码
This commit is contained in:
parent
5c80ff7a73
commit
16e7531f7d
|
@ -45,8 +45,8 @@ export const news = {
|
||||||
deleteFriend(param) {
|
deleteFriend(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
url: `/user/chat/relation/deleteFriend`,
|
url: `/user/chat/relation/deleteFriend`,
|
||||||
method: 'POST',
|
method: 'DELETE',
|
||||||
data: param.data,
|
query: param.query,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -133,6 +133,7 @@ export const news = {
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
//
|
||||||
grabredLog(param) {
|
grabredLog(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
url: `/home/grabredLog`,
|
url: `/home/grabredLog`,
|
||||||
|
@ -147,7 +148,45 @@ export const news = {
|
||||||
url: `/user/chat/relation/myFriends`,
|
url: `/user/chat/relation/myFriends`,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
|
||||||
|
// 获取私聊聊天记录
|
||||||
|
getUserMsgHistory(param) {
|
||||||
|
return util.request({
|
||||||
|
url: `/user/chat/single/getMsgList`,
|
||||||
|
query: param.query,
|
||||||
|
method: 'GET'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取群聊聊天记录
|
||||||
|
getGroupMsgHistory(param) {
|
||||||
|
return util.request({
|
||||||
|
url: `/user/chat/group/getMsgList`,
|
||||||
|
query: param.query,
|
||||||
|
method: 'GET'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 私聊发消息
|
||||||
|
sendUserMsg(param) {
|
||||||
|
return util.request({
|
||||||
|
url: `/user/chat/single/sendMsg`,
|
||||||
|
query: param.query,
|
||||||
|
data: param.data,
|
||||||
|
method: 'POST'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 群聊发消息
|
||||||
|
sendGroupMsg(param) {
|
||||||
|
return util.request({
|
||||||
|
url: `/user/chat/group/sendMsg`,
|
||||||
|
query: param.query,
|
||||||
|
data: param.data,
|
||||||
|
method: 'POST'
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default news
|
export default news
|
|
@ -1731,7 +1731,7 @@ const util = {
|
||||||
* @param {Object} option
|
* @param {Object} option
|
||||||
* @param {Object} option.name 标题昵称
|
* @param {Object} option.name 标题昵称
|
||||||
* @param {Object} option.msgId 聊天对象id
|
* @param {Object} option.msgId 聊天对象id
|
||||||
* @param {Object} option.type 聊天类型
|
* @param {Object} option.type 聊天类型 C2C单聊 GROUP群聊
|
||||||
*/
|
*/
|
||||||
toChat(option) {
|
toChat(option) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|
|
@ -223,8 +223,9 @@
|
||||||
api.news.getFriendList().then(rs => {
|
api.news.getFriendList().then(rs => {
|
||||||
if (rs.code == 200) {
|
if (rs.code == 200) {
|
||||||
const result = rs.data
|
const result = rs.data
|
||||||
|
userList.data.length = 0
|
||||||
//
|
//
|
||||||
userList.data.push(...result.rows.map(item => {
|
userList.data.push(...result.map(item => {
|
||||||
// 取拼音
|
// 取拼音
|
||||||
let char = pinyin.getCamelChars(item.remark || item.userNickname);
|
let char = pinyin.getCamelChars(item.remark || item.userNickname);
|
||||||
return {
|
return {
|
||||||
|
@ -233,6 +234,7 @@
|
||||||
child: [item]
|
child: [item]
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
console.log('userList', userList.data)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
util.alert({
|
util.alert({
|
||||||
|
@ -312,8 +314,8 @@
|
||||||
})
|
})
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
api.news.deleteFriend({
|
api.news.deleteFriend({
|
||||||
data: {
|
query: {
|
||||||
toUserId: user.userId,
|
toUserIds: user.userId,
|
||||||
},
|
},
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
if (rs.code === 200) {
|
if (rs.code === 200) {
|
||||||
|
@ -370,8 +372,8 @@
|
||||||
*/
|
*/
|
||||||
function handleUser(user) {
|
function handleUser(user) {
|
||||||
util.toChat({
|
util.toChat({
|
||||||
name: user.remark || user.profile.nick,
|
name: user.remark || user.userNickname,
|
||||||
msgId: user.userID,
|
msgId: user.userId,
|
||||||
type: 'C2C',
|
type: 'C2C',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -393,7 +395,7 @@
|
||||||
<!-- 菜单 -->
|
<!-- 菜单 -->
|
||||||
<view class="menu oh c333 f34">
|
<view class="menu oh c333 f34">
|
||||||
<view class="rows ptb20 plr30 bfff" @click="link('/pages/news/newFriend')">
|
<view class="rows ptb20 plr30 bfff" @click="link('/pages/news/newFriend')">
|
||||||
<view class="">好友申请</view>
|
<view class="">新朋友</view>
|
||||||
<uni-icons type="right" color="#999" size="30rpx" />
|
<uni-icons type="right" color="#999" size="30rpx" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
nextTick,
|
nextTick,
|
||||||
onUnmounted,
|
onUnmounted,
|
||||||
onMounted,
|
onMounted,
|
||||||
inject,
|
|
||||||
provide,
|
|
||||||
computed,
|
computed,
|
||||||
getCurrentInstance,
|
getCurrentInstance,
|
||||||
watch,
|
watch,
|
||||||
|
@ -26,18 +24,16 @@
|
||||||
onPageScroll,
|
onPageScroll,
|
||||||
onUnload
|
onUnload
|
||||||
} from "@dcloudio/uni-app"
|
} from "@dcloudio/uni-app"
|
||||||
import {
|
|
||||||
getHistoryMsg
|
|
||||||
} from './fn.js'
|
|
||||||
|
|
||||||
import newsTempSystem from './components/news-temp-system'
|
// 单条消息
|
||||||
import newsTemplate from './components/news-temp'
|
import newsTemplate from './components/news-temp'
|
||||||
import NewsEmoji from '@/static/news-emoji.png'
|
// 表情
|
||||||
import NewsPlus from '@/static/news-plus.png'
|
|
||||||
import NewsVoice from '@/static/news-voice.png'
|
|
||||||
import emoji from './emoji.vue'
|
import emoji from './emoji.vue'
|
||||||
|
// 语音条
|
||||||
import JyVoice from './jy-voice.vue'
|
import JyVoice from './jy-voice.vue'
|
||||||
|
// 加号菜单
|
||||||
import JyPlus from './jy-plus.vue'
|
import JyPlus from './jy-plus.vue'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
useStore
|
useStore
|
||||||
} from 'vuex'
|
} from 'vuex'
|
||||||
|
@ -55,18 +51,22 @@
|
||||||
})
|
})
|
||||||
// 输入的内容
|
// 输入的内容
|
||||||
const content = ref('')
|
const content = ref('')
|
||||||
|
// 加载
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const isLast = ref(false)
|
|
||||||
// 用户信息
|
// 用户信息
|
||||||
const userinfo = computed(() => {
|
const userinfo = computed(() => {
|
||||||
let result = store.state.userinfo
|
let result = store.state.userinfo
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
//显示的数据
|
// 列表数据
|
||||||
const list = ref([])
|
const list = reactive({
|
||||||
// 消息分页id 腾讯云im需要
|
// 列表条数
|
||||||
const nextReqMessageID = ref(undefined)
|
limit: 20,
|
||||||
|
//显示的数据
|
||||||
|
data: [],
|
||||||
|
//
|
||||||
|
total: 0,
|
||||||
|
})
|
||||||
// 滚动条位置
|
// 滚动条位置
|
||||||
const top = ref(0)
|
const top = ref(0)
|
||||||
// 工具条的高度
|
// 工具条的高度
|
||||||
|
@ -95,14 +95,17 @@
|
||||||
// 开启消息监听
|
// 开启消息监听
|
||||||
addListener()
|
addListener()
|
||||||
// 获取历史消息
|
// 获取历史消息
|
||||||
getHistory(scrollToBottom)
|
getHistory({
|
||||||
//
|
callback: scrollToBottom
|
||||||
|
})
|
||||||
|
// #ifdef APP
|
||||||
uni.onKeyboardHeightChange((rs) => {
|
uni.onKeyboardHeightChange((rs) => {
|
||||||
ghostBox.value.height = rs.height + 'px'
|
ghostBox.value.height = rs.height + 'px'
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
scrollToBottom()
|
scrollToBottom()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
// #endif
|
||||||
})
|
})
|
||||||
|
|
||||||
onReady(() => {
|
onReady(() => {
|
||||||
|
@ -118,15 +121,21 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnload(() => {
|
onUnload(() => {
|
||||||
|
// #ifdef APP
|
||||||
uni.offKeyboardHeightChange(() => {})
|
uni.offKeyboardHeightChange(() => {})
|
||||||
|
// #endif
|
||||||
videoContext.value.stop()
|
videoContext.value.stop()
|
||||||
})
|
})
|
||||||
|
|
||||||
// 开启监听消息
|
// 开启监听消息
|
||||||
function addListener() {
|
function addListener() {
|
||||||
let onMessageReceived = function(event) {
|
let onMessageReceived = function(event) {
|
||||||
|
console.log('TencentCloudChat.EVENT.MESSAGE_RECEIVED', event)
|
||||||
|
return
|
||||||
|
// 获取历史记录
|
||||||
|
getHistory()
|
||||||
//
|
//
|
||||||
list.value.push(...event.data)
|
list.data.push(...event.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.$chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
|
uni.$chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
|
||||||
|
@ -139,67 +148,76 @@
|
||||||
|
|
||||||
// 获取更多消息记录
|
// 获取更多消息记录
|
||||||
function getMoreHistroy() {
|
function getMoreHistroy() {
|
||||||
if (nextReqMessageID.value) getHistory()
|
// 获取第一条消息记录
|
||||||
|
if (list.total <= list.data.length) return
|
||||||
|
getHistory({
|
||||||
|
param: list.data[0].id
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取历史
|
/**
|
||||||
function getHistory(callback = () => {}) {
|
* 获取历史记录
|
||||||
|
* @param {Object} param
|
||||||
|
*/
|
||||||
|
function getHistory(param = {}) {
|
||||||
// 验证sdk是否准备完毕
|
// 验证sdk是否准备完毕
|
||||||
let isReady = uni.$chat.isReady();
|
let isReady = uni.$chat.isReady();
|
||||||
//
|
//
|
||||||
if (!isReady && userinfo.value.userId) {
|
if (!isReady && userinfo.value.id) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
getHistory(callback)
|
getHistory(param)
|
||||||
}, 200);
|
}, 200);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果没有msgId
|
||||||
|
// if(!param.msgId)
|
||||||
if (loading.value) {
|
if (loading.value) {
|
||||||
// 提示加载中
|
// 提示加载中
|
||||||
util.showToastAndRedirect("加载中")
|
util.showToastAndRedirect("加载中")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!isLast.value) {
|
|
||||||
loading.value = true
|
//
|
||||||
// 获取历史记录
|
loading.value = true
|
||||||
getHistoryMsg({
|
|
||||||
msgId: msg.id,
|
// 获取单聊聊天记录
|
||||||
chatType: msg.type,
|
let request = api.news.getUserMsgHistory
|
||||||
nextReqMessageID: nextReqMessageID.value,
|
// 如果是群聊 获取群聊聊天记录
|
||||||
}).then(res => {
|
if (msg.type === 'GROUP') api.news.getGroupMsgHistory
|
||||||
|
|
||||||
|
// 获取历史记录
|
||||||
|
request({
|
||||||
|
query: {
|
||||||
|
msgId: param.msgId || '',
|
||||||
|
fromId: userinfo.value.id,
|
||||||
|
toId: msg.id,
|
||||||
|
limit: param.limit || list.limit,
|
||||||
|
},
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
// 价格
|
||||||
const result = res.data
|
const result = res.data
|
||||||
if (page.value == 1) list.value.length = 0
|
// 追加
|
||||||
// 消息列表
|
list.data.unshift(...result.list.map(item => {
|
||||||
list.value.unshift(...result.messageList.map(item => {
|
item.callbackData = JSON.parse(item.callbackJson)
|
||||||
try {
|
|
||||||
// 1普通消息 2系统消息
|
|
||||||
item.messageType = 1
|
|
||||||
// console.log('check 1', item.type, TencentCloudChat.TYPES.MSG_CUSTOM, item.payload.data)
|
|
||||||
// 如果是自定义消息
|
|
||||||
if (item.type === TencentCloudChat.TYPES.MSG_CUSTOM && item.payload.data) {
|
|
||||||
if (item.payload.data) item.payload.data = JSON.parse(item.payload.data)
|
|
||||||
if (item.payload.data.data) item.payload.data.data = JSON.parse(item.payload.data.data)
|
|
||||||
// 视频消息类型 新建群聊
|
|
||||||
if (['1', 'group_create'].includes(item.payload.data.businessID)) {
|
|
||||||
item.messageType = 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.log('map catch', err)
|
|
||||||
}
|
|
||||||
return item
|
return item
|
||||||
}))
|
}))
|
||||||
page.value++
|
// 总数
|
||||||
console.log('getHistoryMsg then', result.messageList.length, list.value, res)
|
list.total = result.totalCount
|
||||||
// 用于续拉,分页续拉时需传入该字段。
|
console.log('list', list.data)
|
||||||
nextReqMessageID.value = result.nextReqMessageID || undefined;
|
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
callback()
|
param.callback && param.callback()
|
||||||
})
|
})
|
||||||
}).finally(() => {
|
return
|
||||||
loading.value = false
|
}
|
||||||
|
util.alert({
|
||||||
|
content: res.msg,
|
||||||
|
showCancel: false,
|
||||||
})
|
})
|
||||||
}
|
}).finally(() => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 滚动至底部
|
// 滚动至底部
|
||||||
|
@ -236,22 +254,15 @@
|
||||||
|
|
||||||
// 点击发送
|
// 点击发送
|
||||||
function handleSend() {
|
function handleSend() {
|
||||||
// 创建文本消息
|
|
||||||
let message = uni.$chat.createTextMessage({
|
|
||||||
to: msg.id,
|
|
||||||
conversationType: msg.type,
|
|
||||||
payload: {
|
|
||||||
text: content.value
|
|
||||||
},
|
|
||||||
// 消息已读回执
|
|
||||||
needReadReceipt: true,
|
|
||||||
// 消息自定义数据(云端保存,会发送到对端,程序卸载重装后还能拉取到)
|
|
||||||
// cloudCustomData: 'content.value',
|
|
||||||
});
|
|
||||||
|
|
||||||
// 发送消息
|
// 发送消息
|
||||||
sendMsg({
|
sendMsg({
|
||||||
message,
|
query: {
|
||||||
|
toUserId: msg.id,
|
||||||
|
msgType: TencentCloudChat.TYPES.MSG_TEXT,
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
text: content.value
|
||||||
|
},
|
||||||
success: () => {
|
success: () => {
|
||||||
// 清空已发送的消息
|
// 清空已发送的消息
|
||||||
content.value = ''
|
content.value = ''
|
||||||
|
@ -275,12 +286,27 @@
|
||||||
* @param {Object} param
|
* @param {Object} param
|
||||||
*/
|
*/
|
||||||
function sendMsg(param) {
|
function sendMsg(param) {
|
||||||
|
//
|
||||||
|
const request = api.news.sendUserMsg
|
||||||
|
//
|
||||||
|
if (msg.type == 'group') request = api.news.sendGroupMsg
|
||||||
// 发送消息
|
// 发送消息
|
||||||
uni.$chat.sendMessage(param.message).then((rs) => {
|
request({
|
||||||
console.log('rs', rs)
|
query: param.query,
|
||||||
param.success ? param.success() : ''
|
data: param.data,
|
||||||
//
|
}).then((rs) => {
|
||||||
getHistory(scrollToBottom())
|
if (rs.code == 200) {
|
||||||
|
param.success ? param.success() : ''
|
||||||
|
//
|
||||||
|
getHistory({
|
||||||
|
callback: scrollToBottom,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
util.alert({
|
||||||
|
content: rs.msg,
|
||||||
|
showCancel: false,
|
||||||
|
})
|
||||||
}).catch((rs) => {
|
}).catch((rs) => {
|
||||||
console.log('sendMsg error:', rs);
|
console.log('sendMsg error:', rs);
|
||||||
})
|
})
|
||||||
|
@ -407,7 +433,6 @@
|
||||||
videoUrl.value = item.payload.videoUrl
|
videoUrl.value = item.payload.videoUrl
|
||||||
// 进入全屏
|
// 进入全屏
|
||||||
videoContext.value.requestFullScreen()
|
videoContext.value.requestFullScreen()
|
||||||
videoContext.value.requestFullScreen()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听视频是否全屏
|
// 监听视频是否全屏
|
||||||
|
@ -419,37 +444,29 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="app">
|
<view class="app">
|
||||||
<scroll-view class="scroll-view" scroll-y :scroll-with-animation="true" :scroll-top="top" @scroll="onContentScroll" @scrolltoupper="getMoreHistroy">
|
<scroll-view class="scroll-view" scroll-y :scroll-with-animation="true" :scroll-top="top"
|
||||||
|
@scroll="onContentScroll" @scrolltoupper="getMoreHistroy">
|
||||||
<view id="scroll-content" style="padding: 30rpx 30rpx">
|
<view id="scroll-content" style="padding: 30rpx 30rpx">
|
||||||
<view v-for="(item, index) in list" :key="index">
|
<view v-for="(item, index) in list.data" :key="index">
|
||||||
<!-- 系统消息 -->
|
|
||||||
<template v-if="item.messageType == 2">
|
|
||||||
<!-- 创建群聊 -->
|
|
||||||
<view class="mtb30 tac c999 f22" v-if="item.payload.data.businessID === 'group_create'">群组创建成功</view>
|
|
||||||
</template>
|
|
||||||
<!-- 普通消息 -->
|
<!-- 普通消息 -->
|
||||||
<template v-else-if="item.messageType == 1">
|
<view class="message" :class="[item.From_Account === userinfo.id ? 'self' : 'friend']">
|
||||||
<view class="message" :class="[item.from === userinfo.userId ? 'self' : 'friend']">
|
<!-- 如果是我自己 -->
|
||||||
<!-- 如果是我自己 -->
|
<view>
|
||||||
<view v-if="item.from === userinfo.userId">
|
<image :src="item.callbackData.from_url" class="avatar" mode="widthFix" />
|
||||||
<image :src="util.format_url(userinfo.userPortrait, 'img')" class="avatar" mode="widthFix" />
|
|
||||||
</view>
|
|
||||||
<!-- 如果是用户 -->
|
|
||||||
<view v-else>
|
|
||||||
<image :src="item.avatar" class="avatar" mode="widthFix" />
|
|
||||||
</view>
|
|
||||||
<view class="df fdc mlr20">
|
|
||||||
<!-- 昵称 -->
|
|
||||||
<view class="df fdc" v-if="item.from != userinfo.userId">
|
|
||||||
<view class="name">{{ item.nick }}</view>
|
|
||||||
</view>
|
|
||||||
<!-- 消息 -->
|
|
||||||
<newsTemplate :item="item" :msg="msg" @openRedBag="handleRedPacket" @viewVideo="handleViewVideo" />
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
<view class="df fdc mlr20">
|
||||||
|
<!-- 昵称 -->
|
||||||
|
<view class="df fdc" v-if="item.from != userinfo.userId">
|
||||||
|
<view class="name">{{ item.callbackData.from_name }}</view>
|
||||||
|
</view>
|
||||||
|
<!-- 消息 -->
|
||||||
|
<newsTemplate :item="item" :msg="msg" @openRedBag="handleRedPacket"
|
||||||
|
@viewVideo="handleViewVideo" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="showGhost" :style="{ height: `${ghostBox.height}px`, transition: `${ghostBox.duration}s` }">
|
||||||
</view>
|
</view>
|
||||||
<view v-if="showGhost" :style="{ height: `${ghostBox.height}px`, transition: `${ghostBox.duration}s` }"></view>
|
|
||||||
<view class="ghost" :style="{height: toolHeight + 'px'}"></view>
|
<view class="ghost" :style="{height: toolHeight + 'px'}"></view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
@ -458,20 +475,22 @@
|
||||||
<view class="tool" id="tool">
|
<view class="tool" id="tool">
|
||||||
<view class="tool-group" style="background: #F6F6F6;">
|
<view class="tool-group" style="background: #F6F6F6;">
|
||||||
<!-- 语音 -->
|
<!-- 语音 -->
|
||||||
<image :src="NewsVoice" mode="widthFix" class="thumb" @click="handleTool('voice')"></image>
|
<image src="/static/news-voice.png" mode="widthFix" class="thumb" @click="handleTool('voice')"></image>
|
||||||
<!-- 摁住说话 -->
|
<!-- 摁住说话 -->
|
||||||
<template v-if="toolStatus == 'voice'">
|
<template v-if="toolStatus == 'voice'">
|
||||||
<JyVoice @send="voiceSend" :msg="msg" />
|
<JyVoice @send="voiceSend" :msg="msg" />
|
||||||
</template>
|
</template>
|
||||||
<!-- 输入框 -->
|
<!-- 输入框 -->
|
||||||
<template v-if="toolStatus != 'voice'">
|
<template v-if="toolStatus != 'voice'">
|
||||||
<uni-easyinput @focus="onFocus" type="text" v-model="content" :clearable="false" class="input" :adjust-position="false" @keyboardheightchange="keyboardheightchange" placeholder="请输入你的问题" confirmType="发送" />
|
<uni-easyinput @focus="onFocus" type="text" v-model="content" :clearable="false" class="input"
|
||||||
|
:adjust-position="false" @keyboardheightchange="keyboardheightchange" placeholder="请输入你的问题"
|
||||||
|
confirmType="发送" />
|
||||||
</template>
|
</template>
|
||||||
<!-- 表情 -->
|
<!-- 表情 -->
|
||||||
<image :src="NewsEmoji" mode="widthFix" class="thumb" @click="handleTool('emoji')"></image>
|
<image src="/static/news-emoji.png" mode="widthFix" class="thumb" @click="handleTool('emoji')"></image>
|
||||||
<!-- 加号 -->
|
<!-- 加号 -->
|
||||||
<template v-if="!content">
|
<template v-if="!content">
|
||||||
<image :src="NewsPlus" mode="widthFix" class="thumb" @click="handleTool('plus')" />
|
<image src="/static/news-plus.png" mode="widthFix" class="thumb" @click="handleTool('plus')" />
|
||||||
</template>
|
</template>
|
||||||
<!-- 文本发送按钮 -->
|
<!-- 文本发送按钮 -->
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
<!-- 系统消息 -->
|
|
||||||
<template>
|
|
||||||
<view class="news-temp-system">
|
|
||||||
<view v-if="item.ext.type === 'time'" class="system"> {{ item.ext.time }}</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { ref } from 'vue'
|
|
||||||
const props = defineProps({
|
|
||||||
item: {
|
|
||||||
type: Object,
|
|
||||||
default: () => { }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.system {
|
|
||||||
padding: 20rpx 0;
|
|
||||||
color: #858585;
|
|
||||||
font-size: 28rpx;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -30,13 +30,6 @@
|
||||||
} from 'vuex'
|
} from 'vuex'
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const emit = defineEmits(['openRedBag', 'viewVideo'])
|
const emit = defineEmits(['openRedBag', 'viewVideo'])
|
||||||
|
|
||||||
// watch(props.item, nV => {
|
|
||||||
// console.log('watch item', nV.type, nV)
|
|
||||||
// }, {
|
|
||||||
// immediate: true
|
|
||||||
// })
|
|
||||||
|
|
||||||
//
|
//
|
||||||
const formatData = computed(() => {
|
const formatData = computed(() => {
|
||||||
let result = props.item.payload.data
|
let result = props.item.payload.data
|
||||||
|
@ -85,17 +78,17 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="content pr">
|
<view class="content pr">
|
||||||
<!-- 图片 -->
|
<!-- 图片 -->
|
||||||
<template v-if="item.type === TencentCloudChat.TYPES.MSG_IMAGE">
|
<template v-if="item.callbackData.MsgType === TencentCloudChat.TYPES.MSG_IMAGE">
|
||||||
<image :src="item.payload.imageInfoArray[0].imageUrl" mode="widthFix" />
|
<image :src="item.payload.imageInfoArray[0].imageUrl" mode="widthFix" />
|
||||||
</template>
|
</template>
|
||||||
<!-- 文字 -->
|
<!-- 文字 -->
|
||||||
<template v-else-if="item.type === TencentCloudChat.TYPES.MSG_TEXT">
|
<template v-else-if="item.callbackData.MsgType === TencentCloudChat.TYPES.MSG_TEXT">
|
||||||
<view class="p25">
|
<view class="p25">
|
||||||
{{ item.payload.text }}
|
{{ item.callbackData.callback_json.Text }}
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<!-- 自定义消息 -->
|
<!-- 自定义消息 -->
|
||||||
<template v-else-if="item.type === TencentCloudChat.TYPES.MSG_CUSTOM">
|
<template v-else-if="item.callbackData.MsgType === TencentCloudChat.TYPES.MSG_CUSTOM">
|
||||||
<!-- 判断业务字段 -->
|
<!-- 判断业务字段 -->
|
||||||
<template v-if="formatData.businessID">
|
<template v-if="formatData.businessID">
|
||||||
<!-- 音视频通话 -->
|
<!-- 音视频通话 -->
|
||||||
|
@ -104,8 +97,10 @@
|
||||||
<view class="p25" @click="handleCall">
|
<view class="p25" @click="handleCall">
|
||||||
<template v-if="formatData.actionType == TencentCloudChat.TSignaling.ACTION_TYPE_INVITE">
|
<template v-if="formatData.actionType == TencentCloudChat.TSignaling.ACTION_TYPE_INVITE">
|
||||||
<text>[ </text>
|
<text>[ </text>
|
||||||
<uni-icons type="videocam" color="#333" size="32rpx" v-if="formatData.data.call_type == 1" />
|
<uni-icons type="videocam" color="#333" size="32rpx"
|
||||||
<uni-icons type="phone" color="#333" size="32rpx" v-else-if="formatData.data.call_type == 2" />
|
v-if="formatData.data.call_type == 1" />
|
||||||
|
<uni-icons type="phone" color="#333" size="32rpx"
|
||||||
|
v-else-if="formatData.data.call_type == 2" />
|
||||||
<text>发起</text>
|
<text>发起</text>
|
||||||
<text v-if="formatData.data.call_type == 1">语音</text>
|
<text v-if="formatData.data.call_type == 1">语音</text>
|
||||||
<text v-else-if="formatData.data.call_type == 2">视频</text>
|
<text v-else-if="formatData.data.call_type == 2">视频</text>
|
||||||
|
@ -114,27 +109,36 @@
|
||||||
</template>
|
</template>
|
||||||
<template v-if="formatData.actionType == TencentCloudChat.TSignaling.ACTION_TYPE_CANCEL_INVITE">
|
<template v-if="formatData.actionType == TencentCloudChat.TSignaling.ACTION_TYPE_CANCEL_INVITE">
|
||||||
<text>[</text>
|
<text>[</text>
|
||||||
<uni-icons type="videocam" color="#333" size="32rpx" v-if="formatData.data.call_type == 1" />
|
<uni-icons type="videocam" color="#333" size="32rpx"
|
||||||
<uni-icons type="phone" color="#333" size="32rpx" v-else-if="formatData.data.call_type == 2" />
|
v-if="formatData.data.call_type == 1" />
|
||||||
|
<uni-icons type="phone" color="#333" size="32rpx"
|
||||||
|
v-else-if="formatData.data.call_type == 2" />
|
||||||
<text>已取消通话 ]</text>
|
<text>已取消通话 ]</text>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="formatData.actionType == TencentCloudChat.TSignaling.ACTION_TYPE_ACCEPT_INVITE">
|
<template v-if="formatData.actionType == TencentCloudChat.TSignaling.ACTION_TYPE_ACCEPT_INVITE">
|
||||||
<text>[ </text>
|
<text>[ </text>
|
||||||
<uni-icons type="videocam" color="#333" size="32rpx" v-if="formatData.data.call_type == 1" />
|
<uni-icons type="videocam" color="#333" size="32rpx"
|
||||||
<uni-icons type="phone" color="#333" size="32rpx" v-else-if="formatData.data.call_type == 2" />
|
v-if="formatData.data.call_type == 1" />
|
||||||
|
<uni-icons type="phone" color="#333" size="32rpx"
|
||||||
|
v-else-if="formatData.data.call_type == 2" />
|
||||||
<text>已接通 ]</text>
|
<text>已接通 ]</text>
|
||||||
<!-- <text>[ 通话时长 {{formatData.data.call_end}} ]</text> -->
|
<!-- <text>[ 通话时长 {{formatData.data.call_end}} ]</text> -->
|
||||||
</template>
|
</template>
|
||||||
<template v-if="formatData.actionType == TencentCloudChat.TSignaling.ACTION_TYPE_REJECT_INVITE">
|
<template v-if="formatData.actionType == TencentCloudChat.TSignaling.ACTION_TYPE_REJECT_INVITE">
|
||||||
<text>[ </text>
|
<text>[ </text>
|
||||||
<uni-icons type="videocam" color="#333" size="32rpx" v-if="formatData.data.call_type == 1" />
|
<uni-icons type="videocam" color="#333" size="32rpx"
|
||||||
<uni-icons type="phone" color="#333" size="32rpx" v-else-if="formatData.data.call_type == 2" />
|
v-if="formatData.data.call_type == 1" />
|
||||||
|
<uni-icons type="phone" color="#333" size="32rpx"
|
||||||
|
v-else-if="formatData.data.call_type == 2" />
|
||||||
<text>已拒绝通话 ]</text>
|
<text>已拒绝通话 ]</text>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="formatData.actionType == TencentCloudChat.TSignaling.ACTION_TYPE_INVITE_TIMEOUT">
|
<template
|
||||||
|
v-if="formatData.actionType == TencentCloudChat.TSignaling.ACTION_TYPE_INVITE_TIMEOUT">
|
||||||
<text>[ </text>
|
<text>[ </text>
|
||||||
<uni-icons type="videocam" color="#333" size="32rpx" v-if="formatData.data.call_type == 1" />
|
<uni-icons type="videocam" color="#333" size="32rpx"
|
||||||
<uni-icons type="phone" color="#333" size="32rpx" v-else-if="formatData.data.call_type == 2" />
|
v-if="formatData.data.call_type == 1" />
|
||||||
|
<uni-icons type="phone" color="#333" size="32rpx"
|
||||||
|
v-else-if="formatData.data.call_type == 2" />
|
||||||
<text>超时未接听 ]</text>
|
<text>超时未接听 ]</text>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
|
@ -142,7 +146,8 @@
|
||||||
<!-- 红包消息 -->
|
<!-- 红包消息 -->
|
||||||
<template v-else-if="formatData.businessID == 'redPacket'">
|
<template v-else-if="formatData.businessID == 'redPacket'">
|
||||||
<!-- 红包 -->
|
<!-- 红包 -->
|
||||||
<view class="redPacket br10" :class="{'disabled': formatData.status != 0 || formatData.receive}" @click="handleOpenRedBag">
|
<view class="redPacket br10" :class="{'disabled': formatData.status != 0 || formatData.receive}"
|
||||||
|
@click="handleOpenRedBag">
|
||||||
<view class="df aic">
|
<view class="df aic">
|
||||||
<image class="img mr10" src="/static/image/red-envelope.png" />
|
<image class="img mr10" src="/static/image/red-envelope.png" />
|
||||||
<view class="red-packet-text">{{ formatData.name }}</view>
|
<view class="red-packet-text">{{ formatData.name }}</view>
|
||||||
|
@ -156,7 +161,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 音频文件 -->
|
<!-- 音频文件 -->
|
||||||
<template v-if="item.type == TencentCloudChat.TYPES.MSG_AUDIO">
|
<template v-if="item.callbackData.MsgType == TencentCloudChat.TYPES.MSG_AUDIO">
|
||||||
<div class="df aic p25" style="width: 100rpx" @click="payAudio(item)">
|
<div class="df aic p25" style="width: 100rpx" @click="payAudio(item)">
|
||||||
<image class="mr20" style="width: 30rpx;height: 30rpx;z-index: 1;" :src="NewsAudio" />
|
<image class="mr20" style="width: 30rpx;height: 30rpx;z-index: 1;" :src="NewsAudio" />
|
||||||
<text>{{ item.payload.downloadFlag }}''</text>
|
<text>{{ item.payload.downloadFlag }}''</text>
|
||||||
|
@ -164,7 +169,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 视频消息 -->
|
<!-- 视频消息 -->
|
||||||
<template v-if="item.type == TencentCloudChat.TYPES.MSG_VIDEO">
|
<template v-if="item.callbackData.MsgType == TencentCloudChat.TYPES.MSG_VIDEO">
|
||||||
<image :src="item.payload.snapshotUrl" mode="widthFix" />
|
<image :src="item.payload.snapshotUrl" mode="widthFix" />
|
||||||
<view class="window pfull" @click="handleViewVideo(item)">
|
<view class="window pfull" @click="handleViewVideo(item)">
|
||||||
<image class="pause pmid wh40" src="/static/pause.png" mode="aspectFit" />
|
<image class="pause pmid wh40" src="/static/pause.png" mode="aspectFit" />
|
||||||
|
@ -172,11 +177,11 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 咨询订单 -->
|
<!-- 咨询订单 -->
|
||||||
<template v-if="item.type === 'order'">
|
<template v-if="item.callbackData.MsgType === 'order'">
|
||||||
<JyCommodityInformation :showType="4" :right="false"></JyCommodityInformation>
|
<JyCommodityInformation :showType="4" :right="false"></JyCommodityInformation>
|
||||||
</template>
|
</template>
|
||||||
<!-- 咨询商品-->
|
<!-- 咨询商品-->
|
||||||
<template v-if="item.type === 'shop'">
|
<template v-if="item.callbackData.MsgType === 'shop'">
|
||||||
<JyCommodityInformation :showType="3"></JyCommodityInformation>
|
<JyCommodityInformation :showType="3"></JyCommodityInformation>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<!-- 语音 -->
|
<!-- 语音 -->
|
||||||
<template>
|
<template>
|
||||||
<view class="voice_box" @touchstart="sv.touchstartVoice" @touchmove.stop.prevent="sv.touchmoveVoice" @touchend="sv.touchendVoice" @touchcancel="sv.touchcancelVoice">
|
<view class="voice_box" @touchstart="sv.touchstartVoice" @touchmove.stop.prevent="sv.touchmoveVoice"
|
||||||
|
@touchend="sv.touchendVoice" @touchcancel="sv.touchcancelVoice">
|
||||||
<text class="voice_text c000">{{ voiceText }}</text>
|
<text class="voice_text c000">{{ voiceText }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
@ -22,7 +23,9 @@
|
||||||
// 腾讯云聊天
|
// 腾讯云聊天
|
||||||
import TencentCloudChat from '@tencentcloud/chat';
|
import TencentCloudChat from '@tencentcloud/chat';
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
msg: Object,
|
msg: {
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['send'])
|
const emit = defineEmits(['send'])
|
||||||
//录音
|
//录音
|
||||||
|
|
|
@ -279,9 +279,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// 容器
|
||||||
.swiper {
|
.swiper {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 正在加载
|
// 正在加载
|
||||||
|
|
|
@ -344,6 +344,10 @@
|
||||||
util.alert('正文不能为空')
|
util.alert('正文不能为空')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!labelSelect[0]) {
|
||||||
|
util.alert('标签不能为空')
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 如果有选择的标签
|
// 如果有选择的标签
|
||||||
if (labelSelect[0]) {
|
if (labelSelect[0]) {
|
||||||
|
|
|
@ -175,12 +175,6 @@ register
|
||||||
isShop
|
isShop
|
||||||
1
|
1
|
||||||
|
|
||||||
实名认证
|
|
||||||
账号唯一
|
|
||||||
一个实名信息只能绑定一个账号
|
|
||||||
其他的账号绑定实名提示
|
|
||||||
|
|
||||||
|
|
||||||
即时通讯 发红包
|
即时通讯 发红包
|
||||||
积分 余额
|
积分 余额
|
||||||
消息添加红包功能
|
消息添加红包功能
|
||||||
|
@ -355,12 +349,6 @@ call_type 通话类型 2为视频,1是音频
|
||||||
|
|
||||||
长按二倍速
|
长按二倍速
|
||||||
|
|
||||||
发布
|
|
||||||
视频列表
|
|
||||||
有效读秒
|
|
||||||
释放榴莲果
|
|
||||||
钱包
|
|
||||||
释放
|
|
||||||
|
|
||||||
选择视频截帧
|
选择视频截帧
|
||||||
|
|
||||||
|
@ -388,3 +376,6 @@ call_type 通话类型 2为视频,1是音频
|
||||||
"likeStatus": "1" // 1 公开赞 2私有赞 0 没有赞
|
"likeStatus": "1" // 1 公开赞 2私有赞 0 没有赞
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,22 +15,22 @@ export default defineConfig({
|
||||||
},
|
},
|
||||||
"/user": {
|
"/user": {
|
||||||
// target: "http://192.168.0.129:8080",
|
// target: "http://192.168.0.129:8080",
|
||||||
target: "http://192.168.0.133:8080",
|
target: "http://192.168.1.199:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/coreplay": {
|
"/coreplay": {
|
||||||
// target: "http://192.168.0.129:8080",
|
// target: "http://192.168.0.129:8080",
|
||||||
target: "http://192.168.0.133:8080",
|
target: "http://192.168.1.199:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/file": {
|
"/file": {
|
||||||
// target: "http://192.168.0.129:8080",
|
// target: "http://192.168.0.129:8080",
|
||||||
target: "http://192.168.0.133:8080",
|
target: "http://192.168.1.199:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/video": {
|
"/video": {
|
||||||
// target: "http://192.168.0.129:8080",
|
// target: "http://192.168.0.129:8080",
|
||||||
target: "http://192.168.0.133:8080",
|
target: "http://192.168.1.199:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue