flat: 图片优化
This commit is contained in:
@@ -122,9 +122,18 @@
|
||||
<!-- btn -->
|
||||
<CollapseTransition :show="showfile">
|
||||
<view class="area-file">
|
||||
<image class="file-img" @click="uploadCamera" src="/static/icon/carmreupload.png"></image>
|
||||
<image class="file-img" @click="getUploadFile" src="/static/icon/fileupload.png"></image>
|
||||
<image class="file-img" @click="uploadCamera('album')" src="/static/icon/imgupload.png"></image>
|
||||
<view class="file-card" @click="uploadCamera">
|
||||
<image class="card-img" src="/static/icon/file1.png"></image>
|
||||
<text>拍照上传</text>
|
||||
</view>
|
||||
<view class="file-card" @click="uploadCamera('album')">
|
||||
<image class="card-img" src="/static/icon/file2.png"></image>
|
||||
<text>相册上传</text>
|
||||
</view>
|
||||
<view class="file-card" @click="getUploadFile">
|
||||
<image class="card-img" src="/static/icon/file3.png"></image>
|
||||
<text>文件上传</text>
|
||||
</view>
|
||||
</view>
|
||||
</CollapseTransition>
|
||||
|
||||
@@ -132,20 +141,26 @@
|
||||
<view class="area-uploadfiles" v-if="filesList.length">
|
||||
<scroll-view class="uploadfiles-scroll" scroll-x="true">
|
||||
<view class="uploadfiles-list">
|
||||
<view class="file-uploadsend" v-for="(file, index) in filesList" :key="index">
|
||||
<view
|
||||
class="file-uploadsend"
|
||||
:class="{ 'file-border': isImage(file.type) }"
|
||||
v-for="(file, index) in filesList"
|
||||
:key="index"
|
||||
>
|
||||
<image
|
||||
class="file-icon"
|
||||
class="file-iconImg"
|
||||
@click="jumpUrl(file)"
|
||||
v-if="isImage(file.type)"
|
||||
src="/static/icon/image.png"
|
||||
:src="file.url"
|
||||
></image>
|
||||
<image
|
||||
class="file-icon"
|
||||
@click="jumpUrl(file)"
|
||||
v-if="isFile(file.type)"
|
||||
src="/static/icon/doc.png"
|
||||
></image>
|
||||
<text class="filename-text">{{ file.name }}</text>
|
||||
<view class="file-doc" @click="jumpUrl(file)" v-else>
|
||||
<view style="width: 100%">
|
||||
<view class="filename-text">{{ file.name }}</view>
|
||||
<view class="filename-size">{{ file.size }}</view>
|
||||
</view>
|
||||
<FileIcon :type="file.type"></FileIcon>
|
||||
<!-- <image class="file-icon" @click="jumpUrl(file)" :src=""></image> -->
|
||||
</view>
|
||||
<view class="file-del" catchtouchmove="true" @click="delfile(file)">
|
||||
<uni-icons type="closeempty" color="#4B4B4B" size="10"></uni-icons>
|
||||
</view>
|
||||
@@ -169,6 +184,7 @@ const { messages, isTyping, textInput, chatSessionID } = storeToRefs(useChatGrou
|
||||
import CollapseTransition from '@/components/CollapseTransition/CollapseTransition.vue';
|
||||
import FadeView from '@/components/FadeView/FadeView.vue';
|
||||
import AudioWave from './AudioWave.vue';
|
||||
import FileIcon from './fileIcon.vue';
|
||||
import { useAudioRecorder } from '@/hook/useRealtimeRecorder.js';
|
||||
|
||||
const { isRecording, recognizedText, startRecording, stopRecording, cancelRecording } = useAudioRecorder(
|
||||
@@ -245,14 +261,16 @@ const sendMessageGuess = (item) => {
|
||||
const delfile = (file) => {
|
||||
uni.showModal({
|
||||
content: '确认删除文件?',
|
||||
success() {
|
||||
filesList.value = filesList.value.filter((item) => item.url !== file.url);
|
||||
if (!filesList.value.length) {
|
||||
if (textInput.value === state.uploadFileTips) {
|
||||
textInput.value = '';
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
filesList.value = filesList.value.filter((item) => item.url !== file.url);
|
||||
if (!filesList.value.length) {
|
||||
if (textInput.value === state.uploadFileTips) {
|
||||
textInput.value = '';
|
||||
}
|
||||
}
|
||||
$api.msg('附件删除成功');
|
||||
}
|
||||
$api.msg('附件删除成功');
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -289,12 +307,16 @@ function getGuess() {
|
||||
});
|
||||
}
|
||||
|
||||
function isImage(fileNmae) {
|
||||
return new RegExp('image').test(fileNmae);
|
||||
function isImage(type) {
|
||||
return new RegExp('image').test(type);
|
||||
}
|
||||
|
||||
function isFile(fileNmae) {
|
||||
return new RegExp('custom-doc').test(fileNmae);
|
||||
function isFile(type) {
|
||||
const allowedTypes = config.allowedFileTypes || [];
|
||||
if (!allowedTypes.includes(type)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function jumpUrl(file) {
|
||||
@@ -347,6 +369,7 @@ function getUploadFile(type = 'camera') {
|
||||
const tempFilePaths = res.tempFilePaths;
|
||||
const file = res.tempFiles[0];
|
||||
const allowedTypes = config.allowedFileTypes || [];
|
||||
const size = $api.formatFileSize(file.size);
|
||||
if (!allowedTypes.includes(file.type)) {
|
||||
return $api.msg('仅支持 txt md html word pdf ppt csv excel 格式类型');
|
||||
}
|
||||
@@ -355,8 +378,9 @@ function getUploadFile(type = 'camera') {
|
||||
resData = JSON.parse(resData);
|
||||
filesList.value.push({
|
||||
url: resData.msg,
|
||||
type: 'custom-doc',
|
||||
type: file.type,
|
||||
name: file.name,
|
||||
size: size,
|
||||
});
|
||||
textInput.value = state.uploadFileTips;
|
||||
});
|
||||
@@ -605,7 +629,7 @@ image-margin-top = 40rpx
|
||||
padding: 20rpx;
|
||||
}
|
||||
.input-area {
|
||||
padding: 32rpx;
|
||||
padding: 32rpx 28rpx 24rpx 28rpx;
|
||||
position: relative;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx -4rpx 10rpx 0rpx rgba(11,44,112,0.06);
|
||||
@@ -697,13 +721,28 @@ image-margin-top = 40rpx
|
||||
width: 100%
|
||||
grid-template-columns: repeat(3, 1fr)
|
||||
grid-gap: 20rpx
|
||||
padding: 20rpx 0 0 0;
|
||||
.file-img
|
||||
height: 179rpx
|
||||
width: 100%
|
||||
padding: 32rpx 0 0 0;
|
||||
.file-card
|
||||
display: flex
|
||||
flex-direction: column
|
||||
align-items: center
|
||||
padding: 24rpx 0
|
||||
background: #F5F5F5;
|
||||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||||
text
|
||||
font-size: 24rpx
|
||||
font-weight: 500
|
||||
color: #000000
|
||||
padding-top: 8rpx
|
||||
.card-img
|
||||
height: 56rpx
|
||||
width: 56rpx
|
||||
.file-card:active
|
||||
background: #e8e8e8
|
||||
|
||||
.area-uploadfiles
|
||||
position: absolute
|
||||
top: -100rpx
|
||||
top: -180rpx
|
||||
width: calc(100% - 40rpx)
|
||||
background: #FFFFFF
|
||||
left: 0
|
||||
@@ -715,18 +754,21 @@ image-margin-top = 40rpx
|
||||
height: 100%
|
||||
display: flex
|
||||
flex-wrap: nowrap
|
||||
.file-uploadsend
|
||||
.file-doc
|
||||
display: flex
|
||||
flex-wrap: nowrap
|
||||
justify-content: center
|
||||
align-items: center
|
||||
flex-direction: column
|
||||
align-items: flex-start
|
||||
justify-content: space-between
|
||||
padding: 16rpx 20rpx 18rpx 20rpx
|
||||
height: calc(100% - 40rpx)
|
||||
.file-uploadsend
|
||||
margin: 10rpx 18rpx 0 10rpx;
|
||||
height: 100%
|
||||
border-radius: 30rpx
|
||||
font-size: 24rpx
|
||||
position: relative
|
||||
width: 218rpx;
|
||||
height: 80rpx;
|
||||
width: 360rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
border: 2rpx solid #E2E2E2;
|
||||
.file-del
|
||||
@@ -751,13 +793,27 @@ image-margin-top = 40rpx
|
||||
text-overflow: ellipsis
|
||||
white-space: nowrap
|
||||
color: #333333
|
||||
font-size: 24rpx
|
||||
flex: 1
|
||||
font-weight: 500
|
||||
max-width: 100%
|
||||
.filename-size
|
||||
overflow: hidden
|
||||
text-overflow: ellipsis
|
||||
white-space: nowrap
|
||||
color: #7B7B7B;
|
||||
flex: 1
|
||||
max-width: 100%
|
||||
.file-icon
|
||||
height: 40rpx
|
||||
width: 40rpx
|
||||
margin: 0 18rpx 0 18rpx
|
||||
.file-iconImg
|
||||
height: 100%
|
||||
width: 100%
|
||||
border-radius: 15rpx
|
||||
.file-border
|
||||
width: 160rpx;
|
||||
border: 0
|
||||
|
||||
@keyframes ai-circle {
|
||||
0% {
|
||||
|
Reference in New Issue
Block a user