1.4.8 • Published 11 months ago

yp-media-upload-update-service v1.4.8

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

yp-media-upload-update-service

介绍

yp-media-upload-update-service 用于内部使用的多媒体上传插件(更新后)

安装教程

npm install yp-media-upload-update-service
yarn add yp-media-upload-update-service

使用说明

使用示例
/** 引入 */
import { ypMediaUploadUpdate } from "yp-media-upload-update-service"

ypMediaUploadUpdate({
  headerConfig: {
			// 请求头header 参数
			appId: 101,
			system: 'android',
			env: YP_ENV === 'develop' ? 'dev' : (YP_ENV as any),
			timeout: 600,
			token,
			...headers,
		},
		paramConfig: {
			// 请求 body 参数
			fileList: (shouldUploadList as unknown) as IFileListItem[],
			entryId: 0,
    	processType:  4
			...data,
		},
  onUploadProgress: (progressArr) => { // 上传进度(单个文件的每次上传进度更新就会触发回调一次)
    console.log(progressArr)
  },
  onSuccess: (fileItem, fileList) => { // 上传成功(单个文件上传成功后,就会触发回调一次)
    console.log(fileItem, fileList, "onSuccess")
  },
  onError: (fileItem, fileList) => { // 上传失败(单个文件上传失败后,就会触发回调一次)
    console.log(fileItem, fileList, "onError")
  },
})

}

参数说明

  1. 请求头 headerConfig 参数 |参数|类型|说明|必传| |---|:---|:---|---| |appId|number|业务应用 id每个业务独立进行申请DEV 环境可以用:125|- x| |token|string|用户登录态 token|- | |headers|Object|内部约定请求头|- |

  2. 请求 paramConfig 参数 |参数|类型|说明|必传| |---|:---|:---|---| |processType|number|资源类型 id,这个开发时须向有关产品或后端咨询|- x| |entryId|number|入口场景 id,这个开发时须向有关产品或后端咨询|- x| |type|number|资源类型,0:图片,1 视频,2 音频|- x| |file|IFileItem[]|文件数组,具体类型可参考代码内提示|- x| |city|string|城市|- | |address|number|水印类型,2 音频可以为空|- | |wmId|number|水印类型,2 音频可以为空|- | |wmcInfo|object|水印相关扩展信息,2 音频可以为空|- | |uid|number|鱼泡 uid|- |

  3. 回调方法参数 |方法|返回参数|说明|必返| |---|:---|:---|---| |onUploadProgress|progressArr|单个文件上传进度变化时,将传入的 fileList 原样返回并更新每个 item 的 persent(上传进度)|- x| |onSuccess|fileItem, fileList|单个文件上传成功时,回调当前成功的 fileItem, 及原样返回且修改了 status 的 fileList|- x| |onError|fileItem, fileList|同 onSuccess 一样,只是在单个文件上传失败时触发回调|- x|

1.4.6

11 months ago

1.4.5

11 months ago

1.4.8

11 months ago

1.4.4

11 months ago

1.4.3

11 months ago

1.4.2

11 months ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.9

2 years ago

1.3.8

2 years ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.9

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.1

2 years ago