|
@@ -2,51 +2,51 @@
|
|
|
<div ref="target" class="bg-[#F0F2F6]">
|
|
|
<van-grid class="px-3 py-3" :border="false" :column-num="4">
|
|
|
<van-grid-item
|
|
|
- v-for="action in actionList"
|
|
|
- :key="action.type"
|
|
|
- clickable
|
|
|
- :icon="action.icon"
|
|
|
- :text="action.text"
|
|
|
- @click="clickAction(action)"
|
|
|
+ v-for="action in actionList"
|
|
|
+ :key="action.type"
|
|
|
+ clickable
|
|
|
+ :icon="action.icon"
|
|
|
+ :text="action.text"
|
|
|
+ @click="clickAction(action)"
|
|
|
/>
|
|
|
</van-grid>
|
|
|
<van-uploader
|
|
|
- v-show="false"
|
|
|
- ref="uploaderRef"
|
|
|
- :accept="uploadChooseOptions.accept"
|
|
|
- :capture="uploadChooseOptions.capture"
|
|
|
- :preview-image="false"
|
|
|
- multiple
|
|
|
- max-count="9"
|
|
|
- :after-read="afterReadFile"
|
|
|
+ v-show="false"
|
|
|
+ ref="uploaderRef"
|
|
|
+ :accept="uploadChooseOptions.accept"
|
|
|
+ :capture="uploadChooseOptions.capture"
|
|
|
+ :preview-image="false"
|
|
|
+ multiple
|
|
|
+ max-count="9"
|
|
|
+ :after-read="afterReadFile"
|
|
|
/>
|
|
|
<van-action-sheet
|
|
|
- v-model:show="actionSheetVisible"
|
|
|
- teleport="body"
|
|
|
- :actions="actionSheetActions"
|
|
|
- @select="onActionSelect"
|
|
|
+ v-model:show="actionSheetVisible"
|
|
|
+ teleport="body"
|
|
|
+ :actions="actionSheetActions"
|
|
|
+ @select="onActionSelect"
|
|
|
/>
|
|
|
- <div class="dac"></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import image from "@/assets/images/chatFooter/image.png";
|
|
|
import camera from "@/assets/images/chatFooter/camera.png";
|
|
|
+import file from "@/assets/images/chatFooter/file.png";
|
|
|
import call from "@/assets/images/chatFooter/call.png";
|
|
|
|
|
|
-import { onClickOutside } from "@vueuse/core";
|
|
|
+import {onClickOutside} from "@vueuse/core";
|
|
|
import {
|
|
|
ActionSheetAction,
|
|
|
UploaderFileListItem,
|
|
|
UploaderInstance,
|
|
|
} from "vant";
|
|
|
-import { useInviteRtc } from "@/hooks/useInviteRtc";
|
|
|
+import {useInviteRtc} from "@/hooks/useInviteRtc";
|
|
|
import useConversationStore from "@/store/modules/conversation";
|
|
|
-import { ChatFooterActionType } from "@/constants/action";
|
|
|
+import {ChatFooterActionType} from "@/constants/action";
|
|
|
|
|
|
-const { t, locale } = useI18n()
|
|
|
-const { inviteRtc } = useInviteRtc();
|
|
|
+const {t, locale} = useI18n()
|
|
|
+const {inviteRtc} = useInviteRtc();
|
|
|
const conversationStore = useConversationStore();
|
|
|
|
|
|
type ChatFooterActionEmits = {
|
|
@@ -71,6 +71,11 @@ const actionList: ChatFooterActionItem[] = [
|
|
|
icon: camera,
|
|
|
type: ChatFooterActionType.Shoot,
|
|
|
},
|
|
|
+ {
|
|
|
+ text: t("footerAction.file"),
|
|
|
+ icon: file,
|
|
|
+ type: ChatFooterActionType.File,
|
|
|
+ },
|
|
|
{
|
|
|
text: t("rtc.video"),
|
|
|
icon: call,
|
|
@@ -138,11 +143,8 @@ onClickOutside(target, () => emit("closeActionBar"), {
|
|
|
ignore: [".van-overlay", ".van-action-sheet__content"],
|
|
|
});
|
|
|
|
|
|
-const onActionSelect = ({ type }: any, idx: number) => {
|
|
|
- if (
|
|
|
- type === ChatFooterActionType.VoiceCall ||
|
|
|
- type === ChatFooterActionType.VideoCall
|
|
|
- ) {
|
|
|
+const onActionSelect = ({type}: any, idx: number) => {
|
|
|
+ if (type === ChatFooterActionType.VoiceCall || type === ChatFooterActionType.VideoCall) {
|
|
|
actionSheetVisible.value = false;
|
|
|
inviteRtc(type, [conversationStore.currentConversation.userID]);
|
|
|
return;
|
|
@@ -155,8 +157,7 @@ const onActionSelect = ({ type }: any, idx: number) => {
|
|
|
actionSheetVisible.value = false;
|
|
|
};
|
|
|
|
|
|
-const clickAction = ({ type }: ChatFooterActionItem) => {
|
|
|
- console.log(type);
|
|
|
+const clickAction = ({type}: ChatFooterActionItem) => {
|
|
|
switch (type) {
|
|
|
case ChatFooterActionType.Album:
|
|
|
actionSheetActions.value = [...albumActions];
|
|
@@ -166,6 +167,10 @@ const clickAction = ({ type }: ChatFooterActionItem) => {
|
|
|
actionSheetActions.value = [...shootActions];
|
|
|
actionSheetVisible.value = true;
|
|
|
break;
|
|
|
+ case ChatFooterActionType.File:
|
|
|
+ uploadChooseOptions.accept = "*"
|
|
|
+ nextTick(() => uploaderRef.value?.chooseFile());
|
|
|
+ break;
|
|
|
case ChatFooterActionType.VideoCall:
|
|
|
actionSheetActions.value = [...videoCallActions];
|
|
|
actionSheetVisible.value = true;
|