feat:还原更新框架

This commit is contained in:
2026-07-23 14:49:48 +08:00
parent d5a6a16ea5
commit 75c7434f79
529 changed files with 43714 additions and 68201 deletions
@@ -1,4 +1,3 @@
import test from '../../libs/function/test'
function pickExclude(obj, keys) {
// 某些情况下,type可能会为
if (!['[object Object]', '[object File]'].includes(Object.prototype.toString.call(obj))) {
@@ -23,14 +22,10 @@ function formatImage(res) {
name: item.name,
file: item
// #endif
// #ifndef H5
name: item.path.split('/').pop() + '.png',
// #endif
}))
}
function formatVideo(res) {
// console.log(res)
return [
{
...pickExclude(res, ['tempFilePath', 'thumbTempFilePath', 'errMsg']),
@@ -38,15 +33,10 @@ function formatVideo(res) {
url: res.tempFilePath,
thumb: res.thumbTempFilePath,
size: res.size,
width: res.width || 0, // APP 2.1.0+、H5、微信小程序、京东小程序
height: res.height || 0, // APP 2.1.0+、H5、微信小程序、京东小程序
// #ifdef H5
name: res.name,
file: res
// #endif
// #ifndef H5
name: res.tempFilePath.split('/').pop() + '.mp4',
// #endif
}
]
}
@@ -61,9 +51,6 @@ function formatMedia(res) {
// #ifdef H5
file: item
// #endif
// #ifndef H5
name: item.tempFilePath.split('/').pop() + (res.type === 'video' ? '.mp4': '.png'),
// #endif
}))
}
@@ -90,11 +77,6 @@ export function chooseFile({
maxCount,
extension
}) {
try {
capture = test.array(capture) ? capture : capture.split(',');
} catch(e) {
capture = [];
}
return new Promise((resolve, reject) => {
switch (accept) {
case 'image':
@@ -130,28 +112,32 @@ export function chooseFile({
fail: reject
})
break
// #ifdef MP-WEIXIN || H5
// 只有微信小程序才支持chooseMessageFile接口
// #ifdef MP-WEIXIN || H5
// 只有微信小程序才支持chooseMessageFile接口
case 'file':
// #ifdef MP-WEIXIN
wx.chooseMessageFile({
count: multiple ? maxCount : 1,
type: accept,
success: (res) => resolve(formatFile(res)),
fail: reject
})
// #endif
// #ifdef H5
// 需要hx2.9.9以上才支持uni.chooseFile
let params = {
count: multiple ? maxCount : 1,
type: accept,
success: (res) => resolve(formatFile(res)),
fail: reject
}
// Array<string>根据文件拓展名过滤,仅 type==file 时有效。每一项都不能是空字符串。默认不过滤。
if (extension.length && extension.length > 0) {
params.extension = extension
}
// #ifdef MP-WEIXIN
wx.chooseMessageFile(params)
// #endif
// #ifdef H5
// 需要hx2.9.9以上才支持uni.chooseFile
uni.chooseFile(params)
// #endif
break
// #endif
// #endif
default:
// 此为保底选项,在accept不为上面任意一项的时候选取全部文件
// #ifdef MP-WEIXIN