群列表 红包

This commit is contained in:
sx 2025-01-12 02:05:25 +08:00
parent 8b9514d161
commit 044f759fa5
19 changed files with 263 additions and 205 deletions

View File

@ -120,30 +120,16 @@ export const news = {
url: `/im/token/getUserAppToken`,
method: 'get',
query: param
})
},
/**
* 商品列表
* @param {Object} param
*/
sendRedBag(param) {
// 发红包
sendRedPacket(param) {
return util.request({
url: `/home/sendRedBag`,
url: `/user/sendRedPacket`,
method: 'POST',
data: param.data,
})
},
// 抢红包
grabred(param) {
return util.request({
url: `/home/grabred`,
method: 'POST',
data: param.data,
query: param.query,
})
},
@ -156,7 +142,8 @@ export const news = {
})
},
//
// 红包记录
grabredLog(param) {
return util.request({
url: `/home/grabredLog`,

View File

@ -163,6 +163,18 @@ const shop = {
query: param.query,
})
},
/**
* 保存商品信息
* @param {Object} param
*/
saveProduct(param) {
return util.request({
url: `/shopify//webProduct/saveProduct`,
method: 'POST',
data: param.data,
})
},
}

View File

@ -9,8 +9,8 @@ const video = {
*/
homeVideo(param) {
return util.request({
// url: `/video/video/list`,
url: `/video/api/queryVideoByPage`,
url: `/video/video/list`,
// url: `/video/api/queryVideoByPage`,
query: param.query,
method: 'GET',
})
@ -22,8 +22,8 @@ const video = {
*/
saveVideo(param) {
return util.request({
// url: `/video/video/add`,
url: `/video/api/saveVideo`,
url: `/video/video/add`,
// url: `/video/api/saveVideo`,
data: param.data,
method: 'POST',
})
@ -158,14 +158,14 @@ const video = {
},
/**
* 我的收藏列表
* 查询收藏夹
* @param {Object} param
*/
getCollectList(param) {
return util.request({
url: `/collect/getCollectList`,
url: `/video/collection/getfavorite`,
query: param.query,
method: 'POST',
method: 'GET',
})
},
@ -175,7 +175,7 @@ const video = {
*/
saveCollectList(param) {
return util.request({
url: `/collect/saveCollectList`,
url: `/video/collection/addfavorite`,
query: param.query,
method: 'POST',
load: true,

View File

@ -5,8 +5,8 @@ const config = {
host: 'http://localhost:5173',
// #endif
// #ifndef H5
host: 'http://13859d41.r22.cpolar.top',
// host: 'http://192.168.1.236:8080',
// host: 'http://1641c8e0.r22.cpolar.top',
host: 'http://192.168.0.129:8080',
// #endif
// 上传文件二级路径
uploadFilePath: "/homecommon/file/preview?fileName=",

View File

@ -1730,6 +1730,7 @@ const util = {
name: option.name,
msgId: option.msgId,
type: option.type,
num: option.num,
})
})
},

View File

@ -101,6 +101,7 @@
pageSize: listProperty.pageSize,
}
}).then(rs => {
console.log('collect', rs)
if (rs.code === 200) {
const result = rs.rows
//
@ -197,7 +198,8 @@
<uni-swipe-action ref="swipeActionRef" v-else>
<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="poster">
<image class="wh80 br20" :src="item.formatPic" mode="aspectFill" />

View File

@ -386,11 +386,11 @@
}).then(rs => {
if (rs.confirm) emit('like', {
index,
isLike: 3,
isLike: 2,
})
else emit('like', {
index,
isLike: 0
isLike: 1
})
})
}).catch(() => {
@ -516,14 +516,14 @@
<view class="col">
<view class="pr">
<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)" />
<!-- 公开赞 -->
<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"
v-else-if="item.likeStatus == 2" @click="handleLike(index, 1)" />
v-else-if="item.likeStatus == 2" @click="handleLike(index, 0)" />
</view>
<view class="txt mt10">
<text class="text">{{ item.publicLikeCount }}</text>

View File

@ -36,9 +36,7 @@
//
const pwd = ref('')
//
const userinfo = computed(() => {
return store.state.userinfo
})
const userinfo = computed(() => store.state.userinfo)
//
function open() {

View File

@ -605,6 +605,7 @@
videoId: item.id,
}
}).then(rs => {
console.log('request', rs)
if (rs.code == 200) {
uni.$emit('updateVideo', rs.data)
return

View File

@ -46,8 +46,10 @@
const msg = reactive({
//
id: '',
//
// C2C GROUP
type: '',
//
num: '',
})
//
const content = ref('')
@ -83,15 +85,23 @@
const videoContext = ref(null)
onLoad(option => {
//
if (option.name) uni.setNavigationBarTitle({
title: option.name
})
// id
if (option.msgId) msg.id = option.msgId
//
let title = ''
//
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()
//
@ -130,12 +140,13 @@
//
function addListener() {
let onMessageReceived = function(event) {
console.log('TencentCloudChat.EVENT.MESSAGE_RECEIVED', event)
return
//
getHistory()
//
list.data.push(...event.data)
setTimeout(() => {
//
getHistory({
msgId: '',
limit: 1,
})
}, 200)
}
uni.$chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
@ -169,22 +180,14 @@
}, 200);
return
}
// msgId
// if(!param.msgId)
if (loading.value) {
//
util.showToastAndRedirect("加载中")
return
}
//
loading.value = true
//
let request = api.news.getUserMsgHistory
//
if (msg.type === 'GROUP') api.news.getGroupMsgHistory
if (msg.type == 'GROUP') request = api.news.getGroupMsgHistory
console.log('getHistory')
//
request({
@ -192,19 +195,29 @@
msgId: param.msgId || '',
fromId: userinfo.value.id,
toId: msg.id,
groupId: msg.id,
limit: param.limit || list.limit,
},
}).then(res => {
if (res.code === 200) {
//
//
const result = res.data
//
list.data.unshift(...result.list.map(item => {
item.callbackData = JSON.parse(item.callbackJson)
return item
}))
//
if (param.limit == 1) {
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)
nextTick(() => {
param.callback && param.callback()
@ -215,6 +228,8 @@
content: res.msg,
showCancel: false,
})
}).catch(rs => {
console.log('err', rs)
}).finally(() => {
loading.value = false
})
@ -257,6 +272,7 @@
//
sendMsg({
query: {
formId: userinfo.value.id,
toUserId: msg.id,
msgType: TencentCloudChat.TYPES.MSG_TEXT,
},
@ -284,9 +300,9 @@
*/
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({
query: param.query,
@ -294,10 +310,6 @@
}).then((rs) => {
if (rs.code == 200) {
param.success ? param.success() : ''
//
getHistory({
callback: scrollToBottom,
})
return
}
util.alert({
@ -446,7 +458,8 @@
<view id="scroll-content" style="padding: 30rpx 30rpx">
<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>
<image :src="item.callbackData.from_url" class="avatar" mode="widthFix" />

View File

@ -30,15 +30,8 @@
} from 'vuex'
const store = useStore()
const emit = defineEmits(['openRedBag', 'viewVideo'])
//
const formatData = computed(() => {
let result = props.item.payload.data
// console.log('computed formatData', {
// ...result
// })
return result
})
//
const formatData = computed(() => props.item.callbackData.callback_json[0])
//
const innerAudioContext = uni.createInnerAudioContext();
//
@ -79,20 +72,20 @@
<view class="content pr">
<!-- 图片 -->
<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 v-else-if="item.callbackData.MsgType === TencentCloudChat.TYPES.MSG_TEXT">
<view class="p25">
{{ item.callbackData.callback_json.Text }}
{{ formatData.MsgContent.Text }}
</view>
</template>
<!-- 自定义消息 -->
<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">
<template v-if="formatData.actionType == TencentCloudChat.TSignaling.ACTION_TYPE_INVITE">
@ -144,7 +137,7 @@
</view>
</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}"
@click="handleOpenRedBag">
@ -154,7 +147,7 @@
</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>
</template>
</template>

View File

@ -123,6 +123,7 @@
'C2C': 1,
'GROUP': 2,
} [props.msg.type],
num: props.msg.num,
})
})
// popupRE.value.open()

View File

@ -25,17 +25,19 @@
const list = reactive([])
//
const rightOption = [{
text: '退出群聊',
style: {
backgroundColor: '#F85050'
},
fn: (item) => quitGroup(item)
}]
const rightOption = [
// {
// text: '退',
// style: {
// backgroundColor: '#F85050'
// },
// fn: (item) => quitGroup(item)
// }
]
onLoad(() => {
//
// getGroupList()
getGroupList()
//
addListener()
})
@ -62,7 +64,7 @@
//
function getGroupList() {
api.news.myGroups().then(rs => {
api.news.myGroups().then(rs => {
if (rs.code == 200) {
list.length = 0
list.push(...rs.data)
@ -77,15 +79,16 @@
}
/**
* 获取群组列表
* 跳转聊天
* @param {Object} item
*/
function handleGroupItem(item) {
console.log('group item', item)
util.toChat({
name: `${item.name}(${item.memberCount})`,
msgId: item.groupID,
name: `${item.name}`,
msgId: item.groupId,
type: 'GROUP',
num: item.memberCount,
})
}
@ -118,16 +121,16 @@
</script>
<template>
<view class="group app">
<view class="appbw">
<uni-swipe-action ref="swipeAction">
<view class="list plr20 pb30">
<view class="li" v-for="(item, index) in list" :key="index">
<view class="list plr30 pb30">
<view class="item" v-for="(item, index) in list" :key="index">
<uni-swipe-action-item :right-options="rightOption" @click="handleMenu($event,item)">
<view class="item rows ptb20" @click="handleGroupItem(item)">
<image class="wh80 avatar br10" :src="item.avatar" mode="aspectFill" />
<view class="item rows ptb30" @click="handleGroupItem(item)">
<image class="wh120 fs0 avatar br10" :src="item.groupFaceUrl" mode="aspectFill" />
<view class="f1 mlr20">
<view class="name thd f1 c333 f32">{{item.name}}</view>
<view class="f1 oh ml30">
<view class="name thd f1 c333 f34">{{item.name}}</view>
<!-- <view class="content thd mt10 c666 f24">{{item.lastMessage.messageForShow || ''}}</view> -->
</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>
<style lang="scss">
.group {
height: 100%;
.scroll {
height: 100%;
.list {
.item + .item {
border-top: 2rpx solid #eee;
}
}
</style>

View File

@ -90,9 +90,10 @@
util.alert('请至少选择两名用户')
return
}
// id
data.ownerAccount = userinfo.value.id
//
data.groupUsers = [
{
data.groupUsers = [{
userId: userinfo.value.id
},
...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({

View File

@ -1,7 +1,5 @@
<script setup>
/**
* 消息
*/
//
import {
ref,

View File

@ -3,6 +3,7 @@
ref,
reactive,
computed,
getCurrentInstance,
} from 'vue';
import {
useStore
@ -13,36 +14,62 @@
import util from '@/common/js/util.js'
import {
onLoad,
onReady
} from "@dcloudio/uni-app"
//
import payPwd from '@/components/mine/payPwd.vue'
//
const store = useStore()
//
const {
proxy
} = getCurrentInstance()
//
const form = reactive({
status: 0,
totalAmount: '',
totalCount: '',
})
//
const typeList = reactive([{
id: 1,
//
const priceList = reactive([{
id: 2,
name: '积分红包',
}, {
id: 2,
id: 1,
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 groupNum = ref('')
//
const typeIndex = ref(0)
//
//
const typeCurrent = computed(() => {
let result = typeList[typeIndex.value]
return result
})
//
const priceCurrent = computed(() => {
let result = priceList[priceIndex.value]
return result
})
//
const formatTotal = computed(() => {
let result = Number(total.value || 0)
let result = Number(form.totalAmount || 0)
result = result.toFixed(2)
return result
})
@ -55,82 +82,91 @@
onLoad((option) => {
const type = option.sendType
if (type) {
// 1 2
form.sendType = type
form[{
1: 'sendId',
2: 'roomId',
1: 'toId',
2: 'groupId',
} [type]] = option.msgId
//
if (type == 2) getGroup()
}
//
if (option.num) groupNum.value = option.num
})
//
function getGroup() {
// sdk
let isReady = uni.$chat.isReady();
onReady(() => {
// proxy.$refs.payPwdRef.open()
})
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) {
const index = ev.detail.value
if (index === typeIndex.value) return
typeIndex.value = index
}
//
function handlePriceIndex(ev) {
const index = ev.detail.value
if (index === priceIndex.value) return
priceIndex.value = index
}
//
function onNumBlur() {
if (form.num > groupNum.value) form.num = groupNum.value
}
//
function handleSubmit() {
/**
* 发布红包
* @param {Object} secPwd 二级密码
*/
function handleSubmit(secPwd) {
//
const data = {
...form
}
console.log('data', data)
if (data.sendType == 2) {
if (!data.num) {
if (!data.totalCount) {
util.alert('数量不能为空')
return
}
if (Number(data.totalCount) > Number(groupNum.value)) {
util.alert('红包数量不能大于群成员数量')
return
}
}
if (!total.value) {
if (!data.totalAmount) {
util.alert('总金额不能为空')
return
}
//
data[{
1: 'score',
2: 'balance',
} [typeCurrent.value.id]] = total.value
//
if (!data.totalCount) data.totalCount = 1
//
if (!data.name) data.name = greeting.value
//
data.type = typeCurrent.value.id
if (!data.blessing) data.blessing = greeting.value
// 32
if (data.blessing.length > 32) {
util.alert('祝福语不能超过32个字')
return
}
//
data.payType = priceCurrent.value.id
// id
data.userId = userinfo.value.userId
data.userId = userinfo.value.id
//
data.limitColumn = groupNum.value
console.log('data', data)
//
api.news.sendRedBag({
api.news.sendRedPacket({
query: {
//
secondLevelCipher: secPwd,
//
type: typeCurrent.value.id
},
data,
}).then(rs => {
if (rs.code == 200) {
@ -143,15 +179,37 @@
})
})
}
//
function handleSend() {
//
const data = {
...form
}
//
proxy.$refs.payPwdRef.open()
}
</script>
<template>
<view class="app">
<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>红包类型</view>
<view class="f1 tar mr10">{{ typeCurrent.name }}</view>
<view>金额类型</view>
<view class="f1 tar mr10">{{ priceCurrent.name }}</view>
<uni-icons type="right" />
</view>
</picker>
@ -159,7 +217,7 @@
<view class="form-group rows mtb30 bfff">
<text>总金额</text>
<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>
@ -168,7 +226,7 @@
<view class="form-group rows bfff">
<text>数量</text>
<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 class="ml10"></view>
</view>
@ -186,9 +244,12 @@
<text></text>
<text>{{ formatTotal }}</text>
</view>
<view class="btn-primary btn plus mauto" @click="handleSubmit">发送红包</view>
<view class="btn-primary btn plus mauto" @click="handleSend">发送红包</view>
</view>
</view>
<!-- 红包接口 -->
<payPwd ref="payPwdRef" @confirm="handleSubmit" />
</template>
<style lang="scss" scoped>

View File

@ -8,6 +8,10 @@
import {
onLoad
} from '@dcloudio/uni-app'
// api
import api from '@/api/index.js'
//
import util from '@/common/js/util.js'
//
const form = reactive({
//

View File

@ -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
0 非好友
1 好友

View File

@ -11,32 +11,38 @@ export default defineConfig({
proxy: {
"/system": {
// 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,
},
"/shopify": {
// 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,
},
"/user": {
// 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,
},
"/coreplay": {
// 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,
},
"/file": {
// 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,
},
"/video": {
// 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,
},
}