Commit 530084ab by pangchong

feat: 发送消息

parent f7a042f5
......@@ -28,7 +28,6 @@ export const alova = createAlova({
// 请求拦截器
beforeRequest(method) {
console.log(method)
//开启加载动画
const appStore = useAppStore()
const loading = method.meta?.loading
......@@ -39,8 +38,8 @@ export const alova = createAlova({
appStore.count++
}
// 设置请求头application/json;charset=UTF-8
const isDownload = method.meta?.isDownload
if (isDownload && method.data) {
const isUpload = method.meta?.isUpload
if (isUpload && method.data) {
method.data = Object.entries(method.data).reduce(function (q, w) {
if (!(w[1] instanceof File)) {
q.set(w[0], w[1])
......
......@@ -2,11 +2,6 @@
<a-layout-header class="h-[60px] flex items-center px-4 justify-between bg-theme-bg2">
<a-image :src="logo" :preview="false" fit="fill" />
<a-space size="large">
<a-upload :show-file-list="false" :custom-request="uploadMuFile">
<template #upload-button>
<a-button type="outline" shape="circle"><global-icon icon="question-circle" :size="14"></global-icon></a-button>
</template>
</a-upload>
<a-button type="outline" shape="circle"><global-icon icon="question-circle" :size="14"></global-icon></a-button>
<a-button type="outline" shape="circle"><global-icon icon="safe" :size="14"></global-icon></a-button>
<!-- <a-dropdown @select="handleLanguage">
......@@ -40,7 +35,6 @@ import logo from '@/assets/images/header/logo.png'
import useLocale from '@/hooks/locale'
import { activedTheme } from '../../../project.ui.config'
import useUserStore from '@/store/user'
import { alova } from '@/api/alova-instance'
const { changeLocale } = useLocale()
//切换语言
......@@ -56,17 +50,6 @@ const userStore = useUserStore()
const logOut = () => {
userStore.handleLogOut()
}
const uploadMuFile = (option: any) => {
const { onProgress, onError, onSuccess, fileItem, name } = option
var params = {
apiPwd: 'Ifar$2_0160_525_Mocp',
file: fileItem.file,
requestFrom: 6,
uid: 4
}
alova.Post('/admin/uploadMuFile', params, { meta: { isDownload: true } }).then(() => {})
}
</script>
<style lang="less" scoped>
.arco-btn {
......
......@@ -7,25 +7,25 @@
<a-col :span="12">
<div class="flex items-center p-1.5 leading-7">
<global-icon icon="wifi" :size="16"></global-icon>
<span class="text-xs ml-1 text-theme-text2">网络状态{{NetworkQualityLevel.label}}</span>
<span class="text-xs ml-1 text-theme-text2">网络状态{{ NetworkQualityLevel.label }}</span>
</div>
</a-col>
<a-col :span="12">
<div class="flex items-center p-1.5 leading-7">
<global-icon icon="user-group" :size="16"></global-icon>
<span class="text-xs ml-1 text-theme-text2">房间已有 {{chatChannelState.currentChatters.length}}</span>
<span class="text-xs ml-1 text-theme-text2">房间已有 {{ chatChannelState.currentChatters.length }}</span>
</div>
</a-col>
<a-col :span="12">
<div class="flex items-center p-1.5 leading-7">
<global-icon icon="mic" :size="16"></global-icon>
<span class="text-xs ml-1 text-theme-text2">{{webrtcStates.isMicroAttached ? "麦克风已开启" : "麦克风未开启"}}</span>
<span class="text-xs ml-1 text-theme-text2">{{ webrtcStates.isMicroAttached ? '麦克风已开启' : '麦克风未开启' }}</span>
</div>
</a-col>
<a-col :span="12">
<div class="flex items-center p-1.5 leading-7">
<global-icon icon="camera" :size="16"></global-icon>
<span class="text-xs ml-1 text-theme-text2">{{webrtcStates.isCameraAttached ? '摄像头已开启' : "摄像头未开启"}}</span>
<span class="text-xs ml-1 text-theme-text2">{{ webrtcStates.isCameraAttached ? '摄像头已开启' : '摄像头未开启' }}</span>
</div>
</a-col>
</a-row>
......@@ -39,15 +39,27 @@
</div>
<div class="px-4 py-2">
<a-space size="medium">
<div class="flex-center px-3 py-1 rounded cursor-pointer bg-fill-bg1">
<global-icon icon="image" :size="15"></global-icon>
</div>
<div class="flex-center px-3 py-1 rounded cursor-pointer bg-fill-bg1">
<global-icon icon="pdf" :size="15"></global-icon>
</div>
<div class="flex-center px-3 py-1 rounded cursor-pointer bg-fill-bg1">
<global-icon icon="video" :size="15"></global-icon>
</div>
<a-upload :show-file-list="false" accept="image/*" :custom-request="uploadMuFile" @change="handleChange">
<template #upload-button>
<div class="flex-center px-3 py-1 rounded cursor-pointer bg-fill-bg1">
<global-icon icon="image" :size="15"></global-icon>
</div>
</template>
</a-upload>
<a-upload :show-file-list="false" accept=".pdf" :custom-request="uploadMuFile" @change="handleChange">
<template #upload-button>
<div class="flex-center px-3 py-1 rounded cursor-pointer bg-fill-bg1">
<global-icon icon="pdf" :size="15"></global-icon>
</div>
</template>
</a-upload>
<a-upload :show-file-list="false" accept="video/*" :custom-request="uploadMuFile" @change="handleChange">
<template #upload-button>
<div class="flex-center px-3 py-1 rounded cursor-pointer bg-fill-bg1">
<global-icon icon="video" :size="15"></global-icon>
</div>
</template>
</a-upload>
</a-space>
<a-textarea class="h-16 mt-2" placeholder="请输入" allow-clear />
</div>
......@@ -57,9 +69,39 @@
<script setup lang="ts">
import VideoItem from './videoItem.vue'
import ChatDetails from './chatDetails.vue'
import {webrtcStates} from "AnyR/states/webrtcStates";
import {chatChannelState} from "AnyR/states/chatChannelStates";
import {NetworkQualityLevel} from "AnyR/states/webrtcStates";
import { webrtcStates } from 'AnyR/states/webrtcStates'
import { chatChannelState } from 'AnyR/states/chatChannelStates'
import { NetworkQualityLevel } from 'AnyR/states/webrtcStates'
import { alova } from '@/api/alova-instance'
import { Message } from '@arco-design/web-vue'
const uploadMuFile = (option: any) => {
const { onProgress, onError, onSuccess, fileItem, name } = option
var params = {
apiPwd: 'Ifar$2_0160_525_Mocp',
file: fileItem.file,
requestFrom: 6,
uid: 4
}
return alova
.Post<any>('/admin/uploadMuFile', params, { meta: { isUpload: true } })
.then((res) => {
if (res.code == 200) {
onSuccess(res)
Message.success('发送成功')
} else {
onError(new Error('Upload failed'))
Message.success('发送失败')
}
})
.catch((error) => {
onError(error)
}) as any
}
const handleChange = (fileList: any, file: any) => {
console.log('FileList:', fileList)
console.log('Current file:', file)
}
</script>
<style lang="less" scoped>
.chat-list {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment