2112
This commit is contained in:
@@ -256,6 +256,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<uni-popup
|
<uni-popup
|
||||||
ref="refPopup"
|
ref="refPopup"
|
||||||
|
safeArea
|
||||||
type="bottom"
|
type="bottom"
|
||||||
background-color="#ffffff"
|
background-color="#ffffff"
|
||||||
borderRadius="16rpx 16rpx 0 0"
|
borderRadius="16rpx 16rpx 0 0"
|
||||||
@@ -279,6 +280,7 @@
|
|||||||
{{ isMultiple ? '关闭' : '取消' }}
|
{{ isMultiple ? '关闭' : '取消' }}
|
||||||
</text>
|
</text>
|
||||||
<text class="text">选择聊天</text>
|
<text class="text">选择聊天</text>
|
||||||
|
<view>
|
||||||
<text
|
<text
|
||||||
v-if="isMultiple"
|
v-if="isMultiple"
|
||||||
:class="{ 'on-btn': !selectedList.length > 0 }"
|
:class="{ 'on-btn': !selectedList.length > 0 }"
|
||||||
@@ -289,7 +291,10 @@
|
|||||||
`下一步 ${selectedList.length > 0 ? selectedList.length : ''}`
|
`下一步 ${selectedList.length > 0 ? selectedList.length : ''}`
|
||||||
}}
|
}}
|
||||||
</text>
|
</text>
|
||||||
<text v-else class="multiple" @click="isMultiple = true">多选</text>
|
<view v-else class="multiple" @click="isMultiple = true">
|
||||||
|
多选
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 选项数据 -->
|
<!-- 选项数据 -->
|
||||||
<view v-if="selectedList.length > 0" class="option-box">
|
<view v-if="selectedList.length > 0" class="option-box">
|
||||||
@@ -310,12 +315,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<view class="list-box">
|
<view scroll-y="true" class="list-box">
|
||||||
<!-- 群聊列表 ================ -->
|
|
||||||
{{ groupList.length }} == {{ friendList.length }}
|
|
||||||
|
|
||||||
<view
|
<view
|
||||||
v-for="(item, index) in groupList"
|
v-for="(item, index) in groupList"
|
||||||
:key="index"
|
:key="index"
|
||||||
@@ -410,6 +411,13 @@
|
|||||||
.close {
|
.close {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
}
|
}
|
||||||
|
.text {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
.multiple {
|
.multiple {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
}
|
}
|
||||||
@@ -425,19 +433,11 @@
|
|||||||
.on-btn {
|
.on-btn {
|
||||||
background: #b7b7b7;
|
background: #b7b7b7;
|
||||||
}
|
}
|
||||||
.text {
|
|
||||||
position: absolute;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
font-size: 32rpx;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-box {
|
.list-box {
|
||||||
padding: 22rpx 24rpx;
|
padding: 22rpx 24rpx;
|
||||||
height: 46vh;
|
height: 46vh;
|
||||||
background: red;
|
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
.item-box + .item-box {
|
.item-box + .item-box {
|
||||||
margin-top: 12rpx;
|
margin-top: 12rpx;
|
||||||
|
|||||||
@@ -355,6 +355,12 @@
|
|||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/shop-together/user",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/discover/ranking-list",
|
"path": "pages/discover/ranking-list",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
@@ -102,18 +102,17 @@
|
|||||||
<ActionSheet v-model="isShowCoGuestSheet" :title="coGuestSheetTitle" :itemList="coGuestSheetItems"
|
<ActionSheet v-model="isShowCoGuestSheet" :title="coGuestSheetTitle" :itemList="coGuestSheetItems"
|
||||||
@select="onCoGuestSheetSelect" />
|
@select="onCoGuestSheetSelect" />
|
||||||
|
|
||||||
<SharePopup
|
<share-popup
|
||||||
v-model:show="shareDialog"
|
v-model:show="shareDialog"
|
||||||
:id="currentLive.liveId"
|
:id="currentLive.liveId"
|
||||||
:text="currentLive.liveName"
|
:text="currentLive.liveName"
|
||||||
:cover="currentLive.coverUrl"
|
:cover="currentLive.coverUrl"
|
||||||
:userLiveData="currentLive.liveOwner"
|
:userLiveData="currentLive.liveOwner"
|
||||||
type="1"
|
type="1"
|
||||||
></SharePopup>
|
></share-popup>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import SharePopup from '@/components/share-popup/share-popup.vue'
|
|
||||||
import { imDataEndLive, getLiveActivityDetail, getLiveActivityRecord } from '@/api/tui-kit'
|
import { imDataEndLive, getLiveActivityDetail, getLiveActivityRecord } from '@/api/tui-kit'
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import { ref, onMounted, computed, onUnmounted, watch, nextTick } from 'vue';
|
import { ref, onMounted, computed, onUnmounted, watch, nextTick } from 'vue';
|
||||||
|
|||||||
@@ -91,11 +91,12 @@
|
|||||||
></image>
|
></image>
|
||||||
</template>
|
</template>
|
||||||
<template #right>
|
<template #right>
|
||||||
|
<!-- shareDialog = true navigateTo -->
|
||||||
<image
|
<image
|
||||||
src="/static/images/public/share-icon.png"
|
src="/static/images/public/share-icon.png"
|
||||||
mode="heightFix"
|
mode="heightFix"
|
||||||
class="right-icon"
|
class="right-icon"
|
||||||
@click="shareDialog = true"
|
@click="navigateTo('/pages/shop-together/user')"
|
||||||
></image>
|
></image>
|
||||||
</template>
|
</template>
|
||||||
</nav-bar>
|
</nav-bar>
|
||||||
|
|||||||
427
pages/shop-together/user.vue
Normal file
427
pages/shop-together/user.vue
Normal file
@@ -0,0 +1,427 @@
|
|||||||
|
<script setup>
|
||||||
|
import TUIChatEngine, {
|
||||||
|
TUIStore,
|
||||||
|
StoreName,
|
||||||
|
TUIChatService
|
||||||
|
} from '@tencentcloud/chat-uikit-engine-lite'
|
||||||
|
import { reactive, ref } from 'vue'
|
||||||
|
import { onLoad, onBackPress } from '@dcloudio/uni-app'
|
||||||
|
|
||||||
|
import { navigateBack } from '../../utils/router'
|
||||||
|
import { useUI } from '../../utils/use-ui'
|
||||||
|
|
||||||
|
const { showLoading, hideLoading, showToast, showDialog } = useUI()
|
||||||
|
|
||||||
|
/** 页面调用数据 */
|
||||||
|
const propsData = reactive({
|
||||||
|
/** 分享类型: 1 直播 2 商品详情*/
|
||||||
|
type: '2',
|
||||||
|
id: '',
|
||||||
|
/** 分享文本 */
|
||||||
|
text: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 多选状态 */
|
||||||
|
const isMultiple = ref(false)
|
||||||
|
/** 群列表 */
|
||||||
|
const groupList = ref([])
|
||||||
|
/** 好友列表 */
|
||||||
|
const friendList = ref([])
|
||||||
|
/** 选中数据 */
|
||||||
|
const selectedList = ref([])
|
||||||
|
|
||||||
|
const topBack = () => {
|
||||||
|
if (!isMultiple.value) {
|
||||||
|
console.log('返回')
|
||||||
|
navigateBack()
|
||||||
|
} else {
|
||||||
|
selectedList.value = []
|
||||||
|
isMultiple.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 判断多选状态 */
|
||||||
|
const multipleShow = id => {
|
||||||
|
return selectedList.value.some(item => item.id === id)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取好友列表 */
|
||||||
|
const onFriendListUpdated = list => {
|
||||||
|
friendList.value = friendList.value.map(v => {
|
||||||
|
return {
|
||||||
|
...v,
|
||||||
|
...(v?.profile || {})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('好友列表:', friendList.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取群列表 */
|
||||||
|
const onGroupListUpdated = list => {
|
||||||
|
groupList.value = list
|
||||||
|
|
||||||
|
console.log('群列表:', groupList.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选项
|
||||||
|
* @param item
|
||||||
|
* @param state 1 群聊 0 好友
|
||||||
|
*/
|
||||||
|
const onSelect = (item, state) => {
|
||||||
|
let data = {}
|
||||||
|
if (state) {
|
||||||
|
data = {
|
||||||
|
id: `GROUP${item.groupID}`,
|
||||||
|
name: item.name,
|
||||||
|
avatar: item.avatar
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
data = {
|
||||||
|
id: `C2C${item.profile.userID}`,
|
||||||
|
name: item.profile.nick || item.profile.userID,
|
||||||
|
avatar: item.profile.avatar
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isMultiple.value) {
|
||||||
|
if (multipleShow(data.id)) {
|
||||||
|
selectedList.value = selectedList.value.filter(
|
||||||
|
item => item.id !== data.id
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
if (selectedList.value.length >= 9) {
|
||||||
|
showDialog('提示', '最多选择9个', false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
selectedList.value.push(data)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
onConfirm(0, data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 发送自定义信息数据 */
|
||||||
|
const sendCustomData = async item => {
|
||||||
|
let to = ''
|
||||||
|
let isGroup = false
|
||||||
|
if (item.id.includes('GROUP')) {
|
||||||
|
// 分割 GROUP
|
||||||
|
to = item.id.split('GROUP')[1]
|
||||||
|
isGroup = true
|
||||||
|
} else {
|
||||||
|
to = item.id.split('C2C')[1]
|
||||||
|
isGroup = false
|
||||||
|
}
|
||||||
|
const payload = {
|
||||||
|
data: JSON.stringify(
|
||||||
|
props.type == 1
|
||||||
|
? {
|
||||||
|
id: props.id,
|
||||||
|
businessID: CHAT_MSG_CUSTOM_TYPE.LIVE,
|
||||||
|
title: props.text,
|
||||||
|
cover: props.cover,
|
||||||
|
userLiveData: props.userLiveData
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
id: props.id,
|
||||||
|
businessID: CHAT_MSG_CUSTOM_TYPE.GOODS,
|
||||||
|
title: props.text,
|
||||||
|
cover: props.cover,
|
||||||
|
price: props.price
|
||||||
|
}
|
||||||
|
),
|
||||||
|
description: props.text,
|
||||||
|
extension: props.text
|
||||||
|
}
|
||||||
|
const options = {
|
||||||
|
to,
|
||||||
|
payload,
|
||||||
|
conversationType: isGroup
|
||||||
|
? TUIChatEngine.TYPES.CONV_GROUP
|
||||||
|
: TUIChatEngine.TYPES.CONV_C2C,
|
||||||
|
needReadReceipt: isEnabledMessageReadReceiptGlobal()
|
||||||
|
}
|
||||||
|
await TUIChatService.sendCustomMessage(options)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 多选分享 */
|
||||||
|
const multiSelectShare = async () => {
|
||||||
|
showLoading()
|
||||||
|
const requests = selectedList.value.map(v => sendCustomData(v))
|
||||||
|
await Promise.all(requests)
|
||||||
|
hideLoading()
|
||||||
|
await showToast('分享成功', 'success')
|
||||||
|
isShow.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定分享
|
||||||
|
* @param state 1 多选 0 单选
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
const onConfirm = async (state, item) => {
|
||||||
|
const show = await showDialog(
|
||||||
|
'提示',
|
||||||
|
`确定分享${props.type == 1 ? '直播间' : '商品'}吗?`
|
||||||
|
)
|
||||||
|
if (!show) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (state) {
|
||||||
|
multiSelectShare()
|
||||||
|
} else {
|
||||||
|
showLoading()
|
||||||
|
await sendCustomData(item)
|
||||||
|
hideLoading()
|
||||||
|
await showToast('分享成功', 'success')
|
||||||
|
isShow.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
|
TUIStore.watch(StoreName.GRP, {
|
||||||
|
groupList: onGroupListUpdated
|
||||||
|
})
|
||||||
|
|
||||||
|
TUIStore.watch(StoreName.FRIEND, {
|
||||||
|
friendList: onFriendListUpdated
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
onBackPress(() => {
|
||||||
|
TUIStore.unwatch(StoreName.GRP, {
|
||||||
|
groupList: onGroupListUpdated
|
||||||
|
})
|
||||||
|
|
||||||
|
TUIStore.unwatch(StoreName.FRIEND, {
|
||||||
|
friendList: onFriendListUpdated
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<nav-bar
|
||||||
|
:showBack="false"
|
||||||
|
isTopBg
|
||||||
|
isPlaceholder
|
||||||
|
isCustomBack
|
||||||
|
title="选择聊天"
|
||||||
|
>
|
||||||
|
<template #back>
|
||||||
|
<text class="top-close" @click="topBack">
|
||||||
|
{{ isMultiple ? '关闭' : '取消' }}
|
||||||
|
</text>
|
||||||
|
</template>
|
||||||
|
<template #right>
|
||||||
|
<text
|
||||||
|
v-if="isMultiple"
|
||||||
|
:class="{ 'on-btn': !selectedList.length > 0 }"
|
||||||
|
class="multiple-btn"
|
||||||
|
@click="onConfirm(1)"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
`下一步 ${selectedList.length > 0 ? selectedList.length : ''}`
|
||||||
|
}}
|
||||||
|
</text>
|
||||||
|
<text v-else class="multiple" @click="isMultiple = true">
|
||||||
|
多选
|
||||||
|
</text>
|
||||||
|
</template>
|
||||||
|
</nav-bar>
|
||||||
|
|
||||||
|
<!-- 选项数据 -->
|
||||||
|
<view v-if="selectedList.length > 0" class="option-box">
|
||||||
|
<view
|
||||||
|
v-for="(item, index) in selectedList"
|
||||||
|
:key="index"
|
||||||
|
class="option-card"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
v-if="item?.avatar"
|
||||||
|
:src="item?.avatar"
|
||||||
|
mode="aspectFill"
|
||||||
|
class="avatar"
|
||||||
|
></image>
|
||||||
|
<view v-else class="avatar">
|
||||||
|
<uni-icons type="contact-filled" size="98rpx"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<view scroll-y="true" class="list-box">
|
||||||
|
<view
|
||||||
|
v-for="(item, index) in groupList"
|
||||||
|
:key="index"
|
||||||
|
class="item-box"
|
||||||
|
@click="onSelect(item, 1)"
|
||||||
|
>
|
||||||
|
<view v-if="isMultiple" class="box">
|
||||||
|
<uni-icons
|
||||||
|
v-if="!multipleShow(`GROUP${item?.groupID}`)"
|
||||||
|
type="circle"
|
||||||
|
color="#b7b7b7"
|
||||||
|
size="30"
|
||||||
|
></uni-icons>
|
||||||
|
<uni-icons
|
||||||
|
v-else
|
||||||
|
type="checkbox-filled"
|
||||||
|
color="#00d993"
|
||||||
|
size="30"
|
||||||
|
></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="card-box">
|
||||||
|
<image
|
||||||
|
v-if="item?.avatar"
|
||||||
|
:src="item?.avatar"
|
||||||
|
mode="aspectFill"
|
||||||
|
class="head-img"
|
||||||
|
></image>
|
||||||
|
<view v-else class="head-img">
|
||||||
|
<uni-icons type="contact-filled" size="108rpx"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="right-box">
|
||||||
|
<text class="name">
|
||||||
|
{{ item?.name }}
|
||||||
|
</text>
|
||||||
|
<text class="num">({{ item?.memberCount }}人)</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 好友列表================== -->
|
||||||
|
<view
|
||||||
|
v-for="(item, index) in friendList"
|
||||||
|
:key="index"
|
||||||
|
class="item-box"
|
||||||
|
@click="onSelect(item, 0)"
|
||||||
|
>
|
||||||
|
<view v-if="isMultiple" class="box">
|
||||||
|
<uni-icons
|
||||||
|
v-if="!multipleShow(`C2C${item?.userID}`)"
|
||||||
|
type="circle"
|
||||||
|
color="#b7b7b7"
|
||||||
|
size="30"
|
||||||
|
></uni-icons>
|
||||||
|
<uni-icons
|
||||||
|
v-else
|
||||||
|
type="checkbox-filled"
|
||||||
|
color="#00d993"
|
||||||
|
size="30"
|
||||||
|
></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="card-box">
|
||||||
|
<image
|
||||||
|
v-if="item?.avatar"
|
||||||
|
:src="item?.avatar"
|
||||||
|
mode="aspectFill"
|
||||||
|
class="head-img"
|
||||||
|
></image>
|
||||||
|
<view v-else class="head-img">
|
||||||
|
<uni-icons type="contact-filled" size="108rpx"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="right-box">
|
||||||
|
<text class="name">
|
||||||
|
{{ item?.nick || item?.userID }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.top-close,
|
||||||
|
.multiple {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.multiple-btn {
|
||||||
|
right: 24rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
background: #00d993;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
padding: 4rpx 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.on-btn {
|
||||||
|
background: #b7b7b7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-box {
|
||||||
|
padding: 22rpx 24rpx;
|
||||||
|
|
||||||
|
.item-box + .item-box {
|
||||||
|
margin-top: 12rpx;
|
||||||
|
padding-top: 12rpx;
|
||||||
|
border-top: 2rpx solid #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-box {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.box {
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
.card-box {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.head-img {
|
||||||
|
width: 80rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
border-radius: 80rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
margin-right: 16rpx;
|
||||||
|
}
|
||||||
|
.right-box {
|
||||||
|
display: flex;
|
||||||
|
.name {
|
||||||
|
flex-shrink: 0;
|
||||||
|
max-width: 340rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
// 显示省略号
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.num {
|
||||||
|
margin-left: 8rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.option-box {
|
||||||
|
padding: 20rpx 24rpx;
|
||||||
|
border-bottom: 2rpx solid #f2f2f2;
|
||||||
|
// 超过宽度左右滑动
|
||||||
|
overflow-x: auto;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.option-card + .option-card {
|
||||||
|
margin-left: 14rpx;
|
||||||
|
}
|
||||||
|
.option-card {
|
||||||
|
.avatar {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 70rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
border-radius: 70rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background: rgb(194, 194, 194);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user