@chenxushan
2016-03-15T12:06:05.000000Z
字数 5988
阅读 1039
未分类
html
<div><ul id="ul_pics" class="ul_pics clearfix"><li id="btn"><img class="btn" src="img/award-add.png" alt=""/></li></ul></div>
css部分
.ul_pics li{float:left;width:50px;height:50px;border:1px solid #ddd;padding:2px;text-align: center;margin:0 5px 5px 0;}.ul_pics li img{max-width: 40px;max-height: 40px;vertical-align: middle;}.progress{position:relative;padding: 1px; border-radius:3px; margin:60px 0 0 0;}.bar {background-color: green; display:block; width:0%; height:20px; border-radius:3px; }.percent{position:absolute; height:20px; display:inline-block;top:3px; left:2%; color:#fff }
UploadImg('btn','ul_pics','/test/pictest',4);function UploadImg (clickEventId,EventUlId,ServerUrl,ImgCount){var ulId = "#"+EventUlId;var clickBtn = "#"+clickEventId;var uploader = new plupload.Uploader({ //创建实例的构造方法// runtimes: 'html5,flash,silverlight,html4',//上传插件初始化选用那种方式的优先级顺序browse_button: clickEventId,// 上传按钮url: ServerUrl,//远程上传地址// flash_swf_url: 'plupload/Moxie.swf',//flash文件地址// silverlight_xap_url: 'plupload/Moxie.xap',//silverlight文件地址filters: {max_file_size: '500kb',//最大上传文件大小(格式100b, 10kb, 10mb, 1gb)mime_types: [ //允许文件上传类型{title: "files",extensions: "jpg,png,gif"}]},multi_selection: true,//true:ctrl多文件上传, false 单文件上传init: {FilesAdded: function(up, files) { //文件上传前if ($(ulId).children("li").length > ImgCount) {alert("您上传的图片太多了!");uploader.destroy();} else {var li = '';plupload.each(files,function(file) { //遍历文件li += "<li id='" + file['id'] + "'><div class='progress'><span class='bar'></span><span class='percent'>0%</span></div></li>";});$(ulId).prepend(li);uploader.start();}},UploadProgress: function(up, file) { //上传中,显示进度条$("#" + file.id).find('.bar').css({"width": file.percent + "%"}).find(".percent").text(file.percent + "%");},FileUploaded: function(up, file, info) { //文件上传成功的时候触发var data = JSON.parse(info.response);$("#" + file.id).html("<div class='img'><img src='" +'/uploads/test/'+data.picuris + "'/></div><p>");if($(ulId).children("li").length > ImgCount){// $(clickBtn).hide();$(clickBtn).remove();uploader.destroy();}},Error: function(up, err) { //上传出错的时候触发alert(err.message);}}});uploader.init();}
返回格式:
{"state": 1,"data": [{"id": 1,"companyid": 26,"taskname": "每天签到","taskdesc": "要签到啊啊啊 啊啊啊","taskscore": 2,"tasktarget": ",0,26,","isneedpic": 0,"totaltimes": 1,"taskdatetype": 2,"startdate": "2016-03-06 16:55:52","enddate": "2016-03-06 16:55:52","fromtaskid": 6,"currtiems": 0,"selected": 1,"createat": "2016-03-06 14:15:00","updateat": "2016-03-06 14:15:00"}]}
返回格式:
{"state": 1,"data": {"finishtime": [{"id": 5,"taskname": "打扫卫生","taskscore": 2,"finishtime": "2016-03-07 13:19:30","needpic": "1456986260.jpg"},{"id": 3,"taskname": "再来测试","taskscore": 1,"finishtime": "2016-03-07 13:15:07","needpic": "0"}],"score": [{"id": 5,"comid": 26,"userid": 22,"comtaskid": 5,"taskname": "打扫卫生","taskdesc": null,"taskscore": 2,"taskstate": 2,"remark": null,"needpic": "1456986260.jpg","finishtime": "2016-03-07 13:19:30","createat": "2016-03-07 13:19:30","updateat": "2016-03-07 13:19:30"},{"id": 3,"comid": 26,"userid": 22,"comtaskid": 2,"taskname": "再来测试","taskdesc": null,"taskscore": 1,"taskstate": 0,"remark": null,"needpic": "0","finishtime": "2016-03-07 13:15:07","createat": "2016-03-06 16:55:52","updateat": "2016-03-06 16:55:52"}]}}
返回格式
{"state": 1,"data": {"creatat": [{"taskstate": 0,"taskname": "TestTest","taskscore": 1,"createat": "2016-03-06 16:55:52"}],"score": [{"taskstate": 0,"taskname": "TestTest","taskscore": 1,"createat": "2016-03-06 16:55:52"}]}}
-失败:无数据
{"state":0,"errorcode":1}
返回格式
{"state": 1,"data": {"finishtime": [{"taskname": "打扫卫生","taskscore": 2,"finishtime": "2016-03-07 13:19:30","needpic": "1456986260.jpg"}],"score": [{"taskname": "打扫卫生","taskscore": 2,"finishtime": "2016-03-07 13:19:30","needpic": "1456986260.jpg"}]}}
返回格式
{"state": 1,"data": {"finishtime": [{"taskname": "擦玻璃","taskscore": 1,"finishtime": "2016-03-07 15:44:05","needpic": "0"}],"score": [{"taskname": "擦玻璃","taskscore": 1,"finishtime": "2016-03-07 15:44:05","needpic": "0"}]}}
返回格式:
{"state": 1,"data": [{"companynum": "1456841641","username": "小朱","phonenum": "13140999028","email": null,"jobinfo": "运营猪","headpicuri": "1456843474.jpg"}]}
返回格式
{"state": 1,"data": "插入成功!"}
-失败
{"state": 0,"errorcode": 1}提示信息:表单不能为空
{"state": 0,"errorcode": 2}提交失败请重新提交:数据库插入失败;
返回格式
{"state": 1,"data": "插入成功!"}
-失败
{"state": 0,"errorcode": 1}提示信息:表单不能为空
{"state": 0,"errorcode": 2}提交失败请重新提交:数据库插入失败;
返回格式
{"state": 1,"data": [{"id": 8,"comid": 0,"userid": 22,"comtaskid": 2,"taskname": "打扫教室","taskdesc": null,"taskscore": 1,"taskstate": 1,"remark": "打扫干净","needpic": "0","finishtime": "2016-03-16 00:00:00","createat": null,"updateat": null},{"id": 5,"comid": 26,"userid": 22,"comtaskid": 5,"taskname": "打扫卫生","taskdesc": null,"taskscore": 2,"taskstate": 2,"remark": null,"needpic": "1456986260.jpg","finishtime": "2016-03-07 13:19:30","createat": "2016-03-07 13:19:30","updateat": "2016-03-07 13:19:30"}]}
-失败
{"state":0,"errorcode":1}提交内容不能为空
{"state":0,"errorcode":2}没有搜索到符合条件的任务