tPMobileBizForm.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //通用弹出式文件上传
  2. function commonUpload(callback){
  3. $.dialog({
  4. content: "url:systemController.do?commonUpload",
  5. lock : true,
  6. title:"文件上传",
  7. zIndex:2100,
  8. width:700,
  9. height: 200,
  10. parent:windowapi,
  11. cache:false,
  12. ok: function(){
  13. var iframe = this.iframe.contentWindow;
  14. iframe.uploadCallback(callback);
  15. return true;
  16. },
  17. cancelVal: '关闭',
  18. cancel: function(){
  19. }
  20. });
  21. }
  22. function browseImages(inputId, Img) {// 图片管理器,可多个上传共用
  23. var finder = new CKFinder();
  24. finder.selectActionFunction = function(fileUrl, data) {//设置文件被选中时的函数
  25. $("#" + Img).attr("src", fileUrl);
  26. $("#" + inputId).attr("value", fileUrl);
  27. };
  28. finder.resourceType = 'Images';// 指定ckfinder只为图片进行管理
  29. finder.selectActionData = inputId; //接收地址的input ID
  30. finder.removePlugins = 'help';// 移除帮助(只有英文)
  31. finder.defaultLanguage = 'zh-cn';
  32. finder.popup();
  33. }
  34. function browseFiles(inputId, file) {// 文件管理器,可多个上传共用
  35. var finder = new CKFinder();
  36. finder.selectActionFunction = function(fileUrl, data) {//设置文件被选中时的函数
  37. $("#" + file).attr("href", fileUrl);
  38. $("#" + inputId).attr("value", fileUrl);
  39. decode(fileUrl, file);
  40. };
  41. finder.resourceType = 'Files';// 指定ckfinder只为文件进行管理
  42. finder.selectActionData = inputId; //接收地址的input ID
  43. finder.removePlugins = 'help';// 移除帮助(只有英文)
  44. finder.defaultLanguage = 'zh-cn';
  45. finder.popup();
  46. }
  47. function decode(value, id) {//value传入值,id接受值
  48. var last = value.lastIndexOf("/");
  49. var filename = value.substring(last + 1, value.length);
  50. $("#" + id).text(decodeURIComponent(filename));
  51. }