zoukankan      html  css  js  c++  java
  • It运维项目整理

    String.prototype.toWeek=function(){
    var date = new Date(this);
    var week = "";
    switch (date.getDay()) {
    case 0:week = "周日";break;
    case 1:week = "周一";break;
    case 2:week = "周二";break;
    case 3:week = "周三";break;
    case 4:week = "周四";break;
    case 5:week = "周五";break;
    case 6:week = "周六";break;
    }
    return week;
    };


    上传图片用的是 webuploader.js
    function webUpload(obj,fn) {
    var width=100;
    var height=85;
    var uploader = WebUploader.create({
    swf: './Uploader.swf',
    server: "/itsm/a/file/upload",
    pick: {id:obj.pickId},
    });
    uploader.on('fileQueued', function (file) {
    uploader.md5File(file)
    .progress(function (percentage) {
    console.log('Percentage:', percentage);
    })
    .then(function (val) {
    uploader.options.formData.fileMd5 = val;
    uploader.options.formData.fileName = file.name;
    uploader.options.formData.__sid = getQueryParam('sessionid');
    uploader.options.formData.uploadType="all";
    uploader.options.formData.bizType=obj.bizType;
    uploader.options.formData.bizKey=obj.bizKey;
    console.log(" uploader.options.formData:", uploader.options.formData);
    uploader.upload()
    });
    uploader.makeThumb(file, function (error, src) {
    if (error) {
    console.log("不能预览")
    return;
    }
    var img=new Image();
    img.width=width;
    img.height=height;
    img.src=src
    $(obj.pickId+" .webuploader-pick").html(img);
    }, width, height);
    });
    uploader.on('uploadSuccess', function (file,response ) {
    if(response.result=="true"){
    $(obj.pickId+" .webuploader-pick").addClass("webuploader-pick-success")
    }else{
    $(obj.pickId+" .webuploader-pick").addClass("webuploader-pick-error")
    }
    console.log("上传成功返回值:",JSON.stringify(response))
    fn.call(null,response)
    });
    uploader.on('uploadError', function (file) {
    $(obj.pickId+" .webuploader-pick").addClass("webuploader-pick-error")
    console.log("上传失败")
    });
    }

    function webUploadVoice(obj,fn) {
    var width=100;
    var height=85;
    var uploader = WebUploader.create({
    swf: './js/Uploader.swf',
    server: "/itsm/a/file/upload",
    pick: {id:obj.pickId},
    accept: {
    mimeTypes: 'audio/*'
    }
    });
    setTimeout(function(){
    $(".webuploader-element-invisible").attr("capture","microphone")
    $(".webuploader-element-invisible").removeAttr("multiple")
    })
    uploader.on('fileQueued', function (file) {
    uploader.md5File(file)
    .progress(function (percentage) {
    console.log('Percentage:', percentage);
    })
    .then(function (val) {
    uploader.options.formData.fileMd5 = val;
    uploader.options.formData.fileName = file.name;
    uploader.options.formData.__sid = getQueryParam('sessionid');
    uploader.options.formData.uploadType="all";
    uploader.options.formData.bizType=obj.bizType;
    uploader.options.formData.bizKey=obj.bizKey;
    console.log(" uploader.options.formData:", uploader.options.formData);
    uploader.upload()
    });
    uploader.makeThumb(file, function (error, src) {
    if (error) {
    console.log("不能预览")
    return;
    }
    var img=new Image();
    img.width=width;
    img.height=height;
    img.src=src
    $(obj.pickId+" .webuploader-pick").html(img);
    }, width, height);
    });
    uploader.on('uploadSuccess', function (file,response ) {
    if(response.result=="true"){
    $(obj.pickId+" .webuploader-pick").addClass("webuploader-pick-success")
    }else{
    $(obj.pickId+" .webuploader-pick").addClass("webuploader-pick-error")
    }

    console.log("上传成功返回值:",JSON.stringify(response))
    fn.call(null,response)
    });
    uploader.on('uploadError', function (file) {
    $(obj.pickId+" .webuploader-pick").addClass("webuploader-pick-error")
    console.log("上传失败")
    });
    }



    动态插入js
    document.write(" <script language="javascript" src="js/vconsole.min.js " > </script>");
    document.write(" <script>var aa=new VConsole()</script>");
  • 相关阅读:
    笨蛋蛋都能学会的开机grub消除(双系统开机总是黑屏肿么办--多半是欠reset)
    Find a way HDU
    非常可乐 HDU
    Oil Deposits HDU
    迷宫问题 POJ
    Fire!
    Fire Game FZU
    Pots POJ
    Prime Path POJ
    Jquery鼠标悬停按钮图标动态变化效果
  • 原文地址:https://www.cnblogs.com/liuhao-web/p/10007621.html
Copyright © 2011-2022 走看看