Commit 07427bcf by haojie

文件名带.导致无法上传的问题

parent 51cbcdb4
...@@ -93,7 +93,6 @@ watch( ...@@ -93,7 +93,6 @@ watch(
} }
.custom-card-box { .custom-card-box {
width: 170px; width: 170px;
height: 224px;
background: #1e1e1e; background: #1e1e1e;
border-radius: 8px; border-radius: 8px;
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1); box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
...@@ -104,13 +103,12 @@ watch( ...@@ -104,13 +103,12 @@ watch(
color: white; color: white;
.img-box { .img-box {
position: relative; position: relative;
height: 259px;
img { img {
width: 100%; width: 100%;
height: 174px; height: 100%;
border-top-left-radius: 8px; border-top-left-radius: 8px;
border-top-right-radius: 8px; border-top-right-radius: 8px;
// object-fit: contain;
// object-fit: cover;
} }
} }
.hover { .hover {
......
...@@ -87,7 +87,6 @@ const nameChange = (value: string) => { ...@@ -87,7 +87,6 @@ const nameChange = (value: string) => {
} }
.custom-card-two-box { .custom-card-two-box {
width: 200px; width: 200px;
height: 310px;
background: #1e1e1e; background: #1e1e1e;
border-radius: 8px; border-radius: 8px;
transition: all 0.2s; transition: all 0.2s;
...@@ -98,7 +97,7 @@ const nameChange = (value: string) => { ...@@ -98,7 +97,7 @@ const nameChange = (value: string) => {
flex-direction: column; flex-direction: column;
.custom-card-two-image { .custom-card-two-image {
position: relative; position: relative;
height: 236px; height: 355px;
.hover { .hover {
position: absolute; position: absolute;
top: 0; top: 0;
......
...@@ -11,7 +11,7 @@ import { ...@@ -11,7 +11,7 @@ import {
} from 'tdesign-vue-next'; } from 'tdesign-vue-next';
import { getUserCookie } from '@/utils/api/userApi'; import { getUserCookie } from '@/utils/api/userApi';
import request from '@/utils/otherRequest'; import request from '@/utils/otherRequest';
import { isDev, show_message } from '@/utils/tool'; import { getFileSuffix, isDev, show_message } from '@/utils/tool';
import { v4 } from 'uuid'; import { v4 } from 'uuid';
import Button from '../Button.vue'; import Button from '../Button.vue';
...@@ -128,7 +128,7 @@ export default defineComponent({ ...@@ -128,7 +128,7 @@ export default defineComponent({
return false; return false;
} }
if (props.accept) { if (props.accept) {
let fileName = file.name.split('.')[1]; let fileName = getFileSuffix(file);
fileName = fileName.toLowerCase(); fileName = fileName.toLowerCase();
let proAccept = props.accept.toLowerCase(); let proAccept = props.accept.toLowerCase();
if (proAccept.indexOf(fileName) == -1) { if (proAccept.indexOf(fileName) == -1) {
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
} }
.more-choices { .more-choices {
width: 170px; width: 170px;
height: 224px;
background: #1e1e1e; background: #1e1e1e;
border-radius: 8px; border-radius: 8px;
transition: all 0.2s; transition: all 0.2s;
......
...@@ -286,10 +286,9 @@ watch( ...@@ -286,10 +286,9 @@ watch(
.custom-card-box { .custom-card-box {
background: white; background: white;
width: 150px; width: 150px;
height: 200px;
color: black; color: black;
img { .img-box {
height: 150px; height: 224px;
} }
} }
.create-digital-person-grid { .create-digital-person-grid {
......
...@@ -295,9 +295,8 @@ onMounted(() => { ...@@ -295,9 +295,8 @@ onMounted(() => {
.digital-people-list-box { .digital-people-list-box {
margin-top: 12px; margin-top: 12px;
width: 100%; width: 100%;
height: 348px;
background: #303030; background: #303030;
padding: 33px 30px 0px 30px; padding: 30px;
border-radius: 6px; border-radius: 6px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
...@@ -322,7 +321,6 @@ onMounted(() => { ...@@ -322,7 +321,6 @@ onMounted(() => {
} }
.more-choices { .more-choices {
width: 170px; width: 170px;
height: 224px;
background: #1e1e1e; background: #1e1e1e;
border-radius: 8px; border-radius: 8px;
transition: all 0.2s; transition: all 0.2s;
......
...@@ -280,8 +280,10 @@ export const alyOssUpload = ( ...@@ -280,8 +280,10 @@ export const alyOssUpload = (
// 获取文件后缀 // 获取文件后缀
export const getFileSuffix = (file: any) => { export const getFileSuffix = (file: any) => {
// 获取最后一个点的位置
if (file.name && file.name.indexOf('.') !== -1) { if (file.name && file.name.indexOf('.') !== -1) {
return file.name.split('.')[1]; let list = file.name.split('.');
return list[list.length - 1];
} else { } else {
return file.type.split('/')[1]; return file.type.split('/')[1];
} }
......
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