新增一体机附件上传
This commit is contained in:
@@ -241,7 +241,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<PopupFeeBack ref="feeback" @onClose="colseFeeBack" @onSend="confirmFeeBack"></PopupFeeBack>
|
||||
<UploadQrcode ref="qrcodeRef"></UploadQrcode>
|
||||
<UploadQrcode ref="qrcodeRef" @onSend="handleFileSend" :sessionId="chatSessionID"></UploadQrcode>
|
||||
<MsgTips ref="feeBackTips" content="已收到反馈,感谢您的关注" title="反馈成功" :icon="successIcon"></MsgTips>
|
||||
</view>
|
||||
</template>
|
||||
@@ -282,7 +282,7 @@ const emit = defineEmits(['onConfirm']);
|
||||
const { messages, isTyping, textInput, chatSessionID } = storeToRefs(useChatGroupDBStore());
|
||||
import successIcon from '@/static/icon/success.png';
|
||||
import useUserStore from '@/stores/useUserStore';
|
||||
const {isMachineEnv} = storeToRefs(useUserStore());
|
||||
const { isMachineEnv } = storeToRefs(useUserStore());
|
||||
// hook
|
||||
// 语音识别
|
||||
const {
|
||||
@@ -463,7 +463,14 @@ function getGuess() {
|
||||
}
|
||||
|
||||
function isImage(type) {
|
||||
return new RegExp('image').test(type);
|
||||
if (!type || typeof type !== 'string') return false;
|
||||
const imageTypes = [
|
||||
'jpg', 'jpeg', 'png', 'gif', 'bmp',
|
||||
'webp', 'svg', 'tiff', 'tif', 'ico',
|
||||
'apng', 'avif', 'heic', 'heif', 'jfif'
|
||||
];
|
||||
const lowerType = type.toLowerCase();
|
||||
return imageTypes.includes(lowerType);
|
||||
}
|
||||
|
||||
function isFile(type) {
|
||||
@@ -543,6 +550,31 @@ function getUploadFile(type = 'camera') {
|
||||
});
|
||||
}
|
||||
|
||||
const handleFileSend = (rows)=>{
|
||||
filesList.value = []
|
||||
try {
|
||||
rows.map(item=>{
|
||||
if(isImage(item.fileSuffix)){
|
||||
filesList.value.push({
|
||||
url: item.fileUrl,
|
||||
type: item.fileSuffix,
|
||||
name: item.fileName,
|
||||
});
|
||||
}else{
|
||||
filesList.value.push({
|
||||
url: item.fileUrl,
|
||||
type: item.fileSuffix,
|
||||
name: item.fileName,
|
||||
});
|
||||
}
|
||||
})
|
||||
textInput.value = state.uploadFileTips;
|
||||
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
const tipsPermisson = () => {
|
||||
uni.showToast({
|
||||
title: '需要授权麦克风权限才能使用语音功能',
|
||||
@@ -604,7 +636,7 @@ function changeVoice() {
|
||||
}
|
||||
|
||||
function changeShowFile() {
|
||||
if(isMachineEnv){
|
||||
if(isMachineEnv.value){
|
||||
qrcodeRef.value?.open()
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user