iteach-upload
v1.0.41
Published
modeType 1素材上传、2、校本库、个人上传 3、作业包 4、课程产品课件上传,6教研云(个人,校本云盘) 9默认展示上传按钮 ``` @Prop({ required: false, default: 1 }) public modeType!: number; // ``` limit 最大允许上传个数 ``` @Prop({ required: false, default: 3 }) public limit!: number; ``` acceptTy
Downloads
11
Keywords
Readme
#iteach-upload
Props
modeType 1素材上传、2、校本库、个人上传 3、作业包 4、课程产品课件上传,6教研云(个人,校本云盘) 9默认展示上传按钮
@Prop({ required: false, default: 1 })
public modeType!: number; //
limit 最大允许上传个数
@Prop({ required: false, default: 3 })
public limit!: number;
acceptType 限定上传文件类型,例如:'.ppts,.mp4'
@Prop({ required: false, default: '.jpg' })
public acceptType!: string;
sourceType 素材库上传时限定素材类型
@Prop({ required: false, default: '6' })
public sourceType!: string; //
addParams{} 直接上传文件的附加参数
@Prop({
required: false,
default: () => {
return {
param: {} // 参数
url:'' //上传路径
}
}
})
public addParams!: any;
jyy2 兼容教研云的悬浮窗,值为1时生效
public jyy2: any = false;
type 素材库上传时特殊类型
public type: string = '';
sliceType 素材库上传时特殊切片类型
public sliceType: string = '';
sourceItem 素材库替换素材
@Prop({
required: false,
default: () => {
return {
modifyType: '',
resourceId: '',
}
}
})
public sourceItem!: any;
Emit func
1、@changeFile 文件上传完成之后,返回文件上传结果
public changeFile(list: Array<{ previewUrl: any; fileId: any; sliceType: any; downloadUrl: any; size: any; structJson: any; coverImgUrl: any; fileMd5: any; fileName: any; }>,fileId?:string | undefined) {
this.$emit('changeFile',list,fileId);
}
2、@changeFilePercent 进度条更新事件
public changeFilePercent(filePercent: number, id: any) {
this.fileList.forEach((v: any) => {
if (v.sourceId === id) {
v.filePercent = filePercent;
}
});
this.$forceUpdate();
this.$emit('changeFilePercent',filePercent,id)
}
3、@startUploadEvent 开始上传
public startUploadEvent(): void {
this.$emit('startUploadEvent')
}
4、@singleChangeFile 单文件上传完成
public singleChangeFile(file: any, fileId: any) {
this.$emit('singleChangeFile', file, fileId);
}
5,changeError 上传数量超出限制 #Event func 1、addFileFunc() 自定义按钮唤起文件上传
<iteach-upload ref="upload1"></iteach-upload>
this.$refs.upload1.addFileFunc();
2、按钮自定义样式,插槽处可填写自定义element,点击后自动唤起文件上传
<iteach-upload>
<slot/>
</iteach-upload>
3、stopDownload() 删除文件列表的某一个文件
public stopDownload(file: any, fileId: string): void {
this.$refs.upload1.stopDownload(file, fileId);
}
4、clearFiles()//清空文件选择器中的文件
public clearFiles(){
this.$refs.upload1.clearFiles();
}
5、setSourceItem() //编辑素材时数据传入
6、getFilemd5(file) // 直接传入文件
7、setOthers() // 增加文件额外参数 public setOthers(item:any): void { this.$refs.iteachUpns.setOthers(item) }
##callBack 1、singleFinishCallback 单文件上传完成回调
2、