12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535 |
- {include file="public/layout" /}
-
- {eq name="$editor.editor_select" value="1"}
- {load href="__PUBLIC__/plugins/Ueditor/ueditor.config.js" /}
- {load href="__PUBLIC__/plugins/Ueditor/ueditor.all.min.js" /}
- {load href="__PUBLIC__/plugins/Ueditor/lang/zh-cn/zh-cn.js" /}
- {else/}
- {load href="__PUBLIC__/plugins/ckeditor/ckeditor.js" /}
- {/eq}
-
- <body class="bodysy-w">
- <div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
- <div id="append_parent"></div>
- <div id="ajaxwaitid"></div>
- <div id="geduan_div" class="h10"></div>
- <div id="page_div" class="page min-hg-c mb-20" style="min-width:auto;box-shadow:none;">
- <div class="fixed-bar">
- <div class="item-title">
- {include file="public/callback_page_1" /}<!-- 返回箭头 -->
- <a class="back_sz" href="javascript:void(0);" data-href="{:url('Media/help')}" onclick="openHelpframe(this, '设置与帮助', '500px', '100%', 'r');" title="设置与帮助"><i class="iconfont e-shezhi-tongyong"></i></a>
- <div class="subject">
- <h3>发布文档</h3>
- <h5></h5>
- </div>
- <ul class="tab-base nc-row">
- <li><a href="javascript:void(0);" data-index='1' class="tab current"><span>基础内容</span></a></li>
- <li><a href="javascript:void(0);" data-index='2' class="tab"><span>SEO优化</span></a></li>
- <li><a href="javascript:void(0);" data-index='3' class="tab"><span>更多设置</span></a></li>
- <!-- #weapp_demontrate_li# -->
- <!-- #weapp_li# -->
- </ul>
- </div>
- </div>
- <form class="form-horizontal" id="post_form" action="{:url('Media/add')}" method="post">
- <!-- 常规信息 -->
- <div class="ncap-form-default tab_div_1">
- <dl class="row">
- <dt class="tit">
- <label for="title"><em>*</em>文档标题</label>
- </dt>
- <dd class="opt">
- <input type="text" name="title" value="" id="title" class="input-txt" maxlength="200" {eq name="$channelRow.is_repeat_title" value="0"} oninput="check_title_repeat(this,0);" {/eq}>
-
- 副标题:<input type="text" name="subtitle" value="" id="subtitle" class="w200">
- <span class="err"></span>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="title"><em>*</em>栏目分类</label>
- </dt>
- <dd class="opt">
- <select name="typeid" id="typeid">
- <option value="0">请选择栏目…</option>
- {$arctype_html}
- </select>
- <span class="err"></span>
- <p class="notic">谨慎切换,自定义字段的内容会随着栏目切换而清空,在保存之前不受影响!</p>
- </dd>
- </dl>
- {notempty name='$global.web_stypeid_open'}
- <dl class="row">
- <dt class="tit">
- <label for="stypeid">副栏目分类</label>
- </dt>
- <dd class="opt">
- <input type="hidden" name="stypeid" id="stypeid" value="" class="input-txt" onkeyup="this.value=this.value.replace(/[^\d\,]/g,'');" onpaste="this.value=this.value.replace(/[^\d\,]/g,'');">
- <a href="javascript:void(0);" data-channel="{$channeltype}" onclick="select_stypeid(this);" class="ncap-btn ncap-btn-green">选择副栏目</a>
- <span class="err"></span>
- <p class="notic">支持同频道模型的栏目</p>
- <div id="stypeid_txt" class="pt5"></div>
- </dd>
- </dl>
- {/notempty}
- <dl class="row">
- <dt class="tit">
- <label>文档属性</label>
- </dt>
- <dd class="opt">
- {volist name="archives_flags" id="vo"}
- <label><input type="checkbox" name="{$vo.flag_fieldname}" value="1">{$vo.flag_name}<!-- [{$vo.flag_attr}] --></label>
- {/volist}
- <span class="err"></span>
- <p class="notic">如需管理,请点击右上角设置与帮助按钮</p>
- </dd>
- </dl>
- <dl class="row none dl_jump">
- <dt class="tit">
- <label>跳转网址</label>
- </dt>
- <dd class="opt">
- <input type="text" value="" name="jumplinks" id="jumplinks" class="input-txt" placeholder="http://">
- <span class="err"></span>
- <p class="notic">请输入完整的URL网址(包含http或https),设置后访问该条信息将直接跳转到设置的网址</p>
- </dd>
- </dl>
- <dl class="row" style="z-index:2;">
- <dt class="tit">
- <label>文档标签</label>
- </dt>
- <dd class="opt">
- <input type="text" value="" name="tags" id="tags" class="input-txt" placeholder="多个标签之间以逗号隔开" autocomplete="off" oninput="get_common_tagindex_input(this);" onfocus="$('#often_tags').hide();" onkeyup="this.value=this.value.replace(/[\,]/g,',');" onpaste="this.value=this.value.replace(/[\,]/g,',')">
- <a href="javascript:void(0);" onclick="get_common_tagindex(this);">显示常用标签</a> <img id="tag_loading" src="__STATIC__/common/images/loading.gif" style="display: none;" />
- <div class="often_tags" id="often_tags" data-opt="add" style="display: none;"></div>
- <div class="often_tags" id="often_tags_input" style="display: none;"></div>
- <input type="hidden" id="tags_click_count">
- </dd>
- </dl>
- <dl class="row {empty name="$global.web_citysite_open"} none {/empty} ">
- <dt class="tit">
- <label for="title">所属区域</label>
- </dt>
- <dd class="opt">
- <select name="province_id" id="province_id" onchange="set_city_list(0);">
- <option value="0">全国</option>
- {volist name=':get_site_province_list()' id='vo'}
- <option value="{$vo.id}" {eq name="$Request.param.province_id" value="$vo.id" } selected="true" {/eq}>{$vo.name}</option>
- {/volist}
- </select>
- <select name="city_id" id="city_id" class="none ml5" onchange="set_area_list(0);">
- <option value="">--请选择--</option>
- </select>
- <select name="area_id" id="area_id" class="none ml5">
- <option value="">--请选择--</option>
- </select>
- <span class="err"></span>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label>封面图片</label>
- </dt>
- <dd class="opt">
- <div class="input-file-show div_litpic_local">
- <span class="show">
- <a id="img_a" target="_blank" class="nyroModal" rel="gal" href="javascript:void(0);">
- <i id="img_i" class="fa fa-picture-o" onmouseover="" onmouseout="layer.close(layer_tips);"></i>
- </a>
- </span>
- <span class="type-file-box">
- <input type="text" id="litpic_local" name="litpic_local" value="" class="type-file-text" autocomplete="off">
- <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
- <input class="type-file-file" onClick="GetUploadify(1,'','allimg','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo"
- title="点击前方预览图可查看大图,点击按钮选择文件并提交表单后上传生效">
- </span>
- </div>
- <input type="text" id="litpic_remote" name="litpic_remote" value="" placeholder="http://" class="input-txt" onKeyup="keyupRemote(this, 'litpic');" style="display: none;">
-
- <label><input type="checkbox" name="is_remote" id="is_remote" value="1" onClick="clickRemote(this, 'litpic');">远程图片</label>
- <span class="err"></span>
- <p class="notic">当没有手动上传图片时候,会自动提取正文的第一张图片作为缩略图</p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label>付费限制</label>
- </dt>
- <dd class="opt">
- <label class="curpoin"><input type="radio" name="restric_type" value="0" checked="checked">免费</label>
- <label class="curpoin"><input type="radio" name="restric_type" value="1">付费</label>
- <label class="curpoin"><input type="radio" name="restric_type" value="2">指定会员</label>
- <label class="curpoin"><input type="radio" name="restric_type" value="3">会员付费</label>
- </dd>
- </dl>
- <dl class="row none" id="dl_arc_level_id">
- <dt class="tit">
- <label><em>*</em>会员等级</label>
- </dt>
- <dd class="opt">
- <select name="arc_level_id" id="arc_level_id">
- {volist name="users_level" id="vo"}
- <option value="{$vo.level_id}" level_value="{$vo.level_value}">{$vo.level_name}</option>
- {/volist}
- </select>
- <label id="no_vip_pay_label"><input type="checkbox" name="no_vip_pay" id="no_vip_pay" value="1" onClick="clickNoVipPay(this);">开启非会员付费</label>
- </dd>
- </dl>
- <dl class="row none" id="dl_users_price">
- <dt class="tit">
- <label for="users_price"><em>*</em>购买价格</label>
- </dt>
- <dd class="opt">
- <input type="text" name="users_price" id="users_price" class="input-txt" autocomplete="off" style="width: 100px !important;text-align: right;" onkeyup="this.value=this.value.replace(/[^\d\.]/g,'');" onpaste="this.value=this.value.replace(/[^\d\.]/g,'')"> 元
- <span class="err"></span>
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label>视频上传</label>
- </dt>
- <dd class="opt">
- <a href="javascript:void(0);" onclick="addUrlSys();" class="ncap-btn ncap-btn-green">新增</a>
- <a href="javascript:void(0);" onclick="batch_import_url();" class="ncap-btn ncap-btn-green">批量导入</a>
- <div id="url-box_sys" style="padding: 10px 0">
- <div id="num_upload_box_sys" class='media_del_1586481014_1' data-num='1' style='margin-bottom: 10px;'>
- <span> 链接地址:</span>
- <input type="text" class="input-txt" id="video_url_sys_1" style="width: 300px !important;" >
- <span> 选集名称:</span>
- <input type="text" class="input-txt" id="video_title_sys_1" style="width: 150px !important;">
- {notempty name="$is_open_videogroup"}
- <span> 所在章节:</span>
- <select class="video_group_id_sys" id="video_group_id_sys_1">
- <option value="0">--请选择--</option>
- </select>
- {/notempty}
- <span> 时长(秒):</span>
- <input type="text" class="input-txt" id="video_time_sys_1" style="width: 50px !important;">
- <span> 排序:</span>
- <input type="text" class="input-txt" id="video_sort_order_1" value="100" style="width: 50px !important;">
- <input type="hidden" class="input-txt" id="video_size_sys_1" >
- <input type="hidden" class="input-txt" id="video_mime_sys_1" >
- <input type="hidden" class="input-txt" id="video_name_sys_1" >
- <input type="file" class="input-txt" id="qiniu_click_sys_1" onchange="QiniuUpload(1);" style="display: none;">
- <input type="file" class="input-txt" id="oss_click_sys_1" onchange="OssUpload(1);" style="display: none;">
- <input type="file" class="input-txt" id="cos_click_sys_1" onchange="CosUpload(1);" style="display: none;">
- {if isset($channelRow.data.qiniuyun_open) && $channelRow.data.qiniuyun_open == 1}
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="qiniu_upload_video_sys_1" onclick="click_qiniu_sys(1);">七牛云上传</a>
- {/if}
-
- {if isset($channelRow.data.oss_open) && $channelRow.data.oss_open == 1}
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="oss_upload_video_sys_1" onclick="click_oss_sys(1);">oss上传</a>
- {/if}
-
- {if isset($channelRow.data.cos_open) && $channelRow.data.cos_open == 1}
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="cos_upload_video_sys_1" onclick="click_cos_sys(1);">cos上传</a>
- {/if}
-
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green " id="upload_video_sys_1" data-num='1'>本地上传</a>
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green" onclick="media_del('1');">删除</a>
- <label onselectstart="return false"><input type="checkbox" id="video_gratis_sys_1" value="1">试看</label>
- </div>
- </div>
- <span class="err"></span>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label>附件地址</label>
- </dt>
- <dd class="opt">
- <input type="text" name="addonFieldExt[courseware]" value="" id="addonFieldExt_courseware" class="input-txt">
- <input type="file" id="courseware_file" data-type='local' onchange="upload_file_courseware_1585641738(this)" style="display: none;">
- {eq name="$channelRow.data.qiniuyun_open" value="1"}
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="upload_addonFieldExt_courseware_qiniu" onclick="$('#courseware_file').attr('data-type','qiniu').trigger('click');">七牛云上传</a>
- {/eq}
-
- {eq name="$channelRow.data.oss_open" value="1"}
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="upload_addonFieldExt_courseware_oss" onclick="$('#courseware_file').attr('data-type','oss').trigger('click');">oss上传</a>
- {/eq}
-
- {eq name="$channelRow.data.cos_open" value="1"}
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green" id="upload_addonFieldExt_courseware_cos" onclick="$('#courseware_file').attr('data-type', 'cos').trigger('click');">cos上传</a>
- {/eq}
-
- <a href="javascript:void(0);" class="ncap-btn ncap-btn-green " id="upload_addonFieldExt_courseware_local" onclick="$('#courseware_file').attr('data-type','local').trigger('click');">本地上传</a>
- <span class="err"></span>
- </dd>
- </dl>
-
- {include file="archives/get_field_addonextitem" /}
- </div>
- <!-- 常规信息 -->
- <!-- SEO参数 -->
- <div class="ncap-form-default tab_div_2" style="display:none;">
- <dl class="row">
- <dt class="tit">
- <label for="seo_title">SEO标题</label>
- </dt>
- <dd class="opt">
- <input type="text" value="" name="seo_title" id="seo_title" class="input-txt">
- <span class="err"></span>
- <p class="notic">一般不超过80个字符,为空时系统自动构成,可以到 <a href="{:url('Seo/index', array('inc_type'=>'seo'))}">SEO设置 - SEO基础</a> 中设置构成规则。</p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label>SEO关键词</label>
- </dt>
- <dd class="opt">
- <textarea rows="5" cols="60" id="seo_keywords" name="seo_keywords" style="height:20px;"></textarea>
- <span class="err"></span>
- <p class="notic">一般不超过100个字符,多个关键词请用英文逗号(,)隔开,建议3到5个关键词。</p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label>SEO描述</label>
- </dt>
- <dd class="opt">
- <textarea rows="5" cols="60" id="seo_description" name="seo_description" style="height:54px;" class="keywordsTextarea" onkeyup="monitorInputStr();" onkeypress="monitorInputStr();"></textarea>
- <span class="err"></span>
- <p class="notic">一般不超过100个字符,不填写时系统自动提取正文的前100个字符</p>
- <p class="notic2 none" id="beenWritten">你已输入<span id="beenWrittenStr">0</span>个字符</p>
- </dd>
- </dl>
- </div>
- <!-- SEO参数 -->
- <!-- 其他参数 -->
- <div class="ncap-form-default tab_div_3" style="display:none;">
- <dl class="row">
- <dt class="tit">
- <label for="author">作者</label>
- </dt>
- <dd class="opt">
- <input type="text" value="{$Think.session.admin_info.pen_name|default='小编'}" name="author" id="author" class="input-txt">
- <span class="err"></span>
- <p class="notic">设置作者默认名称(将同步至管理员笔名)</p>
- </dd>
- </dl>
- <dl class="row dl_origin">
- <dt class="tit">
- <label>来源</label>
- </dt>
- <dd class="opt origin-hot">
- <input type="text" value="{$system_originlist_0}" name="origin" id="origin" class="input-txt" onclick="searchOrigin(this);" autocomplete="off">
- <div class="origin-hot-list" style="display: none;" id="search_keywords_list_origin"></div>
- <textarea id="system_originlist_str" style="display: none;">{$system_originlist_str}</textarea>
- <span class="setting" onclick="set_originlist();">设置</span>
- <span class="err"></span>
- <p class="notic">为空时默认“网络”</p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label>点击数</label>
- </dt>
- <dd class="opt">
- <input type="text" value="{$rand_arcclick}" name="click" id="click" class="input-txt">
- <span class="err"></span>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label>阅读权限</label>
- </dt>
- <dd class="opt">
- <select name="arcrank" id="arcrank" {if $admin_info.role_id > 0 && $auth_role_info.check_oneself < 1} disabled="disabled" {/if}>
- {volist name="arcrank_list" id="vo"}
- <option value="{$vo.rank}" {if $admin_info.role_id > 0 && $auth_role_info.check_oneself < 1 && $vo.rank==-1} selected="selected" {/if}>{$vo.name}</option>
- {/volist}
- </select>
- <span class="err"></span>
- </dd>
- </dl>
- <!-- #weapp_UsersGroup_content_users_id={$field.users_id}#--><!-- #weapp_UsersGroup_content# -->
- <dl class="row">
- <dt class="tit">
- <label for="articleForm">发布时间</label>
- </dt>
- <dd class="opt">
- <input type="text" class="input-txt" id="add_time" name="add_time" value="{php}echo date('Y-m-d H:i:s'){/php}" autocomplete="off">
- <span class="add-on input-group-addon">
- <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
- </span>
- <span class="err"></span>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="tempview">文档模板</label>
- </dt>
- <dd class="opt">
- <select name="tempview" id="tempview">
- {volist name='$templateList' id='vo'}
- <option value="{$vo}" {eq name='$vo' value='$tempview'}selected{/eq}>{$vo}</option>
- {/volist}
- </select>
- <input type="hidden" name="type_tempview" value="{$tempview}" />
- <span class="err"></span>
- </dd>
- </dl>
- <dl class="row {notin name='$seo_pseudo' value='2,3'}no-grey{/notin}">
- <dt class="tit">
- <label>自定义文件名</label>
- </dt>
- <dd class="opt">
- <input type="text" {notin name='$seo_pseudo' value='2,3'}readonly="readonly" title="动态模式下不支持自定义文档url"{/notin} value="" name="htmlfilename" id="htmlfilename" autocomplete="off" onkeyup="this.value=this.value.replace(/[^\u4E00-\u9FA5\w\-]/g,'-');" onpaste="this.value=this.value.replace(/[^\u4E00-\u9FA5\w\-]/g,'-');" class="input-txt {notin name='$seo_pseudo' value='2,3'}no-drop{/notin}">.html
- <span class="err"></span>
- <p class="notic">自定义文件名可由字母、数字、下划线(_)、连接符(-)等符号组成,除此之外其他字符将自动转为连接符(-)</p>
- </dd>
- </dl>
- </div>
- <!-- 其他参数 -->
- <!-- #weapp_demontrate_div# -->
- <!-- #weapp_div# -->
- <div class="ncap-form-default">
- <div class="bot2">
- <input type="hidden" name="gourl" value="{$gourl|default=''}">
- <textarea class="none" name="video" id="video" cols="30" rows="10"></textarea>
- <textarea style="display: none;" id="video_group_list"></textarea>
- <input type="hidden" name="editor_addonFieldExt" id="editor_addonFieldExt" value="">
- <a href="JavaScript:void(0);" onclick="check_submit();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
- {include file="public/callback_page_2" /}<!-- 返回按钮 -->
- </div>
- </div>
- </form>
- </div>
- <script type="text/javascript">
- layui.use('upload', function(){
- var upload = layui.upload;
- //执行实例
-
- //创建监听函数
- var xhrOnProgress=function(fun) {
- xhrOnProgress.onprogress = fun; //绑定监听
- //使用闭包实现监听绑
- return function() {
- var xhr = $.ajaxSettings.xhr(); //通过此方法获得XMLHttpRequest对象
- //判断监听函数是否为函数
- if (typeof xhrOnProgress.onprogress !== 'function') {
- return xhr;
- }
- //如果有监听函数并且xhr对象支持绑定时就把监听函数绑定上去
- if (xhrOnProgress.onprogress && xhr.upload) {
- xhr.upload.onprogress = xhrOnProgress.onprogress;
- }
- return xhr;
- }
- };
-
- upload.render({
- elem: "#upload_video_sys_1" //绑定元素
- ,url: "{:url('Ueditor/upVideo', ['savepath'=>'media'])}" //上传接口
- ,accept: 'video' //视频
- ,exts: '{$media_type}'
- ,size: {$upload_max_filesize} //限制文件大小,单位 KB
- ,before: function(obj){
- $("#upload_video_sys_1").text('等待中...');
- }
- ,xhr:xhrOnProgress
- ,progress: function(percent) {
- //上传进度回调 value进度值
- $("#upload_video_sys_1").text('上传中...'+percent+'%');
- }
- ,done: function(res){
- if ("SUCCESS" == res.state) {
- $("#video_url_sys_1").val(res.url);
- $("#video_time_sys_1").val(res.time);
- $("#video_size_sys_1").val(res.size);
- $("#video_mime_sys_1").val(res.mime);
- $("#video_name_sys_1").val(res.title);
- $("#upload_video_sys_1").text('上传成功');
- setTimeout(function(){
- $('#upload_video_sys_1').text('本地上传');
- }, 2000 )
- }else {
- $("#upload_video_sys_1").text('上传失败');
- setTimeout(function(){
- $('#upload_video_sys_1').text('本地上传');
- }, 2000 )
- layer.msg(res.state,{icon: 2});
- }
- }
- ,error: function(){
- // layer.close(load); //关闭loading
- }
- });
- });
- layui.use('laydate', function() {
- var laydate = layui.laydate;
-
- //常规用法
- laydate.render({
- elem: '#add_time'
- ,type: 'datetime'
- });
- })
-
- $(function () {
- try {
- var web_citysite_open = {$global['web_citysite_open']|default=0};
- var site_province_id = {$site_province_id|default=0};
- var site_city_id = {$site_city_id|default=0};
- var site_area_id = {$site_area_id|default=0};
- if (web_citysite_open > 0 && site_province_id > 0) {
- $('select[name=province_id]').val(site_province_id);
- set_city_list(site_city_id);
- set_area_list(site_area_id);
- }
- }catch(e){}
-
- //选项卡切换列表
- $('.tab-base').find('.tab').click(function(){
- $('.tab-base').find('.tab').each(function(){
- $(this).removeClass('current');
- });
- $(this).addClass('current');
- var tab_index = $(this).data('index');
- $(".tab_div_1, .tab_div_2, .tab_div_3").hide();
- $(".tab_div_"+tab_index).show();
- layer.closeAll();
- });
-
- $('input[name=is_jump]').click(function(){
- if ($(this).is(':checked')) {
- $('.dl_jump').show();
- } else {
- $('.dl_jump').hide();
- }
- });
-
- var dftypeid = {$typeid|default='0'};
- $('#typeid').change(function(){
- var current_channel = $(this).find('option:selected').data('current_channel');
- if (0 < $(this).val() && {$channeltype} != current_channel) {
- showErrorMsg('请选择对应模型的栏目!');
- $(this).val(dftypeid);
- } else if ({$channeltype} == current_channel) {
- layer.closeAll();
- }
- GetAddonextitem(1, $(this).val(), {$channeltype}, 0, true);
- });
-
- $(document).click(function(){
- $('#often_tags').hide();
- $('#often_tags_input').hide();
- event.stopPropagation();
- });
-
- $('#often_tags').click(function(){
- $('#often_tags').show();
- event.stopPropagation();
- });
-
- $('input[name=restric_type]').click(function(){
- $('#dl_arc_level_id').hide();
- $('#dl_users_price').hide();
- $('#no_vip_pay_label').hide();
- var restric_type = $(this).val();
- $('#arc_level_id').find('option:eq(0)').attr('selected',true);
- if (-1 < $.inArray(restric_type, ['1','3'])) {
- $('#dl_users_price').show();
- }
- if (-1 < $.inArray(restric_type, ['2','3'])) {
- $('#dl_arc_level_id').show();
- if (2 == restric_type) {
- $('#no_vip_pay_label').show();
- if ($('#no_vip_pay').is(':checked')){
- $('#dl_users_price').show();
- }
- }
- }
- });
-
- $('input[name=tags]').keyup(function(){
- var tags = $.trim($(this).val());
- $('#seo_keywords').val(tags);
- });
- });
-
- // 判断输入框是否为空
- function check_submit(){
- urlToStr();
- if($.trim($('input[name=title]').val()) == ''){
- $($('.tab-base').find('.tab')[0]).trigger('click');
- showErrorMsg('标题不能为空!');
- $('input[name=title]').focus();
- return false;
- }
- if ($('#typeid').val() == 0) {
- $($('.tab-base').find('.tab')[0]).trigger('click');
- showErrorMsg('请选择栏目…!');
- $('#typeid').focus();
- return false;
- }
- var restric_type = $('input[name=restric_type]:checked').val();
- if ( restric_type == 1 || restric_type == 3 || (restric_type == 2 && $('#no_vip_pay').is(':checked'))){
- var users_price = $('#users_price').val();
- if (parseFloat(users_price).toString() == "NaN") {
- users_price = 0;
- }
- if (0 == users_price || users_price == '') {
- showErrorMsg('购买价格不能为空或0');
- $('#users_price').focus();
- return false;
- } else {
- var exp = /^(([1-9]\d*)|\d)(\.\d{1,2})?$/;
- if (!exp.test(users_price)) {
- showErrorMsg('购买价格格式不正确!');
- $('#users_price').focus();
- return false;
- }
- }
- }
-
- var htmlfilename = $.trim($('input[name=htmlfilename]').val());
- if (htmlfilename != '') {
- var exp = /^\d{1,}$/;
- if (exp.test(htmlfilename)) {
- showErrorAlert('自定义文件名不能纯数字,会与文档ID冲突!');
- $('input[name=htmlfilename]').focus();
- return false;
- }
- }
-
- layer_loading('正在处理');
- if(!ajax_check_htmlfilename())
- {
- layer.closeAll();
- showErrorMsg('同栏目下,自定义文件名已存在!');
- $('input[name=htmlfilename]').focus();
- return false;
- }
- setTimeout(function (){
- editor_auto_210607();
- $('#post_form').submit();
- }, 1);
- }
-
- function img_call_back(fileurl_tmp)
- {
- $("#litpic_local").val(fileurl_tmp);
- $("#img_a").attr('href', fileurl_tmp);
- $("#img_i").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");
- $("input[name=is_litpic]").attr('checked', true); // 自动勾选属性[图片]
- }
-
- function addUrlSys(){
- var is_show_qiniuyun = {$channelRow.data.qiniuyun_open|default=0};
- var is_show_oss = {$channelRow.data.oss_open|default=0};
- var is_show_cos = {$channelRow.data.cos_open|default=0};
-
- var num = $("div [id=num_upload_box_sys]").last().attr("data-num");
- if (!num){
- num=0;
- }
- num++;
-
- var html = "";
- html += "<div id=\"num_upload_box_sys\" class='media_del_1586481014_"+num+"' data-num='"+num+"' style='margin-bottom: 10px;'>\n" +
- " <span> 链接地址:</span>\n" +
- " <input type=\"text\" class=\"input-txt\" id=\"video_url_sys_"+num+"\" style=\"width: 300px !important;\" >\n" +
- " <span> 选集名称:</span>\n" +
- " <input type=\"text\" class=\"input-txt\" id=\"video_title_sys_"+num+"\" style=\"width: 150px !important;\">\n";
- // 视频章节分组插件
- var is_open_videogroup = {$is_open_videogroup|default=0};
- if (is_open_videogroup == 1) {
- html += " <span> 所在章节:</span>\n";
- html += " <select class=\"video_group_id_sys\" id=\"video_group_id_sys_"+num+"\">\n";
- html += " <option value=\"0\">--请选择--</option>\n";
- var video_group_str = $('#video_group_list').val();
- if (video_group_str != '') {
- var video_group_list = jQuery.parseJSON(video_group_str);
- $.each(video_group_list, function(index, item){
- html += " <option value=\""+item.group_id+"\">"+item.group_name+"</option>\n";
- });
- }
- html += " </select>\n";
- }
-
- html += " <span> 时长(秒):</span>\n" +
- " <input type=\"text\" class=\"input-txt\" id=\"video_time_sys_"+num+"\" style=\"width: 50px !important;\">\n" +
- " <span> 排序:</span>\n" +
- " <input type=\"text\" class=\"input-txt\" id=\"video_sort_order_"+num+"\" value=\"100\" style=\"width: 50px !important;\">\n" +
- " <input type=\"hidden\" class=\"input-txt\" id=\"video_size_sys_"+num+"\">" +
- " <input type=\"hidden\" class=\"input-txt\" id=\"video_mime_sys_"+num+"\">" +
- " <input type=\"hidden\" class=\"input-txt\" id=\"video_name_sys_"+num+"\">" +
- " <input type=\"file\" class=\"input-txt\" id=\"qiniu_click_sys_"+num+"\" onchange=\"QiniuUpload('"+num+"');\" style=\"display: none;\">\n"+
- " <input type=\"file\" class=\"input-txt\" id=\"oss_click_sys_"+num+"\" onchange=\"OssUpload('"+num+"');\" style=\"display: none;\">\n"+
- " <input type=\"file\" class=\"input-txt\" id=\"cos_click_sys_"+num+"\" onchange=\"CosUpload('"+num+"');\" style=\"display: none;\">\n";
- if (is_show_qiniuyun == 1) {
- html += " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" id=\"qiniu_upload_video_sys_"+num+"\" onclick=\"click_qiniu_sys('"+num+"');\">七牛云上传</a>\n";
- }
- if (is_show_oss == 1) {
- html += " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" id=\"oss_upload_video_sys_"+num+"\" onclick=\"click_oss_sys('"+num+"');\">oss上传</a>\n";
- }
- if (is_show_cos == 1) {
- html += " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" id=\"cos_upload_video_sys_"+num+"\" onclick=\"click_cos_sys('"+num+"');\">cos上传</a>\n";
- }
- html += " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green \" id=\"upload_video_sys_"+num+"\" data-num='"+num+"'>本地上传</a>\n" +
- " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" onclick=\"media_del('"+num+"');\">删除</a>\n" +
- " <label onselectstart='return false'><input type='checkbox' id='video_gratis_sys_"+num+"' value='1'>试看</label>" +
- " </div>";
-
- $('#url-box_sys').append(html);
-
-
- layui.use('upload', function(){
- var upload = layui.upload;
- //执行实例
-
- //创建监听函数
- var xhrOnProgress=function(fun) {
- xhrOnProgress.onprogress = fun; //绑定监听
- //使用闭包实现监听绑
- return function() {
- var xhr = $.ajaxSettings.xhr(); //通过此方法获得XMLHttpRequest对象
- //判断监听函数是否为函数
- if (typeof xhrOnProgress.onprogress !== 'function') {
- return xhr;
- }
- //如果有监听函数并且xhr对象支持绑定时就把监听函数绑定上去
- if (xhrOnProgress.onprogress && xhr.upload) {
- xhr.upload.onprogress = xhrOnProgress.onprogress;
- }
- return xhr;
- }
- };
-
- upload.render({
- elem: "#upload_video_sys_"+num //绑定元素
- ,url: "{:url('Ueditor/upVideo', ['savepath'=>'media'])}" //上传接口
- ,accept: 'video' //视频
- ,exts: '{$media_type}'
- ,size: {$upload_max_filesize} //限制文件大小,单位 KB
- ,before: function(obj){
- $("#upload_video_sys_"+num).text('等待中...');
- }
- ,xhr:xhrOnProgress
- ,progress: function(percent) {
- //上传进度回调 value进度值
- $("#upload_video_sys_"+num).text('上传中...'+percent+'%');
- }
- ,done: function(res){
- if ("SUCCESS" == res.state) {
- var n = $(this.item).attr('data-num');
- $("#video_url_sys_"+n).val(res.url);
- $("#video_time_sys_"+n).val(res.time);
- $("#video_size_sys_"+n).val(res.size);
- $("#video_mime_sys_"+n).val(res.mime);
- $("#video_name_sys_"+n).val(res.title);
- $("#upload_video_sys_"+num).text('上传成功');
- setTimeout(function(){
- $('#upload_video_sys_'+num).text('本地上传');
- }, 2000 )
- }else {
- $("#upload_video_sys_"+num).text('上传失败');
- setTimeout(function(){
- $('#upload_video_sys_'+num).text('本地上传');
- }, 2000 )
- layer.msg(res.state,{icon: 2});
- }
- }
- ,error: function(){
- // layer.close(load); //关闭loading
- }
- });
- });
- }
- function media_del(num) {
- $(".media_del_1586481014_"+num).remove();
- }
- function click_qiniu_sys(num)
- {
- $("#qiniu_click_sys_"+num).trigger("click");
- }
-
- function QiniuUpload(num)
- {
- var file = $("#qiniu_click_sys_"+num)[0].files[0]; //获取文件路径名
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExt(fileExt);
- if (ext==-1) {
- showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
- return false;
- }
- var size = "{$upload_max_filesize}";
- if (file.size > size) {
- showErrorMsg('视频大小超过限制,可在附件设置中修改');
- return false;
- }
- $.ajax({
- type: 'POST',
- url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
- data: {_ajax:1},
- dataType: "JSON",
- success: function(res1){
- if (1 == res1.code){
- var token = res1.data.token;
- var formData = new FormData();
- formData.append('file', file);
- formData.append('token', token);
-
- fileName = res1.data.filePath + fileExt;
- formData.append('key', fileName);
- $.ajax({
- url: res1.data.uphost,
- type: 'POST',
- dataType: 'JSON',
- data: formData,
- timeout: 1200000,
- cache: false, //默认是true,但是一般不做缓存
- processData: false, //用于对data参数进行序列化处理,这里必须false;如果是true,就会将FormData转换为String类型
- contentType: false, //一些文件上传http协议的关系,自行百度,如果上传的有文件,那么只能设置为false
- xhr: function () { //获取ajaxSettings中的xhr对象,为它的upload属性绑定progress事件的处理函数
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) { //检查upload属性是否存在
- //绑定progress事件的回调函数
- // myXhr.upload.addEventListener('progress', progressHandlingFunction, false);
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- $("#qiniu_upload_video_sys_"+num).text('上传中...'+process+"%");
- });
- }
-
- return myXhr; //xhr对象返回给jQuery使用
- },
- success: function(res2){
- $("#qiniu_upload_video_sys_"+num).text('上传成功');
- setTimeout(function(){
- $('#qiniu_upload_video_sys_'+num).text('七牛云上传');
- }, 2000 )
- var video_url = res1.data.domain+"/"+res2.key;
- $("#video_url_sys_"+num).val(video_url);
- $("#video_mime_sys_"+num).val('');
- $("#video_name_sys_"+num).val(res2.key);
-
- var rx=/^https?:\/\//i;
- if (!rx.test(video_url)) {
- video_url = 'http:'+video_url;
- }
- $.ajax({
- type: 'GET',
- url: video_url+"?avinfo",
- data: {},
- dataType: "JSON",
- success: function (res3) {
- $("#video_time_sys_"+num).val(parseInt(res3.format.duration));
- $("#video_size_sys_"+num).val(res3.format.size);
- }
- })
- },
- error: function(e){
- showErrorMsg(e.responseText);
- return false;
- }
- });
- }else{
- $("#qiniu_click_sys_"+num).val('');
- showErrorMsg(res1.msg);
- }
- },
- error: function(e){
- $("#qiniu_click_sys_"+num).val('');
- showErrorMsg(e.responseText);
- }
- });
- }
- function click_oss_sys(num)
- {
- $("#oss_click_sys_"+num).trigger("click");
- }
- function OssUpload(num)
- {
- var file = $("#oss_click_sys_"+num)[0].files[0]; //获取文件路径名
- //获取视频时长start
- var url = URL.createObjectURL(file);
- var oVideo = document.createElement('video');
- var duration = 0;
- oVideo.setAttribute('src',url);
- oVideo.oncanplay = ()=>{
- duration = parseInt(oVideo.duration);
- }
- //获取视频时长end
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExt(fileExt);
- if (ext==-1) {
- showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
- return false;
- }
- var size = "{$upload_max_filesize}";
- if (file.size > size) {
- showErrorMsg('视频大小超过限制,可在附件设置中修改');
- return false;
- }
- $.ajax({
- type: 'POST',
- url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
- data: {_ajax: 1},
- dataType: "JSON",
- success: function(res1){
- if (1 == res1.code){
- fileName = res1.data.filePath + fileExt;
- //组装发送数据
- var request = new FormData();
- request.append("OSSAccessKeyId",res1.data.accessid);//Bucket 拥有者的Access Key Id。
- request.append("policy",res1.data.policy);//policy规定了请求的表单域的合法性
- request.append("Signature",res1.data.signature);//根据Access Key Secret和policy计算的签名信息,OSS验证该签名信息从而验证该Post请求的合法性
-
- request.append("key",fileName);//文件名字,可设置路径
- request.append("success_action_status",201);// 让服务端返回200,不然,默认会返回204
- request.append('file', file);//需要上传的文件 file
- $.ajax({
- url : res1.data.host, //上传阿里地址
- data : request,
- processData: false,
- cache: false,
- contentType: false,
- dataType: 'xml',
- type : 'post',
- xhr: function () { //获取ajaxSettings中的xhr对象,为它的upload属性绑定progress事件的处理函数
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) { //检查upload属性是否存在
- //绑定progress事件的回调函数
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- var process = parseInt(curr / total * 100);
- $("#oss_upload_video_sys_"+num).text('上传中...'+process+"%");
- });
- }
- return myXhr; //xhr对象返回给jQuery使用
- },
- success : function(data) {
- var res = $(data).find('PostResponse');
- if (res) {
- var key = res.find('Key').text();
- $("#oss_upload_video_sys_"+num).text('上传成功');
- setTimeout(function(){
- $('#oss_upload_video_sys_'+num).text('oss上传');
- }, 2000 )
- var video_url = res1.data.domain+"/"+key;
- $("#video_url_sys_"+num).val(video_url);
- $("#video_mime_sys_"+num).val('');
- $("#video_name_sys_"+num).val(key);
- $("#video_time_sys_"+num).val(duration);
- $("#video_size_sys_"+num).val(file.size);
- }else{
- $("#oss_upload_video_sys_"+num).text('上传失败');
- setTimeout(function(){
- $('#oss_upload_video_sys_'+num).text('oss上传');
- }, 2000 )
- }
- },
- error : function(e) {
- console.log(e.responseText);
- }
- });
- }else{
- $("#oss_click_sys_"+num).val('');
- showErrorMsg(res1.msg);
- }
- },
- error: function(e){
- $("#oss_click_sys_"+num).val('');
- showErrorMsg(e.responseText);
- }
- });
- }
-
- // 课件地址上传
- function upload_file_courseware_1585641738(e){
- var data_type = $(e).attr('data-type');
- if ('qiniu' == data_type) {
- upload_addonFieldExt_courseware_qiniu(e); // 七牛云上传
- } else if ('oss' == data_type) {
- upload_addonFieldExt_courseware_oss(e); // OSS上传
- } else if ('cos' == data_type) {
- upload_addonFieldExt_courseware_cos(e); // COS上传
- } else {
- var file = $(e)[0].files[0];
- if (!file) {
- return false;
- }
- var formData = new FormData();
- formData.append('file',file);
- $.ajax({
- type: 'post',
- url: "{:url('Ueditor/DownloadUploadFileAjax')}",
- data: formData,
- contentType: false,
- processData: false,
- dataType: 'json',
- xhr: function () { //获取ajaxSettings中的xhr对象,为它的upload属性绑定progress事件的处理函数
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) { //检查upload属性是否存在
- //绑定progress事件的回调函数
- // myXhr.upload.addEventListener('progress', progressHandlingFunction, false);
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- $("#upload_addonFieldExt_courseware_local").html('上传中...'+process+"%");
- });
- }
-
- return myXhr; //xhr对象返回给jQuery使用
- },
- success: function (res) {
- $("#upload_addonFieldExt_courseware_local").html('上传成功');
- setTimeout(function(){
- $('#upload_addonFieldExt_courseware_local').html('本地上传');
- }, 2000 );
- if (res.code==0){
- showErrorMsg(res.msg);
- }else {
- $("#addonFieldExt_courseware").val(res.file_url);
- }
- }
- })
- }
- }
-
- function upload_addonFieldExt_courseware_qiniu(obj)
- {
- var file = $("#courseware_file")[0].files[0]; //获取文件路径名
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExt(fileExt,1);
- if (ext==-1) {
- showErrorMsg('不支持选中的文件格式,可在附件设置中修改');
- return false;
- }
- var size = "{$upload_max_filesize}";
- if (file.size > size) {
- showErrorMsg('文件大小超过限制,可在附件设置中修改');
- return false;
- }
- $.ajax({
- type: 'POST',
- url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
- data: {_ajax:1},
- dataType: "JSON",
- success: function(res1){
- if (1 == res1.code){
- var token = res1.data.token;
- var formData = new FormData();
- formData.append('file', file);
- formData.append('token', token);
-
- fileName = res1.data.filePath + fileExt;
- formData.append('key', fileName);
- $.ajax({
- url: res1.data.uphost,
- type: 'POST',
- dataType: 'JSON',
- data: formData,
- timeout: 1200000,
- cache: false, //默认是true,但是一般不做缓存
- processData: false, //用于对data参数进行序列化处理,这里必须false;如果是true,就会将FormData转换为String类型
- contentType: false, //一些文件上传http协议的关系,自行百度,如果上传的有文件,那么只能设置为false
- xhr: function () { //获取ajaxSettings中的xhr对象,为它的upload属性绑定progress事件的处理函数
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) { //检查upload属性是否存在
- //绑定progress事件的回调函数
- // myXhr.upload.addEventListener('progress', progressHandlingFunction, false);
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- $("#upload_addonFieldExt_courseware_qiniu").html('上传中...'+process+"%");
- });
- }
-
- return myXhr; //xhr对象返回给jQuery使用
- },
- success: function(res2){
- $("#upload_addonFieldExt_courseware_qiniu").html('上传成功');
- setTimeout(function(){
- $('#upload_addonFieldExt_courseware_qiniu').html('七牛云上传');
- }, 2000 );
- var video_url = res1.data.domain+"/"+res2.key;
- $("#addonFieldExt_courseware").val(video_url);
- },
- error: function(e){
- showErrorMsg(e.responseText);
- return false;
- }
- });
- }else{
- $("#courseware_file").val('');
- showErrorMsg(res1.msg);
- }
- },
- error: function(e){
- $("#courseware_file").val('');
- showErrorMsg(e.responseText);
- }
- });
- }
- function upload_addonFieldExt_courseware_oss(obj)
- {
- var file = $("#courseware_file")[0].files[0]; //获取文件路径名
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExt(fileExt,1);
- if (ext==-1) {
- showErrorMsg('不支持选中的文件格式,可在附件设置中修改');
- return false;
- }
- var size = "{$upload_max_filesize}";
- if (file.size > size) {
- showErrorMsg('文件大小超过限制,可在附件设置中修改');
- return false;
- }
- $.ajax({
- type: 'POST',
- url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
- data: {_ajax:1},
- dataType: "JSON",
- success: function(res1){
- if (1 == res1.code){
- fileName = res1.data.filePath + fileExt;
-
- //组装发送数据
- var request = new FormData();
- request.append("OSSAccessKeyId",res1.data.accessid);//Bucket 拥有者的Access Key Id。
- request.append("policy",res1.data.policy);//policy规定了请求的表单域的合法性
- request.append("Signature",res1.data.signature);//根据Access Key Secret和policy计算的签名信息,OSS验证该签名信息从而验证该Post请求的合法性
-
- request.append("key",fileName);//文件名字,可设置路径
- request.append("success_action_status",201);// 让服务端返回200,不然,默认会返回204
- request.append('file', file);//需要上传的文件 file
-
- $.ajax({
- url : res1.data.host, //上传阿里地址
- data : request,
- processData: false,
- cache: false,
- contentType: false,
- dataType: 'xml',
- type : 'post',
- xhr: function () { //获取ajaxSettings中的xhr对象,为它的upload属性绑定progress事件的处理函数
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) { //检查upload属性是否存在
- //绑定progress事件的回调函数
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- var process = parseInt(curr / total * 100);
- $("#upload_addonFieldExt_courseware_oss").html('上传中...'+process+"%");
- });
- }
- return myXhr; //xhr对象返回给jQuery使用
- },
- success: function(res2){
- var res = $(res2).find('PostResponse');
- if (res) {
- var key = res.find('Key').text();
- $("#upload_addonFieldExt_courseware_oss").html('上传成功');
- setTimeout(function(){
- $('#upload_addonFieldExt_courseware_oss').html('oss上传');
- }, 2000 );
- var video_url = res1.data.domain+"/"+key;
- $("#addonFieldExt_courseware").val(video_url);
- }else{
- $("#upload_addonFieldExt_courseware_oss").html('上传失败');
- setTimeout(function(){
- $('#upload_addonFieldExt_courseware_oss').html('oss上传');
- }, 2000 );
- }
- },
- error: function(e){
- showErrorMsg(e.responseText);
- return false;
- }
- });
- }else{
- $("#courseware_file").val('');
- showErrorMsg(res1.msg);
- }
- },
- error: function(e){
- $("#courseware_file").val('');
- showErrorMsg(e.responseText);
- }
- });
- }
-
- function judgeExt(ext,i) {
- var type = '';
- if (i==1){
- type = "{$file_type}";
- }else{
- type = "{$media_type}";
- }
- var extArr = [];
- extArr = type.split("|");
- var ext = ext.replace(".","");
-
- return extArr.indexOf(ext);
- }
-
- /*腾讯云COS上传代码 --- 陈风任 --- 2021-02-03*/
- function click_cos_sys(num) {
- $("#cos_click_sys_"+num).trigger("click");
- }
- // 上传视频
- function CosUpload(num) {
- // 获取文件路径名
- var file = $("#cos_click_sys_"+num)[0].files[0];
-
- // 获取视频时长start
- var url = URL.createObjectURL(file);
- var oVideo = document.createElement('video');
- var duration = 0;
- oVideo.setAttribute('src', url);
- oVideo.oncanplay = ()=>{
- duration = parseInt(oVideo.duration);
- }
- // 获取视频时长end
-
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExt(fileExt);
- if (ext == -1) {
- showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
- return false;
- }
- var size = "{$upload_max_filesize}";
- if (file.size > size) {
- showErrorMsg('视频大小超过限制,可在附件设置中修改');
- return false;
- }
- var formData = new FormData();
- formData.append('file', file);
- formData.append('file_ext', fileExt);
- $.ajax({
- type: 'post',
- url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&_ajax=1',
- data: formData,
- contentType: false,
- processData: false,
- dataType: 'json',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- if (100 == process) {
- process = 99;
- layer_loading('上传腾讯云');
- }
- $("#cos_upload_video_sys_"+num).text('上传中...'+process+"%");
-
- });
- }
- return myXhr;
- },
- success: function(res) {
- layer.closeAll();
- if (1 == res.code) {
- $("#video_url_sys_" + num).val(res.data.url);
- $("#video_title_sys_" + num).val(res.data.name);
- $("#video_time_sys_" + num).val(duration);
- $("#video_size_sys_" + num).val(res.data.size);
- $("#cos_upload_video_sys_"+num).text('上传成功');
- } else {
- $("#cos_upload_video_sys_"+num).text('上传失败');
- }
- setTimeout(function(){
- $('#cos_upload_video_sys_'+num).text('cos上传');
- }, 2000);
- },
- error: function(e){
- layer.closeAll();
- $("#cos_click_sys_"+num).val('');
- showErrorMsg(e.responseText);
- }
- });
- }
-
- // 上传附件
- function upload_addonFieldExt_courseware_cos() {
- var file = $("#courseware_file")[0].files[0]; //获取文件路径名
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- var ext = judgeExt(fileExt, 1);
- if (ext == -1) {
- showErrorMsg('不支持选中的文件格式,可在附件设置中修改');
- return false;
- }
- var size = "{$upload_max_filesize}";
- if (file.size > size) {
- showErrorMsg('文件大小超过限制,可在附件设置中修改');
- return false;
- }
-
- var formData = new FormData();
- formData.append('file', file);
- formData.append('file_ext', fileExt);
- $.ajax({
- type: 'post',
- url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&up_type=1&_ajax=1',
- data: formData,
- contentType: false,
- processData: false,
- dataType: 'json',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- var process = parseInt(curr / total * 100);
- if (100 == process) {
- process = 99;
- layer_loading('上传腾讯云');
- }
- $("#upload_addonFieldExt_courseware_cos").html('上传中...'+process+"%");
- });
- }
- return myXhr;
- },
- success: function(res) {
- layer.closeAll();
- if (1 == res.code) {
- $("#upload_addonFieldExt_courseware_cos").html('上传成功');
- $("#addonFieldExt_courseware").val(res.data.url);
- } else {
- $("#upload_addonFieldExt_courseware_cos").html('上传失败');
- }
- setTimeout(function() {
- $('#upload_addonFieldExt_courseware_cos').html('oss上传');
- }, 2000);
- },
- error: function(e) {
- layer.closeAll();
- $("#courseware_file").val('');
- showErrorMsg(e.responseText);
- }
- });
- }
- /* END */
-
- /* 批量导入视频信息 start */
- function batch_import_url() {
- layer.prompt({
- formType: 2,
- shade: layer_shade,
- value: '参考格式:链接地址$选集名称$时长(秒)$试看(是/否)\r\n示例如下:\r\nhttp://www.xxx.com/1.mp4$名称1$30$是\r\nhttp://www.xxx.com/2.mp4$名称2$50$否',
- title: '批量导入视频链接',
- area: ['800px', '250px'] //自定义文本域宽高
- ,id: 'ey_batch_links'
- ,maxlength: 60000
- ,success: function(layero, index){
- $("#ey_batch_links").find('textarea').attr('placeholder', '参考格式:链接地址$选集名称$时长(秒)$试看(是/否)\r\n示例如下:\r\nhttp://www.xxx.com/1.mp4$名称1$30$是\r\nhttp://www.xxx.com/2.mp4$名称2$50$否');
- }
- }, function(value, index, elem){
- let code = value.split(/[(\r\n)\r\n]+/); // 根据换行或者回车进行识别
- code.forEach((item, index) => { // 删除空项
- if (!item) {
- code.splice(index, 1);
- }else{
- code[index] = item.split('$');
- }
- })
- code = Array.from(new Set(code)); // 去重
- code.forEach((item, index) => { // 删除空项
- addImportUrlSys(item[0],item[1],item[2],item[3])
- })
- layer.close(index);
- });
- }
-
- function addImportUrlSys(url,name,time,gratis){
- var first = $('#url-box_sys div:first-child').attr('data-num');
- if('' == $('#video_url_sys_'+first).val()){
- $('#url-box_sys div:first-child').remove();
- }
- if ('undefined' == name || !name) {
- name = '';
- }
- if ('undefined' == time || !time) {
- time = '';
- }
- if ('是' == gratis){
- gratis = 'checked';
- }else{
- gratis = '';
- }
- var is_show_qiniuyun = {$channelRow.data.qiniuyun_open|default=0};
- var is_show_oss = {$channelRow.data.oss_open|default=0};
- var is_show_cos = {$channelRow.data.cos_open|default=0};
- var num = $("div [id=num_upload_box_sys]").last().attr("data-num");
- if (!num){
- num=0;
- }
- num++;
-
- var html = "";
- html += "<div id=\"num_upload_box_sys\" class='media_del_1586481014_"+num+"' data-num='"+num+"' style='margin-bottom: 10px;'>\n" +
- " <span> 链接地址:</span>\n" +
- " <input type=\"text\" class=\"input-txt\" id=\"video_url_sys_"+num+"\" value='"+url+"' style=\"width: 300px !important;\" >\n" +
- " <span> 选集名称:</span>\n" +
- " <input type=\"text\" class=\"input-txt\" id=\"video_title_sys_"+num+"\" value='"+name+"' style=\"width: 150px !important;\">\n";
- // 视频章节分组插件
- var is_open_videogroup = {$is_open_videogroup|default=0};
- if (is_open_videogroup == 1) {
- html += " <span> 所在章节:</span>\n";
- html += " <select class=\"video_group_id_sys\" id=\"video_group_id_sys_"+num+"\">\n";
- html += " <option value=\"0\">--请选择--</option>\n";
- var video_group_str = $('#video_group_list').val();
- if (video_group_str != '') {
- var video_group_list = jQuery.parseJSON(video_group_str);
- $.each(video_group_list, function(index, item){
- html += " <option value=\""+item.group_id+"\">"+item.group_name+"</option>\n";
- });
- }
- html += " </select>\n";
- }
-
- html += " <span> 时长(秒):</span>\n" +
- " <input type=\"text\" class=\"input-txt\" id=\"video_time_sys_"+num+"\" value='"+time+"' style=\"width: 50px !important;\">\n" +
- " <span> 排序:</span>\n" +
- " <input type=\"text\" class=\"input-txt\" id=\"video_sort_order_"+num+"\" value='100' style=\"width: 50px !important;\">\n" +
- " <input type=\"hidden\" class=\"input-txt\" id=\"video_size_sys_"+num+"\">" +
- " <input type=\"hidden\" class=\"input-txt\" id=\"video_mime_sys_"+num+"\">" +
- " <input type=\"hidden\" class=\"input-txt\" id=\"video_name_sys_"+num+"\">" +
- " <input type=\"file\" class=\"input-txt\" id=\"qiniu_click_sys_"+num+"\" onchange=\"QiniuUpload('"+num+"');\" style=\"display: none;\">\n"+
- " <input type=\"file\" class=\"input-txt\" id=\"oss_click_sys_"+num+"\" onchange=\"OssUpload('"+num+"');\" style=\"display: none;\">\n"+
- " <input type=\"file\" class=\"input-txt\" id=\"cos_click_sys_"+num+"\" onchange=\"CosUpload('"+num+"');\" style=\"display: none;\">\n";
- if (is_show_qiniuyun == 1) {
- html += " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" id=\"qiniu_upload_video_sys_"+num+"\" onclick=\"click_qiniu_sys('"+num+"');\">七牛云上传</a>\n";
- }
- if (is_show_oss == 1) {
- html += " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" id=\"oss_upload_video_sys_"+num+"\" onclick=\"click_oss_sys('"+num+"');\">oss上传</a>\n";
- }
- if (is_show_cos == 1) {
- html += " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" id=\"cos_upload_video_sys_"+num+"\" onclick=\"click_cos_sys('"+num+"');\">cos上传</a>\n";
- }
- html += " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green \" id=\"upload_video_sys_"+num+"\" data-num='"+num+"'>本地上传</a>\n" +
- " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" onclick=\"media_del('"+num+"');\">删除</a>\n" +
- " <label onselectstart='return false'><input type='checkbox' id='video_gratis_sys_"+num+"' value='1' "+gratis+">试看</label>" +
- " </div>";
-
- $('#url-box_sys').append(html);
-
-
- layui.use('upload', function(){
- var upload = layui.upload;
- //执行实例
-
- //创建监听函数
- var xhrOnProgress=function(fun) {
- xhrOnProgress.onprogress = fun; //绑定监听
- //使用闭包实现监听绑
- return function() {
- var xhr = $.ajaxSettings.xhr(); //通过此方法获得XMLHttpRequest对象
- //判断监听函数是否为函数
- if (typeof xhrOnProgress.onprogress !== 'function') {
- return xhr;
- }
- //如果有监听函数并且xhr对象支持绑定时就把监听函数绑定上去
- if (xhrOnProgress.onprogress && xhr.upload) {
- xhr.upload.onprogress = xhrOnProgress.onprogress;
- }
- return xhr;
- }
- };
-
- upload.render({
- elem: "#upload_video_sys_"+num //绑定元素
- ,url: "{:url('Ueditor/upVideo', ['savepath'=>'media'])}" //上传接口
- ,accept: 'video' //视频
- ,exts: '{$media_type}'
- ,size: {$upload_max_filesize} //限制文件大小,单位 KB
- ,before: function(obj){
- $("#upload_video_sys_"+num).text('等待中...');
- }
- ,xhr:xhrOnProgress
- ,progress: function(percent) {
- //上传进度回调 value进度值
- $("#upload_video_sys_"+num).text('上传中...'+percent+'%');
- }
- ,done: function(res){
- if ("SUCCESS" == res.state) {
- var n = $(this.item).attr('data-num');
- $("#video_url_sys_"+n).val(res.url);
- $("#video_time_sys_"+n).val(res.time);
- $("#video_size_sys_"+n).val(res.size);
- $("#video_mime_sys_"+n).val(res.mime);
- $("#video_name_sys_"+n).val(res.title);
- $("#upload_video_sys_"+num).text('上传成功');
- setTimeout(function(){
- $('#upload_video_sys_'+num).text('本地上传');
- }, 2000 )
- }else {
- $("#upload_video_sys_"+num).text('上传失败');
- setTimeout(function(){
- $('#upload_video_sys_'+num).text('本地上传');
- }, 2000 )
- layer.msg(res.state,{icon: 2});
- }
- }
- ,error: function(){
- // layer.close(load); //关闭loading
- }
- });
- });
- }
- /* 批量导入视频信息 end */
- function urlToStr() {
- var video = [];
- $("#url-box_sys div").each(function(){
- var n = $(this).attr('data-num');
- var arr ={};
- arr.file_url = $("#video_url_sys_"+n).val();
- if (!arr.file_url) {
- return true
- }
- arr.file_title = $("#video_title_sys_"+n).val();
- arr.file_name = $("#video_name_sys_"+n).val();
- arr.file_time = $("#video_time_sys_"+n).val();
- arr.file_size = $("#video_size_sys_"+n).val();
- arr.file_mime = $("#video_mime_sys_"+n).val();
- arr.sort_order = $("#video_sort_order_"+n).val();
- arr.video_group_id = $("#video_group_id_sys_"+n).val();
- var gratis_checked = $("#video_gratis_sys_"+n).is(':checked');
- if (gratis_checked == true){
- arr.gratis = 1;
- } else{
- arr.gratis = 0;
- }
- video.push(arr);
- });
- video = JSON.stringify(video)
- $("#video").val(video)
- }
- function clickNoVipPay(obj) {
- if ($(obj).is(':checked')) {
- $('#dl_users_price').show();
- } else {
- $('#dl_users_price').hide();
- }
- }
- </script>
- <script>
- try{
- var mt20_1649209614 = sessionStorage.getItem("mt20_1649209614");
- if (mt20_1649209614 == 1){
- $("#geduan_div").removeClass("h10");
- }else{
- $("#geduan_div").addClass("h10");
- }
- }catch(e){}
- </script>
- {include file="public/footer" /}
|