评论商品接口有问题
This commit is contained in:
@@ -28,9 +28,13 @@
|
||||
import Icon from '../../common/Icon.vue'
|
||||
import More from '../../../assets/icon/more.svg'
|
||||
import backSVG from '../../../assets/icon/back.svg'
|
||||
import { useUI } from '../../../../utils/use-ui'
|
||||
import { endUserService } from '../../../../api/my-index'
|
||||
|
||||
const { showDialog, showToast } = useUI()
|
||||
|
||||
const emits = defineEmits(['openGroupManagement'])
|
||||
const props = defineProps(['isGroup'])
|
||||
const props = defineProps(['isGroup', 'serviceID'])
|
||||
|
||||
const currentConversation = ref<IConversationModel>()
|
||||
const typingStatus = ref(false)
|
||||
@@ -86,8 +90,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
function back() {
|
||||
uni.navigateBack()
|
||||
const back = async () => {
|
||||
if (props.serviceID) {
|
||||
const show = await showDialog('提示', '确定要退出当前会话吗?')
|
||||
if (show) {
|
||||
await endUserService(props.serviceID)
|
||||
await showToast('结束服务成功')
|
||||
uni.navigateBack()
|
||||
}
|
||||
} else {
|
||||
uni.navigateBack()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@@ -14,9 +14,11 @@
|
||||
<ChatHeader
|
||||
:isGroup="isGroup"
|
||||
:headerExtensionList="headerExtensionList"
|
||||
:serviceID="serviceID"
|
||||
@closeChat="closeChat"
|
||||
@openGroupManagement="handleGroup"
|
||||
/>
|
||||
|
||||
<Forward @toggleMultipleSelectMode="toggleMultipleSelectMode" />
|
||||
<MessageList
|
||||
ref="messageListRef"
|
||||
@@ -120,6 +122,7 @@
|
||||
import { initChat, logout } from './entry-chat-only.ts'
|
||||
|
||||
onLoad(options => {
|
||||
serviceID.value = options?.id || ''
|
||||
initChat(options)
|
||||
})
|
||||
|
||||
@@ -136,7 +139,8 @@
|
||||
// @End uniapp use Chat only
|
||||
|
||||
const emits = defineEmits(['closeChat'])
|
||||
|
||||
/** 客服 id */
|
||||
const serviceID = ref('')
|
||||
const groupID = ref(undefined)
|
||||
const isGroup = ref(false)
|
||||
const isNotInGroup = ref(false)
|
||||
@@ -163,7 +167,7 @@
|
||||
}
|
||||
uni.onWindowResize(windowResizeCallback)
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(e => {
|
||||
TUIStore.watch(StoreName.CONV, {
|
||||
currentConversation: onCurrentConversationUpdate
|
||||
})
|
||||
|
||||
@@ -1,26 +1,15 @@
|
||||
<template>
|
||||
<div
|
||||
:ref="convHeaderRef"
|
||||
class="tui-conversation-header"
|
||||
>
|
||||
<div :ref="convHeaderRef" class="tui-conversation-header">
|
||||
<Navigation title="消息">
|
||||
<template
|
||||
#right
|
||||
>
|
||||
<template #right>
|
||||
<div v-show="!isGlobalSearching" class="menu-container">
|
||||
<ul
|
||||
v-if="menuList.length > 0"
|
||||
class="list"
|
||||
>
|
||||
<ul v-if="menuList.length > 0" class="list">
|
||||
<li
|
||||
v-for="(item, index) in menuList"
|
||||
:key="index"
|
||||
class="list-item"
|
||||
>
|
||||
<main
|
||||
class="list-item-item"
|
||||
@click.stop="handleMenu(item)"
|
||||
>
|
||||
<main class="list-item-item" @click.stop="handleMenu(item)">
|
||||
<Icon
|
||||
v-if="item.icon"
|
||||
class="list-item-icon"
|
||||
@@ -36,7 +25,7 @@
|
||||
<li
|
||||
v-for="(childrenItem, childrenIndex) in showChildren"
|
||||
:key="childrenIndex"
|
||||
class="list-item"
|
||||
class="list-item top-right_box"
|
||||
@click="handleMenu(childrenItem)"
|
||||
>
|
||||
<Icon
|
||||
@@ -56,64 +45,106 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { StoreName, TUIStore } from '@tencentcloud/chat-uikit-engine-lite';
|
||||
import { computed, ref, onMounted, onUnmounted } from '../../../adapter-vue';
|
||||
import Icon from '../../common/Icon.vue';
|
||||
import Navigation from '../../common/Navigation/index.vue';
|
||||
import Server, { IMenuItem } from './server';
|
||||
import type { ISearchingStatus } from '../../TUISearch/type';
|
||||
import {
|
||||
StoreName,
|
||||
TUIStore
|
||||
} from '@tencentcloud/chat-uikit-engine-lite'
|
||||
import {
|
||||
computed,
|
||||
ref,
|
||||
onMounted,
|
||||
onUnmounted
|
||||
} from '../../../adapter-vue'
|
||||
import Icon from '../../common/Icon.vue'
|
||||
import Navigation from '../../common/Navigation/index.vue'
|
||||
import Server, { IMenuItem } from './server'
|
||||
import type { ISearchingStatus } from '../../TUISearch/type'
|
||||
import { navigateTo } from '../../../../utils/router'
|
||||
|
||||
const showChildren = ref<IMenuItem[]>([]);
|
||||
const convHeaderRef = ref<HTMLElement | undefined>();
|
||||
const isGlobalSearching = ref(false);
|
||||
const showChildren = ref<IMenuItem[]>([])
|
||||
const convHeaderRef = ref<HTMLElement | undefined>()
|
||||
const isGlobalSearching = ref(false)
|
||||
|
||||
const menuList = computed(() => {
|
||||
return Server.getInstance().getMenu();
|
||||
});
|
||||
const menuList = computed(() => {
|
||||
return Server.getInstance().getMenu()
|
||||
})
|
||||
|
||||
const onCurrentSearchingStatusChange = (data: ISearchingStatus) => {
|
||||
isGlobalSearching.value = data.searchType === 'global' && data.isSearching;
|
||||
if (isGlobalSearching.value) {
|
||||
closeChildren();
|
||||
const onCurrentSearchingStatusChange = (data: ISearchingStatus) => {
|
||||
isGlobalSearching.value =
|
||||
data.searchType === 'global' && data.isSearching
|
||||
if (isGlobalSearching.value) {
|
||||
closeChildren()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
showChildren.value = [];
|
||||
TUIStore.watch(StoreName.SEARCH, {
|
||||
currentSearchingStatus: onCurrentSearchingStatusChange,
|
||||
});
|
||||
});
|
||||
onMounted(() => {
|
||||
showChildren.value = []
|
||||
TUIStore.watch(StoreName.SEARCH, {
|
||||
currentSearchingStatus: onCurrentSearchingStatusChange
|
||||
})
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
TUIStore.unwatch(StoreName.SEARCH, {
|
||||
currentSearchingStatus: onCurrentSearchingStatusChange,
|
||||
});
|
||||
});
|
||||
onUnmounted(() => {
|
||||
TUIStore.unwatch(StoreName.SEARCH, {
|
||||
currentSearchingStatus: onCurrentSearchingStatusChange
|
||||
})
|
||||
})
|
||||
|
||||
const handleMenu = (item: IMenuItem) => {
|
||||
const { data: { children }, listener = { onClicked: () => {} } } = item;
|
||||
if (children) {
|
||||
showChildren.value = showChildren.value.length > 0 ? [] : children;
|
||||
} else {
|
||||
listener.onClicked(item);
|
||||
closeChildren();
|
||||
const handleMenu = (item: IMenuItem) => {
|
||||
const {
|
||||
data: { children },
|
||||
listener = { onClicked: () => {} }
|
||||
} = item
|
||||
if (children) {
|
||||
let listData = children
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
// 扫一扫
|
||||
const scanItem = {
|
||||
data: { name: 'isScan' },
|
||||
icon: '/TUIKit/assets/icon/scan.svg',
|
||||
text: '扫一扫',
|
||||
listener: {
|
||||
onClicked: () => {}
|
||||
}
|
||||
}
|
||||
listData = [scanItem, ...listData]
|
||||
// #endif
|
||||
showChildren.value = showChildren.value.length > 0 ? [] : listData
|
||||
} else {
|
||||
if (item.data.name === 'isScan') {
|
||||
uni.scanCode({
|
||||
onlyFromCamera: false,
|
||||
scanType: ['qrCode'],
|
||||
success: (res: any) => {
|
||||
navigateTo(res.result)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
listener.onClicked(item)
|
||||
}
|
||||
closeChildren()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const closeChildren = () => {
|
||||
showChildren.value = [];
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
closeChildren,
|
||||
});
|
||||
const closeChildren = () => {
|
||||
showChildren.value = []
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
closeChildren
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.menu-container {
|
||||
position: relative;
|
||||
}
|
||||
.menu-container {
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped src="../style/index.scss"></style>
|
||||
<style lang="scss" scoped>
|
||||
.top-right_box {
|
||||
width: 180rpx;
|
||||
display: flex;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user