暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

edit.htm 89KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733
  1. {include file="public/layout" /}
  2. {eq name="$editor.editor_select" value="1"}
  3. {load href="__PUBLIC__/plugins/Ueditor/ueditor.config.js" /}
  4. {load href="__PUBLIC__/plugins/Ueditor/ueditor.all.min.js" /}
  5. {load href="__PUBLIC__/plugins/Ueditor/lang/zh-cn/zh-cn.js" /}
  6. {else/}
  7. {load href="__PUBLIC__/plugins/ckeditor/ckeditor.js" /}
  8. {/eq}
  9. <body class="bodysy-w">
  10. <div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
  11. <div id="append_parent"></div>
  12. <div id="ajaxwaitid"></div>
  13. <div id="geduan_div" class="h10"></div>
  14. <div id="page_div" class="page min-hg-c mb-20" style="min-width:auto;box-shadow:none;">
  15. <div class="fixed-bar">
  16. <div class="item-title">
  17. {include file="public/callback_page_1" /}<!-- 返回箭头 -->
  18. <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>
  19. <div class="subject">
  20. <h3>编辑文档</h3>
  21. <h5></h5>
  22. </div>
  23. <ul class="tab-base nc-row">
  24. <li><a href="javascript:void(0);" data-index='1' class="tab current"><span>基础内容</span></a></li>
  25. <li><a href="javascript:void(0);" data-index='2' class="tab"><span>SEO优化</span></a></li>
  26. <li><a href="javascript:void(0);" data-index='3' class="tab"><span>更多设置</span></a></li>
  27. <!-- #weapp_demontrate_li# -->
  28. <!-- #weapp_li# -->
  29. </ul>
  30. </div>
  31. </div>
  32. <form class="form-horizontal" id="post_form" action="{:url('Media/edit')}" method="post">
  33. <!-- 常规信息 -->
  34. <div class="ncap-form-default tab_div_1">
  35. <dl class="row">
  36. <dt class="tit">
  37. <label for="title"><em>*</em>文档标题</label>
  38. </dt>
  39. <dd class="opt">
  40. <input type="text" name="title" value="{$field.title}" id="title" class="input-txt" maxlength="200" {eq name="$channelRow.is_repeat_title" value="0"} oninput="check_title_repeat(this,'{$field.aid}');" {/eq}>
  41. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  42. 副标题:<input type="text" name="subtitle" value="{$field.subtitle}" id="subtitle" class="w200">
  43. <span class="err"></span>
  44. <p class="notic"></p>
  45. </dd>
  46. </dl>
  47. <dl class="row">
  48. <dt class="tit">
  49. <label for="title"><em>*</em>栏目分类</label>
  50. </dt>
  51. <dd class="opt">
  52. <input type="hidden" name="attr[typeid]" id="attr_typeid" value="{$field.typeid}">
  53. <select name="typeid" id="typeid">
  54. {$arctype_html}
  55. </select>
  56. <span class="err"></span>
  57. <p class="notic">谨慎切换,自定义字段的内容会随着栏目切换而清空,在保存之前不受影响!</p>
  58. </dd>
  59. </dl>
  60. {notempty name='$global.web_stypeid_open'}
  61. <dl class="row">
  62. <dt class="tit">
  63. <label for="stypeid">副栏目分类</label>
  64. </dt>
  65. <dd class="opt">
  66. <input type="hidden" name="stypeid" id="stypeid" value="{$field.stypeid}" class="input-txt" onkeyup="this.value=this.value.replace(/[^\d\,]/g,'');" onpaste="this.value=this.value.replace(/[^\d\,]/g,'');" placeholder="">
  67. &nbsp;<a href="javascript:void(0);" data-channel="{$channeltype}" onclick="select_stypeid(this);" class="ncap-btn ncap-btn-green">选择副栏目</a>
  68. <span class="err"></span>
  69. <p class="notic">支持同频道模型的栏目</p>
  70. <div id="stypeid_txt" class="pt5">
  71. {volist name='$stypeid_arr' id='vo'}{gt name='$key' value='0'}&nbsp;&nbsp;|&nbsp;&nbsp;{/gt}<span>{$vo.typename}</span>{/volist}
  72. </div>
  73. </dd>
  74. </dl>
  75. {/notempty}
  76. <dl class="row">
  77. <dt class="tit">
  78. <label>文档属性</label>
  79. </dt>
  80. <dd class="opt">
  81. {volist name="archives_flags" id="vo"}
  82. <input type="hidden" name="attr[{$vo.flag_fieldname}]" {if $field[$vo.flag_fieldname] == 1}value="1"{else/}value="0"{/if}>
  83. <label><input type="checkbox" name="{$vo.flag_fieldname}" value="1" {if $field[$vo.flag_fieldname] == 1}checked{/if}>{$vo.flag_name}<!-- [{$vo.flag_attr}] --></label>&nbsp;
  84. {/volist}
  85. <span class="err"></span>
  86. <p class="notic">如需管理,请点击右上角设置与帮助按钮</p>
  87. </dd>
  88. </dl>
  89. <dl class="row {if condition="$field.is_jump != 1"}none{/if} dl_jump">
  90. <dt class="tit">
  91. <label>跳转网址</label>
  92. </dt>
  93. <dd class="opt">
  94. <input type="text" value="{$field.jumplinks}" name="jumplinks" id="jumplinks" class="input-txt" placeholder="http://">
  95. <span class="err"></span>
  96. <p class="notic">请输入完整的URL网址(包含http或https),设置后访问该条信息将直接跳转到设置的网址</p>
  97. </dd>
  98. </dl>
  99. <dl class="row" style="z-index:2;">
  100. <dt class="tit">
  101. <label>文档标签</label>
  102. </dt>
  103. <dd class="opt">
  104. <input type="text" value="{$field.tags}" 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,',')">&nbsp;
  105. <a href="javascript:void(0);" onclick="get_common_tagindex(this);">显示常用标签</a>&nbsp;<img id="tag_loading" src="__STATIC__/common/images/loading.gif" style="display: none;" />
  106. <div class="often_tags" id="often_tags" data-opt="edit" style="display: none;"></div>
  107. <div class="often_tags" id="often_tags_input" style="display: none;"></div>
  108. <input type="hidden" id="tags_click_count">
  109. </dd>
  110. </dl>
  111. <dl class="row {empty name="$global.web_citysite_open"} none {/empty} ">
  112. <dt class="tit">
  113. <label for="title">所属区域</label>
  114. </dt>
  115. <dd class="opt">
  116. <select name="province_id" id="province_id" onchange="set_city_list(0);">
  117. <option value="0">全国</option>
  118. {volist name=':get_site_province_list()' id='vo'}
  119. <option value="{$vo.id}" {eq name="$field.province_id" value="$vo.id" } selected {/eq} >{$vo.name}</option>
  120. {/volist}
  121. </select>
  122. <select name="city_id" id="city_id" class="none ml5" onchange="set_area_list(0);">
  123. <option value="">--请选择--</option>
  124. </select>
  125. <select name="area_id" id="area_id" class="none ml5">
  126. <option value="">--请选择--</option>
  127. </select>
  128. <span class="err"></span>
  129. <p class="notic"></p>
  130. </dd>
  131. </dl>
  132. <dl class="row">
  133. <dt class="tit">
  134. <label>封面图片</label>
  135. </dt>
  136. <dd class="opt">
  137. <div class="input-file-show div_litpic_local" {neq name="$field.is_remote" value="0"}style="display: none;"{/neq}>
  138. <span class="show">
  139. <a id="img_a" target="_blank" class="nyroModal" rel="gal" href="{$field.litpic_local|default='javascript:void(0);'}">
  140. <i id="img_i" class="fa fa-picture-o" {notempty name="$field.litpic_local"}onmouseover="layer_tips=layer.tips('<img src={$field.litpic_local} class=\'layer_tips_img\'>',this,{tips: [1, '#fff']});"{/notempty} onmouseout="layer.close(layer_tips);"></i>
  141. </a>
  142. </span>
  143. <span class="type-file-box">
  144. <input type="text" id="litpic_local" name="litpic_local" value="{$field.litpic_local|default=''}" class="type-file-text" autocomplete="off">
  145. <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
  146. <input class="type-file-file" onClick="GetUploadify(1,'','allimg','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo"
  147. title="点击前方预览图可查看大图,点击按钮选择文件并提交表单后上传生效">
  148. </span>
  149. </div>
  150. <input type="text" id="litpic_remote" name="litpic_remote" value="{$field.litpic_remote|default=''}" placeholder="http://" class="input-txt" onKeyup="keyupRemote(this, 'litpic');" {neq name="$field.is_remote" value="1"}style="display: none;"{/neq}>
  151. &nbsp;
  152. <label><input type="checkbox" name="is_remote" id="is_remote" value="1" {eq name="$field.is_remote" value="1"}checked="checked"{/eq} onClick="clickRemote(this, 'litpic');">远程图片</label>
  153. <span class="err"></span>
  154. <p class="notic">当没有手动上传图片时候,会自动提取正文的第一张图片作为缩略图</p>
  155. </dd>
  156. </dl>
  157. <dl class="row">
  158. <dt class="tit">
  159. <label>付费限制</label>
  160. </dt>
  161. <dd class="opt">
  162. <label class="curpoin"><input type="radio" name="restric_type" value="0" {empty name="$field.restric_type"} checked="checked" {/empty}>免费</label>&nbsp;&nbsp;
  163. <label class="curpoin"><input type="radio" name="restric_type" value="1" {eq name="$field.restric_type" value="1"} checked="checked" {/eq}>付费</label>&nbsp;&nbsp;
  164. <label class="curpoin"><input type="radio" name="restric_type" value="2" {eq name="$field.restric_type" value="2"} checked="checked" {/eq}>指定会员</label>&nbsp;&nbsp;
  165. <label class="curpoin"><input type="radio" name="restric_type" value="3" {eq name="$field.restric_type" value="3"} checked="checked" {/eq}>会员付费</label>&nbsp;&nbsp;
  166. </dd>
  167. </dl>
  168. <dl class="row {if condition='!in_array($field.restric_type, [2,3])'} none {/if}" id="dl_arc_level_id">
  169. <dt class="tit">
  170. <label><em>*</em>会员等级</label>
  171. </dt>
  172. <dd class="opt">
  173. <select name="arc_level_id" id="arc_level_id">
  174. {volist name="users_level" id="vo"}
  175. <option value="{$vo.level_id}" level_value="{$vo.level_value}" {eq name='$vo.level_id' value='$field.arc_level_id'} selected {/eq}>{$vo.level_name}</option>
  176. {/volist}
  177. </select>
  178. &nbsp;
  179. <label id="no_vip_pay_label" class="{neq name="$field.restric_type" value="2"} none {/neq}" ><input type="checkbox" name="no_vip_pay" id="no_vip_pay" value="1" {eq name="$field.no_vip_pay" value="1"}checked="checked"{/eq} onClick="clickNoVipPay(this);">开启非会员付费</label>
  180. <span class="err"></span>
  181. <p class="notic">包括等于或高于指定的会员等级</p>
  182. </dd>
  183. </dl>
  184. <dl class="row {if condition='in_array($field.restric_type, [0]) || ($field.restric_type == 2 && $field.no_vip_pay == 0) '} none {/if}" id="dl_users_price">
  185. <dt class="tit">
  186. <label for="users_price"><em>*</em>购买价格</label>
  187. </dt>
  188. <dd class="opt">
  189. <input type="text" name="users_price" id="users_price" value="{$field.users_price}" class="input-txt" autocomplete="off" onkeyup="this.value=this.value.replace(/[^\d\.]/g,'');" onpaste="this.value=this.value.replace(/[^\d\.]/g,'')" style="width: 100px !important;text-align: right;">&nbsp;元
  190. <span class="err"></span>
  191. <p class="notic"></p>
  192. </dd>
  193. </dl>
  194. <dl class="row">
  195. <dt class="tit">
  196. <label>视频上传</label>
  197. </dt>
  198. <dd class="opt">
  199. <a href="javascript:void(0);" onclick="addUrlSys();" class="ncap-btn ncap-btn-green" id="a_add_url_sys">新增</a>
  200. <a href="javascript:void(0);" onclick="batch_import_url();" class="ncap-btn ncap-btn-green">批量导入</a>
  201. &nbsp;<a href="JavaScript:void(0);" id="label_tech" onclick="click_to_eyou_1575506523('https://www.eyoucms.com/plus/view.php?aid=9993&origin_eycms=1','视频模型的模板标签调用')" style="font-size: 12px;">标签教程</a>
  202. <div id="url-box_sys" style="padding: 10px 0">
  203. </div>
  204. <span class="err"></span>
  205. </dd>
  206. </dl>
  207. <dl class="row">
  208. <dt class="tit">
  209. <label>附件地址</label>
  210. </dt>
  211. <dd class="opt">
  212. <input type="text" name="addonFieldExt[courseware]" value="{$field['addonFieldExt']['courseware']|default=''}" id="addonFieldExt_courseware" class="input-txt">
  213. <input type="file" id="courseware_file" data-type='local' onchange="upload_file_courseware_1585641738(this)" style="display: none;">
  214. {if isset($channelRow.data.qiniuyun_open) && $channelRow.data.qiniuyun_open == 1}
  215. &nbsp;<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>
  216. {/if}
  217. {if isset($channelRow.data.oss_open) && $channelRow.data.oss_open == 1}
  218. &nbsp;<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>
  219. {/if}
  220. {if isset($channelRow.data.cos_open) && $channelRow.data.cos_open == 1}
  221. &nbsp;<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>
  222. {/if}
  223. &nbsp;<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>
  224. <span class="err"></span>
  225. </dd>
  226. </dl>
  227. {include file="archives/get_field_addonextitem" /}
  228. </div>
  229. <!-- 常规信息 -->
  230. <!-- SEO参数 -->
  231. <div class="ncap-form-default tab_div_2" style="display:none;">
  232. <dl class="row">
  233. <dt class="tit">
  234. <label for="seo_title">SEO标题</label>
  235. </dt>
  236. <dd class="opt">
  237. <input type="text" value="{$field.seo_title}" name="seo_title" id="seo_title" class="input-txt">
  238. <p class="notic">一般不超过80个字符,为空时系统自动构成,可以到 <a href="{:url('Seo/index', array('inc_type'=>'seo'))}">SEO设置 - SEO基础</a> 中设置构成规则。</p>
  239. </dd>
  240. </dl>
  241. <dl class="row">
  242. <dt class="tit">
  243. <label>SEO关键词</label>
  244. </dt>
  245. <dd class="opt">
  246. <textarea rows="5" cols="60" id="seo_keywords" name="seo_keywords" style="height:20px;">{$field.seo_keywords}</textarea>
  247. <span class="err"></span>
  248. <p class="notic">一般不超过100个字符,多个关键词请用英文逗号(,)隔开,建议3到5个关键词。</p>
  249. </dd>
  250. </dl>
  251. <dl class="row">
  252. <dt class="tit">
  253. <label>SEO描述</label>
  254. </dt>
  255. <dd class="opt">
  256. <textarea rows="5" cols="60" id="seo_description" name="seo_description" style="height:54px;" class="keywordsTextarea" onkeyup="monitorInputStr();" onkeypress="monitorInputStr();">{$field.seo_description}</textarea>
  257. <span class="err"></span>
  258. <p class="notic">一般不超过100个字符,不填写时系统自动提取正文的前100个字符</p>
  259. <p class="notic2 {empty name='$field.seo_description'}none{/empty}" id="beenWritten">你已输入<span id="beenWrittenStr">0</span>个字符</p>
  260. <p><label><input type="checkbox" name="basic_update_seo_description" value="1" {if condition="!empty($global['basic_update_seo_description'])"} checked="checked" {/if}>勾选后SEO描述将随正文内容更新</label></p>
  261. </dd>
  262. </dl>
  263. </div>
  264. <!-- SEO参数 -->
  265. <!-- 其他参数 -->
  266. <div class="ncap-form-default tab_div_3" style="display:none;">
  267. <dl class="row">
  268. <dt class="tit">
  269. <label for="author">作者</label>
  270. </dt>
  271. <dd class="opt origin-hot">
  272. <input type="hidden" value="{$field.users_id}" name="users_id" class="input-txt">
  273. <input type="text" value="{$field.author}" name="author" id="author" class="input-txt">
  274. <span class="err"></span>
  275. <p class="notic">设置作者默认名称(将同步至管理员笔名)</p>
  276. </dd>
  277. </dl>
  278. <dl class="row dl_origin">
  279. <dt class="tit">
  280. <label>来源</label>
  281. </dt>
  282. <dd class="opt origin-hot">
  283. <input type="text" value="{$field.origin}" name="origin" id="origin" class="input-txt" onclick="searchOrigin(this);" autocomplete="off">
  284. <div class="origin-hot-list" style="display: none;" id="search_keywords_list_origin"></div>
  285. <textarea id="system_originlist_str" style="display: none;">{$system_originlist_str}</textarea>
  286. <span class="setting" onclick="set_originlist();">设置</span>
  287. <span class="err"></span>
  288. <p class="notic">为空时默认“网络”</p>
  289. </dd>
  290. </dl>
  291. <dl class="row">
  292. <dt class="tit">
  293. <label>点击数</label>
  294. </dt>
  295. <dd class="opt">
  296. <input type="text" value="{$field.click}" name="click" id="click" class="input-txt">
  297. <span class="err"></span>
  298. </dd>
  299. </dl>
  300. <dl class="row">
  301. <dt class="tit">
  302. <label>阅读权限</label>
  303. </dt>
  304. <dd class="opt">
  305. <input type="hidden" value="{$field.arcrank}" name="old_arcrank" class="input-txt">
  306. <select name="arcrank" id="arcrank" {if $field.arcrank < 0 && $admin_info.role_id > 0 && $auth_role_info.check_oneself < 1} disabled="disabled" {/if}>
  307. {volist name="arcrank_list" id="vo"}
  308. <option value="{$vo.rank}" {eq name="$vo.rank" value="$field.arcrank"}selected{/eq}>{$vo.name}</option>
  309. {/volist}
  310. </select>
  311. <span class="err"></span>
  312. </dd>
  313. </dl>
  314. <!-- #weapp_UsersGroup_content_users_id={$field.users_id}#--><!-- #weapp_UsersGroup_content# -->
  315. <dl class="row">
  316. <dt class="tit">
  317. <label for="articleForm">发布时间</label>
  318. </dt>
  319. <dd class="opt">
  320. <input type="text" class="input-txt" id="add_time" name="add_time" value="{$field.add_time|date='Y-m-d H:i:s',###}" autocomplete="off">
  321. <span class="add-on input-group-addon">
  322. <i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
  323. </span>
  324. <span class="err"></span>
  325. </dd>
  326. </dl>
  327. <dl class="row">
  328. <dt class="tit">
  329. <label for="tempview">文档模板</label>
  330. </dt>
  331. <dd class="opt">
  332. <select name="tempview" id="tempview">
  333. {volist name='$templateList' id='vo'}
  334. <option value="{$vo}" {eq name='$vo' value='$tempview'}selected{/eq}>{$vo}</option>
  335. {/volist}
  336. </select>
  337. <input type="hidden" name="type_tempview" value="{$tempview}" />
  338. <span class="err"></span>
  339. </dd>
  340. </dl>
  341. <dl class="row {notin name='$seo_pseudo' value='2,3'}no-grey{/notin}">
  342. <dt class="tit">
  343. <label>自定义文件名</label>
  344. </dt>
  345. <dd class="opt">
  346. <input type="text" {notin name='$seo_pseudo' value='2,3'}readonly="readonly" title="动态模式下不支持自定义文档url"{/notin} value="{$field.htmlfilename}" 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
  347. <span class="err"></span>
  348. <p class="notic">自定义文件名可由字母、数字、下划线(_)、连接符(-)等符号组成,除此之外其他字符将自动转为连接符(-)</p>
  349. </dd>
  350. </dl>
  351. </div>
  352. <!-- 其他参数 -->
  353. <!-- #weapp_demontrate_div# -->
  354. <!-- #weapp_div# -->
  355. <div class="ncap-form-default">
  356. <div class="bot2">
  357. <input type="hidden" id="num">
  358. <input type="hidden" name="gourl" value="{$gourl|default=''}">
  359. <input type="hidden" name="aid" value="{$field.aid|default='0'}">
  360. <textarea class="none" name="video" id="video" cols="30" rows="10"></textarea>
  361. <textarea style="display: none;" id="video_group_list">{$video_group_list|default=""}</textarea>
  362. <input type="hidden" name="editor_addonFieldExt" id="editor_addonFieldExt" value="">
  363. <a href="JavaScript:void(0);" onclick="check_submit();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
  364. {include file="public/callback_page_2" /}<!-- 返回按钮 -->
  365. </div>
  366. </div>
  367. </form>
  368. </div>
  369. <script type="text/javascript">
  370. layui.use('laydate', function() {
  371. var laydate = layui.laydate;
  372. //常规用法
  373. laydate.render({
  374. elem: '#add_time'
  375. ,type: 'datetime'
  376. });
  377. })
  378. $(function () {
  379. try {
  380. var web_citysite_open = {$global['web_citysite_open']|default=0};
  381. if (web_citysite_open > 0) {
  382. var province_id = {$field.province_id|default=0};
  383. var city_id = {$field.city_id|default=0};
  384. var area_id = {$field.area_id|default=0};
  385. if (province_id > 0) {
  386. set_city_list(city_id);
  387. }
  388. if (city_id > 0) {
  389. set_area_list(area_id);
  390. }
  391. }
  392. }catch(e){}
  393. //选项卡切换列表
  394. $('.tab-base').find('.tab').click(function(){
  395. $('.tab-base').find('.tab').each(function(){
  396. $(this).removeClass('current');
  397. });
  398. $(this).addClass('current');
  399. var tab_index = $(this).data('index');
  400. $(".tab_div_1, .tab_div_2, .tab_div_3").hide();
  401. $(".tab_div_"+tab_index).show();
  402. layer.closeAll();
  403. });
  404. $('input[name=is_jump]').click(function(){
  405. if ($(this).is(':checked')) {
  406. $('.dl_jump').show();
  407. } else {
  408. $('.dl_jump').hide();
  409. }
  410. });
  411. var dftypeid = {$field.typeid|default='0'};
  412. $('#typeid').change(function(){
  413. var current_channel = $(this).find('option:selected').data('current_channel');
  414. if (0 < $(this).val() && {$channeltype} != current_channel) {
  415. showErrorMsg('请选择对应模型的栏目!');
  416. $(this).val(dftypeid);
  417. } else if ({$channeltype} == current_channel) {
  418. layer.closeAll();
  419. }
  420. var aid = $("input[name=aid]").val();
  421. GetAddonextitem(1, $(this).val(), {$channeltype}, aid, true);
  422. });
  423. var data = '{$video_file|default=""}';
  424. var num = length = media_chapter_length = 0;
  425. data = JSON.parse(data);
  426. //如果开启分组并且数据不为空则隐藏原新增按钮
  427. var is_open_videogroup = {$is_open_videogroup|default=0};
  428. if (is_open_videogroup == 1) {
  429. $("#label_tech").attr('onclick',"click_to_eyou_1575506523('https://www.eyoucms.com/plus/view.php?aid=28671&origin_eycms=1', '视频章节分组插件使用指南');");
  430. // if (0 < data.length) {
  431. // $('#a_add_url_sys').hide();
  432. // }
  433. }
  434. $("#num").val(data.length);
  435. if(data){
  436. data.forEach(function(v){
  437. num++;
  438. if (is_open_videogroup == 1 && v.video_group_id) {
  439. length = $("#url-box_sys .video_group_"+v.video_group_id).length;
  440. if (length == 0){
  441. media_chapter_length = $("#url-box_sys .media_chapter").length;
  442. if (0 == media_chapter_length) {
  443. $("#url-box_sys").append("<div class=\"media_chapter video_group_"+v.video_group_id+"\" data-group='"+v.video_group_id+"'><span class=\"chapter_name\">"+v.group_name+"</span><span class=\"fr\"><a class=\"mr20 curpoin\" onclick=\"addGroupUrlSys("+v.video_group_id+");\">新增</a><a class=\"curpoin show_and_hide_"+v.video_group_id+"\" onclick=\"showAndHide("+v.video_group_id+");\" data-status='1'>收缩</a></span></div>");
  444. }else{
  445. $("#url-box_sys").append("<div class=\"media_chapter video_group_"+v.video_group_id+"\" data-group='"+v.video_group_id+"'><span class=\"chapter_name\">"+v.group_name+"</span><span class=\"fr\"><a class=\"mr20 curpoin\" onclick=\"addGroupUrlSys("+v.video_group_id+");\">新增</a><a class=\"curpoin show_and_hide_"+v.video_group_id+"\" onclick=\"showAndHide("+v.video_group_id+");\" data-status='0'>展开</a></span></div>");
  446. }
  447. }
  448. }
  449. addUrlSys(num,v,media_chapter_length);
  450. });
  451. }
  452. $(document).click(function(){
  453. $('#often_tags').hide();
  454. $('#often_tags_input').hide();
  455. event.stopPropagation();
  456. });
  457. $('#often_tags').click(function(){
  458. $('#often_tags').show();
  459. event.stopPropagation();
  460. });
  461. $('input[name=restric_type]').click(function(){
  462. $('#dl_arc_level_id').hide();
  463. $('#dl_users_price').hide();
  464. $('#no_vip_pay_label').hide();
  465. var restric_type = $(this).val();
  466. $('#arc_level_id').find('option:eq(0)').attr('selected',true);
  467. if (-1 < $.inArray(restric_type, ['1','3'])) {
  468. $('#dl_users_price').show();
  469. }
  470. if (-1 < $.inArray(restric_type, ['2','3'])) {
  471. $('#dl_arc_level_id').show();
  472. if (2 == restric_type) {
  473. $('#no_vip_pay_label').show();
  474. if ($('#no_vip_pay').is(':checked')){
  475. $('#dl_users_price').show();
  476. }
  477. }
  478. }
  479. });
  480. });
  481. function showAndHide(group_id) {
  482. var status = $(".show_and_hide_"+group_id).attr('data-status');
  483. if (0 == status) {
  484. //展开
  485. $(".upload_box_group_"+group_id).show();
  486. $(".show_and_hide_"+group_id).text('收缩');
  487. $(".show_and_hide_"+group_id).attr('data-status',"1");
  488. }else{
  489. $(".upload_box_group_"+group_id).hide();
  490. $(".show_and_hide_"+group_id).text('展开');
  491. $(".show_and_hide_"+group_id).attr('data-status',"0");
  492. }
  493. }
  494. // 判断输入框是否为空
  495. function check_submit(){
  496. urlToStr();
  497. if($.trim($('input[name=title]').val()) == ''){
  498. $($('.tab-base').find('.tab')[0]).trigger('click');
  499. showErrorMsg('标题不能为空!');
  500. $('input[name=title]').focus();
  501. return false;
  502. }
  503. if ($('#typeid').val() == 0) {
  504. $($('.tab-base').find('.tab')[0]).trigger('click');
  505. showErrorMsg('请选择栏目…!');
  506. $('#typeid').focus();
  507. return false;
  508. }
  509. var restric_type = $('input[name=restric_type]:checked').val()
  510. if ( restric_type == 1 || restric_type == 3 || (restric_type == 2 && $('#no_vip_pay').is(':checked'))){
  511. var users_price = $('#users_price').val();
  512. if (parseFloat(users_price).toString() == "NaN") {
  513. users_price = 0;
  514. }
  515. if (0 == users_price || users_price == '') {
  516. showErrorMsg('购买价格不能为空或0');
  517. $('#users_price').focus();
  518. return false;
  519. } else {
  520. var exp = /^(([1-9]\d*)|\d)(\.\d{1,2})?$/;
  521. if (!exp.test(users_price)) {
  522. showErrorMsg('购买价格格式不正确!');
  523. $('#users_price').focus();
  524. return false;
  525. }
  526. }
  527. }
  528. var htmlfilename = $.trim($('input[name=htmlfilename]').val());
  529. if (htmlfilename != '') {
  530. var exp = /^\d{1,}$/;
  531. if (exp.test(htmlfilename)) {
  532. showErrorAlert('自定义文件名不能纯数字,会与文档ID冲突!');
  533. $('input[name=htmlfilename]').focus();
  534. return false;
  535. }
  536. }
  537. layer_loading('正在处理');
  538. if(!ajax_check_htmlfilename())
  539. {
  540. layer.closeAll();
  541. showErrorMsg('同栏目下,自定义文件名已存在!');
  542. $('input[name=htmlfilename]').focus();
  543. return false;
  544. }
  545. setTimeout(function (){
  546. editor_auto_210607();
  547. $('#post_form').submit();
  548. }, 1);
  549. }
  550. function img_call_back(fileurl_tmp)
  551. {
  552. $("#litpic_local").val(fileurl_tmp);
  553. $("#img_a").attr('href', fileurl_tmp);
  554. $("#img_i").attr('onmouseover', "layer_tips=layer.tips('<img src="+fileurl_tmp+" class=\\'layer_tips_img\\'>',this,{tips: [1, '#fff']});");
  555. $("input[name=is_litpic]").attr('checked', true); // 自动勾选属性[图片]
  556. }
  557. function addGroupUrlSys(group_id){
  558. var is_show_qiniuyun = {$channelRow.data.qiniuyun_open|default=0};
  559. var is_show_oss = {$channelRow.data.oss_open|default=0};
  560. var is_show_cos = {$channelRow.data.cos_open|default=0};
  561. //点击新增的时候展开
  562. $(".upload_box_group_"+group_id).show();
  563. $(".show_and_hide_"+group_id).text('收缩');
  564. $(".show_and_hide_"+group_id).attr('data-status',"1");
  565. $("#num").val();
  566. var now_group_id = 0;
  567. var obj = '';
  568. var action = 'before';
  569. $('#url-box_sys .media_chapter').each(function(){
  570. if (now_group_id == group_id) {
  571. obj = $(this);
  572. action = 'before';
  573. return false;
  574. }else{
  575. now_group_id = $(this).data('group');
  576. obj = $(this);
  577. action = 'append';
  578. }
  579. });
  580. var num = $("#num").val();
  581. if (!num){
  582. num=0;
  583. }
  584. num++;
  585. $("#num").val(num);
  586. var html = "";
  587. //upload_box_group_? 用来做展开收缩的
  588. html += "<div id='num_upload_box_sys' class='media_del_1586481014_"+num+" upload_box_group_"+group_id+"' data-num='"+num+"' style='margin-bottom: 10px;'>\n" +
  589. " <span>&nbsp;链接地址:</span>\n" +
  590. " <input type=\"text\" class=\"input-txt\" id=\"video_url_sys_" + num + "\" style=\"width: 300px !important;\" >\n" +
  591. " <span>&nbsp;选集名称:</span>\n" +
  592. " <input type=\"text\" class=\"input-txt\" id=\"video_title_sys_" + num + "\" style=\"width: 150px !important;\">\n";
  593. // 视频章节分组插件
  594. var is_open_videogroup = {$is_open_videogroup|default=0};
  595. if (is_open_videogroup == 1) {
  596. html += " <span>&nbsp;所在章节:</span>\n";
  597. html += " <select class=\"video_group_id_sys\" id=\"video_group_id_sys_"+num+"\">\n";
  598. html += " <option value=\"0\">--请选择--</option>\n";
  599. var video_group_str = $('#video_group_list').val();
  600. if (video_group_str != '') {
  601. var video_group_list = jQuery.parseJSON(video_group_str);
  602. var selected = "";
  603. $.each(video_group_list, function(index, item){
  604. if (group_id == item.group_id) {
  605. selected = 'selected';
  606. }else{
  607. selected = '';
  608. }
  609. html += " <option value=\""+item.group_id+"\" "+selected+">"+item.group_name+"</option>\n";
  610. });
  611. }
  612. html += " </select>\n";
  613. }
  614. html += " <span>&nbsp;时长(秒):</span>\n" +
  615. " <input type=\"text\" class=\"input-txt\" id=\"video_time_sys_" + num + "\" style=\"width: 50px !important;\">\n" +
  616. " <span>&nbsp;排序:</span>\n" +
  617. " <input type=\"text\" class=\"input-txt\" id=\"video_sort_order_"+num+"\" value=\"100\" style=\"width: 50px !important;\">\n" +
  618. " <input type=\"hidden\" class=\"input-txt\" id=\"video_size_sys_"+num+"\">" +
  619. " <input type=\"hidden\" class=\"input-txt\" id=\"video_mime_sys_"+num+"\">" +
  620. " <input type=\"hidden\" class=\"input-txt\" id=\"video_name_sys_"+num+"\">" +
  621. " <input type=\"hidden\" class=\"input-txt\" id=\"video_file_id_"+num+"\">" +
  622. " <input type=\"file\" class=\"input-txt\" id=\"qiniu_click_sys_"+num+"\" onchange=\"QiniuUpload('"+num+"');\" style=\"display: none;\">\n"+
  623. " <input type=\"file\" class=\"input-txt\" id=\"oss_click_sys_"+num+"\" onchange=\"OssUpload('"+num+"');\" style=\"display: none;\">\n"+
  624. " <input type=\"file\" class=\"input-txt\" id=\"cos_click_sys_"+num+"\" onchange=\"CosUpload('"+num+"');\" style=\"display: none;\">\n";
  625. if (is_show_qiniuyun == 1) {
  626. html += " &nbsp;<a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" id=\"qiniu_upload_video_sys_" + num + "\" onclick=\"click_qiniu_sys('" + num + "')\">七牛云上传</a>\n";
  627. }
  628. if (is_show_oss == 1) {
  629. html += " &nbsp;<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";
  630. }
  631. if (is_show_cos == 1) {
  632. html += " &nbsp;<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";
  633. }
  634. html += " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" id=\"upload_video_sys_" + num + "\" data-num='" + num + "'>本地上传</a>\n" +
  635. " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" onclick=\"media_del('"+num+"')\">删除</a>\n" +
  636. " &nbsp; &nbsp; <label onselectstart='return false'><input type='checkbox' id='video_gratis_sys_"+num+"' value='1'>试看</label>" +
  637. " </div>";
  638. if ('before' == action) {
  639. obj.before(html);
  640. }else{
  641. $('#url-box_sys').append(html);
  642. }
  643. layui.use('upload', function(){
  644. var upload = layui.upload;
  645. var xhrOnProgress=function(fun) {
  646. xhrOnProgress.onprogress = fun;
  647. return function() {
  648. var xhr = $.ajaxSettings.xhr();
  649. if (typeof xhrOnProgress.onprogress !== 'function') {
  650. return xhr;
  651. }
  652. if (xhrOnProgress.onprogress && xhr.upload) {
  653. xhr.upload.onprogress = xhrOnProgress.onprogress;
  654. }
  655. return xhr;
  656. }
  657. };
  658. upload.render({
  659. elem: "#upload_video_sys_"+num
  660. ,url: "{:url('Ueditor/upVideo', ['savepath'=>'media'])}"
  661. ,accept: 'video' //视频
  662. ,exts: '{$media_type}'
  663. ,size: {$upload_max_filesize} //限制文件大小,单位 KB
  664. ,before: function(obj){
  665. $("#upload_video_sys_"+num).text('等待中...');
  666. }
  667. ,xhr:xhrOnProgress
  668. ,progress: function(percent) {
  669. $("#upload_video_sys_"+num).text('上传中...'+percent+'%');
  670. }
  671. ,done: function(res){
  672. if ("SUCCESS" == res.state) {
  673. var n = $(this.item).attr('data-num');
  674. $("#video_url_sys_"+n).val(res.url);
  675. $("#video_time_sys_"+n).val(res.time);
  676. $("#video_size_sys_"+n).val(res.size);
  677. $("#video_mime_sys_"+n).val(res.mime);
  678. $("#video_name_sys_"+n).val(res.title);
  679. $("#upload_video_sys_"+num).text('上传成功');
  680. setTimeout(function(){
  681. $('#upload_video_sys_'+num).text('本地上传');
  682. }, 2000 );
  683. }else {
  684. $("#upload_video_sys_"+num).text('上传失败');
  685. setTimeout(function(){
  686. $('#upload_video_sys_'+num).text('本地上传');
  687. }, 2000 );
  688. layer.msg(res.state,{icon: 2});
  689. }
  690. }
  691. ,error: function(){
  692. // layer.close(load); //关闭loading
  693. }
  694. });
  695. });
  696. }
  697. function addUrlSys(n,v,l){
  698. var is_show_qiniuyun = {$channelRow.data.qiniuyun_open|default=0};
  699. var is_show_oss = {$channelRow.data.oss_open|default=0};
  700. var is_show_cos = {$channelRow.data.cos_open|default=0};
  701. if (n){
  702. var num = n;
  703. var html = "";
  704. var is_open_videogroup = {$is_open_videogroup|default=0};
  705. var class_none = '';
  706. //默认展开第一条
  707. if (0 < v.video_group_id && is_open_videogroup == 1 && 0 < l){
  708. class_none = 'none';
  709. }
  710. html += "<div id=\"num_upload_box_sys\" class='"+class_none+" media_del_1586481014_"+num+" upload_box_group_"+v.video_group_id+"' data-num='"+num+"' style='margin-bottom: 10px;'>\n" +
  711. " <span>&nbsp;链接地址:</span>\n" +
  712. " <input type=\"text\" class=\"input-txt\" id=\"video_url_sys_"+num+"\" value=\""+v.file_url+"\" style=\"width: 300px !important;\" >\n" +
  713. " <span>&nbsp;选集名称:</span>\n" +
  714. " <input type=\"text\" class=\"input-txt\" id=\"video_title_sys_"+num+"\" value=\""+v.file_title+"\" style=\"width: 150px !important;\">\n";
  715. // 视频章节分组插件
  716. if (is_open_videogroup == 1) {
  717. html += " <span>&nbsp;所在章节:</span>\n";
  718. html += " <select class=\"video_group_id_sys\" id=\"video_group_id_sys_"+num+"\">\n";
  719. html += " <option value=\"0\">--请选择--</option>\n";
  720. var video_group_str = $('#video_group_list').val();
  721. if (video_group_str != '') {
  722. var video_group_list = jQuery.parseJSON(video_group_str);
  723. $.each(video_group_list, function(index, item){
  724. html += " <option value=\""+item.group_id+"\" ";
  725. if (item.group_id == v.video_group_id) {
  726. html += " selected=\"true\" ";
  727. }
  728. html += " >"+item.group_name+"</option>\n";
  729. });
  730. }
  731. html += " </select>\n";
  732. }
  733. html += " <span>&nbsp;时长(秒):</span>\n" +
  734. " <input type=\"text\" class=\"input-txt\" id=\"video_time_sys_"+num+"\" value=\""+v.file_time+"\" style=\"width: 50px !important;\">\n" +
  735. " <span>&nbsp;排序:</span>\n" +
  736. " <input type=\"text\" class=\"input-txt\" id=\"video_sort_order_"+num+"\" value=\""+v.sort_order+"\" style=\"width: 50px !important;\">\n" +
  737. " <input type=\"hidden\" class=\"input-txt\" id=\"video_size_sys_"+num+"\" value=\""+v.file_size+"\">" +
  738. " <input type=\"hidden\" class=\"input-txt\" id=\"video_mime_sys_"+num+"\" value=\""+v.file_mime+"\">" +
  739. " <input type=\"hidden\" class=\"input-txt\" id=\"video_name_sys_"+num+"\" value=\""+v.file_name+"\">" +
  740. " <input type=\"hidden\" class=\"input-txt\" id=\"video_file_id_"+num+"\" value=\""+v.file_id+"\">" +
  741. " <input type=\"file\" class=\"input-txt\" id=\"qiniu_click_sys_"+num+"\" onchange=\"QiniuUpload('"+num+"');\" style=\"display: none;\">\n"+
  742. " <input type=\"file\" class=\"input-txt\" id=\"oss_click_sys_"+num+"\" onchange=\"OssUpload('"+num+"');\" style=\"display: none;\">\n"+
  743. " <input type=\"file\" class=\"input-txt\" id=\"cos_click_sys_"+num+"\" onchange=\"CosUpload('"+num+"');\" style=\"display: none;\">\n";
  744. if (is_show_qiniuyun == 1) {
  745. html += " &nbsp;<a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" id=\"qiniu_upload_video_sys_"+num+"\" onclick=\"click_qiniu_sys('"+num+"')\">七牛云上传</a>\n";
  746. }
  747. if (is_show_oss == 1) {
  748. html += " &nbsp;<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";
  749. }
  750. if (is_show_cos == 1) {
  751. html += " &nbsp;<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";
  752. }
  753. var IsGratis = 1 == v.gratis ? 'checked' : '';
  754. html += " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" id=\"upload_video_sys_"+num+"\" data-num='"+num+"'>本地上传</a>\n" +
  755. " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" onclick=\"media_del('"+num+"')\">删除</a>\n" +
  756. " &nbsp; &nbsp; <label onselectstart='return false'><input type='checkbox' id='video_gratis_sys_"+num+"' value='1' "+IsGratis+">试看</label>" +
  757. " </div>";
  758. $('#url-box_sys').append(html);
  759. } else {
  760. var num = $("#num").val();
  761. if (!num){
  762. num=0;
  763. }
  764. num++;
  765. $("#num").val(num);
  766. var html = "";
  767. html += "<div id=\"num_upload_box_sys\" class='media_del_1586481014_"+num+"' data-num='"+num+"' style='margin-bottom: 10px;'>\n" +
  768. " <span>&nbsp;链接地址:</span>\n" +
  769. " <input type=\"text\" class=\"input-txt\" id=\"video_url_sys_" + num + "\" style=\"width: 300px !important;\" >\n" +
  770. " <span>&nbsp;选集名称:</span>\n" +
  771. " <input type=\"text\" class=\"input-txt\" id=\"video_title_sys_" + num + "\" style=\"width: 150px !important;\">\n";
  772. // 视频章节分组插件
  773. var is_open_videogroup = {$is_open_videogroup|default=0};
  774. if (is_open_videogroup == 1) {
  775. html += " <span>&nbsp;所在章节:</span>\n";
  776. html += " <select class=\"video_group_id_sys\" id=\"video_group_id_sys_"+num+"\">\n";
  777. html += " <option value=\"0\">--请选择--</option>\n";
  778. var video_group_str = $('#video_group_list').val();
  779. if (video_group_str != '') {
  780. var video_group_list = jQuery.parseJSON(video_group_str);
  781. $.each(video_group_list, function(index, item){
  782. html += " <option value=\""+item.group_id+"\">"+item.group_name+"</option>\n";
  783. });
  784. }
  785. html += " </select>\n";
  786. }
  787. html += " <span>&nbsp;时长(秒):</span>\n" +
  788. " <input type=\"text\" class=\"input-txt\" id=\"video_time_sys_" + num + "\" style=\"width: 50px !important;\">\n" +
  789. " <span>&nbsp;排序:</span>\n" +
  790. " <input type=\"text\" class=\"input-txt\" id=\"video_sort_order_"+num+"\" value=\"100\" style=\"width: 50px !important;\">\n" +
  791. " <input type=\"hidden\" class=\"input-txt\" id=\"video_size_sys_"+num+"\">" +
  792. " <input type=\"hidden\" class=\"input-txt\" id=\"video_mime_sys_"+num+"\">" +
  793. " <input type=\"hidden\" class=\"input-txt\" id=\"video_name_sys_"+num+"\">" +
  794. " <input type=\"hidden\" class=\"input-txt\" id=\"video_file_id_"+num+"\">" +
  795. " <input type=\"file\" class=\"input-txt\" id=\"qiniu_click_sys_"+num+"\" onchange=\"QiniuUpload('"+num+"');\" style=\"display: none;\">\n"+
  796. " <input type=\"file\" class=\"input-txt\" id=\"oss_click_sys_"+num+"\" onchange=\"OssUpload('"+num+"');\" style=\"display: none;\">\n"+
  797. " <input type=\"file\" class=\"input-txt\" id=\"cos_click_sys_"+num+"\" onchange=\"CosUpload('"+num+"');\" style=\"display: none;\">\n";
  798. if (is_show_qiniuyun == 1) {
  799. html += " &nbsp;<a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" id=\"qiniu_upload_video_sys_" + num + "\" onclick=\"click_qiniu_sys('" + num + "')\">七牛云上传</a>\n";
  800. }
  801. if (is_show_oss == 1) {
  802. html += " &nbsp;<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";
  803. }
  804. if (is_show_cos == 1) {
  805. html += " &nbsp;<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";
  806. }
  807. html += " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" id=\"upload_video_sys_" + num + "\" data-num='" + num + "'>本地上传</a>\n" +
  808. " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" onclick=\"media_del('"+num+"')\">删除</a>\n" +
  809. " &nbsp; &nbsp; <label onselectstart='return false'><input type='checkbox' id='video_gratis_sys_"+num+"' value='1'>试看</label>" +
  810. " </div>";
  811. if (is_open_videogroup == 1) {
  812. $('#url-box_sys').prepend(html);
  813. }else{
  814. $('#url-box_sys').append(html);
  815. }
  816. }
  817. layui.use('upload', function(){
  818. var upload = layui.upload;
  819. var xhrOnProgress=function(fun) {
  820. xhrOnProgress.onprogress = fun;
  821. return function() {
  822. var xhr = $.ajaxSettings.xhr();
  823. if (typeof xhrOnProgress.onprogress !== 'function') {
  824. return xhr;
  825. }
  826. if (xhrOnProgress.onprogress && xhr.upload) {
  827. xhr.upload.onprogress = xhrOnProgress.onprogress;
  828. }
  829. return xhr;
  830. }
  831. };
  832. upload.render({
  833. elem: "#upload_video_sys_"+num
  834. ,url: "{:url('Ueditor/upVideo', ['savepath'=>'media'])}"
  835. ,accept: 'video' //视频
  836. ,exts: '{$media_type}'
  837. ,size: {$upload_max_filesize} //限制文件大小,单位 KB
  838. ,before: function(obj){
  839. $("#upload_video_sys_"+num).text('等待中...');
  840. }
  841. ,xhr:xhrOnProgress
  842. ,progress: function(percent) {
  843. $("#upload_video_sys_"+num).text('上传中...'+percent+'%');
  844. }
  845. ,done: function(res){
  846. if ("SUCCESS" == res.state) {
  847. var n = $(this.item).attr('data-num');
  848. $("#video_url_sys_"+n).val(res.url);
  849. $("#video_time_sys_"+n).val(res.time);
  850. $("#video_size_sys_"+n).val(res.size);
  851. $("#video_mime_sys_"+n).val(res.mime);
  852. $("#video_name_sys_"+n).val(res.title);
  853. $("#upload_video_sys_"+num).text('上传成功');
  854. setTimeout(function(){
  855. $('#upload_video_sys_'+num).text('本地上传');
  856. }, 2000 );
  857. }else {
  858. $("#upload_video_sys_"+num).text('上传失败');
  859. setTimeout(function(){
  860. $('#upload_video_sys_'+num).text('本地上传');
  861. }, 2000 );
  862. layer.msg(res.state,{icon: 2});
  863. }
  864. }
  865. ,error: function(){
  866. // layer.close(load); //关闭loading
  867. }
  868. });
  869. });
  870. }
  871. function media_del(num) {
  872. $(".media_del_1586481014_"+num).remove();
  873. }
  874. function click_qiniu_sys(num)
  875. {
  876. $("#qiniu_click_sys_"+num).trigger("click");
  877. }
  878. function QiniuUpload(num)
  879. {
  880. var file = $("#qiniu_click_sys_"+num)[0].files[0];
  881. var fileName = file.name;
  882. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  883. var ext = judgeExt(fileExt);
  884. if (ext==-1) {
  885. showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
  886. return false;
  887. }
  888. var size = "{$upload_max_filesize}";
  889. if (file.size > size) {
  890. showErrorMsg('视频大小超过限制,可在附件设置中修改');
  891. return false;
  892. }
  893. $.ajax({
  894. type: 'POST',
  895. url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
  896. data: {_ajax:1},
  897. dataType: "JSON",
  898. success: function(res1){
  899. if (1 == res1.code){
  900. var token = res1.data.token;
  901. var formData = new FormData();
  902. formData.append('file', file);
  903. formData.append('token', token);
  904. fileName = res1.data.filePath + fileExt;
  905. formData.append('key', fileName);
  906. $.ajax({
  907. url: res1.data.uphost,
  908. type: 'POST',
  909. dataType: 'JSON',
  910. data: formData,
  911. timeout: 1200000,
  912. cache: false,
  913. processData: false,
  914. contentType: false,
  915. xhr: function () {
  916. myXhr = $.ajaxSettings.xhr();
  917. if (myXhr.upload) {
  918. myXhr.upload.addEventListener('progress', function(e){
  919. var curr = e.loaded;
  920. var total = e.total;
  921. var process = parseInt(curr / total * 100);
  922. $("#qiniu_upload_video_sys_"+num).text('上传中...'+process+"%");
  923. });
  924. }
  925. return myXhr;
  926. },
  927. success: function(res2){
  928. $("#qiniu_upload_video_sys_"+num).text('上传成功');
  929. var video_url = res1.data.domain+"/"+res2.key;
  930. $("#video_url_sys_"+num).val(video_url);
  931. $("#video_mime_sys_"+num).val('');
  932. $("#video_name_sys_"+num).val(res2.key);
  933. setTimeout(function(){
  934. $('#qiniu_upload_video_sys_'+num).text('七牛云上传');
  935. }, 2000 )
  936. var rx=/^https?:\/\//i;
  937. if (!rx.test(video_url)) {
  938. video_url = 'http:'+video_url;
  939. }
  940. $.ajax({
  941. type: 'GET',
  942. url: video_url+"?avinfo",
  943. data: {},
  944. dataType: "JSON",
  945. success: function (res3) {
  946. $("#video_time_sys_"+num).val(parseInt(res3.format.duration));
  947. $("#video_size_sys_"+num).val(res3.format.size);
  948. }
  949. })
  950. },
  951. error: function(e){
  952. showErrorMsg(e.responseText);
  953. return false;
  954. }
  955. });
  956. }else{
  957. $("#qiniu_click_sys_"+num).val('');
  958. if (res1.data.code == -1) {
  959. showErrorMsg(res1.msg);
  960. } else if (res1.data.code == -2) {
  961. layer.alert(res1.msg, {icon: 5, title: false, btn:['启用']}, function(index){
  962. layer.close(index);
  963. layer_loading('正在启用');
  964. $.ajax({
  965. type: 'POST',
  966. url: "{:url('Index/changeTableVal')}",
  967. data: {table:'weapp', id_name:'id', id_value:res1.data.id, field:'status', value:1, _ajax:1},
  968. dataType: "JSON",
  969. success: function (res) {
  970. layer.closeAll();
  971. if (res.code == 1) {
  972. layer.msg(res.msg, {icon: 1, time:1000});
  973. } else {
  974. showErrorMsg(res.msg);
  975. }
  976. }
  977. })
  978. });
  979. } else if (res1.data.code == -3) {
  980. layer.confirm(res1.msg, {
  981. icon: 5,
  982. title: false,
  983. btn: ['立即配置']
  984. }, function () {
  985. layer.closeAll();
  986. //iframe窗
  987. layer.open({
  988. type: 2,
  989. title: false,
  990. fixed: true,
  991. shadeClose: false,
  992. shade: layer_shade,
  993. maxmin: false,
  994. area: ['80%', '80%'],
  995. content: "{:weapp_url('Qiniuyun/Qiniuyun/index')}"
  996. });
  997. }, function (index) {
  998. layer.closeAll();
  999. });
  1000. } else {
  1001. showErrorMsg(res1.msg);
  1002. }
  1003. }
  1004. },
  1005. error: function(e){
  1006. $("#qiniu_click_sys_"+num).val('');
  1007. showErrorMsg(e.responseText);
  1008. }
  1009. });
  1010. }
  1011. function click_oss_sys(num)
  1012. {
  1013. $("#oss_click_sys_"+num).trigger("click");
  1014. }
  1015. function OssUpload(num)
  1016. {
  1017. var file = $("#oss_click_sys_"+num)[0].files[0]; //获取文件路径名
  1018. //获取视频时长start
  1019. var url = URL.createObjectURL(file);
  1020. var oVideo = document.createElement('video');
  1021. var duration = 0;
  1022. oVideo.setAttribute('src',url);
  1023. oVideo.oncanplay = ()=>{
  1024. duration = parseInt(oVideo.duration);
  1025. }
  1026. //获取视频时长end
  1027. var fileName = file.name;
  1028. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  1029. var ext = judgeExt(fileExt);
  1030. if (ext==-1) {
  1031. showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
  1032. return false;
  1033. }
  1034. var size = "{$upload_max_filesize}";
  1035. if (file.size > size) {
  1036. showErrorMsg('视频大小超过限制,可在附件设置中修改');
  1037. return false;
  1038. }
  1039. $.ajax({
  1040. type: 'POST',
  1041. url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
  1042. data: {_ajax:1},
  1043. dataType: "JSON",
  1044. success: function(res1){
  1045. if (1 == res1.code){
  1046. fileName = res1.data.filePath + fileExt;
  1047. //组装发送数据
  1048. var request = new FormData();
  1049. request.append("OSSAccessKeyId",res1.data.accessid);//Bucket 拥有者的Access Key Id。
  1050. request.append("policy",res1.data.policy);//policy规定了请求的表单域的合法性
  1051. request.append("Signature",res1.data.signature);//根据Access Key Secret和policy计算的签名信息,OSS验证该签名信息从而验证该Post请求的合法性
  1052. request.append("key",fileName);//文件名字,可设置路径
  1053. request.append("success_action_status",201);// 让服务端返回200,不然,默认会返回204
  1054. request.append('file', file);//需要上传的文件 file
  1055. $.ajax({
  1056. url : res1.data.host, //上传阿里地址
  1057. data : request,
  1058. processData: false,
  1059. cache: false,
  1060. contentType: false,
  1061. dataType: 'xml',
  1062. type : 'post',
  1063. xhr: function () {
  1064. myXhr = $.ajaxSettings.xhr();
  1065. if (myXhr.upload) {
  1066. myXhr.upload.addEventListener('progress', function(e){
  1067. var curr = e.loaded;
  1068. var total = e.total;
  1069. var process = parseInt(curr / total * 100);
  1070. $("#oss_upload_video_sys_"+num).text('上传中...'+process+"%");
  1071. });
  1072. }
  1073. return myXhr;
  1074. },
  1075. success : function(data) {
  1076. var res = $(data).find('PostResponse');
  1077. if (res) {
  1078. var key = res.find('Key').text();
  1079. $("#oss_upload_video_sys_"+num).text('上传成功');
  1080. setTimeout(function(){
  1081. $('#oss_upload_video_sys_'+num).text('oss上传');
  1082. }, 2000 )
  1083. var video_url = res1.data.domain+"/"+key;
  1084. $("#video_url_sys_"+num).val(video_url);
  1085. $("#video_mime_sys_"+num).val('');
  1086. $("#video_name_sys_"+num).val(key);
  1087. $("#video_time_sys_"+num).val(duration);
  1088. $("#video_size_sys_"+num).val(file.size);
  1089. }else{
  1090. $("#oss_upload_video_sys_"+num).text('上传失败');
  1091. setTimeout(function(){
  1092. $('#oss_upload_video_sys_'+num).text('oss上传');
  1093. }, 2000 )
  1094. }
  1095. },
  1096. error : function(e) {
  1097. console.log(e.responseText);
  1098. }
  1099. });
  1100. }else{
  1101. $("#oss_click_sys_"+num).val('');
  1102. showErrorMsg(res1.msg);
  1103. }
  1104. },
  1105. error: function(e){
  1106. $("#oss_click_sys_"+num).val('');
  1107. showErrorMsg(e.responseText);
  1108. }
  1109. });
  1110. }
  1111. // 课件地址上传
  1112. function upload_file_courseware_1585641738(e){
  1113. var data_type = $(e).attr('data-type');
  1114. if ('qiniu' == data_type) {
  1115. upload_addonFieldExt_courseware_qiniu(e); // 七牛云上传
  1116. } else if ('oss' == data_type) {
  1117. upload_addonFieldExt_courseware_oss(e); // OSS上传
  1118. } else if ('cos' == data_type) {
  1119. upload_addonFieldExt_courseware_cos(e); // COS上传
  1120. } else {
  1121. var file = $(e)[0].files[0];
  1122. if (!file) {
  1123. return false;
  1124. }
  1125. var formData = new FormData();
  1126. formData.append('file',file);
  1127. $.ajax({
  1128. type: 'post',
  1129. url: "{:url('Ueditor/DownloadUploadFileAjax')}",
  1130. data: formData,
  1131. contentType: false,
  1132. processData: false,
  1133. dataType: 'json',
  1134. xhr: function () {
  1135. myXhr = $.ajaxSettings.xhr();
  1136. if (myXhr.upload) {
  1137. myXhr.upload.addEventListener('progress', function(e){
  1138. var curr = e.loaded;
  1139. var total = e.total;
  1140. var process = parseInt(curr / total * 100);
  1141. $("#upload_addonFieldExt_courseware_local").html('上传中...'+process+"%");
  1142. });
  1143. }
  1144. return myXhr;
  1145. },
  1146. success: function (res) {
  1147. $("#upload_addonFieldExt_courseware_local").html('上传成功');
  1148. setTimeout(function(){
  1149. $('#upload_addonFieldExt_courseware_local').html('本地上传');
  1150. }, 2000 );
  1151. if (res.code==0){
  1152. showErrorMsg(res.msg);
  1153. }else {
  1154. $("#addonFieldExt_courseware").val(res.file_url);
  1155. }
  1156. }
  1157. })
  1158. }
  1159. }
  1160. function upload_addonFieldExt_courseware_qiniu(obj)
  1161. {
  1162. var file = $("#courseware_file")[0].files[0];
  1163. var fileName = file.name;
  1164. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  1165. var ext = judgeExt(fileExt,1);
  1166. if (ext==-1) {
  1167. showErrorMsg('不支持选中的文件格式,可在附件设置中修改');
  1168. return false;
  1169. }
  1170. var size = "{$upload_max_filesize}";
  1171. if (file.size > size) {
  1172. showErrorMsg('文件大小超过限制,可在附件设置中修改');
  1173. return false;
  1174. }
  1175. $.ajax({
  1176. type: 'POST',
  1177. url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
  1178. data: {_ajax:1},
  1179. dataType: "JSON",
  1180. success: function(res1){
  1181. if (1 == res1.code){
  1182. var token = res1.data.token;
  1183. var formData = new FormData();
  1184. formData.append('file', file);
  1185. formData.append('token', token);
  1186. fileName = res1.data.filePath + fileExt;
  1187. formData.append('key', fileName);
  1188. $.ajax({
  1189. url: res1.data.uphost,
  1190. type: 'POST',
  1191. dataType: 'JSON',
  1192. data: formData,
  1193. timeout: 1200000,
  1194. cache: false,
  1195. processData: false,
  1196. contentType: false,
  1197. xhr: function () {
  1198. myXhr = $.ajaxSettings.xhr();
  1199. if (myXhr.upload) {
  1200. myXhr.upload.addEventListener('progress', function(e){
  1201. var curr = e.loaded;
  1202. var total = e.total;
  1203. var process = parseInt(curr / total * 100);
  1204. $("#upload_addonFieldExt_courseware_qiniu").html('上传中...'+process+"%");
  1205. });
  1206. }
  1207. return myXhr;
  1208. },
  1209. success: function(res2){
  1210. $("#upload_addonFieldExt_courseware_qiniu").html('上传成功');
  1211. setTimeout(function(){
  1212. $('#upload_addonFieldExt_courseware_qiniu').html('七牛云上传');
  1213. }, 2000 );
  1214. var video_url = res1.data.domain+"/"+res2.key;
  1215. $("#addonFieldExt_courseware").val(video_url);
  1216. },
  1217. error: function(e){
  1218. showErrorMsg(e.responseText);
  1219. return false;
  1220. }
  1221. });
  1222. }else{
  1223. $("#courseware_file").val('');
  1224. showErrorMsg(res1.msg);
  1225. }
  1226. },
  1227. error: function(e){
  1228. $("#courseware_file").val('');
  1229. showErrorMsg(e.responseText);
  1230. }
  1231. });
  1232. }
  1233. function upload_addonFieldExt_courseware_oss(obj)
  1234. {
  1235. var file = $("#courseware_file")[0].files[0];
  1236. var fileName = file.name;
  1237. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  1238. var ext = judgeExt(fileExt,1);
  1239. if (ext==-1) {
  1240. showErrorMsg('不支持选中的文件格式,可在附件设置中修改');
  1241. return false;
  1242. }
  1243. var size = "{$upload_max_filesize}";
  1244. if (file.size > size) {
  1245. showErrorMsg('文件大小超过限制,可在附件设置中修改');
  1246. return false;
  1247. }
  1248. $.ajax({
  1249. type: 'POST',
  1250. url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
  1251. data: {_ajax:1},
  1252. dataType: "JSON",
  1253. success: function(res1){
  1254. if (1 == res1.code){
  1255. fileName = res1.data.filePath + fileExt;
  1256. //组装发送数据
  1257. var request = new FormData();
  1258. request.append("OSSAccessKeyId",res1.data.accessid);//Bucket 拥有者的Access Key Id。
  1259. request.append("policy",res1.data.policy);//policy规定了请求的表单域的合法性
  1260. request.append("Signature",res1.data.signature);//根据Access Key Secret和policy计算的签名信息,OSS验证该签名信息从而验证该Post请求的合法性
  1261. request.append("key",fileName);//文件名字,可设置路径
  1262. request.append("success_action_status",201);// 让服务端返回200,不然,默认会返回204
  1263. request.append('file', file);//需要上传的文件 file
  1264. $.ajax({
  1265. url : res1.data.host,
  1266. data : request,
  1267. processData: false,
  1268. cache: false,
  1269. contentType: false,
  1270. dataType: 'xml',
  1271. type : 'post',
  1272. xhr: function () {
  1273. myXhr = $.ajaxSettings.xhr();
  1274. if (myXhr.upload) {
  1275. myXhr.upload.addEventListener('progress', function(e){
  1276. var curr = e.loaded;
  1277. var total = e.total;
  1278. var process = parseInt(curr / total * 100);
  1279. $("#upload_addonFieldExt_courseware_oss").html('上传中...'+process+"%");
  1280. });
  1281. }
  1282. return myXhr;
  1283. },
  1284. success: function(res2){
  1285. var res = $(res2).find('PostResponse');
  1286. if (res) {
  1287. var key = res.find('Key').text();
  1288. $("#upload_addonFieldExt_courseware_oss").html('上传成功');
  1289. setTimeout(function(){
  1290. $('#upload_addonFieldExt_courseware_oss').html('oss上传');
  1291. }, 2000 );
  1292. var video_url = res1.data.domain+"/"+key;
  1293. $("#addonFieldExt_courseware").val(video_url);
  1294. }else{
  1295. $("#upload_addonFieldExt_courseware_oss").html('上传失败');
  1296. setTimeout(function(){
  1297. $('#upload_addonFieldExt_courseware_oss').html('oss上传');
  1298. }, 2000 );
  1299. }
  1300. },
  1301. error: function(e){
  1302. showErrorMsg(e.responseText);
  1303. return false;
  1304. }
  1305. });
  1306. }else{
  1307. $("#courseware_file").val('');
  1308. showErrorMsg(res1.msg);
  1309. }
  1310. },
  1311. error: function(e){
  1312. $("#courseware_file").val('');
  1313. showErrorMsg(e.responseText);
  1314. }
  1315. });
  1316. }
  1317. function judgeExt(ext,i) {
  1318. var type = '';
  1319. if (i==1){
  1320. type = "{$file_type}";
  1321. }else{
  1322. type = "{$media_type}";
  1323. }
  1324. var extArr = [];
  1325. extArr = type.split("|");
  1326. var ext = ext.replace(".","");
  1327. return extArr.indexOf(ext);
  1328. }
  1329. //腾讯云COS上传代码-陈风任2021-02-03
  1330. function click_cos_sys(num) {
  1331. $("#cos_click_sys_"+num).trigger("click");
  1332. }
  1333. // 上传视频
  1334. function CosUpload(num) {
  1335. // 获取文件路径名
  1336. var file = $("#cos_click_sys_"+num)[0].files[0];
  1337. // 获取视频时长start
  1338. var url = URL.createObjectURL(file);
  1339. var oVideo = document.createElement('video');
  1340. var duration = 0;
  1341. oVideo.setAttribute('src', url);
  1342. oVideo.oncanplay = ()=>{
  1343. duration = parseInt(oVideo.duration);
  1344. }
  1345. var fileName = file.name;
  1346. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  1347. var ext = judgeExt(fileExt);
  1348. if (ext == -1) {
  1349. showErrorMsg('不支持选中的视频格式,可在附件设置中修改');
  1350. return false;
  1351. }
  1352. var size = "{$upload_max_filesize}";
  1353. if (file.size > size) {
  1354. showErrorMsg('视频大小超过限制,可在附件设置中修改');
  1355. return false;
  1356. }
  1357. var formData = new FormData();
  1358. formData.append('file', file);
  1359. formData.append('file_ext', fileExt);
  1360. $.ajax({
  1361. type: 'post',
  1362. url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&_ajax=1',
  1363. data: formData,
  1364. contentType: false,
  1365. processData: false,
  1366. dataType: 'json',
  1367. xhr: function () {
  1368. myXhr = $.ajaxSettings.xhr();
  1369. if (myXhr.upload) {
  1370. myXhr.upload.addEventListener('progress', function(e){
  1371. var curr = e.loaded;
  1372. var total = e.total;
  1373. process = parseInt(curr / total * 100);
  1374. if (100 == process) {
  1375. process = 99;
  1376. layer_loading('上传腾讯云');
  1377. }
  1378. $("#cos_upload_video_sys_"+num).text('上传中...'+process+"%");
  1379. });
  1380. }
  1381. return myXhr;
  1382. },
  1383. success: function(res) {
  1384. layer.closeAll();
  1385. if (1 == res.code) {
  1386. $("#video_url_sys_" + num).val(res.data.url);
  1387. $("#video_title_sys_" + num).val(res.data.name);
  1388. $("#video_time_sys_" + num).val(duration);
  1389. $("#video_size_sys_" + num).val(res.data.size);
  1390. $("#cos_upload_video_sys_"+num).text('上传成功');
  1391. } else {
  1392. $("#cos_upload_video_sys_"+num).text('上传失败');
  1393. }
  1394. setTimeout(function(){
  1395. $('#cos_upload_video_sys_'+num).text('cos上传');
  1396. }, 2000);
  1397. },
  1398. error: function(e){
  1399. layer.closeAll();
  1400. $("#cos_click_sys_"+num).val('');
  1401. showErrorMsg(e.responseText);
  1402. }
  1403. });
  1404. }
  1405. // 上传附件
  1406. function upload_addonFieldExt_courseware_cos() {
  1407. var file = $("#courseware_file")[0].files[0];
  1408. var fileName = file.name;
  1409. var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
  1410. var ext = judgeExt(fileExt,1);
  1411. if (ext == -1) {
  1412. showErrorMsg('不支持选中的文件格式,可在附件设置中修改');
  1413. return false;
  1414. }
  1415. var size = "{$upload_max_filesize}";
  1416. if (file.size > size) {
  1417. showErrorMsg('文件大小超过限制,可在附件设置中修改');
  1418. return false;
  1419. }
  1420. var formData = new FormData();
  1421. formData.append('file', file);
  1422. formData.append('file_ext', fileExt);
  1423. $.ajax({
  1424. type: 'post',
  1425. url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&up_type=1&_ajax=1',
  1426. data: formData,
  1427. contentType: false,
  1428. processData: false,
  1429. dataType: 'json',
  1430. xhr: function () {
  1431. myXhr = $.ajaxSettings.xhr();
  1432. if (myXhr.upload) {
  1433. myXhr.upload.addEventListener('progress', function(e){
  1434. var curr = e.loaded;
  1435. var total = e.total;
  1436. var process = parseInt(curr / total * 100);
  1437. if (100 == process) {
  1438. process = 99;
  1439. layer_loading('上传腾讯云');
  1440. }
  1441. $("#upload_addonFieldExt_courseware_cos").html('上传中...'+process+"%");
  1442. });
  1443. }
  1444. return myXhr;
  1445. },
  1446. success: function(res) {
  1447. layer.closeAll();
  1448. if (1 == res.code) {
  1449. $("#upload_addonFieldExt_courseware_cos").html('上传成功');
  1450. $("#addonFieldExt_courseware").val(res.data.url);
  1451. } else {
  1452. $("#upload_addonFieldExt_courseware_cos").html('上传失败');
  1453. }
  1454. setTimeout(function() {
  1455. $('#upload_addonFieldExt_courseware_cos').html('oss上传');
  1456. }, 2000);
  1457. },
  1458. error: function(e){
  1459. layer.closeAll();
  1460. $("#courseware_file").val('');
  1461. showErrorMsg(e.responseText);
  1462. }
  1463. });
  1464. }
  1465. /* END */
  1466. //批量导入视频信息
  1467. function batch_import_url() {
  1468. layer.prompt({
  1469. formType: 2,
  1470. shade: layer_shade,
  1471. value: '参考格式:链接地址$选集名称$时长(秒)$试看(是/否)\r\n示例如下:\r\nhttp://www.xxx.com/1.mp4$名称1$30$是\r\nhttp://www.xxx.com/2.mp4$名称2$50$否',
  1472. title: '批量导入视频链接',
  1473. area: ['800px', '250px'] //自定义文本域宽高
  1474. ,id: 'ey_batch_links'
  1475. ,maxlength: 60000
  1476. ,success: function(layero, index){
  1477. $("#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$否');
  1478. }
  1479. }, function(value, index, elem){
  1480. let code = value.split(/[(\r\n)\r\n]+/); // 根据换行或者回车进行识别
  1481. code.forEach((item, index) => { // 删除空项
  1482. if (!item) {
  1483. code.splice(index, 1);
  1484. }else{
  1485. code[index] = item.split('$');
  1486. }
  1487. })
  1488. code = Array.from(new Set(code)); // 去重
  1489. code.forEach((item, index) => { // 删除空项
  1490. addImportUrlSys(item[0],item[1],item[2],item[3]);
  1491. })
  1492. layer.close(index);
  1493. });
  1494. }
  1495. function addImportUrlSys(url,name,time,gratis){
  1496. // var first = $('#url-box_sys #num_upload_box_sys:first-child').attr('data-num');
  1497. // if('' == $('#video_url_sys_'+first).val()){
  1498. // $('#url-box_sys div:first-child').remove();
  1499. // }
  1500. if ('undefined' == name || !name) {
  1501. name = '';
  1502. }
  1503. if ('undefined' == time || !time) {
  1504. time = '';
  1505. }
  1506. if ('是' == gratis){
  1507. gratis = 'checked';
  1508. }else{
  1509. gratis = '';
  1510. }
  1511. var is_show_qiniuyun = {$channelRow.data.qiniuyun_open|default=0};
  1512. var is_show_oss = {$channelRow.data.oss_open|default=0};
  1513. var is_show_cos = {$channelRow.data.cos_open|default=0};
  1514. // var num = $("div [id=num_upload_box_sys]").last().attr("data-num");
  1515. var num = $("#num").val();
  1516. if (!num){
  1517. num=0;
  1518. }
  1519. num++;
  1520. $("#num").val(num);
  1521. var html = "";
  1522. html += "<div id=\"num_upload_box_sys\" class='media_del_1586481014_"+num+"' data-num='"+num+"' style='margin-bottom: 10px;'>\n" +
  1523. " <span>&nbsp;链接地址:</span>\n" +
  1524. " <input type=\"text\" class=\"input-txt\" id=\"video_url_sys_"+num+"\" value='"+url+"' style=\"width: 300px !important;\" >\n" +
  1525. " <span>&nbsp;选集名称:</span>\n" +
  1526. " <input type=\"text\" class=\"input-txt\" id=\"video_title_sys_"+num+"\" value='"+name+"' style=\"width: 150px !important;\">\n";
  1527. // 视频章节分组插件
  1528. var is_open_videogroup = {$is_open_videogroup|default=0};
  1529. if (is_open_videogroup == 1) {
  1530. html += " <span>&nbsp;所在章节:</span>\n";
  1531. html += " <select class=\"video_group_id_sys\" id=\"video_group_id_sys_"+num+"\">\n";
  1532. html += " <option value=\"0\">--请选择--</option>\n";
  1533. var video_group_str = $('#video_group_list').val();
  1534. if (video_group_str != '') {
  1535. var video_group_list = jQuery.parseJSON(video_group_str);
  1536. $.each(video_group_list, function(index, item){
  1537. html += " <option value=\""+item.group_id+"\" ";
  1538. html += " >"+item.group_name+"</option>\n";
  1539. });
  1540. }
  1541. html += " </select>\n";
  1542. }
  1543. html += " <span>&nbsp;时长(秒):</span>\n" +
  1544. " <input type=\"text\" class=\"input-txt\" id=\"video_time_sys_"+num+"\" value='"+time+"' style=\"width: 50px !important;\">\n" +
  1545. " <span>&nbsp;排序:</span>\n" +
  1546. " <input type=\"text\" class=\"input-txt\" id=\"video_sort_order_"+num+"\" value='100' style=\"width: 50px !important;\">\n" +
  1547. " <input type=\"hidden\" class=\"input-txt\" id=\"video_size_sys_"+num+"\">" +
  1548. " <input type=\"hidden\" class=\"input-txt\" id=\"video_mime_sys_"+num+"\">" +
  1549. " <input type=\"hidden\" class=\"input-txt\" id=\"video_name_sys_"+num+"\">" +
  1550. " <input type=\"file\" class=\"input-txt\" id=\"qiniu_click_sys_"+num+"\" onchange=\"QiniuUpload('"+num+"');\" style=\"display: none;\">\n"+
  1551. " <input type=\"file\" class=\"input-txt\" id=\"oss_click_sys_"+num+"\" onchange=\"OssUpload('"+num+"');\" style=\"display: none;\">\n"+
  1552. " <input type=\"file\" class=\"input-txt\" id=\"cos_click_sys_"+num+"\" onchange=\"CosUpload('"+num+"');\" style=\"display: none;\">\n";
  1553. if (is_show_qiniuyun == 1) {
  1554. html += " &nbsp;<a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" id=\"qiniu_upload_video_sys_"+num+"\" onclick=\"click_qiniu_sys('"+num+"');\">七牛云上传</a>\n";
  1555. }
  1556. if (is_show_oss == 1) {
  1557. html += " &nbsp;<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";
  1558. }
  1559. if (is_show_cos == 1) {
  1560. html += " &nbsp;<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";
  1561. }
  1562. html += " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green \" id=\"upload_video_sys_"+num+"\" data-num='"+num+"'>本地上传</a>\n" +
  1563. " <a href=\"javascript:void(0);\" class=\"ncap-btn ncap-btn-green\" onclick=\"media_del('"+num+"');\">删除</a>\n" +
  1564. " &nbsp; &nbsp; <label onselectstart='return false'><input type='checkbox' id='video_gratis_sys_"+num+"' value='1' "+gratis+">试看</label>" +
  1565. " </div>";
  1566. if (is_open_videogroup == 1) {
  1567. $('#url-box_sys').prepend(html);
  1568. }else{
  1569. $('#url-box_sys').append(html);
  1570. }
  1571. layui.use('upload', function(){
  1572. var upload = layui.upload;
  1573. var xhrOnProgress=function(fun) {
  1574. xhrOnProgress.onprogress = fun;
  1575. return function() {
  1576. var xhr = $.ajaxSettings.xhr();
  1577. if (typeof xhrOnProgress.onprogress !== 'function') {
  1578. return xhr;
  1579. }
  1580. if (xhrOnProgress.onprogress && xhr.upload) {
  1581. xhr.upload.onprogress = xhrOnProgress.onprogress;
  1582. }
  1583. return xhr;
  1584. }
  1585. };
  1586. upload.render({
  1587. elem: "#upload_video_sys_"+num
  1588. ,url: "{:url('Ueditor/upVideo', ['savepath'=>'media'])}"
  1589. ,accept: 'video' //视频
  1590. ,exts: '{$media_type}'
  1591. ,size: {$upload_max_filesize} //限制文件大小,单位 KB
  1592. ,before: function(obj){
  1593. $("#upload_video_sys_"+num).text('等待中...');
  1594. }
  1595. ,xhr:xhrOnProgress
  1596. ,progress: function(percent) {
  1597. $("#upload_video_sys_"+num).text('上传中...'+percent+'%');
  1598. }
  1599. ,done: function(res){
  1600. if ("SUCCESS" == res.state) {
  1601. var n = $(this.item).attr('data-num');
  1602. $("#video_url_sys_"+n).val(res.url);
  1603. $("#video_time_sys_"+n).val(res.time);
  1604. $("#video_size_sys_"+n).val(res.size);
  1605. $("#video_mime_sys_"+n).val(res.mime);
  1606. $("#video_name_sys_"+n).val(res.title);
  1607. $("#upload_video_sys_"+num).text('上传成功');
  1608. setTimeout(function(){
  1609. $('#upload_video_sys_'+num).text('本地上传');
  1610. }, 2000 )
  1611. }else {
  1612. $("#upload_video_sys_"+num).text('上传失败');
  1613. setTimeout(function(){
  1614. $('#upload_video_sys_'+num).text('本地上传');
  1615. }, 2000 )
  1616. layer.msg(res.state,{icon: 2});
  1617. }
  1618. }
  1619. ,error: function(){
  1620. // layer.close(load); //关闭loading
  1621. }
  1622. });
  1623. });
  1624. }
  1625. function urlToStr() {
  1626. var video = [];
  1627. $("#url-box_sys div").each(function(){
  1628. var n = $(this).attr('data-num');
  1629. var arr ={};
  1630. arr.file_url = $("#video_url_sys_"+n).val();
  1631. if (!arr.file_url) {
  1632. return true
  1633. }
  1634. arr.file_title = $("#video_title_sys_"+n).val();
  1635. arr.file_name = $("#video_name_sys_"+n).val();
  1636. arr.file_time = $("#video_time_sys_"+n).val();
  1637. arr.file_size = $("#video_size_sys_"+n).val();
  1638. arr.file_mime = $("#video_mime_sys_"+n).val();
  1639. arr.file_id = $("#video_file_id_"+n).val();
  1640. arr.sort_order = $("#video_sort_order_"+n).val();
  1641. arr.video_group_id = $("#video_group_id_sys_"+n).val();
  1642. var gratis_checked = $("#video_gratis_sys_"+n).is(':checked');
  1643. if (gratis_checked == true){
  1644. arr.gratis = 1;
  1645. } else{
  1646. arr.gratis = 0;
  1647. }
  1648. video.push(arr);
  1649. });
  1650. video = JSON.stringify(video)
  1651. $("#video").val(video)
  1652. }
  1653. function clickNoVipPay(obj) {
  1654. if ($(obj).is(':checked')) {
  1655. $('#dl_users_price').show();
  1656. } else {
  1657. $('#dl_users_price').hide();
  1658. }
  1659. }
  1660. </script>
  1661. <script>
  1662. try{
  1663. var mt20_1649209614 = sessionStorage.getItem("mt20_1649209614");
  1664. if (mt20_1649209614 == 1){
  1665. $("#geduan_div").removeClass("h10");
  1666. }else{
  1667. $("#geduan_div").addClass("h10");
  1668. }
  1669. }catch(e){}
  1670. </script>
  1671. {include file="public/footer" /}