群列表 红包
This commit is contained in:
parent
8b9514d161
commit
044f759fa5
|
@ -120,30 +120,16 @@ export const news = {
|
||||||
url: `/im/token/getUserAppToken`,
|
url: `/im/token/getUserAppToken`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
query: param
|
query: param
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
// 发红包
|
||||||
* 商品列表
|
sendRedPacket(param) {
|
||||||
* @param {Object} param
|
|
||||||
*/
|
|
||||||
sendRedBag(param) {
|
|
||||||
return util.request({
|
return util.request({
|
||||||
url: `/home/sendRedBag`,
|
url: `/user/sendRedPacket`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: param.data,
|
data: param.data,
|
||||||
|
query: param.query,
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 抢红包
|
|
||||||
grabred(param) {
|
|
||||||
return util.request({
|
|
||||||
url: `/home/grabred`,
|
|
||||||
method: 'POST',
|
|
||||||
data: param.data,
|
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -156,7 +142,8 @@ export const news = {
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//
|
|
||||||
|
// 红包记录
|
||||||
grabredLog(param) {
|
grabredLog(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
url: `/home/grabredLog`,
|
url: `/home/grabredLog`,
|
||||||
|
|
|
@ -163,6 +163,18 @@ const shop = {
|
||||||
query: param.query,
|
query: param.query,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存商品信息
|
||||||
|
* @param {Object} param
|
||||||
|
*/
|
||||||
|
saveProduct(param) {
|
||||||
|
return util.request({
|
||||||
|
url: `/shopify//webProduct/saveProduct`,
|
||||||
|
method: 'POST',
|
||||||
|
data: param.data,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ const video = {
|
||||||
*/
|
*/
|
||||||
homeVideo(param) {
|
homeVideo(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
// url: `/video/video/list`,
|
url: `/video/video/list`,
|
||||||
url: `/video/api/queryVideoByPage`,
|
// url: `/video/api/queryVideoByPage`,
|
||||||
query: param.query,
|
query: param.query,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
})
|
})
|
||||||
|
@ -22,8 +22,8 @@ const video = {
|
||||||
*/
|
*/
|
||||||
saveVideo(param) {
|
saveVideo(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
// url: `/video/video/add`,
|
url: `/video/video/add`,
|
||||||
url: `/video/api/saveVideo`,
|
// url: `/video/api/saveVideo`,
|
||||||
data: param.data,
|
data: param.data,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
})
|
})
|
||||||
|
@ -158,14 +158,14 @@ const video = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 我的收藏列表
|
* 查询收藏夹
|
||||||
* @param {Object} param
|
* @param {Object} param
|
||||||
*/
|
*/
|
||||||
getCollectList(param) {
|
getCollectList(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
url: `/collect/getCollectList`,
|
url: `/video/collection/getfavorite`,
|
||||||
query: param.query,
|
query: param.query,
|
||||||
method: 'POST',
|
method: 'GET',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ const video = {
|
||||||
*/
|
*/
|
||||||
saveCollectList(param) {
|
saveCollectList(param) {
|
||||||
return util.request({
|
return util.request({
|
||||||
url: `/collect/saveCollectList`,
|
url: `/video/collection/addfavorite`,
|
||||||
query: param.query,
|
query: param.query,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
load: true,
|
load: true,
|
||||||
|
|
|
@ -5,8 +5,8 @@ const config = {
|
||||||
host: 'http://localhost:5173',
|
host: 'http://localhost:5173',
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
host: 'http://13859d41.r22.cpolar.top',
|
// host: 'http://1641c8e0.r22.cpolar.top',
|
||||||
// host: 'http://192.168.1.236:8080',
|
host: 'http://192.168.0.129:8080',
|
||||||
// #endif
|
// #endif
|
||||||
// 上传文件二级路径
|
// 上传文件二级路径
|
||||||
uploadFilePath: "/homecommon/file/preview?fileName=",
|
uploadFilePath: "/homecommon/file/preview?fileName=",
|
||||||
|
|
|
@ -1730,6 +1730,7 @@ const util = {
|
||||||
name: option.name,
|
name: option.name,
|
||||||
msgId: option.msgId,
|
msgId: option.msgId,
|
||||||
type: option.type,
|
type: option.type,
|
||||||
|
num: option.num,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -101,6 +101,7 @@
|
||||||
pageSize: listProperty.pageSize,
|
pageSize: listProperty.pageSize,
|
||||||
}
|
}
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
|
console.log('collect', rs)
|
||||||
if (rs.code === 200) {
|
if (rs.code === 200) {
|
||||||
const result = rs.rows
|
const result = rs.rows
|
||||||
// 如果是第一页
|
// 如果是第一页
|
||||||
|
@ -197,7 +198,8 @@
|
||||||
|
|
||||||
<uni-swipe-action ref="swipeActionRef" v-else>
|
<uni-swipe-action ref="swipeActionRef" v-else>
|
||||||
<view class="collect">
|
<view class="collect">
|
||||||
<uni-swipe-action-item :right-options="options" v-for="(item,index) in listProperty.data" :key="index" @click="handleActionItem($event,index)">
|
<uni-swipe-action-item :right-options="options" v-for="(item,index) in listProperty.data" :key="index"
|
||||||
|
@click="handleActionItem($event,index)">
|
||||||
<view class="item rows fdr mlr20 ptb20" @click.stop="handleItem(item)">
|
<view class="item rows fdr mlr20 ptb20" @click.stop="handleItem(item)">
|
||||||
<view class="poster">
|
<view class="poster">
|
||||||
<image class="wh80 br20" :src="item.formatPic" mode="aspectFill" />
|
<image class="wh80 br20" :src="item.formatPic" mode="aspectFill" />
|
||||||
|
|
|
@ -386,11 +386,11 @@
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
if (rs.confirm) emit('like', {
|
if (rs.confirm) emit('like', {
|
||||||
index,
|
index,
|
||||||
isLike: 3,
|
isLike: 2,
|
||||||
})
|
})
|
||||||
else emit('like', {
|
else emit('like', {
|
||||||
index,
|
index,
|
||||||
isLike: 0
|
isLike: 1
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
@ -516,14 +516,14 @@
|
||||||
<view class="col">
|
<view class="col">
|
||||||
<view class="pr">
|
<view class="pr">
|
||||||
<image class="wh50" src="/static/indexLike.png" mode="aspectFit"
|
<image class="wh50" src="/static/indexLike.png" mode="aspectFit"
|
||||||
v-if="item.likeStatus == 0" @click="handleLike(index, 0)"
|
v-if="item.likeStatus == 0" @click="handleLike(index, 1)"
|
||||||
@longpress="handlePrivateLike(index)" />
|
@longpress="handlePrivateLike(index)" />
|
||||||
<!-- 公开赞 -->
|
<!-- 公开赞 -->
|
||||||
<image class="wh50" src="/static/indexLike1.png" mode="aspectFit"
|
<image class="wh50" src="/static/indexLike1.png" mode="aspectFit"
|
||||||
v-else-if="item.likeStatus == 1" @click="handleLike(index, 1)" />
|
v-else-if="item.likeStatus == 1" @click="handleLike(index, 0)" />
|
||||||
<!-- 私密赞的图标 -->
|
<!-- 私密赞的图标 -->
|
||||||
<image class="wh50" src="/static/privateLike.png" mode="aspectFit"
|
<image class="wh50" src="/static/privateLike.png" mode="aspectFit"
|
||||||
v-else-if="item.likeStatus == 2" @click="handleLike(index, 1)" />
|
v-else-if="item.likeStatus == 2" @click="handleLike(index, 0)" />
|
||||||
</view>
|
</view>
|
||||||
<view class="txt mt10">
|
<view class="txt mt10">
|
||||||
<text class="text">{{ item.publicLikeCount }}</text>
|
<text class="text">{{ item.publicLikeCount }}</text>
|
||||||
|
|
|
@ -36,9 +36,7 @@
|
||||||
// 密码
|
// 密码
|
||||||
const pwd = ref('')
|
const pwd = ref('')
|
||||||
// 用户信息
|
// 用户信息
|
||||||
const userinfo = computed(() => {
|
const userinfo = computed(() => store.state.userinfo)
|
||||||
return store.state.userinfo
|
|
||||||
})
|
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
function open() {
|
function open() {
|
||||||
|
|
|
@ -605,6 +605,7 @@
|
||||||
videoId: item.id,
|
videoId: item.id,
|
||||||
}
|
}
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
|
console.log('request', rs)
|
||||||
if (rs.code == 200) {
|
if (rs.code == 200) {
|
||||||
uni.$emit('updateVideo', rs.data)
|
uni.$emit('updateVideo', rs.data)
|
||||||
return
|
return
|
||||||
|
|
|
@ -46,8 +46,10 @@
|
||||||
const msg = reactive({
|
const msg = reactive({
|
||||||
// 聊天对象
|
// 聊天对象
|
||||||
id: '',
|
id: '',
|
||||||
// 聊天类型
|
// 聊天类型 C2C单聊 GROUP群聊
|
||||||
type: '',
|
type: '',
|
||||||
|
// 群人数
|
||||||
|
num: '',
|
||||||
})
|
})
|
||||||
// 输入的内容
|
// 输入的内容
|
||||||
const content = ref('')
|
const content = ref('')
|
||||||
|
@ -83,15 +85,23 @@
|
||||||
const videoContext = ref(null)
|
const videoContext = ref(null)
|
||||||
|
|
||||||
onLoad(option => {
|
onLoad(option => {
|
||||||
// 用户昵称
|
// 标题
|
||||||
if (option.name) uni.setNavigationBarTitle({
|
let title = ''
|
||||||
title: option.name
|
|
||||||
})
|
|
||||||
|
|
||||||
// 用户id
|
|
||||||
if (option.msgId) msg.id = option.msgId
|
|
||||||
// 聊天类型
|
// 聊天类型
|
||||||
if (option.type) msg.type = option.type
|
if (option.type) msg.type = option.type
|
||||||
|
// 标题
|
||||||
|
if (option.name) title = option.name
|
||||||
|
// 用户id
|
||||||
|
if (option.msgId) msg.id = option.msgId
|
||||||
|
// 如果是群组
|
||||||
|
if (option.type == 'GROUP') {
|
||||||
|
msg.num = option.num
|
||||||
|
title = `(${option.num})${option.name}`
|
||||||
|
}
|
||||||
|
// 标题
|
||||||
|
if (title) uni.setNavigationBarTitle({
|
||||||
|
title,
|
||||||
|
})
|
||||||
// 开启消息监听
|
// 开启消息监听
|
||||||
addListener()
|
addListener()
|
||||||
// 获取历史消息
|
// 获取历史消息
|
||||||
|
@ -130,12 +140,13 @@
|
||||||
// 开启监听消息
|
// 开启监听消息
|
||||||
function addListener() {
|
function addListener() {
|
||||||
let onMessageReceived = function(event) {
|
let onMessageReceived = function(event) {
|
||||||
console.log('TencentCloudChat.EVENT.MESSAGE_RECEIVED', event)
|
setTimeout(() => {
|
||||||
return
|
// 获取历史记录
|
||||||
// 获取历史记录
|
getHistory({
|
||||||
getHistory()
|
msgId: '',
|
||||||
//
|
limit: 1,
|
||||||
list.data.push(...event.data)
|
})
|
||||||
|
}, 200)
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.$chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
|
uni.$chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
|
||||||
|
@ -169,22 +180,14 @@
|
||||||
}, 200);
|
}, 200);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有msgId
|
|
||||||
// if(!param.msgId)
|
|
||||||
if (loading.value) {
|
|
||||||
// 提示加载中
|
|
||||||
util.showToastAndRedirect("加载中")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
||||||
// 获取单聊聊天记录
|
// 获取单聊聊天记录
|
||||||
let request = api.news.getUserMsgHistory
|
let request = api.news.getUserMsgHistory
|
||||||
// 如果是群聊 获取群聊聊天记录
|
// 如果是群聊 获取群聊聊天记录
|
||||||
if (msg.type === 'GROUP') api.news.getGroupMsgHistory
|
if (msg.type == 'GROUP') request = api.news.getGroupMsgHistory
|
||||||
|
console.log('getHistory')
|
||||||
|
|
||||||
// 获取历史记录
|
// 获取历史记录
|
||||||
request({
|
request({
|
||||||
|
@ -192,19 +195,29 @@
|
||||||
msgId: param.msgId || '',
|
msgId: param.msgId || '',
|
||||||
fromId: userinfo.value.id,
|
fromId: userinfo.value.id,
|
||||||
toId: msg.id,
|
toId: msg.id,
|
||||||
|
groupId: msg.id,
|
||||||
limit: param.limit || list.limit,
|
limit: param.limit || list.limit,
|
||||||
},
|
},
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
// 价格
|
// 结果
|
||||||
const result = res.data
|
const result = res.data
|
||||||
// 追加
|
|
||||||
list.data.unshift(...result.list.map(item => {
|
// 如果是最新消息
|
||||||
item.callbackData = JSON.parse(item.callbackJson)
|
if (param.limit == 1) {
|
||||||
return item
|
list.data.push(...result.list.map(item => {
|
||||||
}))
|
item.callbackData = JSON.parse(item.callbackJson)
|
||||||
|
return item
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
|
// 追加
|
||||||
|
list.data.unshift(...result.list.map(item => {
|
||||||
|
item.callbackData = JSON.parse(item.callbackJson)
|
||||||
|
return item
|
||||||
|
}))
|
||||||
|
}
|
||||||
// 总数
|
// 总数
|
||||||
list.total = result.totalCount
|
list.total = result.total
|
||||||
console.log('list', list.data)
|
console.log('list', list.data)
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
param.callback && param.callback()
|
param.callback && param.callback()
|
||||||
|
@ -215,6 +228,8 @@
|
||||||
content: res.msg,
|
content: res.msg,
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
})
|
})
|
||||||
|
}).catch(rs => {
|
||||||
|
console.log('err', rs)
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
|
@ -257,6 +272,7 @@
|
||||||
// 发送消息
|
// 发送消息
|
||||||
sendMsg({
|
sendMsg({
|
||||||
query: {
|
query: {
|
||||||
|
formId: userinfo.value.id,
|
||||||
toUserId: msg.id,
|
toUserId: msg.id,
|
||||||
msgType: TencentCloudChat.TYPES.MSG_TEXT,
|
msgType: TencentCloudChat.TYPES.MSG_TEXT,
|
||||||
},
|
},
|
||||||
|
@ -284,9 +300,9 @@
|
||||||
*/
|
*/
|
||||||
function sendMsg(param) {
|
function sendMsg(param) {
|
||||||
//
|
//
|
||||||
const request = api.news.sendUserMsg
|
let request = api.news.sendUserMsg
|
||||||
//
|
//
|
||||||
if (msg.type == 'group') request = api.news.sendGroupMsg
|
if (msg.type == 'GROUP') request = api.news.sendGroupMsg
|
||||||
// 发送消息
|
// 发送消息
|
||||||
request({
|
request({
|
||||||
query: param.query,
|
query: param.query,
|
||||||
|
@ -294,10 +310,6 @@
|
||||||
}).then((rs) => {
|
}).then((rs) => {
|
||||||
if (rs.code == 200) {
|
if (rs.code == 200) {
|
||||||
param.success ? param.success() : ''
|
param.success ? param.success() : ''
|
||||||
//
|
|
||||||
getHistory({
|
|
||||||
callback: scrollToBottom,
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
util.alert({
|
util.alert({
|
||||||
|
@ -446,7 +458,8 @@
|
||||||
<view id="scroll-content" style="padding: 30rpx 30rpx">
|
<view id="scroll-content" style="padding: 30rpx 30rpx">
|
||||||
<view v-for="(item, index) in list.data" :key="index">
|
<view v-for="(item, index) in list.data" :key="index">
|
||||||
<!-- 普通消息 -->
|
<!-- 普通消息 -->
|
||||||
<view class="message" :class="[item.From_Account === userinfo.id ? 'self' : 'friend']">
|
<view class="message"
|
||||||
|
:class="[(item.From_Account || item.fromId) == userinfo.id ? 'self' : 'friend']">
|
||||||
<!-- 如果是我自己 -->
|
<!-- 如果是我自己 -->
|
||||||
<view>
|
<view>
|
||||||
<image :src="item.callbackData.from_url" class="avatar" mode="widthFix" />
|
<image :src="item.callbackData.from_url" class="avatar" mode="widthFix" />
|
||||||
|
|
|
@ -30,15 +30,8 @@
|
||||||
} from 'vuex'
|
} from 'vuex'
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const emit = defineEmits(['openRedBag', 'viewVideo'])
|
const emit = defineEmits(['openRedBag', 'viewVideo'])
|
||||||
//
|
// 格式化
|
||||||
const formatData = computed(() => {
|
const formatData = computed(() => props.item.callbackData.callback_json[0])
|
||||||
let result = props.item.payload.data
|
|
||||||
// console.log('computed formatData', {
|
|
||||||
// ...result
|
|
||||||
// })
|
|
||||||
return result
|
|
||||||
})
|
|
||||||
|
|
||||||
//音频
|
//音频
|
||||||
const innerAudioContext = uni.createInnerAudioContext();
|
const innerAudioContext = uni.createInnerAudioContext();
|
||||||
// 播放语音
|
// 播放语音
|
||||||
|
@ -79,20 +72,20 @@
|
||||||
<view class="content pr">
|
<view class="content pr">
|
||||||
<!-- 图片 -->
|
<!-- 图片 -->
|
||||||
<template v-if="item.callbackData.MsgType === TencentCloudChat.TYPES.MSG_IMAGE">
|
<template v-if="item.callbackData.MsgType === TencentCloudChat.TYPES.MSG_IMAGE">
|
||||||
<image :src="item.payload.imageInfoArray[0].imageUrl" mode="widthFix" />
|
<image class="br10" :src="formatData.MsgContent.ImageInfoArray[0].URL" mode="widthFix" />
|
||||||
</template>
|
</template>
|
||||||
<!-- 文字 -->
|
<!-- 文字 -->
|
||||||
<template v-else-if="item.callbackData.MsgType === TencentCloudChat.TYPES.MSG_TEXT">
|
<template v-else-if="item.callbackData.MsgType === TencentCloudChat.TYPES.MSG_TEXT">
|
||||||
<view class="p25">
|
<view class="p25">
|
||||||
{{ item.callbackData.callback_json.Text }}
|
{{ formatData.MsgContent.Text }}
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<!-- 自定义消息 -->
|
<!-- 自定义消息 -->
|
||||||
<template v-else-if="item.callbackData.MsgType === TencentCloudChat.TYPES.MSG_CUSTOM">
|
<template v-else-if="item.callbackData.MsgType === TencentCloudChat.TYPES.MSG_CUSTOM">
|
||||||
<!-- 判断业务字段 -->
|
<!-- 判断业务字段 -->
|
||||||
<template v-if="formatData.businessID">
|
<template v-if="formatData.businessType">
|
||||||
<!-- 音视频通话 -->
|
<!-- 音视频通话 -->
|
||||||
<template v-if="formatData.businessID == 1">
|
<template v-if="formatData.businessType == 1">
|
||||||
<!-- 拨打电话 -->
|
<!-- 拨打电话 -->
|
||||||
<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">
|
||||||
|
@ -144,7 +137,7 @@
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<!-- 红包消息 -->
|
<!-- 红包消息 -->
|
||||||
<template v-else-if="formatData.businessID == 'redPacket'">
|
<template v-else-if="formatData.businessType == 'redPacket'">
|
||||||
<!-- 红包 -->
|
<!-- 红包 -->
|
||||||
<view class="redPacket br10" :class="{'disabled': formatData.status != 0 || formatData.receive}"
|
<view class="redPacket br10" :class="{'disabled': formatData.status != 0 || formatData.receive}"
|
||||||
@click="handleOpenRedBag">
|
@click="handleOpenRedBag">
|
||||||
|
@ -154,7 +147,7 @@
|
||||||
</view>
|
</view>
|
||||||
<!-- 分割线 -->
|
<!-- 分割线 -->
|
||||||
<view class="line"></view>
|
<view class="line"></view>
|
||||||
<view class="f20" style="color:#FBD3A4">{{ formatData.type == 1 ? '积分红包' : '余额红包' }}</view>
|
<view class="f20" style="color:#FBD3A4">{{ formatData.data.payType == 1 ? '余额红包' : '积分红包' }}</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -123,6 +123,7 @@
|
||||||
'C2C': 1,
|
'C2C': 1,
|
||||||
'GROUP': 2,
|
'GROUP': 2,
|
||||||
} [props.msg.type],
|
} [props.msg.type],
|
||||||
|
num: props.msg.num,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
// popupRE.value.open()
|
// popupRE.value.open()
|
||||||
|
|
|
@ -25,17 +25,19 @@
|
||||||
const list = reactive([])
|
const list = reactive([])
|
||||||
|
|
||||||
// 右滑菜单
|
// 右滑菜单
|
||||||
const rightOption = [{
|
const rightOption = [
|
||||||
text: '退出群聊',
|
// {
|
||||||
style: {
|
// text: '退出群聊',
|
||||||
backgroundColor: '#F85050'
|
// style: {
|
||||||
},
|
// backgroundColor: '#F85050'
|
||||||
fn: (item) => quitGroup(item)
|
// },
|
||||||
}]
|
// fn: (item) => quitGroup(item)
|
||||||
|
// }
|
||||||
|
]
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
//
|
//
|
||||||
// getGroupList()
|
getGroupList()
|
||||||
// 开启监听
|
// 开启监听
|
||||||
addListener()
|
addListener()
|
||||||
})
|
})
|
||||||
|
@ -62,7 +64,7 @@
|
||||||
|
|
||||||
// 获取群组列表
|
// 获取群组列表
|
||||||
function getGroupList() {
|
function getGroupList() {
|
||||||
api.news.myGroups().then(rs => {
|
api.news.myGroups().then(rs => {
|
||||||
if (rs.code == 200) {
|
if (rs.code == 200) {
|
||||||
list.length = 0
|
list.length = 0
|
||||||
list.push(...rs.data)
|
list.push(...rs.data)
|
||||||
|
@ -77,15 +79,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取群组列表
|
* 跳转聊天
|
||||||
* @param {Object} item
|
* @param {Object} item
|
||||||
*/
|
*/
|
||||||
function handleGroupItem(item) {
|
function handleGroupItem(item) {
|
||||||
console.log('group item', item)
|
console.log('group item', item)
|
||||||
util.toChat({
|
util.toChat({
|
||||||
name: `${item.name}(${item.memberCount})`,
|
name: `${item.name}`,
|
||||||
msgId: item.groupID,
|
msgId: item.groupId,
|
||||||
type: 'GROUP',
|
type: 'GROUP',
|
||||||
|
num: item.memberCount,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,16 +121,16 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="group app">
|
<view class="appbw">
|
||||||
<uni-swipe-action ref="swipeAction">
|
<uni-swipe-action ref="swipeAction">
|
||||||
<view class="list plr20 pb30">
|
<view class="list plr30 pb30">
|
||||||
<view class="li" v-for="(item, index) in list" :key="index">
|
<view class="item" v-for="(item, index) in list" :key="index">
|
||||||
<uni-swipe-action-item :right-options="rightOption" @click="handleMenu($event,item)">
|
<uni-swipe-action-item :right-options="rightOption" @click="handleMenu($event,item)">
|
||||||
<view class="item rows ptb20" @click="handleGroupItem(item)">
|
<view class="item rows ptb30" @click="handleGroupItem(item)">
|
||||||
<image class="wh80 avatar br10" :src="item.avatar" mode="aspectFill" />
|
<image class="wh120 fs0 avatar br10" :src="item.groupFaceUrl" mode="aspectFill" />
|
||||||
|
|
||||||
<view class="f1 mlr20">
|
<view class="f1 oh ml30">
|
||||||
<view class="name thd f1 c333 f32">{{item.name}}</view>
|
<view class="name thd f1 c333 f34">{{item.name}}</view>
|
||||||
<!-- <view class="content thd mt10 c666 f24">{{item.lastMessage.messageForShow || ''}}</view> -->
|
<!-- <view class="content thd mt10 c666 f24">{{item.lastMessage.messageForShow || ''}}</view> -->
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="time c999 f22" v-if="item.lastMessage.messageForShow || ''">{{util.formatTime('yyyy-MM-dd HH:mm:ss',item.lastMessage.lastTime)}}</view> -->
|
<!-- <view class="time c999 f22" v-if="item.lastMessage.messageForShow || ''">{{util.formatTime('yyyy-MM-dd HH:mm:ss',item.lastMessage.lastTime)}}</view> -->
|
||||||
|
@ -142,11 +145,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.group {
|
.list {
|
||||||
height: 100%;
|
.item + .item {
|
||||||
|
border-top: 2rpx solid #eee;
|
||||||
.scroll {
|
|
||||||
height: 100%;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
|
@ -90,9 +90,10 @@
|
||||||
util.alert('请至少选择两名用户')
|
util.alert('请至少选择两名用户')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// 群主id
|
||||||
|
data.ownerAccount = userinfo.value.id
|
||||||
// 群成员
|
// 群成员
|
||||||
data.groupUsers = [
|
data.groupUsers = [{
|
||||||
{
|
|
||||||
userId: userinfo.value.id
|
userId: userinfo.value.id
|
||||||
},
|
},
|
||||||
...ids.value.map(item => {
|
...ids.value.map(item => {
|
||||||
|
@ -101,6 +102,8 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
// 群聊id
|
||||||
|
data.groupId = Date.now().toString(36) + Math.random().toString(36).substr(2, 5);
|
||||||
|
|
||||||
// 创建好友工作群
|
// 创建好友工作群
|
||||||
api.news.addChatGroup({
|
api.news.addChatGroup({
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
/**
|
// 消息
|
||||||
* 消息
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
ref,
|
ref,
|
||||||
reactive,
|
reactive,
|
||||||
computed,
|
computed,
|
||||||
|
getCurrentInstance,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import {
|
import {
|
||||||
useStore
|
useStore
|
||||||
|
@ -13,36 +14,62 @@
|
||||||
import util from '@/common/js/util.js'
|
import util from '@/common/js/util.js'
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
|
onReady
|
||||||
} from "@dcloudio/uni-app"
|
} from "@dcloudio/uni-app"
|
||||||
|
// 二级密码
|
||||||
|
import payPwd from '@/components/mine/payPwd.vue'
|
||||||
|
|
||||||
|
//
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
//
|
//
|
||||||
|
const {
|
||||||
|
proxy
|
||||||
|
} = getCurrentInstance()
|
||||||
|
// 红包表单
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
status: 0,
|
status: 0,
|
||||||
|
totalAmount: '',
|
||||||
|
totalCount: '',
|
||||||
})
|
})
|
||||||
// 红包类型列表
|
// 金额类型列表
|
||||||
const typeList = reactive([{
|
const priceList = reactive([{
|
||||||
id: 1,
|
id: 2,
|
||||||
name: '积分红包',
|
name: '积分红包',
|
||||||
}, {
|
}, {
|
||||||
id: 2,
|
id: 1,
|
||||||
name: '余额红包',
|
name: '余额红包',
|
||||||
}])
|
}])
|
||||||
// 红包金额
|
// 金额类型下标
|
||||||
const total = ref('')
|
const priceIndex = ref(0)
|
||||||
|
|
||||||
|
// 红包类型
|
||||||
|
const typeList = reactive([{
|
||||||
|
id: 2,
|
||||||
|
name: '普通红包',
|
||||||
|
}, {
|
||||||
|
id: 1,
|
||||||
|
name: '拼手气红包',
|
||||||
|
}])
|
||||||
|
// 红包类型下标
|
||||||
|
const typeIndex = ref(0)
|
||||||
|
|
||||||
// 红包祝福语
|
// 红包祝福语
|
||||||
const greeting = ref('恭喜发财,大吉大利')
|
const greeting = ref('恭喜发财,大吉大利')
|
||||||
// 群成员数量
|
// 群成员数量
|
||||||
const groupNum = ref('')
|
const groupNum = ref('')
|
||||||
// 红包类型下标
|
// 红包类型
|
||||||
const typeIndex = ref(0)
|
|
||||||
// 当前下标
|
|
||||||
const typeCurrent = computed(() => {
|
const typeCurrent = computed(() => {
|
||||||
let result = typeList[typeIndex.value]
|
let result = typeList[typeIndex.value]
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
// 金额类型
|
||||||
|
const priceCurrent = computed(() => {
|
||||||
|
let result = priceList[priceIndex.value]
|
||||||
|
return result
|
||||||
|
})
|
||||||
// 格式化总价
|
// 格式化总价
|
||||||
const formatTotal = computed(() => {
|
const formatTotal = computed(() => {
|
||||||
let result = Number(total.value || 0)
|
let result = Number(form.totalAmount || 0)
|
||||||
result = result.toFixed(2)
|
result = result.toFixed(2)
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
@ -55,82 +82,91 @@
|
||||||
onLoad((option) => {
|
onLoad((option) => {
|
||||||
const type = option.sendType
|
const type = option.sendType
|
||||||
if (type) {
|
if (type) {
|
||||||
|
// 1私聊 2群聊
|
||||||
form.sendType = type
|
form.sendType = type
|
||||||
form[{
|
form[{
|
||||||
1: 'sendId',
|
1: 'toId',
|
||||||
2: 'roomId',
|
2: 'groupId',
|
||||||
} [type]] = option.msgId
|
} [type]] = option.msgId
|
||||||
//
|
|
||||||
if (type == 2) getGroup()
|
|
||||||
}
|
}
|
||||||
|
// 群成员人数
|
||||||
|
if (option.num) groupNum.value = option.num
|
||||||
})
|
})
|
||||||
|
|
||||||
// 获取群信息
|
onReady(() => {
|
||||||
function getGroup() {
|
// proxy.$refs.payPwdRef.open()
|
||||||
// 验证sdk是否准备完毕
|
})
|
||||||
let isReady = uni.$chat.isReady();
|
|
||||||
|
|
||||||
if (!isReady && userinfo.value.userId) {
|
// 切换红包类型
|
||||||
setTimeout(function() {
|
|
||||||
getGroup()
|
|
||||||
}, 200);
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.$chat.getGroupProfile({
|
|
||||||
groupID: form.roomId,
|
|
||||||
}).then(rs => {
|
|
||||||
if (rs.code == 0) {
|
|
||||||
const result = rs.data.group
|
|
||||||
groupNum.value = result.memberCount
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 切换下标
|
|
||||||
function handleTypeIndex(ev) {
|
function handleTypeIndex(ev) {
|
||||||
const index = ev.detail.value
|
const index = ev.detail.value
|
||||||
if (index === typeIndex.value) return
|
if (index === typeIndex.value) return
|
||||||
typeIndex.value = index
|
typeIndex.value = index
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 切换金额发送下标
|
||||||
|
function handlePriceIndex(ev) {
|
||||||
|
const index = ev.detail.value
|
||||||
|
if (index === priceIndex.value) return
|
||||||
|
priceIndex.value = index
|
||||||
|
}
|
||||||
|
|
||||||
// 发送数量监听
|
// 发送数量监听
|
||||||
function onNumBlur() {
|
function onNumBlur() {
|
||||||
if (form.num > groupNum.value) form.num = groupNum.value
|
if (form.num > groupNum.value) form.num = groupNum.value
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发布红包
|
/**
|
||||||
function handleSubmit() {
|
* 发布红包
|
||||||
|
* @param {Object} secPwd 二级密码
|
||||||
|
*/
|
||||||
|
function handleSubmit(secPwd) {
|
||||||
//
|
//
|
||||||
const data = {
|
const data = {
|
||||||
...form
|
...form
|
||||||
}
|
}
|
||||||
|
console.log('data', data)
|
||||||
|
|
||||||
if (data.sendType == 2) {
|
if (data.sendType == 2) {
|
||||||
if (!data.num) {
|
if (!data.totalCount) {
|
||||||
util.alert('数量不能为空')
|
util.alert('数量不能为空')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (Number(data.totalCount) > Number(groupNum.value)) {
|
||||||
|
util.alert('红包数量不能大于群成员数量')
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!total.value) {
|
if (!data.totalAmount) {
|
||||||
util.alert('总金额不能为空')
|
util.alert('总金额不能为空')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 积分或余额
|
// 红包数量
|
||||||
data[{
|
if (!data.totalCount) data.totalCount = 1
|
||||||
1: 'score',
|
|
||||||
2: 'balance',
|
|
||||||
} [typeCurrent.value.id]] = total.value
|
|
||||||
// 红包祝福语
|
// 红包祝福语
|
||||||
if (!data.name) data.name = greeting.value
|
if (!data.blessing) data.blessing = greeting.value
|
||||||
// 类型
|
// 如果大于32
|
||||||
data.type = typeCurrent.value.id
|
if (data.blessing.length > 32) {
|
||||||
|
util.alert('祝福语不能超过32个字')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 金额类型
|
||||||
|
data.payType = priceCurrent.value.id
|
||||||
// 发送人id
|
// 发送人id
|
||||||
data.userId = userinfo.value.userId
|
data.userId = userinfo.value.id
|
||||||
|
// 群成员
|
||||||
|
data.limitColumn = groupNum.value
|
||||||
|
|
||||||
console.log('data', data)
|
console.log('data', data)
|
||||||
|
|
||||||
//
|
//
|
||||||
api.news.sendRedBag({
|
api.news.sendRedPacket({
|
||||||
|
query: {
|
||||||
|
// 二级密码
|
||||||
|
secondLevelCipher: secPwd,
|
||||||
|
// 红包类型
|
||||||
|
type: typeCurrent.value.id
|
||||||
|
},
|
||||||
data,
|
data,
|
||||||
}).then(rs => {
|
}).then(rs => {
|
||||||
if (rs.code == 200) {
|
if (rs.code == 200) {
|
||||||
|
@ -143,15 +179,37 @@
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 发送红包
|
||||||
|
function handleSend() {
|
||||||
|
//
|
||||||
|
const data = {
|
||||||
|
...form
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 支付二级密码
|
||||||
|
proxy.$refs.payPwdRef.open()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="app">
|
<view class="app">
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<picker mode="selector" :range="typeList" range-key="name" @change="handleTypeIndex">
|
<template v-if="form.sendType == 2">
|
||||||
|
<picker mode="selector" :range="typeList" range-key="name" @change="handleTypeIndex">
|
||||||
|
<view class="form-group rows mtb30 ptb25 bfff">
|
||||||
|
<view>红包类型:</view>
|
||||||
|
<view class="f1 tar mr10">{{ typeCurrent.name }}</view>
|
||||||
|
<uni-icons type="right" />
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<picker mode="selector" :range="priceList" range-key="name" @change="handlePriceIndex">
|
||||||
<view class="form-group rows mtb30 ptb25 bfff">
|
<view class="form-group rows mtb30 ptb25 bfff">
|
||||||
<view>红包类型:</view>
|
<view>金额类型:</view>
|
||||||
<view class="f1 tar mr10">{{ typeCurrent.name }}</view>
|
<view class="f1 tar mr10">{{ priceCurrent.name }}</view>
|
||||||
<uni-icons type="right" />
|
<uni-icons type="right" />
|
||||||
</view>
|
</view>
|
||||||
</picker>
|
</picker>
|
||||||
|
@ -159,7 +217,7 @@
|
||||||
<view class="form-group rows mtb30 bfff">
|
<view class="form-group rows mtb30 bfff">
|
||||||
<text>总金额:</text>
|
<text>总金额:</text>
|
||||||
<view class="easyinput f1 tar">
|
<view class="easyinput f1 tar">
|
||||||
<input class="f34" type="text" v-model="total" placeholder="0.00" />
|
<input class="f34" type="text" v-model="form.totalAmount" placeholder="0.00" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
@ -168,7 +226,7 @@
|
||||||
<view class="form-group rows bfff">
|
<view class="form-group rows bfff">
|
||||||
<text>数量:</text>
|
<text>数量:</text>
|
||||||
<view class="easyinput f1 tar">
|
<view class="easyinput f1 tar">
|
||||||
<input class="f34" type="text" v-model="form.num" placeholder="填写个数" @blur="onNumBlur" />
|
<input class="f34" type="text" v-model="form.totalCount" placeholder="填写个数" @blur="onNumBlur" />
|
||||||
</view>
|
</view>
|
||||||
<view class="ml10">个</view>
|
<view class="ml10">个</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -186,9 +244,12 @@
|
||||||
<text>¥</text>
|
<text>¥</text>
|
||||||
<text>{{ formatTotal }}</text>
|
<text>{{ formatTotal }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn-primary btn plus mauto" @click="handleSubmit">发送红包</view>
|
<view class="btn-primary btn plus mauto" @click="handleSend">发送红包</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 红包接口 -->
|
||||||
|
<payPwd ref="payPwdRef" @confirm="handleSubmit" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
import {
|
import {
|
||||||
onLoad
|
onLoad
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
|
// api
|
||||||
|
import api from '@/api/index.js'
|
||||||
|
// 工具库
|
||||||
|
import util from '@/common/js/util.js'
|
||||||
// 表单
|
// 表单
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
//
|
//
|
||||||
|
|
|
@ -354,29 +354,6 @@ call_type 通话类型 2为视频,1是音频
|
||||||
选择视频截帧
|
选择视频截帧
|
||||||
|
|
||||||
|
|
||||||
"publicLikes": [], // 公开赞列表
|
|
||||||
"privateLikes": [], // 隐私赞列表
|
|
||||||
"favorites": [], //收藏列表
|
|
||||||
"comments": [], // 评论列表
|
|
||||||
"forwords": null,
|
|
||||||
"publicLikeCount": 0, // 公开赞数量
|
|
||||||
"privateLikeCount": 0, // 隐私赞数量
|
|
||||||
"favoriteCount": 0, // 收藏数量
|
|
||||||
"commentCount": 0, // 评论数量
|
|
||||||
"auditUserId": null // 审核人
|
|
||||||
"title": "Java牛逼", //视频标题
|
|
||||||
"description": "Java确实牛逼", //视频描述
|
|
||||||
"tags": "1,2,3", //视频标签(传视频标签id 多个用英文逗号隔开)
|
|
||||||
"coverUrl": "123.jpg", //封面图 URL
|
|
||||||
"videoUrl": "456.mp4", //视频文件 URL
|
|
||||||
"videoSize": 1231, //视频文件大小(b)
|
|
||||||
"videoDuration": 1123, //视频时长(秒)
|
|
||||||
"status": 1, //视频状态 0草稿 1待审核 2审核失败 3已发布 4已下架
|
|
||||||
"breadth": 3.1, //视频宽度
|
|
||||||
"height": 2.1 //视频高度
|
|
||||||
"likeStatus": "1" // 1 公开赞 2私有赞 0 没有赞
|
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
0 非好友
|
0 非好友
|
||||||
1 好友
|
1 好友
|
||||||
|
|
|
@ -11,32 +11,38 @@ export default defineConfig({
|
||||||
proxy: {
|
proxy: {
|
||||||
"/system": {
|
"/system": {
|
||||||
// target: "http://192.168.0.189:8080",
|
// target: "http://192.168.0.189:8080",
|
||||||
target: "http://192.168.0.107:8080",
|
target: "http://192.168.0.102:8080",
|
||||||
|
// target: "http://192.168.0.129:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/shopify": {
|
"/shopify": {
|
||||||
// target: "http://192.168.0.189:8080",
|
// target: "http://192.168.0.189:8080",
|
||||||
target: "http://192.168.0.107:8080",
|
target: "http://192.168.0.102:8080",
|
||||||
|
// target: "http://192.168.0.129:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/user": {
|
"/user": {
|
||||||
// target: "http://192.168.0.189:8080",
|
// target: "http://192.168.0.189:8080",
|
||||||
target: "http://192.168.0.107:8080",
|
target: "http://192.168.0.102:8080",
|
||||||
|
// target: "http://192.168.0.129:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/coreplay": {
|
"/coreplay": {
|
||||||
// target: "http://192.168.0.189:8080",
|
// target: "http://192.168.0.189:8080",
|
||||||
target: "http://192.168.0.107:8080",
|
target: "http://192.168.0.102:8080",
|
||||||
|
// target: "http://192.168.0.129:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/file": {
|
"/file": {
|
||||||
// target: "http://192.168.0.189:8080",
|
// target: "http://192.168.0.189:8080",
|
||||||
target: "http://192.168.0.107:8080",
|
target: "http://192.168.0.102:8080",
|
||||||
|
// target: "http://192.168.0.129:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
"/video": {
|
"/video": {
|
||||||
// target: "http://192.168.0.189:8080",
|
// target: "http://192.168.0.189:8080",
|
||||||
target: "http://192.168.0.107:8080",
|
target: "http://192.168.0.102:8080",
|
||||||
|
// target: "http://192.168.0.129:8080",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue