Commit 530084ab by pangchong

feat: 发送消息

parent f7a042f5
...@@ -28,7 +28,6 @@ export const alova = createAlova({ ...@@ -28,7 +28,6 @@ export const alova = createAlova({
// 请求拦截器 // 请求拦截器
beforeRequest(method) { beforeRequest(method) {
console.log(method)
//开启加载动画 //开启加载动画
const appStore = useAppStore() const appStore = useAppStore()
const loading = method.meta?.loading const loading = method.meta?.loading
...@@ -39,8 +38,8 @@ export const alova = createAlova({ ...@@ -39,8 +38,8 @@ export const alova = createAlova({
appStore.count++ appStore.count++
} }
// 设置请求头application/json;charset=UTF-8 // 设置请求头application/json;charset=UTF-8
const isDownload = method.meta?.isDownload const isUpload = method.meta?.isUpload
if (isDownload && method.data) { if (isUpload && method.data) {
method.data = Object.entries(method.data).reduce(function (q, w) { method.data = Object.entries(method.data).reduce(function (q, w) {
if (!(w[1] instanceof File)) { if (!(w[1] instanceof File)) {
q.set(w[0], w[1]) q.set(w[0], w[1])
......
...@@ -2,11 +2,6 @@ ...@@ -2,11 +2,6 @@
<a-layout-header class="h-[60px] flex items-center px-4 justify-between bg-theme-bg2"> <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-image :src="logo" :preview="false" fit="fill" />
<a-space size="large"> <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="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-button type="outline" shape="circle"><global-icon icon="safe" :size="14"></global-icon></a-button>
<!-- <a-dropdown @select="handleLanguage"> <!-- <a-dropdown @select="handleLanguage">
...@@ -40,7 +35,6 @@ import logo from '@/assets/images/header/logo.png' ...@@ -40,7 +35,6 @@ import logo from '@/assets/images/header/logo.png'
import useLocale from '@/hooks/locale' import useLocale from '@/hooks/locale'
import { activedTheme } from '../../../project.ui.config' import { activedTheme } from '../../../project.ui.config'
import useUserStore from '@/store/user' import useUserStore from '@/store/user'
import { alova } from '@/api/alova-instance'
const { changeLocale } = useLocale() const { changeLocale } = useLocale()
//切换语言 //切换语言
...@@ -56,17 +50,6 @@ const userStore = useUserStore() ...@@ -56,17 +50,6 @@ const userStore = useUserStore()
const logOut = () => { const logOut = () => {
userStore.handleLogOut() 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> </script>
<style lang="less" scoped> <style lang="less" scoped>
.arco-btn { .arco-btn {
......
...@@ -7,25 +7,25 @@ ...@@ -7,25 +7,25 @@
<a-col :span="12"> <a-col :span="12">
<div class="flex items-center p-1.5 leading-7"> <div class="flex items-center p-1.5 leading-7">
<global-icon icon="wifi" :size="16"></global-icon> <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> </div>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<div class="flex items-center p-1.5 leading-7"> <div class="flex items-center p-1.5 leading-7">
<global-icon icon="user-group" :size="16"></global-icon> <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> </div>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<div class="flex items-center p-1.5 leading-7"> <div class="flex items-center p-1.5 leading-7">
<global-icon icon="mic" :size="16"></global-icon> <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> </div>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<div class="flex items-center p-1.5 leading-7"> <div class="flex items-center p-1.5 leading-7">
<global-icon icon="camera" :size="16"></global-icon> <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> </div>
</a-col> </a-col>
</a-row> </a-row>
...@@ -39,15 +39,27 @@ ...@@ -39,15 +39,27 @@
</div> </div>
<div class="px-4 py-2"> <div class="px-4 py-2">
<a-space size="medium"> <a-space size="medium">
<div class="flex-center px-3 py-1 rounded cursor-pointer bg-fill-bg1"> <a-upload :show-file-list="false" accept="image/*" :custom-request="uploadMuFile" @change="handleChange">
<global-icon icon="image" :size="15"></global-icon> <template #upload-button>
</div> <div class="flex-center px-3 py-1 rounded cursor-pointer bg-fill-bg1">
<div class="flex-center px-3 py-1 rounded cursor-pointer bg-fill-bg1"> <global-icon icon="image" :size="15"></global-icon>
<global-icon icon="pdf" :size="15"></global-icon> </div>
</div> </template>
<div class="flex-center px-3 py-1 rounded cursor-pointer bg-fill-bg1"> </a-upload>
<global-icon icon="video" :size="15"></global-icon> <a-upload :show-file-list="false" accept=".pdf" :custom-request="uploadMuFile" @change="handleChange">
</div> <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-space>
<a-textarea class="h-16 mt-2" placeholder="请输入" allow-clear /> <a-textarea class="h-16 mt-2" placeholder="请输入" allow-clear />
</div> </div>
...@@ -57,9 +69,39 @@ ...@@ -57,9 +69,39 @@
<script setup lang="ts"> <script setup lang="ts">
import VideoItem from './videoItem.vue' import VideoItem from './videoItem.vue'
import ChatDetails from './chatDetails.vue' import ChatDetails from './chatDetails.vue'
import {webrtcStates} from "AnyR/states/webrtcStates"; import { webrtcStates } from 'AnyR/states/webrtcStates'
import {chatChannelState} from "AnyR/states/chatChannelStates"; import { chatChannelState } from 'AnyR/states/chatChannelStates'
import {NetworkQualityLevel} from "AnyR/states/webrtcStates"; 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> </script>
<style lang="less" scoped> <style lang="less" scoped>
.chat-list { .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