模塊中直接使用的天翼云的官方j(luò)ssdk+plupload,實現(xiàn)分片上傳。
使用簡單,直接傳天翼云的相關(guān)參數(shù)進(jìn)去就行,支持自定義FilesAdded、FileUploaded、ChunkUploaded、BeforeUpload等方法。
                        
                        layui.config({
	base: '__PUBLIC__/layui/' //靜態(tài)資源所在路徑
}).extend({
	ctyun: 'ctyun/index',
}).use(['index', 'ctyun'], function(){
	var $ = layui.$
	,element = layui.element
	,layer = layui.layer
	,ctyun= layui.ctyun;
	ctyun.loader({
		endPoint: '{$config.ctyun_domain}'
		, browse_button: "upload-video" 
		, drop_element: "hahaha" 
		, BucketName: "{$config.ctyun_bucket}"
		, accessKeyId: "{$config.ctyun_access_key}"
		, secretAccessKey: "{$config.ctyun_secret_key}"
		, initial: true
		, UploadProgress: function(response){
			$(".show_video").show();
			$(".layui-progress").hide();
			element.progress('video-progress', response.percent + '%');
		}
		, UploadComplete: function(res){
			// layer.closeAll('loading'); // 可以調(diào)用loading
			layer.msg("上傳成功!");
			$("#video_url").val(res.Location);
			$(".show_video").find("video").attr("src", res.Location);
			$(".layui-progress").hide();
		}
	})
});