fix: optimize receiving UI and stabilize COS image upload
This commit is contained in:
parent
518ceefb91
commit
3fbd27c72c
@ -11,13 +11,12 @@
|
|||||||
<u-input
|
<u-input
|
||||||
v-model="searchText"
|
v-model="searchText"
|
||||||
placeholder="请输入关键词搜索"
|
placeholder="请输入关键词搜索"
|
||||||
|
:border="searchBorder"
|
||||||
|
prefixIcon="search"
|
||||||
|
prefixIconStyle="color: #909399; font-size: 18px"
|
||||||
clearable
|
clearable
|
||||||
@input="handleSearch"
|
@input="handleSearch"
|
||||||
>
|
></u-input>
|
||||||
<template #prefix>
|
|
||||||
<u-icon name="search" size="18" color="#909399"></u-icon>
|
|
||||||
</template>
|
|
||||||
</u-input>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 底部列表 -->
|
<!-- 底部列表 -->
|
||||||
@ -84,6 +83,10 @@
|
|||||||
allowCreate: {
|
allowCreate: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
searchBorder: {
|
||||||
|
type: String,
|
||||||
|
default: 'surround'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -237,6 +240,18 @@
|
|||||||
background-color: #f5f7fa;
|
background-color: #f5f7fa;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
padding: 0 20rpx;
|
padding: 0 20rpx;
|
||||||
|
min-height: 84rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
::v-deep .u-input {
|
||||||
|
height: 76rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .u-input__content {
|
||||||
|
height: 76rpx;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.quick-filter {
|
.quick-filter {
|
||||||
|
|||||||
@ -44,7 +44,9 @@ export default {
|
|||||||
return {
|
return {
|
||||||
internalFileList: [],
|
internalFileList: [],
|
||||||
// 记录正在上传的文件,用于避免重复上传
|
// 记录正在上传的文件,用于避免重复上传
|
||||||
uploadingFiles: new Set()
|
uploadingFiles: new Set(),
|
||||||
|
// 记录最近一次getCOSUploadConfig请求使用的id(ReferenceFile必须使用该值)
|
||||||
|
lastUploadConfigRequestId: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -98,6 +100,150 @@ export default {
|
|||||||
return filePath.split(/[\\/]/).pop();
|
return filePath.split(/[\\/]/).pop();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析本地可上传文件路径(相册/拍照兼容)
|
||||||
|
*/
|
||||||
|
resolveLocalFilePath(file) {
|
||||||
|
const candidates = [file?.path, file?.tempFilePath, file?.url, file?.thumb].filter(Boolean);
|
||||||
|
if (!candidates.length) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
const rawPath = String(candidates[0]);
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(rawPath);
|
||||||
|
} catch (e) {
|
||||||
|
return rawPath;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提取扩展名(不含.)
|
||||||
|
*/
|
||||||
|
extractExtension(value) {
|
||||||
|
if (!value || typeof value !== 'string') return '';
|
||||||
|
const cleanValue = value.split('?')[0].split('#')[0];
|
||||||
|
const baseName = cleanValue.split(/[\\/]/).pop() || '';
|
||||||
|
const match = baseName.match(/\.([a-z0-9]+)$/i);
|
||||||
|
return match ? match[1].toLowerCase() : '';
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析图片扩展名(优先文件路径/文件名)
|
||||||
|
*/
|
||||||
|
resolveImageExtension(file, filePath = '') {
|
||||||
|
const fromPath = this.extractExtension(filePath || file?.url || file?.path || '');
|
||||||
|
if (['png', 'jpg', 'jpeg', 'webp', 'gif'].includes(fromPath)) {
|
||||||
|
return fromPath === 'jpeg' ? 'jpg' : fromPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fromName = this.extractExtension(file?.name || '');
|
||||||
|
if (['png', 'jpg', 'jpeg', 'webp', 'gif'].includes(fromName)) {
|
||||||
|
return fromName === 'jpeg' ? 'jpg' : fromName;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rawType = String(file?.type || '').toLowerCase();
|
||||||
|
if (rawType.includes('png')) return 'png';
|
||||||
|
if (rawType.includes('jpeg') || rawType.includes('jpg')) return 'jpg';
|
||||||
|
if (rawType.includes('webp')) return 'webp';
|
||||||
|
if (rawType.includes('gif')) return 'gif';
|
||||||
|
|
||||||
|
return 'jpg';
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提取上传配置返回的fileId
|
||||||
|
*/
|
||||||
|
resolveUploadConfigFileId(configData) {
|
||||||
|
if (!configData || typeof configData !== 'object') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return configData.fileId || configData.file_id || configData?.fileInfo?.fileId || configData?.fileInfo?.file_id || '';
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析上传地址(兼容不同后端字段)
|
||||||
|
*/
|
||||||
|
resolveUploadUrl(configData) {
|
||||||
|
if (!configData || typeof configData !== 'object') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return configData.uploadUrl ||
|
||||||
|
configData.upload_url ||
|
||||||
|
configData.fileUrl ||
|
||||||
|
configData.file_url ||
|
||||||
|
configData.url ||
|
||||||
|
configData.postUrl ||
|
||||||
|
configData.post_url ||
|
||||||
|
configData?.fileInfo?.uploadUrl ||
|
||||||
|
configData?.fileInfo?.upload_url ||
|
||||||
|
configData?.fileInfo?.fileUrl ||
|
||||||
|
configData?.fileInfo?.file_url ||
|
||||||
|
'';
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 归一化上传配置
|
||||||
|
*/
|
||||||
|
normalizeUploadConfig(rawUploadConfig, fallbackFileInfo) {
|
||||||
|
const primary = rawUploadConfig?.data && typeof rawUploadConfig.data === 'object'
|
||||||
|
? rawUploadConfig.data
|
||||||
|
: rawUploadConfig;
|
||||||
|
const nested = primary?.data && typeof primary.data === 'object' ? primary.data : null;
|
||||||
|
const source = nested || primary || {};
|
||||||
|
|
||||||
|
const uploadUrl = this.resolveUploadUrl(source) || this.resolveUploadUrl(primary) || this.resolveUploadUrl(rawUploadConfig);
|
||||||
|
const formData = source.data || source.formData || source.fields || source.params || {};
|
||||||
|
const fileInfo = source.fileInfo || primary?.fileInfo || fallbackFileInfo || {};
|
||||||
|
const fileId = this.resolveUploadConfigFileId(source) || this.resolveUploadConfigFileId(primary) || this.resolveUploadConfigFileId(rawUploadConfig);
|
||||||
|
const method = String(source.method || source.httpMethod || source.uploadMethod || source?.fileInfo?.method || '').toUpperCase();
|
||||||
|
const fileFieldName = source.fileFieldName || source.fieldName || source.fileField || source?.fileInfo?.fileFieldName || 'file';
|
||||||
|
const header = source.header || source.headers || source?.fileInfo?.header || source?.fileInfo?.headers || {};
|
||||||
|
|
||||||
|
return {
|
||||||
|
uploadUrl,
|
||||||
|
data: formData,
|
||||||
|
fileInfo,
|
||||||
|
fileId,
|
||||||
|
method: method || '',
|
||||||
|
fileFieldName,
|
||||||
|
header
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规范化图片MIME类型
|
||||||
|
*/
|
||||||
|
resolveImageMimeType(file) {
|
||||||
|
const extension = this.resolveImageExtension(file);
|
||||||
|
if (extension === 'png') return 'image/png';
|
||||||
|
if (extension === 'webp') return 'image/webp';
|
||||||
|
if (extension === 'gif') return 'image/gif';
|
||||||
|
return 'image/jpeg';
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确保文件名包含后缀
|
||||||
|
*/
|
||||||
|
ensureFileNameWithExtension(fileName, fileType, filePath = '') {
|
||||||
|
let normalizedName = String(fileName || '').trim();
|
||||||
|
if (!normalizedName) {
|
||||||
|
normalizedName = `image_${Date.now()}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cleanName = normalizedName.split('?')[0].split('#')[0];
|
||||||
|
const expectedExt = `.${this.resolveImageExtension({ type: fileType, name: cleanName }, filePath)}`;
|
||||||
|
const hasExt = /\.[a-z0-9]+$/i.test(cleanName);
|
||||||
|
|
||||||
|
if (!hasExt) {
|
||||||
|
return `${cleanName}${expectedExt}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cleanName.replace(/\.[a-z0-9]+$/i, expectedExt);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件MD5
|
* 获取文件MD5
|
||||||
*/
|
*/
|
||||||
@ -112,6 +258,60 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取文件为ArrayBuffer(用于预签名PUT原始上传)
|
||||||
|
*/
|
||||||
|
readFileAsArrayBuffer(filePath) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (!uni.getFileSystemManager) {
|
||||||
|
reject(new Error('当前环境不支持文件系统读取'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileSystemManager = uni.getFileSystemManager();
|
||||||
|
fileSystemManager.readFile({
|
||||||
|
filePath,
|
||||||
|
encoding: 'binary',
|
||||||
|
success: (res) => {
|
||||||
|
resolve(res.data);
|
||||||
|
},
|
||||||
|
fail: (error) => {
|
||||||
|
reject(new Error(`读取文件失败: ${error?.errMsg || JSON.stringify(error)}`));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预签名PUT原始二进制上传
|
||||||
|
*/
|
||||||
|
async uploadByRawPut(filePath, config) {
|
||||||
|
const fileBinary = await this.readFileAsArrayBuffer(filePath);
|
||||||
|
const requestHeader = {
|
||||||
|
'Content-Type': config?.fileInfo?.fileType || 'application/octet-stream',
|
||||||
|
...(config?.header || {})
|
||||||
|
};
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.request({
|
||||||
|
url: config.uploadUrl,
|
||||||
|
method: 'PUT',
|
||||||
|
header: requestHeader,
|
||||||
|
data: fileBinary,
|
||||||
|
success: (res) => {
|
||||||
|
if (res.statusCode === 200 || res.statusCode === 201 || res.statusCode === 204) {
|
||||||
|
resolve();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
reject(new Error(`COS原始PUT上传失败,状态码: ${res.statusCode}, 响应: ${typeof res.data === 'string' ? res.data : JSON.stringify(res.data)}`));
|
||||||
|
},
|
||||||
|
fail: (error) => {
|
||||||
|
reject(new Error(`COS原始PUT请求失败: ${error?.errMsg || JSON.stringify(error)}`));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -158,7 +358,11 @@ export default {
|
|||||||
async processFileUpload(file, fileIndex) {
|
async processFileUpload(file, fileIndex) {
|
||||||
try {
|
try {
|
||||||
// 检查是否已经在上传
|
// 检查是否已经在上传
|
||||||
const fileKey = `${file.url}_${file.size}`;
|
const localFilePath = this.resolveLocalFilePath(file);
|
||||||
|
if (!localFilePath) {
|
||||||
|
throw new Error('未获取到可上传的本地文件路径');
|
||||||
|
}
|
||||||
|
const fileKey = `${localFilePath}_${file.size}`;
|
||||||
if (this.uploadingFiles.has(fileKey)) {
|
if (this.uploadingFiles.has(fileKey)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -166,8 +370,11 @@ export default {
|
|||||||
this.uploadingFiles.add(fileKey);
|
this.uploadingFiles.add(fileKey);
|
||||||
|
|
||||||
// 1. 获取文件MD5
|
// 1. 获取文件MD5
|
||||||
const fileInfo = await this.getFileMd5(file.url);
|
const fileInfo = await this.getFileMd5(localFilePath);
|
||||||
const fileName = this.extractFileName(file.url) || file.name;
|
const fileType = this.resolveImageMimeType(file);
|
||||||
|
const rawFileName = this.extractFileName(localFilePath) || file.name;
|
||||||
|
const fileName = this.ensureFileNameWithExtension(rawFileName, fileType, localFilePath);
|
||||||
|
const requestBusinessId = this.business_id;
|
||||||
|
|
||||||
// 2. 更新状态为上传中
|
// 2. 更新状态为上传中
|
||||||
this.fileList[fileIndex] = {
|
this.fileList[fileIndex] = {
|
||||||
@ -178,23 +385,39 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 3. 获取COS上传配置
|
// 3. 获取COS上传配置
|
||||||
|
const getCosUploadConfigPayload = {
|
||||||
|
fileName,
|
||||||
|
fileSize: fileInfo.size,
|
||||||
|
fileType,
|
||||||
|
id: requestBusinessId,
|
||||||
|
md5: fileInfo.digest,
|
||||||
|
type: this.business_type,
|
||||||
|
};
|
||||||
|
console.log('[API] index.getCOSUploadConfig request:', getCosUploadConfigPayload);
|
||||||
const uploadConfig = await this.$http('common.getCOSUploadConfig', {
|
const uploadConfig = await this.$http('common.getCOSUploadConfig', {
|
||||||
data: {
|
data: getCosUploadConfigPayload
|
||||||
fileName,
|
|
||||||
fileSize: fileInfo.size,
|
|
||||||
fileType: file.type,
|
|
||||||
id: this.business_id,
|
|
||||||
md5: fileInfo.digest,
|
|
||||||
type: this.business_type,
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
console.log('[API] index.getCOSUploadConfig response:', uploadConfig);
|
||||||
const configData = uploadConfig.data;
|
|
||||||
if (!configData) {
|
const fallbackFileInfo = {
|
||||||
|
fileName,
|
||||||
|
fileSize: fileInfo.size,
|
||||||
|
fileType,
|
||||||
|
md5: fileInfo.digest
|
||||||
|
};
|
||||||
|
const configData = this.normalizeUploadConfig(uploadConfig, fallbackFileInfo);
|
||||||
|
console.log('[API] normalized COS config:', configData);
|
||||||
|
if (!configData || !configData.uploadUrl) {
|
||||||
|
console.error('[API] getCOSUploadConfig invalid response:', uploadConfig);
|
||||||
throw new Error("获取上传配置失败");
|
throw new Error("获取上传配置失败");
|
||||||
}
|
}
|
||||||
|
const uploadConfigFileId = configData.fileId;
|
||||||
|
if (!uploadConfigFileId) {
|
||||||
|
console.warn('[API] index.getCOSUploadConfig response missing fileId, will fallback to index.uploadSuccessNotify fileId');
|
||||||
|
}
|
||||||
|
this.lastUploadConfigRequestId = requestBusinessId;
|
||||||
// 4. 执行COS上传(这里不会返回响应数据)
|
// 4. 执行COS上传(这里不会返回响应数据)
|
||||||
await this.uploadToCOS(file.url, configData, fileIndex);
|
await this.uploadToCOS(localFilePath, configData, fileIndex);
|
||||||
|
|
||||||
|
|
||||||
// 5. 通知后端上传完成
|
// 5. 通知后端上传完成
|
||||||
@ -202,13 +425,18 @@ export default {
|
|||||||
|
|
||||||
// 6. 更新状态为成功
|
// 6. 更新状态为成功
|
||||||
if (notifyResult.data?.data) {
|
if (notifyResult.data?.data) {
|
||||||
const { fileUrl, fileId } = notifyResult.data.data;
|
const { fileUrl, fileId: notifyFileId, file_id: notifyFileIdAlt } = notifyResult.data.data;
|
||||||
|
const finalFileId = uploadConfigFileId || notifyFileId || notifyFileIdAlt || '';
|
||||||
|
if (!finalFileId) {
|
||||||
|
throw new Error('上传成功但未获取到fileId');
|
||||||
|
}
|
||||||
this.fileList[fileIndex] = {
|
this.fileList[fileIndex] = {
|
||||||
...this.fileList[fileIndex],
|
...this.fileList[fileIndex],
|
||||||
status: "success",
|
status: "success",
|
||||||
message: "",
|
message: "",
|
||||||
url: fileUrl,
|
url: fileUrl,
|
||||||
id: fileId,
|
id: finalFileId,
|
||||||
|
uploadConfigRequestId: requestBusinessId,
|
||||||
successUrl: fileUrl // 保存成功后的URL
|
successUrl: fileUrl // 保存成功后的URL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -223,6 +451,7 @@ export default {
|
|||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("上传流程失败:", error);
|
console.error("上传流程失败:", error);
|
||||||
|
console.error('[API] index.getCOSUploadConfig/reference flow error:', error);
|
||||||
this.fileList[fileIndex] = {
|
this.fileList[fileIndex] = {
|
||||||
...this.fileList[fileIndex],
|
...this.fileList[fileIndex],
|
||||||
status: "error",
|
status: "error",
|
||||||
@ -230,7 +459,8 @@ export default {
|
|||||||
};
|
};
|
||||||
} finally {
|
} finally {
|
||||||
// 清理上传记录
|
// 清理上传记录
|
||||||
const fileKey = `${file.url}_${file.size}`;
|
const localFilePath = this.resolveLocalFilePath(file);
|
||||||
|
const fileKey = `${localFilePath}_${file.size}`;
|
||||||
this.uploadingFiles.delete(fileKey);
|
this.uploadingFiles.delete(fileKey);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -240,42 +470,91 @@ export default {
|
|||||||
*/
|
*/
|
||||||
uploadToCOS(filePath, config, fileIndex) {
|
uploadToCOS(filePath, config, fileIndex) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// COS上传不会返回数据,所以这里只是发起请求
|
if (!config?.uploadUrl) {
|
||||||
const uploadTask = uni.uploadFile({
|
reject(new Error('COS上传地址为空(uploadUrl)'));
|
||||||
url: config.uploadUrl, // 应该从config中获取
|
return;
|
||||||
filePath: filePath,
|
}
|
||||||
name: 'file',
|
const normalizedUploadUrl = String(config.uploadUrl || '').trim();
|
||||||
formData: config.data,
|
const hasFormData = !!(config?.data && Object.keys(config.data).length);
|
||||||
// COS上传成功不会有响应体,只会有状态码
|
const preferredMethod = config?.method || (hasFormData ? 'POST' : 'PUT');
|
||||||
success: (res) => {
|
const fallbackMethod = preferredMethod === 'POST' ? 'PUT' : 'POST';
|
||||||
// 注意:COS返回的HTTP状态码成功通常是204或200,但没有响应体
|
const shouldTryRawPut = !hasFormData && preferredMethod === 'PUT';
|
||||||
if (res.statusCode === 200 || res.statusCode === 204) {
|
|
||||||
resolve();
|
console.log('[API] COS upload request:', {
|
||||||
} else {
|
uploadUrl: normalizedUploadUrl,
|
||||||
reject(new Error(`COS上传失败,状态码: ${res.statusCode}`));
|
filePath,
|
||||||
}
|
method: preferredMethod,
|
||||||
},
|
fallbackMethod,
|
||||||
fail: (error) => {
|
fileFieldName: config?.fileFieldName || 'file',
|
||||||
reject(new Error("COS上传请求失败"));
|
header: config?.header || {},
|
||||||
}
|
formData: config?.data || {},
|
||||||
|
fileName: config?.fileInfo?.fileName,
|
||||||
|
fileType: config?.fileInfo?.fileType
|
||||||
});
|
});
|
||||||
|
|
||||||
// 可以监听上传进度
|
const tryUpload = (method) => new Promise((uploadResolve, uploadReject) => {
|
||||||
uploadTask.onProgressUpdate = (res) => {
|
const uploadTask = uni.uploadFile({
|
||||||
this.fileList[fileIndex] = {
|
url: normalizedUploadUrl,
|
||||||
...this.fileList[fileIndex],
|
filePath: filePath,
|
||||||
progress: res.progress,
|
name: config?.fileFieldName || 'file',
|
||||||
message: `上传中 ${res.progress}%`
|
formData: config?.data || {},
|
||||||
};
|
header: config?.header || {},
|
||||||
|
method,
|
||||||
// 触发进度事件
|
success: (res) => {
|
||||||
this.$emit('upload-progress', {
|
if (res.statusCode === 200 || res.statusCode === 201 || res.statusCode === 204) {
|
||||||
index: fileIndex,
|
uploadResolve();
|
||||||
progress: res.progress,
|
} else {
|
||||||
totalBytesSent: res.totalBytesSent,
|
uploadReject(new Error(`COS上传失败,状态码: ${res.statusCode}, 响应: ${typeof res.data === 'string' ? res.data : JSON.stringify(res.data)}`));
|
||||||
totalBytesExpectedToSend: res.totalBytesExpectedToSend
|
}
|
||||||
|
},
|
||||||
|
fail: (error) => {
|
||||||
|
uploadReject(new Error(`COS上传请求失败: ${error?.errMsg || JSON.stringify(error) || 'unknown error'}`));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
uploadTask.onProgressUpdate((res) => {
|
||||||
|
this.fileList[fileIndex] = {
|
||||||
|
...this.fileList[fileIndex],
|
||||||
|
progress: res.progress,
|
||||||
|
message: `上传中 ${res.progress}%`
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$emit('upload-progress', {
|
||||||
|
index: fileIndex,
|
||||||
|
progress: res.progress,
|
||||||
|
totalBytesSent: res.totalBytesSent,
|
||||||
|
totalBytesExpectedToSend: res.totalBytesExpectedToSend
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const runUploadFileFallback = () => {
|
||||||
|
tryUpload(preferredMethod)
|
||||||
|
.then(resolve)
|
||||||
|
.catch((firstError) => {
|
||||||
|
console.error('[API] COS upload fail detail:', firstError);
|
||||||
|
console.warn(`[API] COS upload retry with method: ${fallbackMethod}`);
|
||||||
|
tryUpload(fallbackMethod)
|
||||||
|
.then(resolve)
|
||||||
|
.catch((secondError) => {
|
||||||
|
console.error('[API] COS upload retry fail detail:', secondError);
|
||||||
|
reject(secondError);
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (shouldTryRawPut) {
|
||||||
|
console.log('[API] COS raw PUT upload attempt');
|
||||||
|
this.uploadByRawPut(filePath, config)
|
||||||
|
.then(resolve)
|
||||||
|
.catch((rawError) => {
|
||||||
|
console.error('[API] COS raw PUT upload fail detail:', rawError);
|
||||||
|
runUploadFileFallback();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
runUploadFileFallback();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -307,18 +586,25 @@ export default {
|
|||||||
async referenceFiles() {
|
async referenceFiles() {
|
||||||
console.log("this.fileList",this.fileList);
|
console.log("this.fileList",this.fileList);
|
||||||
try {
|
try {
|
||||||
|
const referenceId = this.lastUploadConfigRequestId || this.business_id;
|
||||||
|
|
||||||
// 获取所有成功的文件(包括之前已经关联的)
|
// 获取所有成功的文件(包括之前已经关联的)
|
||||||
const validFiles = this.fileList
|
const validFiles = this.fileList
|
||||||
.filter(item => item.status === "success" && item.id)
|
.filter(item => item.status === "success" && item.id)
|
||||||
.map(item => ({ file_id: item.id }));
|
.map(item => ({ file_id: item.id }));
|
||||||
|
|
||||||
if (validFiles.length === 0) {
|
if (validFiles.length === 0) {
|
||||||
// 如果没有成功文件,也要通知后端清空关联
|
const referencePayload = {
|
||||||
const response = await this.$http('common.ReferenceFile', {
|
id: referenceId,
|
||||||
id: this.business_id,
|
|
||||||
type: this.business_type,
|
type: this.business_type,
|
||||||
images: []
|
images: []
|
||||||
|
};
|
||||||
|
console.log('[API] index.ReferenceFile request:', referencePayload);
|
||||||
|
// 如果没有成功文件,也要通知后端清空关联
|
||||||
|
const response = await this.$http('common.ReferenceFile', {
|
||||||
|
...referencePayload
|
||||||
});
|
});
|
||||||
|
console.log('[API] index.ReferenceFile response:', response);
|
||||||
|
|
||||||
// 更新外部绑定
|
// 更新外部绑定
|
||||||
this.$emit('change', this.fileList);
|
this.$emit('change', this.fileList);
|
||||||
@ -326,11 +612,16 @@ export default {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await this.$http('common.ReferenceFile', {
|
const referencePayload = {
|
||||||
id: this.business_id,
|
id: referenceId,
|
||||||
type: this.business_type,
|
type: this.business_type,
|
||||||
images: validFiles
|
images: validFiles
|
||||||
|
};
|
||||||
|
console.log('[API] index.ReferenceFile request:', referencePayload);
|
||||||
|
const response = await this.$http('common.ReferenceFile', {
|
||||||
|
...referencePayload
|
||||||
});
|
});
|
||||||
|
console.log('[API] index.ReferenceFile response:', response);
|
||||||
|
|
||||||
// 更新外部绑定
|
// 更新外部绑定
|
||||||
this.$emit('change', this.fileList);
|
this.$emit('change', this.fileList);
|
||||||
@ -339,6 +630,7 @@ export default {
|
|||||||
return response;
|
return response;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("关联文件失败:", error);
|
console.error("关联文件失败:", error);
|
||||||
|
console.error('[API] index.ReferenceFile error:', error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -46,6 +46,19 @@
|
|||||||
<u-form-item label="净重(g)">
|
<u-form-item label="净重(g)">
|
||||||
<u-input v-model="formData.net_weight" type="digit" placeholder="请输入净重" clearable></u-input>
|
<u-input v-model="formData.net_weight" type="digit" placeholder="请输入净重" clearable></u-input>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
|
<u-form-item label="商品图片">
|
||||||
|
<view class="product-image-upload-wrap">
|
||||||
|
<uploadImgCos
|
||||||
|
business_type="stock"
|
||||||
|
:value="formData.images"
|
||||||
|
:business_id="productImageBusinessId"
|
||||||
|
:disabled="!productImageBusinessId"
|
||||||
|
@change="handleImagesChange"
|
||||||
|
></uploadImgCos>
|
||||||
|
<text class="product-image-tip">支持jpg/png格式,单张不超过10MB</text>
|
||||||
|
<text v-if="!productImageBusinessId" class="product-image-tip">请先保存一次商品后再上传图片</text>
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
</u-form>
|
</u-form>
|
||||||
</view>
|
</view>
|
||||||
<view class="safe-padding-bottom"></view>
|
<view class="safe-padding-bottom"></view>
|
||||||
@ -63,6 +76,7 @@
|
|||||||
:show="showProhibitedPicker"
|
:show="showProhibitedPicker"
|
||||||
:value="formData.prohibited_type_id"
|
:value="formData.prohibited_type_id"
|
||||||
:itemFontSize="32"
|
:itemFontSize="32"
|
||||||
|
searchBorder="none"
|
||||||
:allowCreate="true"
|
:allowCreate="true"
|
||||||
@change="handleProhibitedTypeChange"
|
@change="handleProhibitedTypeChange"
|
||||||
@create="handleProhibitedTypeCreate"
|
@create="handleProhibitedTypeCreate"
|
||||||
@ -75,6 +89,7 @@
|
|||||||
:show="showStockUnitPicker"
|
:show="showStockUnitPicker"
|
||||||
:value="formData.stock_unit_value"
|
:value="formData.stock_unit_value"
|
||||||
:itemFontSize="32"
|
:itemFontSize="32"
|
||||||
|
searchBorder="none"
|
||||||
:allowCreate="true"
|
:allowCreate="true"
|
||||||
@change="handleStockUnitChange"
|
@change="handleStockUnitChange"
|
||||||
@create="handleStockUnitCreate"
|
@create="handleStockUnitCreate"
|
||||||
@ -103,6 +118,7 @@ export default {
|
|||||||
prohibited_type_name: '',
|
prohibited_type_name: '',
|
||||||
gross_weight: '',
|
gross_weight: '',
|
||||||
net_weight: '',
|
net_weight: '',
|
||||||
|
images: [],
|
||||||
stock_unit_value: '',
|
stock_unit_value: '',
|
||||||
stock_unit: '',
|
stock_unit: '',
|
||||||
tag_price: '',
|
tag_price: '',
|
||||||
@ -110,6 +126,11 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
productImageBusinessId() {
|
||||||
|
return this.resolveWarehouseStockId(this.rawItem || {}) || 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.cacheKey = (options && options.cacheKey) || '';
|
this.cacheKey = (options && options.cacheKey) || '';
|
||||||
this.loadProhibitedTypes();
|
this.loadProhibitedTypes();
|
||||||
@ -134,6 +155,7 @@ export default {
|
|||||||
this.formData.prohibited_type_name = String((cached.prohibited && cached.prohibited.type_name) || '');
|
this.formData.prohibited_type_name = String((cached.prohibited && cached.prohibited.type_name) || '');
|
||||||
this.formData.gross_weight = this.normalizeInputValue(cached.gross_weight);
|
this.formData.gross_weight = this.normalizeInputValue(cached.gross_weight);
|
||||||
this.formData.net_weight = this.normalizeInputValue(cached.net_weight);
|
this.formData.net_weight = this.normalizeInputValue(cached.net_weight);
|
||||||
|
this.formData.images = this.normalizeImageListForUpload(cached);
|
||||||
this.formData.stock_unit = String(cached.stock_unit || '');
|
this.formData.stock_unit = String(cached.stock_unit || '');
|
||||||
this.formData.stock_unit_value = String(cached.stock_unit || '');
|
this.formData.stock_unit_value = String(cached.stock_unit || '');
|
||||||
this.formData.tag_price = this.normalizeInputValue(cached.tag_price);
|
this.formData.tag_price = this.normalizeInputValue(cached.tag_price);
|
||||||
@ -181,10 +203,10 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const candidates = [
|
const candidates = [
|
||||||
item.id,
|
|
||||||
item.stock_id,
|
item.stock_id,
|
||||||
item.warehouse_stock_id,
|
item.warehouse_stock_id,
|
||||||
item.storage_id
|
item.storage_id,
|
||||||
|
item.id
|
||||||
];
|
];
|
||||||
|
|
||||||
for (let i = 0; i < candidates.length; i++) {
|
for (let i = 0; i < candidates.length; i++) {
|
||||||
@ -419,6 +441,56 @@ export default {
|
|||||||
}
|
}
|
||||||
return String(value);
|
return String(value);
|
||||||
},
|
},
|
||||||
|
normalizeImageListForUpload(item) {
|
||||||
|
if (!item || typeof item !== 'object') {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(item.images) && item.images.length > 0) {
|
||||||
|
return item.images
|
||||||
|
.map(image => {
|
||||||
|
if (!image) return null;
|
||||||
|
if (typeof image === 'string') {
|
||||||
|
return { url: image, status: 'success' };
|
||||||
|
}
|
||||||
|
if (typeof image === 'object') {
|
||||||
|
const imageUrl = image.url || image.path || image.fileUrl || image.image_url;
|
||||||
|
if (!imageUrl) return null;
|
||||||
|
return {
|
||||||
|
...image,
|
||||||
|
url: imageUrl,
|
||||||
|
status: image.status || 'success'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
.filter(Boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
const singleImage = item.image || item.image_url || item.img || item.pic || item.photo || item.cover || item.cover_url;
|
||||||
|
if (singleImage) {
|
||||||
|
return [{ url: String(singleImage), status: 'success' }];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
extractImageUrls(list) {
|
||||||
|
if (!Array.isArray(list)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return list
|
||||||
|
.map(image => {
|
||||||
|
if (!image) return '';
|
||||||
|
if (typeof image === 'string') return image;
|
||||||
|
if (typeof image === 'object') return image.url || image.path || image.successUrl || image.fileUrl || '';
|
||||||
|
return '';
|
||||||
|
})
|
||||||
|
.filter(Boolean);
|
||||||
|
},
|
||||||
|
handleImagesChange(nextImages) {
|
||||||
|
this.formData.images = Array.isArray(nextImages) ? [...nextImages] : [];
|
||||||
|
},
|
||||||
handleCancel() {
|
handleCancel() {
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1
|
delta: 1
|
||||||
@ -501,6 +573,7 @@ export default {
|
|||||||
prohibited_type_name: String(this.formData.prohibited_type_name || '').trim(),
|
prohibited_type_name: String(this.formData.prohibited_type_name || '').trim(),
|
||||||
gross_weight: grossWeight,
|
gross_weight: grossWeight,
|
||||||
net_weight: String(this.formData.net_weight || '').trim(),
|
net_weight: String(this.formData.net_weight || '').trim(),
|
||||||
|
images: this.extractImageUrls(this.formData.images),
|
||||||
stock_unit: stockUnit,
|
stock_unit: stockUnit,
|
||||||
tag_price: String(this.formData.tag_price || '').trim(),
|
tag_price: String(this.formData.tag_price || '').trim(),
|
||||||
retail_price: String(this.formData.retail_price || '').trim()
|
retail_price: String(this.formData.retail_price || '').trim()
|
||||||
@ -548,6 +621,8 @@ export default {
|
|||||||
},
|
},
|
||||||
gross_weight: grossWeight,
|
gross_weight: grossWeight,
|
||||||
net_weight: String(this.formData.net_weight || '').trim(),
|
net_weight: String(this.formData.net_weight || '').trim(),
|
||||||
|
images: this.extractImageUrls(this.formData.images),
|
||||||
|
image: this.extractImageUrls(this.formData.images)[0] || '',
|
||||||
stock_unit: stockUnit,
|
stock_unit: stockUnit,
|
||||||
tag_price: String(this.formData.tag_price || '').trim(),
|
tag_price: String(this.formData.tag_price || '').trim(),
|
||||||
retail_price: String(this.formData.retail_price || '').trim()
|
retail_price: String(this.formData.retail_price || '').trim()
|
||||||
@ -667,6 +742,17 @@ export default {
|
|||||||
color: #c0c4cc;
|
color: #c0c4cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.product-image-upload-wrap {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-image-tip {
|
||||||
|
display: block;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
.safe-padding-bottom {
|
.safe-padding-bottom {
|
||||||
height: 170rpx;
|
height: 170rpx;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,6 +106,7 @@
|
|||||||
:list="storeList"
|
:list="storeList"
|
||||||
:show="showStorePicker"
|
:show="showStorePicker"
|
||||||
:value="pendingStoreId"
|
:value="pendingStoreId"
|
||||||
|
searchBorder="none"
|
||||||
@change="handleStoreChange"
|
@change="handleStoreChange"
|
||||||
@close="showStorePicker = false"
|
@close="showStorePicker = false"
|
||||||
></inputAndSelect>
|
></inputAndSelect>
|
||||||
|
|||||||
@ -165,7 +165,7 @@
|
|||||||
|
|
||||||
<!-- 货主选择组件 -->
|
<!-- 货主选择组件 -->
|
||||||
<inputAndSelect title="选择货主" :list="stores" :show="showStore" :value="storeId"
|
<inputAndSelect title="选择货主" :list="stores" :show="showStore" :value="storeId"
|
||||||
@change="handleStoreChange" @close="showStore=false"></inputAndSelect>
|
searchBorder="none" @change="handleStoreChange" @close="showStore=false"></inputAndSelect>
|
||||||
|
|
||||||
<!-- 时间选择器 -->
|
<!-- 时间选择器 -->
|
||||||
<u-calendar :show="showSelectDate" mode="range" @confirm="handleDateConfirm" @close="showSelectDate=false" :minDate="minDate" :maxDate="maxDate" :monthNum="calendarMonthNum"></u-calendar>
|
<u-calendar :show="showSelectDate" mode="range" @confirm="handleDateConfirm" @close="showSelectDate=false" :minDate="minDate" :maxDate="maxDate" :monthNum="calendarMonthNum"></u-calendar>
|
||||||
|
|||||||
@ -95,7 +95,7 @@
|
|||||||
|
|
||||||
<!-- 货主选择器 -->
|
<!-- 货主选择器 -->
|
||||||
<inputAndSelect title="选择货主" :list="storeList" :show="showStorePicker" :value="formData.store_id"
|
<inputAndSelect title="选择货主" :list="storeList" :show="showStorePicker" :value="formData.store_id"
|
||||||
@change="handleStoreChange" @close="showStorePicker=false"></inputAndSelect>
|
searchBorder="none" @change="handleStoreChange" @close="showStorePicker=false"></inputAndSelect>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@ -3,9 +3,9 @@
|
|||||||
:scroll-with-animation="scrollWithAnimation" @scroll="handleScroll">
|
:scroll-with-animation="scrollWithAnimation" @scroll="handleScroll">
|
||||||
|
|
||||||
<!-- 收货单基本信息 -->
|
<!-- 收货单基本信息 -->
|
||||||
<view class="receiving-info-card">
|
<view class="receiving-info-card" :class="{ collapsed: !infoExpanded, fixed: fixedHeader, 'no-transition': disableInfoTransition }">
|
||||||
<view v-if="showHeaderMask" class="info-header-top-mask" :style="infoHeaderMaskStyle"></view>
|
<view v-if="showHeaderMask" class="info-header-top-mask" :style="infoHeaderMaskStyle"></view>
|
||||||
<view class="info-header" :class="{ collapsed: !infoExpanded, fixed: fixedHeader }"
|
<view class="info-header" :class="{ collapsed: !infoExpanded, fixed: fixedHeader, 'no-transition': disableInfoTransition }"
|
||||||
:style="infoHeaderStyle" @click="toggleInfoExpanded">
|
:style="infoHeaderStyle" @click="toggleInfoExpanded">
|
||||||
<text class="receiving-number">{{ receivingInfo.receiving_number }}</text>
|
<text class="receiving-number">{{ receivingInfo.receiving_number }}</text>
|
||||||
<view class="header-right">
|
<view class="header-right">
|
||||||
@ -17,7 +17,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view v-if="fixedHeader" class="info-header-placeholder" :class="{ collapsed: !infoExpanded }"></view>
|
<view v-if="fixedHeader" class="info-header-placeholder" :class="{ collapsed: !infoExpanded }"></view>
|
||||||
|
|
||||||
<view v-show="infoExpanded" class="info-content">
|
<view class="info-content" :class="{ collapsed: !infoExpanded, 'no-transition': disableInfoTransition }">
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<text class="label">货主:</text>
|
<text class="label">货主:</text>
|
||||||
<text class="value">{{ receivingInfo.store_name }}</text>
|
<text class="value">{{ receivingInfo.store_name }}</text>
|
||||||
@ -224,6 +224,7 @@
|
|||||||
receivingInfo: {},
|
receivingInfo: {},
|
||||||
details: [],
|
details: [],
|
||||||
infoExpanded: true,
|
infoExpanded: true,
|
||||||
|
disableInfoTransition: false,
|
||||||
scrollTopValue: 0,
|
scrollTopValue: 0,
|
||||||
currentScrollTop: 0,
|
currentScrollTop: 0,
|
||||||
scrollWithAnimation: true,
|
scrollWithAnimation: true,
|
||||||
@ -267,12 +268,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
showHeaderMask() {
|
showHeaderMask() {
|
||||||
if (!this.fixedHeader) {
|
return false
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
const maskHeight = Number(this.fixedMaskHeight)
|
|
||||||
return Number.isFinite(maskHeight) ? maskHeight > 0 : !!this.fixedMaskHeight
|
|
||||||
},
|
},
|
||||||
|
|
||||||
infoHeaderStyle() {
|
infoHeaderStyle() {
|
||||||
@ -280,7 +276,16 @@
|
|||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
const topValue = typeof this.fixedTop === 'number' ? `${this.fixedTop}px` : this.fixedTop
|
let topValue = this.fixedTop
|
||||||
|
if (typeof this.fixedTop === 'number' && typeof this.fixedMaskHeight === 'number') {
|
||||||
|
topValue = Math.max(this.fixedTop - this.fixedMaskHeight, 0)
|
||||||
|
topValue = `${topValue}px`
|
||||||
|
} else if (this.fixedMaskHeight) {
|
||||||
|
topValue = `calc(${this.fixedTop} - ${this.fixedMaskHeight})`
|
||||||
|
} else if (typeof this.fixedTop === 'number') {
|
||||||
|
topValue = `${this.fixedTop}px`
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
top: topValue
|
top: topValue
|
||||||
}
|
}
|
||||||
@ -419,28 +424,27 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!nextExpanded) {
|
if (!nextExpanded) {
|
||||||
|
if (this.currentScrollTop > 0) {
|
||||||
|
this.disableInfoTransition = true
|
||||||
|
this.infoExpanded = false
|
||||||
|
this.$nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.disableInfoTransition = false
|
||||||
|
}, 0)
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.infoExpanded = false
|
this.infoExpanded = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.currentScrollTop > 2) {
|
|
||||||
this.scrollWithAnimation = true
|
|
||||||
this.scrollTopValue = Math.ceil(this.currentScrollTop)
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.scrollTopValue = 0
|
|
||||||
})
|
|
||||||
|
|
||||||
this.expandTimer = setTimeout(() => {
|
|
||||||
this.currentScrollTop = 0
|
|
||||||
this.infoExpanded = true
|
|
||||||
this.expandTimer = null
|
|
||||||
}, 260)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.currentScrollTop > 0) {
|
if (this.currentScrollTop > 0) {
|
||||||
this.scrollWithAnimation = false
|
this.scrollWithAnimation = false
|
||||||
this.scrollTopValue = 0
|
this.scrollTopValue = Math.ceil(this.currentScrollTop)
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.scrollTopValue = 0
|
||||||
|
})
|
||||||
this.expandTimer = setTimeout(() => {
|
this.expandTimer = setTimeout(() => {
|
||||||
this.currentScrollTop = 0
|
this.currentScrollTop = 0
|
||||||
this.infoExpanded = true
|
this.infoExpanded = true
|
||||||
@ -448,7 +452,7 @@
|
|||||||
this.scrollWithAnimation = true
|
this.scrollWithAnimation = true
|
||||||
})
|
})
|
||||||
this.expandTimer = null
|
this.expandTimer = null
|
||||||
}, 20)
|
}, 30)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,28 +497,43 @@
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
margin: 20rpx;
|
margin: 20rpx;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
padding: 30rpx;
|
overflow: hidden;
|
||||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
|
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
|
||||||
|
|
||||||
|
&.fixed.collapsed {
|
||||||
|
background-color: transparent;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.no-transition,
|
||||||
|
&.no-transition .info-header,
|
||||||
|
&.no-transition .info-content {
|
||||||
|
transition: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
.info-header {
|
.info-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
margin-bottom: 30rpx;
|
padding: 20rpx 30rpx;
|
||||||
padding-bottom: 20rpx;
|
margin-bottom: 0;
|
||||||
border-bottom: 1rpx solid #f0f0f0;
|
border-bottom: none;
|
||||||
|
min-height: 96rpx;
|
||||||
|
transition: border-bottom-color 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.3s cubic-bezier(0.22, 1, 0.36, 1);
|
||||||
|
|
||||||
&.fixed {
|
&.fixed {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 40rpx;
|
left: 20rpx;
|
||||||
right: 40rpx;
|
right: 20rpx;
|
||||||
z-index: 200;
|
z-index: 200;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
padding: 18rpx 30rpx;
|
padding: 20rpx 30rpx;
|
||||||
min-height: 76rpx;
|
min-height: 96rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
|
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
|
||||||
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.collapsed {
|
&.collapsed {
|
||||||
@ -565,8 +584,8 @@
|
|||||||
|
|
||||||
.info-header-top-mask {
|
.info-header-top-mask {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 40rpx;
|
left: 20rpx;
|
||||||
right: 40rpx;
|
right: 20rpx;
|
||||||
z-index: 199;
|
z-index: 199;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
@ -583,16 +602,30 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.info-header-placeholder {
|
.info-header-placeholder {
|
||||||
height: 76rpx;
|
height: 96rpx;
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
&.collapsed {
|
&.collapsed {
|
||||||
height: 76rpx;
|
height: 96rpx;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-content {
|
.info-content {
|
||||||
|
padding: 0 30rpx 30rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
max-height: 2200rpx;
|
||||||
|
opacity: 1;
|
||||||
|
transition: max-height 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1), padding 0.3s cubic-bezier(0.22, 1, 0.36, 1);
|
||||||
|
|
||||||
|
&.collapsed {
|
||||||
|
max-height: 0;
|
||||||
|
opacity: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.info-item {
|
.info-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-bottom: 20rpx;
|
margin-bottom: 20rpx;
|
||||||
@ -626,7 +659,7 @@
|
|||||||
.stats-card {
|
.stats-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
margin: 20rpx;
|
margin: 20rpx 0;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
padding: 30rpx 0;
|
padding: 30rpx 0;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user