2025.03.09 工作代码提交

This commit is contained in:
sx 2025-03-10 08:52:36 +08:00
parent 8fd05cc702
commit fc83ac9e06
28 changed files with 1253 additions and 1346 deletions

View File

@ -6,11 +6,10 @@ const config = {
// host: 'h5api',
// #endif
// #ifndef H5
// host: 'http://91f.xyz:8080',
host: 'http://27380b6d.r24.cpolar.top',
host: 'http://91f.xyz:8080',
// #endif
// 是否vivo显示
showVivo: true,
showVivo: false,
// 支付方式配置
payType: {
score: {

View File

@ -213,7 +213,7 @@ const util = {
responseType: params.responseType || 'text',
// 请求成功返回
success: res => {
console.log('request success', url, res, params.data ? params.data : '')
// console.log('request success', url, res, params.data ? params.data : '')
// 关闭加载效果
if (params.load) {
uni.hideLoading()

View File

@ -218,17 +218,6 @@ function removelistener() {
//
function getFriendList() {
// sdk
let isReady = uni.$chat.isReady();
console.log('getFriendList', isReady)
if (!isReady) {
setTimeout(function () {
getFriendList()
}, 500);
return
}
//
api.news.getFriendList().then(rs => {
if (rs.code == 200) {
@ -440,7 +429,7 @@ function link(url) {
<uni-icons type="right" color="#999" size="30rpx" />
</view>
<view class="rows ptb20 plr30 bfff" @click="link('/pages/news/chatGroup')">
<view class="rows ptb20 plr30 bfff" @click="link('/pages/news/group/chatList')">
<view class="">群聊列表</view>
<uni-icons type="right" color="#999" size="30rpx" />
</view>

View File

@ -1,302 +1,299 @@
<script setup>
/**
* 消息列表
*/
import api from '@/api/index.js'
import {
ref,
computed,
reactive,
onMounted,
onUnmounted,
getCurrentInstance,
} from 'vue'
//
import TencentCloudChat from '@tencentcloud/chat';
//
import util from '@/common/js/util.js'
import {
useStore,
} from 'vuex'
const {
proxy
} = getCurrentInstance()
const store = useStore()
const userinfo = computed(() => {
let result = store.state.userinfo
return result
})
//
const rightOption = [{
text: '删除',
style: {
backgroundColor: '#F85050'
},
fn: (item) => delMsg(item)
}, {
text: '设为已读',
style: {
backgroundColor: '#00ADEE'
},
fn: (item) => setRead(item)
},]
//
const systemRightOption = [{
text: '删除',
style: {
backgroundColor: '#F85050'
},
}, {
text: '设为已读',
style: {
backgroundColor: '#00ADEE'
},
},]
//
const props = defineProps({
//
type: {
type: Number,
default: 0,
},
})
//
const list = reactive([])
onMounted(() => {
if (props.type == 0) {
getList()
} else if (props.type == 1) {
//
} else if (props.type == 2) {
//
}
addListener()
})
onUnmounted(() => {
removeListener()
})
//
function addListener() {
let onMessageReceived = function (event) {
getList()
}
uni.$chat.on(TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED, onMessageReceived);
}
//
function removeListener() {
uni.$chat.off(TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED, () => { });
}
//
function getList() {
// sdk
let isReady = uni.$chat.isReady();
if (!isReady) {
setTimeout(function () {
getList();
}, 800);
return
}
uni.$emit('updateNum', {})
uni.$chat.getConversationList().then(rs => {
let res = rs.data.conversationList
let arr = []
res.forEach(item => {
let obj = {}
obj.type = item.type;
obj.chatText = item.lastMessage.messageForShow;
obj.MsgTime = handleDate(item.lastMessage.lastTime);
obj.unreadCount = item.unreadCount;
if (item.type == 'C2C') {
obj.avatar = item.userProfile.avatar;
obj.name = item.userProfile.nick;
obj.userID = item.userProfile.userID;
} else if (item.type == 'GROUP') {
obj.avatar = item.groupProfile.avatar;
obj.name = item.groupProfile.name;
obj.num = item.groupProfile.memberCount;
obj.groupID = item.groupProfile.groupID;
}
arr.push(obj)
})
list.data = arr;
/**
* 消息列表
*/
import api from '@/api/index.js'
import {
ref,
computed,
reactive,
onMounted,
onUnmounted,
getCurrentInstance,
} from 'vue'
//
import TencentCloudChat from '@tencentcloud/chat';
//
import util from '@/common/js/util.js'
import {
useStore,
} from 'vuex'
const {
proxy
} = getCurrentInstance()
const store = useStore()
const userinfo = computed(() => {
let result = store.state.userinfo
return result
})
// api.news.getMessageList({
// query: {
// userId: userinfo.value.id,
// }
// }).then(rs => {
// if (rs.code == 200) {
// let msg = JSON.parse(rs.msg);
//
const rightOption = [{
text: '删除',
style: {
backgroundColor: '#F85050'
},
fn: (item) => delMsg(item)
}, {
text: '设为已读',
style: {
backgroundColor: '#00ADEE'
},
fn: (item) => setRead(item)
}, ]
// list.data = handleList(msg.SessionItem);
//
const systemRightOption = [{
text: '删除',
style: {
backgroundColor: '#F85050'
},
}, {
text: '设为已读',
style: {
backgroundColor: '#00ADEE'
},
}, ]
//
const props = defineProps({
//
type: {
type: Number,
default: 0,
},
})
// return
// }
// util.alert({
// content: rs.msg,
// showCancel: false,
// })
// })
}
//
const list = reactive([])
/**
* 消息列表
* @param {Object} item
*/
function handleList(list) {
// sdk
let isReady = uni.$chat.isReady();
if (!isReady) {
setTimeout(function () {
handleList(list);
}, 800);
return
onMounted(() => {
if (props.type == 0) {
getList()
} else if (props.type == 1) {
//
} else if (props.type == 2) {
//
}
addListener()
})
onUnmounted(() => {
removeListener()
})
//
function addListener() {
let onMessageReceived = function(event) {
getList()
}
uni.$chat.on(TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED, onMessageReceived);
}
if (list) {
list.forEach(item => {
item.MsgTime = handleDate(item.MsgTime)
let type = item.type == 'C2C' ? `C2C${item.To_Account}` : `GROUP${item.GroupId}`;
uni.$chat.getConversationProfile(type).then(rs => {
let res = rs.data.conversation;
//
function removeListener() {
uni.$chat.off(TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED, () => {});
}
//
function getList() {
// sdk
let isReady = uni.$chat.isReady();
if (!isReady) {
setTimeout(function() {
getList();
}, 800);
return
}
uni.$chat.getConversationList().then(rs => {
console.log('msgList getList', rs)
let res = rs.data.conversationList
let arr = []
res.forEach(item => {
let obj = {}
obj.type = item.type;
obj.chatText = item.lastMessage.messageForShow;
obj.MsgTime = handleDate(item.lastMessage.lastTime);
obj.unreadCount = item.unreadCount;
item.chatText = res.lastMessage.messageForShow;
item.unreadCount = res.unreadCount;
if (item.type == 'C2C') {
item.avatar = res.userProfile.avatar;
item.name = res.userProfile.nick;
obj.avatar = item.userProfile.avatar;
obj.name = item.userProfile.nick;
obj.userID = item.userProfile.userID;
} else if (item.type == 'GROUP') {
item.avatar = res.groupProfile.avatar;
item.name = res.groupProfile.name;
item.num = res.groupProfile.memberCount;
obj.avatar = item.groupProfile.avatar;
obj.name = item.groupProfile.name;
obj.num = item.groupProfile.memberCount;
obj.groupID = item.groupProfile.groupID;
}
arr.push(obj)
})
list.data = arr;
})
// api.news.getMessageList({
// query: {
// userId: userinfo.value.id,
// }
// }).then(rs => {
// if (rs.code == 200) {
// let msg = JSON.parse(rs.msg);
// list.data = handleList(msg.SessionItem);
// return
// }
// util.alert({
// content: rs.msg,
// showCancel: false,
// })
// })
}
/**
* 消息列表
* @param {Object} item
*/
function handleList(list) {
// sdk
let isReady = uni.$chat.isReady();
if (!isReady) {
setTimeout(function() {
handleList(list);
}, 800);
return
}
if (list) {
list.forEach(item => {
item.MsgTime = handleDate(item.MsgTime)
let type = item.type == 'C2C' ? `C2C${item.To_Account}` : `GROUP${item.GroupId}`;
uni.$chat.getConversationProfile(type).then(rs => {
let res = rs.data.conversation;
item.chatText = res.lastMessage.messageForShow;
item.unreadCount = res.unreadCount;
if (item.type == 'C2C') {
item.avatar = res.userProfile.avatar;
item.name = res.userProfile.nick;
} else if (item.type == 'GROUP') {
item.avatar = res.groupProfile.avatar;
item.name = res.groupProfile.name;
item.num = res.groupProfile.memberCount;
}
})
})
}
return list
}
// //
// function handleUser(item) {
// uni.navigateTo({
// url: util.setUrl('/pages/index/videoHome', {
// userId: item.userId,
// })
// })
// }
// //
// function navigateToPage(path) {
// uni.navigateTo({
// url: path
// });
// }
/**
* 去聊天
* @param {Object} item
*/
function handleChat(item) {
let param = {};
//
if (item.type == 'C2C') {
param.type = 'C2C'
param.name = `${item.name}`
param.msgId = `${item.userID}`
} else {
//
param.type = 'GROUP'
param.name = `${item.name}`
param.msgId = `${item.groupID}`
param.num = `${item.num}`
}
setRead(item)
util.toChat(param)
}
/**
* 菜单
* @param {Object} ev 默认事件
* @param {Object} item 单项
*/
function handleMenu(ev, item) {
console.log('ev', ev, item)
ev.content.fn(item)
proxy.$refs.swipeAction.closeAll()
}
//
function delMsg(item) {
// sdk
let isReady = uni.$chat.isReady();
if (!isReady) {
setTimeout(function() {
delMsg(item);
}, 800);
return
}
let conversationId = item.type == 'C2C' ? `C2C${item.userID}` : `GROUP${item.groupID}`;
uni.$chat.deleteConversation(conversationId).then(rs => {
getList()
})
}
return list
}
//
function setRead(item) {
// sdk
let isReady = uni.$chat.isReady();
if (!isReady) {
setTimeout(function() {
setRead(item);
}, 800);
return
}
// //
// function handleUser(item) {
// uni.navigateTo({
// url: util.setUrl('/pages/index/videoHome', {
// userId: item.userId,
// })
// })
// }
// //
// function navigateToPage(path) {
// uni.navigateTo({
// url: path
// });
// }
/**
* 去聊天
* @param {Object} item
*/
function handleChat(item) {
let param = {};
//
if (item.type == 'C2C') {
param.type = 'C2C'
param.name = `${item.name}`
param.msgId = `${item.userID}`
} else {
//
param.type = 'GROUP'
param.name = `${item.name}`
param.msgId = `${item.groupID}`
param.num = `${item.num}`
let conversationId = item.type == 'C2C' ? `C2C${item.userID}` : `GROUP${item.groupID}`;
uni.$chat.setMessageRead({
conversationID: conversationId,
}).then(rs => {
getList()
})
}
setRead(item)
util.toChat(param)
}
//
function handleDate(timestamp) {
var timestamp = +timestamp * 1000;
var date = new Date(timestamp);
/**
* 菜单
* @param {Object} ev 默认事件
* @param {Object} item 单项
*/
function handleMenu(ev, item) {
console.log('ev', ev, item)
ev.content.fn(item)
proxy.$refs.swipeAction.closeAll()
}
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
//
function delMsg(item) {
// sdk
let isReady = uni.$chat.isReady();
if (!isReady) {
setTimeout(function () {
delMsg(item);
}, 800);
return
var formattedDate = M + D + h + m + s;
return formattedDate
}
let conversationId = item.type == 'C2C' ? `C2C${item.userID}` : `GROUP${item.groupID}`;
uni.$chat.deleteConversation(conversationId).then(rs => {
getList()
})
}
//
function setRead(item) {
// sdk
let isReady = uni.$chat.isReady();
if (!isReady) {
setTimeout(function () {
setRead(item);
}, 800);
return
}
let conversationId = item.type == 'C2C' ? `C2C${item.userID}` : `GROUP${item.groupID}`;
uni.$chat.setMessageRead({
conversationID: conversationId,
}).then(rs => {
getList()
})
}
//
function handleDate(timestamp) {
var timestamp = +timestamp * 1000;
var date = new Date(timestamp);
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
var formattedDate = M + D + h + m + s;
return formattedDate
}
</script>
<template>
@ -364,7 +361,8 @@ function handleDate(timestamp) {
<view class="rows">
<view class="name f1 thd c333 f32">{{ item.name }}</view>
<view class="datetime c999 f22">
{{ util.formatTime('MM-dd HH:mm', item.MsgTime) }}</view>
{{ util.formatTime('MM-dd HH:mm', item.MsgTime) }}
</view>
</view>
<view class="desc thd mt10 c666 f24">{{ item.chatText }}</view>
</view>
@ -378,34 +376,34 @@ function handleDate(timestamp) {
</template>
<style lang="scss">
//
.firendBox {
height: 100%;
.scroll {
//
.firendBox {
height: 100%;
}
//
.list {
//
.mark,
.dot {
background-color: #FF6B17;
text-align: center;
line-height: 30rpx;
.scroll {
height: 100%;
}
.mark {
width: 30rpx;
height: 30rpx;
}
//
.list {
.dot {
width: 20rpx;
height: 20rpx;
//
.mark,
.dot {
background-color: #FF6B17;
text-align: center;
line-height: 30rpx;
}
.mark {
width: 30rpx;
height: 30rpx;
}
.dot {
width: 20rpx;
height: 20rpx;
}
}
}
}
</style>

View File

@ -73,13 +73,7 @@
}
},
{
"path": "pages/news/group-chat-list/index",
"style": {
"navigationBarTitleText": "群聊列表"
}
},
{
"path": "pages/news/group-chat/index",
"path": "pages/news/group/create",
"style": {
"navigationBarTitleText": "创建群聊",
"navigationBarBackgroundColor": "#fff"
@ -88,16 +82,10 @@
{
"path": "pages/news/chat/chat",
"style": {
"navigationBarTitleText": "",
"navigationBarTitleText": "聊天",
"navigationStyle": "custom"
}
},
{
"path": "pages/news/red-envelope/index",
"style": {
"navigationBarTitleText": "红包详情"
}
},
{
"path": "pages/news/goodsList/index",
"style": {
@ -362,14 +350,14 @@
}
},
{
"path": "pages/news/newAttention",
"path": "pages/mine/newAttention",
"style": {
"navigationBarTitleText": "新的关注",
"navigationBarBackgroundColor": "#fff"
}
},
{
"path": "pages/news/newFans",
"path": "pages/mine/newFans",
"style": {
"navigationBarTitleText": "新的粉丝",
"navigationBarBackgroundColor": "#fff"
@ -408,18 +396,6 @@
"navigationBarTitleText": "红包"
}
},
{
"path": "pages/news/audio-video/audio",
"style": {
"navigationBarTitleText": "语音"
}
},
{
"path": "pages/news/audio-video/video",
"style": {
"navigationBarTitleText": "视频"
}
},
{
"path": "pages/index/integralDetail",
"style": {
@ -687,7 +663,7 @@
}
},
{
"path": "pages/news/chatGroup",
"path": "pages/news/group/chatList",
"style": {
"navigationBarTitleText": "群聊列表",
"navigationBarBackgroundColor": "#fff"
@ -786,6 +762,20 @@
{
"navigationBarTitleText" : "关于九亿"
}
},
{
"path" : "pages/news/detail/group",
"style" :
{
"navigationBarTitleText" : "群聊详情"
}
},
{
"path" : "pages/news/group/invite",
"style" :
{
"navigationBarTitleText" : "邀请加群"
}
}
],

View File

@ -107,9 +107,10 @@
<view class="txt mtb10">每日可释放{{item.releasableDaily}}</view>
<view class="txt mtb10">剩余可释放{{item.remainFruitCount}}</view>
<view class="txt mtb10">当前级别{{item.treeName}}</view>
<view class="txt mtb10" @click.stop="util.copyText(item.treeHash)">
<text>哈希值 {{item.formatHash}}</text>
<view class="txt df aic mtb10" @click.stop="util.copyText(item.treeHash)">
<view class="thd">哈希值 {{item.formatHash}}</view>
<image class="wh20 ml10" src="/static/copy.png" mode="aspectFit" />
<view class="f1"></view>
</view>
</view>
</view>

View File

@ -53,6 +53,9 @@
}, {
type: 2,
name: '已入账',
}, {
type: 3,
name: '已取消',
}])
//
const getTypeListIndex = ref(0)

View File

@ -297,12 +297,12 @@
<view class="key ml10 c666 f24">隐私赞</view>
</view>
<view class="option" @click="link('/pages/news/newAttention')">
<view class="option" @click="link('/pages/mine/newAttention')">
<view class="value fmid f36 br10">{{userinfo.userAttention}}</view>
<view class="key ml10 c666 f24">关注</view>
</view>
<view class="option" @click="link('/pages/news/newFans')">
<view class="option" @click="link('/pages/mine/newFans')">
<view class="value fmid f36 br10">{{userinfo.userFans}}</view>
<view class="key ml10 c666 f24">粉丝</view>
</view>
@ -416,7 +416,7 @@
</uni-popup>
</template>
<style lang="scss">
<style lang="scss" scoped>
//
.apex {

View File

@ -1,14 +0,0 @@
<!-- 页面描述 -->
<template>
<view class="container">1111</view>
</template>
<script setup>
import { ref } from 'vue'
// import RtcEngine from '../../../lib/commonjs/components/Agora-RTC-JS/index';
// const RtcEngine = require('../../../lib/commonjs/components/Agora-RTC-JS/index.js')["default"]
RtcEngine.create('__UNI__08B31BC').then((engine) => {
console.log('init success');
});
</script>
<style scoped lang="scss"></style>

View File

@ -1,14 +0,0 @@
<!-- 页面描述 -->
<template>
<view class="container">1111</view>
</template>
<script setup>
import { ref } from 'vue'
// import RtcEngine from '../../../lib/commonjs/components/Agora-RTC-JS/index';
// const RtcEngine = require('../../../lib/commonjs/components/Agora-RTC-JS/index.js')["default"]
RtcEngine.create('__UNI__08B31BC').then((engine) => {
console.log('init success');
});
</script>
<style scoped lang="scss"></style>

View File

@ -1,8 +0,0 @@
<template>
</template>
<script>
</script>
<style>
</style>

View File

@ -1,8 +0,0 @@
<template>
</template>
<script>
</script>
<style>
</style>

View File

@ -93,16 +93,18 @@
onLoad(option => {
//
let title = ''
//
if (option.type) msg.type = option.type
//
if (option.name) title = option.name
// id
// id
if (option.msgId) msg.id = option.msgId
//
if (option.type == 'GROUP') {
msg.num = option.num
title = `(${option.num})${option.name}`
//
if (option.type) {
msg.type = option.type
//
if (option.type == 'GROUP') {
msg.num = option.num
title = `(${option.num})${option.name}`
}
}
//
if (title) pageTitle.value = title
@ -157,9 +159,7 @@
}, 200)
}
// #ifdef APP
uni.$chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
// #endif
}
//
@ -214,10 +214,10 @@
data: param.data,
}).then((rs) => {
if (rs.code == 200) {
getHistory({
msgId: '',
limit: 1,
})
// getHistory({
// msgId: '',
// limit: 1,
// })
param.success ? param.success() : ''
return
}
@ -261,7 +261,6 @@
//
// if (redPacket.isStale == 1) return
//
api.news.getRedPacket({
query: {
@ -458,6 +457,19 @@
* @param {Object} ev
*/
function handleMore(ev) {
//
const url = {
'GROUP': util.setUrl('/pages/news/detail/group',{
groupId: msg.id,
}),
'C2C': util.setUrl('/')
} [msg.type]
//
uni.navigateTo({
url,
})
return
const config = [{
name: '举报',
callback: rs => {

View File

@ -17,7 +17,7 @@
item: {
type: Object,
default: () => {
{}
return {}
}
},
msg: {
@ -138,15 +138,15 @@
<!-- 红包消息 -->
<template v-else-if="formatData.businessType == 'redPacket'">
<!-- 红包 -->
<view class="redPacket br10" :class="{'disabled': 0}"
@click="handleOpenRedBag">
<view class="redPacket br10" :class="{'disabled': 0}" @click="handleOpenRedBag">
<view class="df aic">
<image class="img fs0 mr10" src="/static/image/red-envelope.png" />
<image class="img fs0 mr10" src="/static/image/pages/news/group/create.png" />
<view class="red-packet-text cfff">{{ formatData.data.blessing }}</view>
</view>
<!-- 分割线 -->
<view class="line"></view>
<view class="f20" style="color:#FBD3A4">{{ formatData.data.payType == 1 ? '余额红包' : '积分红包' }}</view>
<view class="f20" style="color:#FBD3A4">{{ formatData.data.payType == 1 ? '余额红包' : '积分红包' }}
</view>
</view>
</template>
</template>

View File

@ -40,7 +40,7 @@ const plusList = computed(() => {
label: '拍摄',
value: 'takePhoto',
}, {
type: 'red-envelope.png',
type: 'pages/news/group/create.png',
label: '红包',
value: 'redEnvelope',
}

View File

@ -0,0 +1,179 @@
<script setup>
//
//
import TencentCloudChat from '@tencentcloud/chat';
import {
ref,
reactive,
nextTick,
onUnmounted,
onMounted,
computed,
getCurrentInstance,
watch,
} from 'vue'
//
import util from '@/common/js/util.js'
import {
onLoad,
onReady,
onPageScroll,
onUnload
} from "@dcloudio/uni-app"
// id
const groupId = ref('')
//
const detail = reactive({
selfInfo: {
role: '',
}
})
//
const memberList = reactive([])
//
const role = computed(() => detail?.selfInfo?.role)
onLoad((option) => {
if (option.groupId) groupId.value = option.groupId
//
getDetail()
//
getGroupMemberList()
})
/**
* 获取群详细资料
* https://web.sdk.qcloud.com/im/doc/v3/zh-cn/SDK.html#getGroupProfile
*/
function getDetail() {
uni.$chat.getGroupProfile({
groupID: groupId.value,
}).then((rs) => {
if (rs.code == 0) {
Object.assign(detail, rs.data.group)
}
}).catch(function(imError) {
console.warn('getGroupProfile error:', imError); //
});
}
/**
* 获取群成员列表
* https://web.sdk.qcloud.com/im/doc/v3/zh-cn/SDK.html#getGroupMemberList
*/
function getGroupMemberList() {
uni.$chat.getGroupMemberList({
groupID: groupId.value,
count: 20,
}).then(function(rs) {
memberList.length = 0
memberList.push(...rs.data.memberList)
})
}
/**
* 跳转
* @param {Object} url 跳转路径
*/
function link(url) {
uni.navigateTo({
url,
})
}
</script>
<template>
<view class="app">
<!-- 群成员列表 -->
<view class="member container mtb20 plr20 c333 f26 bfff">
<view class="header rows ptb20">
<view class="title f32">群聊成员({{detail.memberCount}})</view>
</view>
<view class="list ptb20">
<view class="item ver" v-for="(item,index) in memberList" :key="item.userID">
<image :src="item.avatar" mode="aspectFill" class="wh80 br10" />
<view class="name thd mt10 c999 f26">{{item.nick}}</view>
</view>
<view class="item ver" @click="link(util.setUrl('/pages/news/group/invite',{'groupId': groupId}))">
<view class="add fmid wh80 br10">
<uni-icons type="plus" color="#999" size="80rpx" />
</view>
<view class="name thd mt10 c999 f26">邀请</view>
</view>
<view class="item ver" v-if="role == 'Owner'">
<view class="add fmid wh80 br10">
<uni-icons type="minus" color="#999" size="80rpx" />
</view>
<view class="name thd mt10 c999 f26">移除</view>
</view>
</view>
</view>
<!-- 群信息 -->
<view class="container plr20 c333 f34 bfff">
<view class="line rows ptb30">
<view class="key">群聊头像</view>
<view class="value c333">
<image :src="detail.avatar" mode="aspectFill" class="wh120" />
</view>
</view>
<view class="line rows ptb30">
<view class="key">群聊名称</view>
<view class="value c666">{{detail.name}}</view>
</view>
<view class="line ptb30">
<view class="key">群聊公告</view>
<view class="value c666">{{detail.notification}}</view>
</view>
<view class="line ptb30">
<view class="key">群聊介绍</view>
<view class="value c666">{{detail.introduction}}</view>
</view>
<view class="line rows ptb30">
<view class="key">举报</view>
<view class="value c666">
<uni-icons type="right" color="#999" />
</view>
</view>
</view>
<!-- 退出群聊 -->
<view class="mtb20 ptb20 tac f34 cFF4242 bfff">退出群聊</view>
</view>
</template>
<style lang="scss">
//
.member {
.list {
display: grid;
grid-template-columns: repeat(5, 1fr);
//
.add,
//
.remove {
box-sizing: border-box;
// border: 4rpx dashed #ddd;
}
}
}
//
.container {
.line+.line {
border-top: 1rpx solid #eee;
}
}
</style>

View File

@ -1,122 +1,120 @@
<script setup>
/**
* 客服聊天界面商品列表
*/
import {
reactive,
defineExpose,
} from 'vue'
//
import util from '@/common/js/util.js'
// api
import api from '@/api/index.js'
/**
* 客服聊天界面商品列表
*/
import {
reactive,
defineExpose,
} from 'vue'
//
import util from '@/common/js/util.js'
// api
import api from '@/api/index.js'
import { onLoad } from "@dcloudio/uni-app"
import {
onLoad
} from "@dcloudio/uni-app"
//
const listPrototype = reactive({
pageSize: 10,
pageNum: 1,
total: 0,
merId: '',
data: [],
})
onLoad(option => {
getList(option)
})
//
const listPrototype = reactive({
pageSize: 10,
pageNum: 1,
total: 0,
merId: '',
data: [],
})
/**
* 点击列表项
* @param {Object} item 列表项
*/
function handleItem(item) {
//
uni.navigateTo({
url: util.setUrl('/pages/shop/commodity/index', {
productId: item.id
})
})
}
//
function refreshList() {
listPrototype.pageNum = 1
listPrototype.total = 0
getList()
}
onLoad(option => {
getList(option)
})
//
function getMoreList() {
console.log('getMoreList', listPrototype)
if (listPrototype.total <= listPrototype.data.length) return
listPrototype.pageNum++
getList()
}
//
function getList(option) {
let param = {
pageSize: listPrototype.pageSize,
pageNum: listPrototype.pageNum,
merId: option.merId
}
api.shop.getShopProductList(param).then(rs => {
if (rs.code == 200) {
if (listPrototype.pageNum == 1) listPrototype.data.length = []
listPrototype.data.push(...rs.rows)
listPrototype.total = rs.total
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
}).finally(rs => {
uni.stopPullDownRefresh()
})
}
/**
* 点击列表项
* @param {Object} item 列表项
*/
function handleItem(item) {
//
uni.navigateTo({
url: util.setUrl('/pages/shop/commodity/index', {
productId: item.id
})
})
}
//
function sendProduct(item) {
console.log('发送商品', item);
}
//
function refreshList() {
listPrototype.pageNum = 1
listPrototype.total = 0
getList()
}
//
function getMoreList() {
console.log('getMoreList', listPrototype)
if (listPrototype.total <= listPrototype.data.length) return
listPrototype.pageNum++
getList()
}
//
function getList(option) {
let param = {
pageSize: listPrototype.pageSize,
pageNum: listPrototype.pageNum,
merId: option.merId
}
api.shop.getShopProductList(param).then(rs => {
if (rs.code == 200) {
if (listPrototype.pageNum == 1) listPrototype.data.length = []
listPrototype.data.push(...rs.rows)
listPrototype.total = rs.total
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
}).finally(rs => {
uni.stopPullDownRefresh()
})
}
//
function sendProduct(item) {
console.log('发送商品', item);
}
defineExpose({
getList,
listPrototype,
refreshList,
getMoreList,
})
defineExpose({
getList,
listPrototype,
refreshList,
getMoreList,
})
</script>
<template>
<view class="list">
<view class="product line df ptb20 plr20" v-for="(item, index) in listPrototype.data" :key="index"
@click="handleItem(item)">
<view class="list">
<view class="product line df ptb20 plr20" v-for="(item, index) in listPrototype.data" :key="index"
@click="handleItem(item)">
<view class="poster wh160">
<image class="wh160 br10" :src="item.sliderImage.split(',')[0]" mode="aspectFill" />
</view>
<view class="poster wh160">
<image class="wh160 br10" :src="item.sliderImage.split(',')[0]" mode="aspectFill" />
</view>
<view class="info df fdc jcsb f1 ml20">
<view class="name t2hd c333 f28">{{ item.name }}</view>
<view class="info df fdc jcsb f1 ml20">
<view class="name t2hd c333 f28">{{ item.name }}</view>
<view class="other rows">
<view class="col c333">
<text class="f20"></text>
<text class="f30">{{ item.price }}</text>
<text class="count ml20 fs0 c999 f24">销量{{ item.sales }}</text>
</view>
<view @click.stop="sendProduct(item)" class="btn ti warmHollow plr20">去咨询</view>
</view>
</view>
</view>
</view>
<view class="other rows">
<view class="col c333">
<text class="f20"></text>
<text class="f30">{{ item.price }}</text>
<text class="count ml20 fs0 c999 f24">销量{{ item.sales }}</text>
</view>
<view @click.stop="sendProduct(item)" class="btn ti warmHollow plr20">去咨询</view>
</view>
</view>
</view>
</view>
</template>
<style scoped lang="scss"></style>

View File

@ -1,34 +0,0 @@
<!-- 群聊列表 -->
<template>
<view class="group-chat-list" v-if="groupList.length > 0">
<view class="p25" v-for="(item, index) in groupList" :key="index"
@click="notificationChat(item, msgType.chatType.GROUP_CHAT)">
{{ item.groupname }}
</view>
</view>
</template>
<script setup>
import { ref, inject } from 'vue';
const groupList = ref([]);
const { notificationChat } = inject('util')
const msgType = {}
const fetchGroupList = () => {
try {
uni.WebIM.conn.getGroup({
limit: 100,
success: function (res) {
groupList.value = res.data
getApp().globalData.groupList = res.data || [];
},
error: function () { }
});
} catch (error) {
console.error('获取群聊列表失败:', error);
}
}
fetchGroupList()
</script>
<style scoped lang="scss"></style>

View File

@ -1,234 +0,0 @@
<script setup>
/**
* 发起群聊
*/
import {
ref,
reactive,
computed
} from 'vue'
import {
useStore
} from 'vuex'
import {
onLoad
} from '@dcloudio/uni-app'
//
import util from '@/common/js/util.js'
//
import apex from '@/components/header/apex.vue'
//
import TencentCloudChat from '@tencentcloud/chat';
// api
import api from '@/api/index.js'
const store = useStore()
// id
const ids = ref([])
//
const form = reactive({
name: '',
groupFaceUrl: '',
type: 'Public',
})
//
const list = reactive([])
//
const userinfo = computed(() => {
let result = store.state.userinfo
return result
})
onLoad(() => {
//
getFriendList()
})
//
function getFriendList() {
api.news.getFriendList().then(rs => {
if (rs.code == 200) {
const result = rs.data
list.length = 0
//
list.push(...result)
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
/**
* 点击用户
* @param {Object} item 当前用户信息
*/
function handleUser(item) {
const find_index = ids.value.findIndex(node => node == item.userId)
console.log(find_index)
if (find_index >= 0) ids.value.splice(find_index, 1)
else ids.value.push(item.userId)
}
//
function handleCreateGroup() {
const data = {
...form
}
if (!data.name) {
util.alert('群聊名称不能为空')
return
}
if (!data.groupFaceUrl) {
util.alert('群聊头像不能为空')
return
}
if (ids.length < 2) {
util.alert('请至少选择两名用户')
return
}
// id
data.ownerAccount = userinfo.value.id
//
data.groupUsers = [{
userId: userinfo.value.id
},
...ids.value.map(item => {
return {
userId: item
}
})
]
// id
data.groupId = Date.now().toString(36) + Math.random().toString(36).substr(2, 5);
//
api.news.addChatGroup({
data: data
}).then(rs => {
if (rs.code == 200) {
util.alert('创建成功')
createGroup(data)
setTimeout(() => {
form.name = ''
form.groupFaceUrl = ''
uni.navigateBack()
}, 2000)
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
function createGroup(data) {
uni.$chat.createGroup({
type: TencentCloudChat.TYPES.GRP_PUBLIC,
name: data.name,
groupID: data.groupId,
avatar: data.groupFaceUrl
})
}
//
function uploadImg() {
util.upload_image({
type: 1,
success: (res) => {
form.groupFaceUrl = res.value
}
})
}
</script>
<template>
<view class="app">
<!-- <uni-search-bar placeholder="请输入群聊名称" v-model="name" style="background: #fff;" /> -->
<view class="jy-chat-box mt30">
<view class="firendBox pr">
<view class="list bfff">
<view class="li" v-for="(item, index) in list" :key="index" @click="handleUser(item)">
<view class="item rows ptb20 pl30 pr50">
<image class="wh80 avatar cir" :src="item.avatar" mode="aspectFill" />
<view class="name thd f1 ml20 c333 f32">{{ item.remark || item.userNickname }}</view>
<uni-icons type="circle-filled" size="40rpx" color="#20D200"
v-if="ids.includes(item.userId)" />
<uni-icons type="circle" size="40rpx" color="#ccc" v-else />
</view>
</view>
</view>
<view class="mtb20 nomore">到底啦~</view>
</view>
</view>
<view class="fill" style="height: 120rpx;"></view>
<view class="footer plr30 bfff shadow">
<view class="btn lg colourful" @click="$refs.groupAlt.open()">下一步</view>
</view>
</view>
<!-- 群聊表单信息 -->
<uni-popup ref="groupAlt" type="bottom">
<view class="groupAlt popBot ptb30 plr30 bfff">
<view class="header rows">
<view class="">新建群聊</view>
<uni-icons type="closeempty" size="40rpx" color="#333" />
</view>
<!-- -->
<view class="main">
<view class="txtplus inputBox mtb30 ptb20 plr20 br10">
<input type="text" v-model="form.name" placeholder="群聊名称" />
</view>
<view class="imgList">
<view class="imgs wh200" v-if="form.groupFaceUrl" @click="uploadImg">
<image class="wh200 br20" :src="form.groupFaceUrl" mode="aspectFill" />
</view>
<view class="imgs wh200 fmid bf8f8f8 br20" v-else @click="uploadImg">
<uni-icons type="plusempty" color="#999" size="50rpx" />
</view>
</view>
</view>
<view class="btn">
<view class="btn lg colourful" @click="handleCreateGroup">新建群聊</view>
</view>
</view>
</uni-popup>
</template>
<style scoped lang="scss">
//
.firendBox {
height: 100%;
.scroll {
height: 100%;
}
//
.li {
.letter {
background-color: #eee;
}
}
//
.child {
.item+.item {
border-top: 2rpx solid #eee;
}
}
}
</style>

View File

@ -0,0 +1,233 @@
<script setup>
/**
* 发起群聊
*/
import {
ref,
reactive,
computed
} from 'vue'
import {
useStore
} from 'vuex'
import {
onLoad
} from '@dcloudio/uni-app'
//
import util from '@/common/js/util.js'
//
import apex from '@/components/header/apex.vue'
//
import TencentCloudChat from '@tencentcloud/chat';
// api
import api from '@/api/index.js'
const store = useStore()
// id
const ids = ref([])
//
const form = reactive({
name: '',
groupFaceUrl: '',
type: 'Public',
})
//
const list = reactive([])
//
const userinfo = computed(() => {
let result = store.state.userinfo
return result
})
onLoad(() => {
//
getFriendList()
})
//
function getFriendList() {
api.news.getFriendList().then(rs => {
if (rs.code == 200) {
const result = rs.data
list.length = 0
//
list.push(...result)
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
/**
* 点击用户
* @param {Object} item 当前用户信息
*/
function handleUser(item) {
const find_index = ids.value.findIndex(node => node == item.userId)
console.log(find_index)
if (find_index >= 0) ids.value.splice(find_index, 1)
else ids.value.push(item.userId)
}
//
function handleCreateGroup() {
const data = {
...form
}
if (!data.name) {
util.alert('群聊名称不能为空')
return
}
if (!data.groupFaceUrl) {
util.alert('群聊头像不能为空')
return
}
if (ids.length < 2) {
util.alert('请至少选择两名用户')
return
}
// id
data.ownerAccount = userinfo.value.id
//
data.groupUsers = [{
userID: userinfo.value.id
},
...ids.value.map(item => {
return {
userID: item
}
})
]
// id
data.groupId = Date.now().toString(36) + Math.random().toString(36).substr(2, 5);
/**
* 创建群聊
* https://web.sdk.qcloud.com/im/doc/v3/zh-cn/SDK.html#createGroup
*/
uni.$chat.createGroup({
//
type: TencentCloudChat.TYPES.GRP_WORK,
//
name: data.name,
//
memberList: data.groupUsers,
// id
groupID: data.groupId,
//
avatar: data.groupFaceUrl,
}).then(function(rs) {
//
const group = rs.data.group
uni.redirectTo({
url: util.setUrl('/pages/news/chat/chat', {
name: group.name,
id: group.groupID,
num: group.memberCount,
type: 'GROUP',
})
})
}).catch(function(imError) {
console.warn('createGroup error:', imError); //
});
}
//
function uploadImg() {
util.upload_image({
type: 1,
success: (res) => {
form.groupFaceUrl = res.value
}
})
}
</script>
<template>
<view class="app">
<!-- <uni-search-bar placeholder="请输入群聊名称" v-model="name" style="background: #fff;" /> -->
<view class="jy-chat-box mt30">
<view class="firendBox pr">
<view class="list bfff">
<view class="li" v-for="(item, index) in list" :key="index" @click="handleUser(item)">
<view class="item rows ptb20 pl30 pr50">
<image class="wh80 avatar cir" :src="item.avatar" mode="aspectFill" />
<view class="name thd f1 ml20 c333 f32">{{ item.remark || item.userNickname }}</view>
<uni-icons type="circle-filled" size="40rpx" color="#20D200"
v-if="ids.includes(item.userId)" />
<uni-icons type="circle" size="40rpx" color="#ccc" v-else />
</view>
</view>
</view>
<view class="mtb20 nomore">到底啦~</view>
</view>
</view>
<view class="fill" style="height: 120rpx;"></view>
<view class="footer plr30 bfff shadow">
<view class="btn lg colourful" @click="$refs.groupAlt.open()">下一步</view>
</view>
</view>
<!-- 群聊表单信息 -->
<uni-popup ref="groupAlt" type="bottom">
<view class="groupAlt popBot ptb30 plr30 bfff">
<view class="header rows">
<view class="">新建群聊</view>
<uni-icons type="closeempty" size="40rpx" color="#333" />
</view>
<!-- -->
<view class="main">
<view class="txtplus inputBox mtb30 ptb20 plr20 br10">
<input type="text" v-model="form.name" placeholder="群聊名称" />
</view>
<view class="imgList">
<view class="imgs wh200" v-if="form.groupFaceUrl" @click="uploadImg">
<image class="wh200 br20" :src="form.groupFaceUrl" mode="aspectFill" />
</view>
<view class="imgs wh200 fmid bf8f8f8 br20" v-else @click="uploadImg">
<uni-icons type="plusempty" color="#999" size="50rpx" />
</view>
</view>
</view>
<view class="btn">
<view class="btn lg colourful" @click="handleCreateGroup">新建群聊</view>
</view>
</view>
</uni-popup>
</template>
<style scoped lang="scss">
//
.firendBox {
height: 100%;
.scroll {
height: 100%;
}
//
.li {
.letter {
background-color: #eee;
}
}
//
.child {
.item+.item {
border-top: 2rpx solid #eee;
}
}
}
</style>

View File

@ -0,0 +1,102 @@
<script setup>
//
//
import TencentCloudChat from '@tencentcloud/chat';
import {
ref,
reactive,
nextTick,
onUnmounted,
onMounted,
computed,
getCurrentInstance,
watch,
} from 'vue'
// api
import api from '@/api/index.js'
//
import util from '@/common/js/util.js'
import {
onLoad,
onReady,
onPageScroll,
onUnload
} from "@dcloudio/uni-app"
// id
const groupId = ref('')
//
const friendList = reactive([])
//
const groupMember = reactive([])
//
const memberList = reactive([])
onLoad((option) => {
if (option.groupId) groupId.value = option.groupId
//
getFriendList()
})
//
function getFriendList() {
//
api.news.getFriendList().then(rs => {
if (rs.code == 200) {
const result = rs.data
friendList.length = 0
friendList.push(...result)
return
}
util.alert({
content: rs.msg,
showCancel: false,
})
})
}
/**
* 获取群成员列表
* https://web.sdk.qcloud.com/im/doc/v3/zh-cn/SDK.html#getGroupMemberList
*/
function getGroupMemberList() {
uni.$chat.getGroupMemberList({
groupID: groupId.value,
count: 100,
}).then(function(rs) {
memberList.length = 0
memberList.push(...rs.data.memberList)
})
}
</script>
<template>
<view class="appbw">
<view class="list pb30">
<view class="item rows mlr20" v-for="(item, index) in friendList" :key="item.userId" :id="item.userId">
<view class="checkBox">
<template>
<uni-icons type="circle" size="40rpx" color="#999" />
</template>
</view>
<view class="child pl30 pr50 f1">
<view class="item rows ptb20">
<image class="wh80 avatar cir" :src="item.avatar" mode="aspectFill" />
<view class="name thd f1 ml20 c333 f32">{{ item.remark || item.userNickname }}</view>
</view>
</view>
</view>
<view class="mtb20 nomore">到底啦~</view>
</view>
<view class="footer plr30 bfff">
<view class="btn colourful">添加</view>
</view>
</view>
</template>
<style>
</style>

View File

@ -1,316 +1,319 @@
<script setup>
//
//
import {
ref,
reactive,
computed,
} from 'vue'
import {
useStore,
} from 'vuex'
import {
onLoad,
onUnload,
} from '@dcloudio/uni-app'
//
import TencentCloudChat from '@tencentcloud/chat';
import {
ref,
reactive,
computed,
} from 'vue'
import {
useStore,
} from 'vuex'
import {
onLoad,
onUnload,
} from '@dcloudio/uni-app'
//
import TencentCloudChat from '@tencentcloud/chat';
//
import apex from '@/components/header/apex'
//
import noLogin from '@/components/login/noLogin.vue'
//
import noAuth from '@/components/mine/noAuth.vue'
//
import book from '@/components/news/book'
//
import groupList from '@/components/news/groupList'
//
import msgList from '@/components/news/msgList'
//
import footerMneu from '@/components/footerMenu/footerMenu'
//
import util from '@/common/js/util.js'
// vuex
const store = useStore()
//
const menuList = reactive([
{
key: 'group',
name: '即时消息',
load: false,
}, {
key: 'friend',
name: '通讯录',
load: false,
},
{
key: 'video',
name: '视讯消息',
load: false,
},
{
key: 'store',
name: '商城消息',
load: false,
},
])
//
const menuIndex = ref('')
//
const showSearch = ref(false)
// im
const imLoad = ref(false)
//
const userinfo = computed(() => {
return store.state.userinfo
})
//
const menuCurrent = computed(() => {
return menuList[menuIndex.value]
})
const footerMneuRef = ref()
//
import apex from '@/components/header/apex'
//
import noLogin from '@/components/login/noLogin.vue'
//
import noAuth from '@/components/mine/noAuth.vue'
//
import book from '@/components/news/book'
//
import groupList from '@/components/news/groupList'
//
import msgList from '@/components/news/msgList'
//
import footerMneu from '@/components/footerMenu/footerMenu'
//
import util from '@/common/js/util.js'
// vuex
const store = useStore()
//
const menuList = reactive([{
key: 'group',
name: '即时消息',
load: false,
}, {
key: 'friend',
name: '通讯录',
load: false,
},
{
key: 'video',
name: '视讯消息',
load: false,
},
{
key: 'store',
name: '商城消息',
load: false,
},
])
//
const menuIndex = ref('')
//
const showSearch = ref(false)
// im
const imLoad = ref(false)
//
const userinfo = computed(() => {
return store.state.userinfo
})
//
const menuCurrent = computed(() => {
return menuList[menuIndex.value]
})
const footerMneuRef = ref()
onLoad(() => {
//
handleMenuIndex(0)
onLoad(() => {
//
handleMenuIndex(0)
//
addListener()
//
uni.$on('updateNum', (val) => {
getNoRead()
})
})
onUnload(() => {
//
removeListener()
})
function getNoRead() {
setTimeout(() => {
footerMneuRef.value.getReadNum();
}, 200)
}
//
addListener()
function addListener() {
uni.$chat.on(TencentCloudChat.EVENT.SDK_READY, imLoading);
}
//
uni.$on('updateNum', (val) => {
getNoRead()
})
})
// im
function imLoading() {
imLoad.value = true
}
onUnload(() => {
//
removeListener()
})
function removeListener() {
// #ifdef APP
uni.$chat.off(TencentCloudChat.EVENT.SDK_READY, () => {});
// #endif
}
function getNoRead() {
setTimeout(() => {
footerMneuRef.value.getReadNum();
}, 200)
}
/**
* 切换下标
* @param {Number} index
*/
function handleMenuIndex(index) {
if (menuIndex.value === index) return
menuList.forEach(item => {
item.load = false;
});
menuList[index].load = true;
menuIndex.value = index
}
//
function addListener() {
uni.$chat.on(TencentCloudChat.EVENT.SDK_READY, imLoading);
}
// im
function imLoading() {
imLoad.value = true
}
//
function removeListener() {
// #ifdef APP
uni.$chat.off(TencentCloudChat.EVENT.SDK_READY, () => { });
// #endif
}
/**
* 切换下标
* @param {Number} index
*/
function handleMenuIndex(index) {
if (menuIndex.value === index) return
menuList.forEach(item => {
item.load = false;
});
menuList[index].load = true;
menuIndex.value = index
}
//
function showActionSheet() {
uni.showActionSheet({
itemList: ['扫一扫', '添加好友', '发起群聊', '我的二维码'],
success: rs => {
switch (rs.tapIndex) {
case 0:
util.scan()
break;
case 1:
uni.navigateTo({
// url: '/pages/news/addFriend'
url: '/pages/news/newFriend'
});
break;
case 2:
uni.navigateTo({
url: '/pages/news/group-chat/index'
});
break;
case 3:
uni.navigateTo({
url: '/pages/news/myQr'
});
break;
default:
break;
//
function showActionSheet() {
uni.showActionSheet({
itemList: ['扫一扫', '添加好友', '发起群聊', '我的二维码'],
success: rs => {
switch (rs.tapIndex) {
case 0:
util.scan()
break;
case 1:
uni.navigateTo({
// url: '/pages/news/addFriend'
url: '/pages/news/newFriend'
});
break;
case 2:
uni.navigateTo({
url: '/pages/news/group/create'
});
break;
case 3:
uni.navigateTo({
url: '/pages/news/myQr'
});
break;
default:
break;
}
}
}
})
}
})
}
function getUserInfos(userRecommend) {
videoApi.getUserInfo({
query: {
userRecommend: userRecommend,
}
}).then(rs => {
if (rs.data !== null) {
uni.navigateTo({
url: '/pages/index/beInvited?header=' + rs.data.userPortrait + '&userId=' + rs.data
.userId + '&userNickname=' +
rs.data.userNickname
});
}
})
}
function getUserInfos(userRecommend) {
videoApi.getUserInfo({
query: {
userRecommend: userRecommend,
}
}).then(rs => {
if (rs.data !== null) {
uni.navigateTo({
url: '/pages/index/beInvited?header=' + rs.data.userPortrait + '&userId=' + rs.data
.userId + '&userNickname=' +
rs.data.userNickname
});
}
})
}
</script>
<template>
<view class="page" v-if="!userinfo.id">
<noLogin class="f1" />
</view>
<view class="page">
<!-- 未登录 -->
<template v-if="!userinfo.id">
<noLogin class="f1" />
</template>
<view class="page" v-else-if="!userinfo.isRealName">
<noAuth class="f1" />
</view>
<!-- 未实名 -->
<template class="page" v-else-if="!userinfo.isRealName">
<noAuth class="f1" />
</template>
<view class="page" v-else>
<apex>
<template #left>
<view></view>
</template>
<template #content>
<!-- <view class="ver">
<template class="page" v-else>
<apex>
<template #left>
<view></view>
</template>
<template #content>
<!-- <view class="ver">
<image class="wh30" src="/static/read.png" mode="aspectFit" />
<text class="f20">一键已读</text>
</view> -->
</template>
<template #right>
<uni-icons type="bars" size="40rpx" @click="showActionSheet" />
</template>
</apex>
</template>
<template #right>
<uni-icons type="bars" size="40rpx" @click="showActionSheet" />
</template>
</apex>
<view class="searchBox" :class="{ 'active': showSearch }">
<view class="search rows mt20 mlr20 ptb10 plr30 bfff bar">
<uni-icons type="search" />
<input type="text" placeholder="搜索" class="f1 ml10" confirm-type="search" />
<view class="searchBox" :class="{ 'active': showSearch }">
<view class="search rows mt20 mlr20 ptb10 plr30 bfff bar">
<uni-icons type="search" />
<input type="text" placeholder="搜索" class="f1 ml10" confirm-type="search" />
</view>
</view>
</view>
<!-- 顶部菜单 -->
<view class="headMenu f24">
<view class="option oh df" v-for="(item, index) in menuList" :key="item.key"
:class="[item.key, { 'active': index === menuIndex }]" @click="handleMenuIndex(index)">
<view class="f1 fmid">{{ item.name }}</view>
<!-- 顶部菜单 -->
<view class="headMenu f24">
<view class="option oh df" v-for="(item, index) in menuList" :key="item.key"
:class="[item.key, { 'active': index === menuIndex }]" @click="handleMenuIndex(index)">
<view class="f1 fmid">{{ item.name }}</view>
</view>
</view>
</view>
<!-- 轮播图 -->
<swiper class="swiper" :current="menuIndex" disable-touch="true">
<!-- 群组 -->
<swiper-item>
<msgList v-if="menuList[0].load" :type="menuIndex" @updateNum="updateNum" />
<view class="loading" v-else>正在加载</view>
</swiper-item>
<!-- 轮播图 -->
<swiper class="swiper" :current="menuIndex" disable-touch="true">
<!-- 群组 -->
<swiper-item>
<msgList v-if="menuList[0].load" :type="menuIndex" />
<view class="loading" v-else>正在加载</view>
</swiper-item>
<!-- 通讯录 -->
<swiper-item>
<book v-if="menuList[1].load" />
<view class="loading" v-else>正在加载</view>
</swiper-item>
<!-- 通讯录 -->
<swiper-item>
<book v-if="menuList[1].load" />
<view class="loading" v-else>正在加载</view>
</swiper-item>
<!-- 视频消息 -->
<swiper-item>
<msgList v-if="menuList[2].load" :type="menuIndex" @updateNum="updateNum" />
<view class="loading" v-else>正在加载</view>
</swiper-item>
<!-- 视频消息 -->
<swiper-item>
<msgList v-if="menuList[2].load" :type="menuIndex" />
<view class="loading" v-else>正在加载</view>
</swiper-item>
<!-- 商城消息 -->
<swiper-item>
<msgList v-if="menuList[3].load" :type="menuIndex" @updateNum="updateNum" />
</swiper-item>
</swiper>
<!-- 商城消息 -->
<swiper-item>
<msgList v-if="menuList[3].load" :type="menuIndex" />
</swiper-item>
</swiper>
<!-- 底部导航 -->
<footerMenu ref="footerMneuRef" page="news" />
</template>
</view>
<!-- 底部导航 -->
<footerMenu ref="footerMneuRef" page="news" />
</template>
<style lang="scss" scoped>
//
.headMenu {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 25rpx;
margin: 20rpx;
//
.headMenu {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-gap: 25rpx;
margin: 20rpx;
//
.option {
height: 120rpx;
background-color: #E2E2E2;
border-radius: 15rpx;
transition: .3s;
//
.option {
height: 100rpx;
background-color: #E2E2E2;
border-radius: 15rpx;
transition: .3s;
//
&.active {
color: #fff;
//
&.active {
color: #fff;
//
&.friend,
&.group,
&.video {
background-image: linear-gradient(126deg, #27EFE2 0%, #A45EFF 43%, #FF004F 100%);
//
&.friend,
&.group,
&.video {
background-image: linear-gradient(126deg, #27EFE2 0%, #A45EFF 43%, #FF004F 100%);
}
//
&.store {
background-image: linear-gradient(270deg, #FF9B27 20%, #FDC123 103%);
}
}
}
//
&.store {
background-image: linear-gradient(270deg, #FF9B27 20%, #FDC123 103%);
}
//
.cartoon {
margin-top: -15rpx;
margin-right: -25rpx;
width: 194rpx;
height: 175rpx;
transform: rotate(-5deg);
}
}
//
.cartoon {
margin-top: -15rpx;
margin-right: -25rpx;
width: 194rpx;
height: 175rpx;
transform: rotate(-5deg);
//
.searchBox {
overflow: hidden;
height: 0;
transition: .3s;
&.active {
height: 80rpx;
}
}
}
//
.searchBox {
overflow: hidden;
height: 0;
transition: .3s;
&.active {
height: 80rpx;
//
.swiper {
flex: 1;
width: 100%;
}
}
//
.swiper {
flex: 1;
width: 100%;
}
//
.loading {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
//
.loading {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
</style>

View File

@ -1,288 +0,0 @@
<template>
<view class="top">
<view class="blessing">
{{ blessing }}
</view>
<view class="money" v-if="randomAmount">
{{ randomAmount }}
</view>
<view class="money" v-else>
暂无记录
</view>
<view class="face" :style="{ 'border-radius': `${radius}` }">
<image src="/static/img/im/face/face_11.jpg"></image>
</view>
<view class="username">
{{ username }}的红包
</view>
</view>
<view class="info">
{{ `已领取${receivedNumber}/${SumNumber} 个,共${receivedMoney}/${SumMoney}${sendType == 1 ? '积分' : '元'}` }}
</view>
<view class="list" v-if="receivedList.length > 0">
<view class="row" v-for="(row, index) in receivedList" :key="index">
<view class="left">
<image :src="row.face"></image>
</view>
<view class="right">
<view class="r1">
<view class="username">
{{ row.userNickname }}
</view>
<view class="money">
{{ `${row.amount}${sendType == 1 ? '积分' : '元'}` }}
</view>
</view>
<view class="r2">
<view class="time">
{{ row.createTime }}
</view>
<view class="lucky" v-if="row.islucky">
手气王
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import api from '@/api/index.js';
export default {
inject: ['util'],
data() {
return {
randomAmount: undefined,
sendType: null,
blessing: "恭喜发财",
money: 0.01,
username: null,
receivedNumber: 8,
SumNumber: 10,
receivedMoney: 5.43,
SumMoney: 10,
receivedList: [],
//
radius: '100% 100% 0 0'
};
},
methods: {
grabredLog() {
let {
bagId
} = this.$route.query;
api.news.grabredLog({
bagId
}).then(res => {
let index = 0;
let max = 0;
res.rows.length > 0 && res.rows.forEach((element, index) => {
const {
userNickname,
userPortrait,
amount,
createTime
} = element
if (amount > max) {
max = element.amount
index = index
}
this.receivedList.push({
userNickname,
face: this.util.format_url(userPortrait),
createTime,
amount,
islucky: false
})
});
this.receivedList[index].islucky = true
})
},
//
getUserinfo(userId) {
api.video.getUserInfo({
query: {
userId
}
}).then(res => {
this.username = res.data.userNickname;
})
},
getRedbag() {
let {
bagId
} = this.$route.query;
redEnvelope.getRedbag({
bagId
}).then(res => {
// all num residue scroe balance
const {
all,
num,
residue,
score,
balance,
sendType,
userId
} = res.data
// {{ receivedNumber }}/{{ SumNumber }}{{ receivedMoney }}/{{ SumMoney }}
this.receivedNumber = all - num
this.SumNumber = all
this.randomAmount = res.data?.randomAmount
this.sendType = sendType
switch (sendType) {
case 1:
this.SumMoney = score
break;
case 2:
this.SumMoney = balance
break;
default:
break;
}
this.receivedMoney = this.SumMoney - residue
this.getUserinfo(userId)
})
}
},
mounted() {
this.getRedbag()
this.grabredLog();
},
onPageScroll(e) {
//e.scrollTop;
if (e.scrollTop > 100) {
return;
}
let radiusTmp = 100 - e.scrollTop;
this.radius = radiusTmp + '% ' + radiusTmp + '% 0 0';
}
}
</script>
<style lang="scss">
view {
display: flex;
flex-wrap: wrap;
}
.top {
width: 100%;
background-color: #cf3c35;
flex-wrap: wrap;
.blessing,
.money {
width: 100%;
color: #f8d757;
padding: 20upx 0;
justify-content: center;
font-size: 34rpx;
}
.money {
font-size: 100rpx;
}
.face {
background-color: #fff;
justify-content: center;
width: 100%;
height: 130rpx;
margin-top: 65rpx;
border-radius: 100% 100% 0 0;
transition: border-radius .15s;
image {
width: 130rpx;
height: 130rpx;
border-radius: 100%;
margin-top: -65rpx;
}
}
.username {
width: 100%;
height: 130rpx;
justify-content: center;
background-color: #fff;
margin-top: -50rpx;
font-size: 38rpx;
}
}
.info {
margin-top: 30rpx;
width: 96%;
height: 50rpx;
padding-left: 4%;
font-size: 28rpx;
color: #999;
border-bottom: solid 1upx #dfdfdf;
}
.list {
width: 100%;
padding-bottom: 200rpx;
.row {
width: 92%;
padding: 0 4%;
height: 120rpx;
border-bottom: solid 1upx #dfdfdf;
justify-content: flex-start;
flex-wrap: nowrap;
.left {
flex-shrink: 0;
width: 100rpx;
height: 120rpx;
justify-content: flex-start;
align-items: center;
image {
width: 80rpx;
height: 80rpx;
border-radius: 100%;
}
}
.right {
width: 100%;
height: 150rpx;
.r1 {
width: 100%;
height: 75rpx;
justify-content: space-between;
align-items: center;
font-size: 34rpx;
}
.r2 {
width: 100%;
height: 75rpx;
justify-content: space-between;
font-size: 26rpx;
.time {
color: #8F8F94;
}
.lucky {
padding: 3upx 8rpx;
border-radius: 5rpx;
background-color: #F8D757;
align-items: center;
height: 30rpx;
font-size: 24rpx;
color: #CF3C35;
}
}
}
}
}
</style>

View File

@ -1,4 +1,5 @@
<script setup>
//
import {
ref,
reactive,

View File

@ -3,8 +3,7 @@ import {
} from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
// let target = 'http://91f.xyz:8080'
let target = 'http://27380b6d.r24.cpolar.top'
let target = 'http://91f.xyz:8080'
export default defineConfig({
plugins: [uni()],