{"id":246,"title":"\u4e03\u725bjs\u4e0a\u4f20","good":0,"bad":0,"hit":2054,"created_at":"2016-11-02 10:48:51","content":"

<?php!defined('IN_KC') && exit('Access Denied');?><!DOCTYPE html><html lang="en">    <head>    <meta charset="UTF-8">    <title><\/title>    <link href="..\/..\/static\/app3\/css\/main.css" type="text\/css" rel="stylesheet">    <script language="javascript" src="..\/..\/static\/app3\/js\/common\/api_config.js"\/><\/script>    <script language="javascript" src="http:\/\/jssdk.demo.qiniu.io\/bower_components\/jquery\/jquery.min.js"\/><\/script>    <script language="javascript" src="http:\/\/jssdk.demo.qiniu.io\/bower_components\/plupload\/js\/moxie.js"><\/script>    <script language="javascript" src="http:\/\/jssdk.demo.qiniu.io\/bower_components\/plupload\/js\/plupload.dev.js"><\/script>    <script language="javascript" src="http:\/\/jssdk.demo.qiniu.io\/src\/qiniu.js"><\/script>    <\/script>    <script language="javascript">    \/\/\u53d6\u6587\u4ef6\u6269\u5c55\u540d    var getFileExtension = function(filename) {                var tempArr = filename.split(".");                var ext;                if (tempArr.length === 1 || (tempArr[0] === "" && tempArr.length === 2)) {                    ext = "";                } else {                    ext = tempArr.pop().toLowerCase(); \/\/get the extension and make it lower-case                }                return ext;            };    $(function(){        \/\/\u70b9\u51fb\u4e0a\u4f20    $("#activity_add").click(function(){        $("#pickfiles").trigger("click");    });    \/\/\u5173\u95ed\u4e0a\u4f20    $("#up_close").click(function(){        $("#up_pic").hide();        $(".new-item").css("display","block");        $("#pic_url").val('');    });    \/\/\u8f93\u5165\u6846\u6587\u5b57\u5904\u7406    $("#url").click(function(){        if($(this).val()=='\u8bf7\u8f93\u5165\u6d3b\u52a8\u94fe\u63a5'){            $(this).val('');        }    });    \/\/\u8fd4\u56de    $("#reset").click(function(){        $("#up_pic").hide();        $("#pic_url").val('');\/\/\u56fe\u7247-database        $(".new-item").css("display","block");        $("#url").val('');    });    \/\/\u63d0\u4ea4    $("#submit").click(function(){        var pic_url=$("#pic_url").val();\/\/\u56fe\u7247\u5730\u5740        var url=$("#url").val();        if(url=='\u8bf7\u8f93\u5165\u6d3b\u52a8\u94fe\u63a5'){            url='';        }        \/*if(!pic_url){            $("#tishi").css("display","block");            $(".alert-content").html('\u8bf7\u4e0a\u4f20\u56fe\u7247');            return false;        }        if(!url){            $("#tishi").css("display","block");            $(".alert-content").html('\u8bf7\u586b\u5199\u94fe\u63a5\u5730\u5740');            return false;        }*\/        $.ajax({            type:"post",            data:{pic:pic_url,url:url},            url:domainUrl + "api.php?cmd=app3admin.activity",            dataType:"json",            success: function(r){                if(r.ret==200){                    $("#tishi").css("display","block");                    $(".alert-content").html('\u4fee\u6539\u6210\u529f');                    setInterval(                    function(){                        window.location.reload();                    }                                        ,2000);                }else{                    $("#tishi").css("display","block");                    $(".alert-content").html('\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5');                }            }        });    });    \/\/\u5173\u95ed\u63d0\u793a    $("#tishi_close").click(function(){        $("#tishi").css("display","none");    });    \/\/\u4ee5\u4e0b\u5fc5\u987b\u5199\u5728$(function(){\u91cc\u9762\uff0c\u5426\u5219\u70b9\u51fb\u4e0a\u4f20\u4f1a\u6ca1\u6709\u53cd\u5e94        var uploader = Qiniu.uploader({            runtimes: 'html5,flash,html4',      \/\/ \u4e0a\u4f20\u6a21\u5f0f\uff0c\u4f9d\u6b21\u9000\u5316            browse_button: 'pickfiles',         \/\/ \u4e0a\u4f20\u9009\u62e9\u7684\u70b9\u9009\u6309\u94ae\uff0c\u5fc5\u9700            \/\/ \u5728\u521d\u59cb\u5316\u65f6\uff0cuptoken\uff0cuptoken_url\uff0cuptoken_func\u4e09\u4e2a\u53c2\u6570\u4e2d\u5fc5\u987b\u6709\u4e00\u4e2a\u88ab\u8bbe\u7f6e            \/\/ \u5207\u5982\u679c\u63d0\u4f9b\u4e86\u591a\u4e2a\uff0c\u5176\u4f18\u5148\u7ea7\u4e3auptoken > uptoken_url > uptoken_func            \/\/ \u5176\u4e2duptoken\u662f\u76f4\u63a5\u63d0\u4f9b\u4e0a\u4f20\u51ed\u8bc1\uff0cuptoken_url\u662f\u63d0\u4f9b\u4e86\u83b7\u53d6\u4e0a\u4f20\u51ed\u8bc1\u7684\u5730\u5740\uff0c\u5982\u679c\u9700\u8981\u5b9a\u5236\u83b7\u53d6uptoken\u7684\u8fc7\u7a0b\u5219\u53ef\u4ee5\u8bbe\u7f6euptoken_func             uptoken : '\u8fd9\u91cc\u586b\u81ea\u5df1\u7684token', \/\/ uptoken\u662f\u4e0a\u4f20\u51ed\u8bc1\uff0c\u7531\u5176\u4ed6\u7a0b\u5e8f\u751f\u6210            \/\/uptoken_url: domainUrl+'api.php?cmd=app3admin.getQiniuToken',         \/\/ Ajax\u8bf7\u6c42uptoken\u7684Url\uff0c\u5f3a\u70c8\u5efa\u8bae\u8bbe\u7f6e\uff08\u670d\u52a1\u7aef\u63d0\u4f9b\uff09            \/\/ uptoken_func: function(file){    \/\/ \u5728\u9700\u8981\u83b7\u53d6uptoken\u65f6\uff0c\u8be5\u65b9\u6cd5\u4f1a\u88ab\u8c03\u7528            \/\/    \/\/ do something            \/\/    return uptoken;            \/\/ },            get_new_uptoken: false,             \/\/ \u8bbe\u7f6e\u4e0a\u4f20\u6587\u4ef6\u7684\u65f6\u5019\u662f\u5426\u6bcf\u6b21\u90fd\u91cd\u65b0\u83b7\u53d6\u65b0\u7684uptoken            \/\/ downtoken_url: '\/downtoken',            \/\/ Ajax\u8bf7\u6c42downToken\u7684Url\uff0c\u79c1\u6709\u7a7a\u95f4\u65f6\u4f7f\u7528\uff0cJS-SDK\u5c06\u5411\u8be5\u5730\u5740POST\u6587\u4ef6\u7684key\u548cdomain\uff0c\u670d\u52a1\u7aef\u8fd4\u56de\u7684JSON\u5fc5\u987b\u5305\u542burl\u5b57\u6bb5\uff0curl\u503c\u4e3a\u8be5\u6587\u4ef6\u7684\u4e0b\u8f7d\u5730\u5740            \/\/ unique_names: true,              \/\/ \u9ed8\u8ba4false\uff0ckey\u4e3a\u6587\u4ef6\u540d\u3002\u82e5\u5f00\u542f\u8be5\u9009\u9879\uff0cJS-SDK\u4f1a\u4e3a\u6bcf\u4e2a\u6587\u4ef6\u81ea\u52a8\u751f\u6210key\uff08\u6587\u4ef6\u540d\uff09            \/\/ save_key: true,                  \/\/ \u9ed8\u8ba4false\u3002\u82e5\u5728\u670d\u52a1\u7aef\u751f\u6210uptoken\u7684\u4e0a\u4f20\u7b56\u7565\u4e2d\u6307\u5b9a\u4e86sava_key\uff0c\u5219\u5f00\u542f\uff0cSDK\u5728\u524d\u7aef\u5c06\u4e0d\u5bf9key\u8fdb\u884c\u4efb\u4f55\u5904\u7406            domain: 'http:\/\/ipadimage.ismond.com\/',     \/\/ bucket\u57df\u540d\uff0c\u4e0b\u8f7d\u8d44\u6e90\u65f6\u7528\u5230\uff0c\u5fc5\u9700            container: 'up_box',             \/\/ \u4e0a\u4f20\u533a\u57dfDOM ID\uff0c\u9ed8\u8ba4\u662fbrowser_button\u7684\u7236\u5143\u7d20            max_file_size: '100mb',             \/\/ \u6700\u5927\u6587\u4ef6\u4f53\u79ef\u9650\u5236            flash_swf_url: 'path\/of\/plupload\/Moxie.swf',  \/\/\u5f15\u5165flash\uff0c\u76f8\u5bf9\u8def\u5f84            max_retries: 0,                     \/\/ \u4e0a\u4f20\u5931\u8d25\u6700\u5927\u91cd\u8bd5\u6b21\u6570            dragdrop: true,                     \/\/ \u5f00\u542f\u53ef\u62d6\u66f3\u4e0a\u4f20            drop_element: 'up_box',          \/\/ \u62d6\u66f3\u4e0a\u4f20\u533a\u57df\u5143\u7d20\u7684ID\uff0c\u62d6\u66f3\u6587\u4ef6\u6216\u6587\u4ef6\u5939\u540e\u53ef\u89e6\u53d1\u4e0a\u4f20            chunk_size: '4mb',                  \/\/ \u5206\u5757\u4e0a\u4f20\u65f6\uff0c\u6bcf\u5757\u7684\u4f53\u79ef            auto_start: true,                   \/\/ \u9009\u62e9\u6587\u4ef6\u540e\u81ea\u52a8\u4e0a\u4f20\uff0c\u82e5\u5173\u95ed\u9700\u8981\u81ea\u5df1\u7ed1\u5b9a\u4e8b\u4ef6\u89e6\u53d1\u4e0a\u4f20            \/\/x_vars : {            \/\/    \u67e5\u770b\u81ea\u5b9a\u4e49\u53d8\u91cf            \/\/    'time' : function(up,file) {            \/\/        var time = (new Date()).getTime();                      \/\/ do something with 'time'            \/\/        return time;            \/\/    },            \/\/    'size' : function(up,file) {            \/\/        var size = file.size;                      \/\/ do something with 'size'            \/\/        return size;            \/\/    }            \/\/},            init: {                'FilesAdded': function(up, files) {                    plupload.each(files, function(file) {                        \/\/ \u6587\u4ef6\u6dfb\u52a0\u8fdb\u961f\u5217\u540e\uff0c\u5904\u7406\u76f8\u5173\u7684\u4e8b\u60c5                    });                },                'BeforeUpload': function(up, file) {                       \/\/ \u6bcf\u4e2a\u6587\u4ef6\u4e0a\u4f20\u524d\uff0c\u5904\u7406\u76f8\u5173\u7684\u4e8b\u60c5                       \/\/alert(file.name);\u6587\u4ef6\u7684\u540d\u79f0                },                'UploadProgress': function(up, file) {                       \/\/ \u6bcf\u4e2a\u6587\u4ef6\u4e0a\u4f20\u65f6\uff0c\u5904\u7406\u76f8\u5173\u7684\u4e8b\u60c5                       $(".layer-box").show();\/\/\u663e\u793aloading\u4e2d                },                'FileUploaded': function(up, file, info) {                       \/\/ \u6bcf\u4e2a\u6587\u4ef6\u4e0a\u4f20\u6210\u529f\u540e\uff0c\u5904\u7406\u76f8\u5173\u7684\u4e8b\u60c5                       \/\/ \u5176\u4e2dinfo\u662f\u6587\u4ef6\u4e0a\u4f20\u6210\u529f\u540e\uff0c\u670d\u52a1\u7aef\u8fd4\u56de\u7684json\uff0c\u5f62\u5f0f\u5982\uff1a                       \/\/ {                       \/\/    "hash": "Fh8xVqod2MQ1mocfI4S4KpRL6D98",                       \/\/    "key": "gogopher.jpg"                       \/\/  }                       \/\/ \u67e5\u770b\u7b80\u5355\u53cd\u9988                       var domain = up.getOption('domain');                       var res = jQuery.parseJSON(info);\/\/\u524d\u9762\u7684jQuery\u4e0d\u80fd\u5c11\uff0c\u5426\u5219\u62a5\u9519                       var sourceLink = domain + res.key; \/\/\u83b7\u53d6\u4e0a\u4f20\u6210\u529f\u540e\u7684\u6587\u4ef6\u7684Url                       $(".layer-box").hide();\/\/\u9690\u85cfloading\u4e2d                       $("#up_pic").show();\/\/\u663e\u793a\u56fe\u7247                       $("#up_close").show();\/\/\u663e\u793a\u5173\u95ed\u6309\u94ae                       var img="<img src='"+sourceLink+"' width=240 height=200 border='0' \/>";                       $("#up_pic_content").html(img);                       $(".new-item").hide();\/\/\u9690\u85cf\u4e0a\u4f20                       $("#pic_url").val(sourceLink);\/\/\u4fdd\u5b58\u5907\u7528\uff0c\u5b58\u5230\u6570\u636e\u5e93\u4e2d                },                'Error': function(up, err, errTip) {                       \/\/\u4e0a\u4f20\u51fa\u9519\u65f6\uff0c\u5904\u7406\u76f8\u5173\u7684\u4e8b\u60c5                       alert(errTip);\/\/\u5f39\u51fa\u9519\u8bef\u63d0\u793a                },                'UploadComplete': function() {                       \/\/\u961f\u5217\u6587\u4ef6\u5904\u7406\u5b8c\u6bd5\u540e\uff0c\u5904\u7406\u76f8\u5173\u7684\u4e8b\u60c5                },                'Key': function(up, file) {\/\/\u5bf9\u6587\u4ef6\u540d\u91cd\u547d\u540d\uff0c\u4e0d\u7136\u5982\u679c\u6587\u4ef6\u5b58\u5728\u4e03\u725b\u4f1a\u63d0\u793a\u5931\u8d25\u4fe1\u606f:file exist                    \/\/ \u82e5\u60f3\u5728\u524d\u7aef\u5bf9\u6bcf\u4e2a\u6587\u4ef6\u7684key\u8fdb\u884c\u4e2a\u6027\u5316\u5904\u7406\uff0c\u53ef\u4ee5\u914d\u7f6e\u8be5\u51fd\u6570                    \/\/ \u8be5\u914d\u7f6e\u5fc5\u987b\u8981\u5728unique_names: false\uff0csave_key: false\u65f6\u624d\u751f\u6548                    var ext= getFileExtension(file.name);                            var key = new Date().getTime() + '.' + ext;                    \/\/ do something with key here                    return key                }            }        });        });    <\/script>    <\/head>    <body><div class="page-box page-profession"><div class="page-header layout-full">      <div class="user-panel">    <div class="layout"> <span class="account-info">\u5f53\u524d\u7528\u6237\uff1a<?php echo $_G['adm_name'];?><\/span> <a href="<?php echo 'http:\/\/'.$_SERVER['HTTP_HOST'].'\/admin\/logout';?>" class="quit">\u9000\u51fa<\/a> <\/div>  <\/div>      <div class="sys-info layout">    <div class="actions fr">           <!--<a href="help.html">\u4f7f\u7528\u5e2e\u52a9<\/a>-->         <\/div>    <a class="logo fl" href="<?php echo 'http:\/\/'.$_SERVER['HTTP_HOST'].'\/admin\/app3';?>"><\/a>    <div class="sys-name"><\/div>  <\/div>    <\/div><div class="page-main-box layout clearfix">      <div class="page-main help-page">    <div class="crumbs"><a class="back-btn fl" id="back-btn" href="javascript:history.go(-1);">\u8fd4\u56de<\/a>\u6d3b\u52a8\u63a8\u9001<\/div>    <div class="content-view">                     <!-- \u5185\u5bb9 -->          <div class="help-content" style="height:600px;overflow: auto;">          <!--\u4e0a\u4f20\u6210\u529f\u540e\u663e\u793a\u56fe\u7247-->          <div id="up_pic" style="border:1px dashed #eee;width:240px;height:200px;margin:0 auto;position:relative;<?php if(!$data['pic']){echo 'display:none;';}else{echo 'display:block';}?>">              <div style="position:absolute;right:0;top:0;background:url('\/static\/app3\/images\/close.png') no-repeat scroll center center;width:16px;height:16px;cursor:pointer;" id="up_close"><\/div>            <div id="up_pic_content"><?php if($data['pic']){echo "<img src=".$data['pic']." border=0 width=240 height=200 \/>";}?><\/div>          <\/div>        <div class="new-item" style="<?php if($data['pic']){echo 'display:none;';}else{echo 'display:block';}?>">              <div class="box"> <i class="icon icon-plus"><\/i>            <button type="button" class="change-img" id="activity_add">\u9009\u62e9\u56fe\u7247\u6dfb\u52a0<\/button>          <\/div>            <\/div>        <div style="text-align:center;margin-top:20px;" id="up_box">              <input name="url" type="text" id="url" style="border:1px solid #ccc;color:#999;padding:3px;border-radius:3px;" value="<?php if($data['url']){echo $data['url'];}else{echo '\u8bf7\u8f93\u5165\u6d3b\u52a8\u94fe\u63a5';}?>" size="33" maxlength="255">              <input type="file" name="pickfiles" id="pickfiles" style="display:none;">              <br>              <div style="margin-top:20px;">              <input type="hidden" value="<?php if($data['pic']){echo $data['pic'];}?>" id="pic_url" name="pic_url"\/>            <input id="reset" style="background:#ccc;color:#fff;border-radius:5px;padding:6px 30px;margin-right:20px;" name="\u91cd\u7f6e" type="reset" value="\u91cd\u7f6e"\/>            <input id="submit" style="background:#f98674;color:#fff;border-radius:5px;padding:6px 30px;" type="submit" name="button" id="button" value="\u63d0\u4ea4">          <\/div>            <\/div>      <\/div>        <\/div>  <\/div>    <\/div><!--loading--><div class="layer-box" style="display: none;">      <div class="layer-masker"><\/div>      <div class="loading-box"><i class="loading-icon"><\/i><span class="text">\u4e0a\u4f20\u4e2d...<\/span><\/div><\/div><!--\u5f39\u51fa\u63d0\u793a--><div class="alert-layer" style="z-index: 999999999;display:none;" id="tishi">    <div class="alert-box">        <div class="alert-title">\u63d0\u793a<\/div>        <div class="alert-content"><\/div>        <div class="alert-actions">            <button type="button" class="alert-button btn-primary" id="tishi_close">\u786e\u8ba4<\/button>        <\/div>    <\/div><\/div><\/body><\/html><\/p>"}