add.php 70 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199
  1. {extend name="public/container"}
  2. {block name='head_top'}
  3. <link rel="stylesheet" href="//g.alicdn.com/de/prismplayer/2.9.21/skins/default/aliplayer-min.css">
  4. <style>
  5. .layui-table {
  6. width: 100%!important;
  7. }
  8. .layui-form-item .special-label {
  9. width: 50px;
  10. float: left;
  11. height: 30px;
  12. line-height: 38px;
  13. margin-left: 10px;
  14. margin-top: 5px;
  15. border-radius: 5px;
  16. background-color: #0092DC;
  17. text-align: center;
  18. }
  19. .layui-form-item .special-label i {
  20. display: inline-block;
  21. width: 18px;
  22. height: 18px;
  23. font-size: 18px;
  24. color: #fff;
  25. }
  26. .layui-form-item .label-box {
  27. border: 1px solid;
  28. border-radius: 10px;
  29. position: relative;
  30. padding: 10px;
  31. height: 30px;
  32. color: #fff;
  33. background-color: #393D49;
  34. text-align: center;
  35. cursor: pointer;
  36. display: inline-block;
  37. line-height: 10px;
  38. }
  39. .layui-form-item .label-box p {
  40. line-height: inherit;
  41. }
  42. .edui-default .edui-for-image .edui-icon {
  43. background-position: -380px 0px;
  44. }
  45. .layui-form-switch, .layui-form-onswitch {
  46. box-sizing: content-box;
  47. }
  48. </style>
  49. <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/ueditor/third-party/zeroclipboard/ZeroClipboard.js"></script>
  50. <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/ueditor/ueditor.config.js"></script>
  51. <script type="text/javascript" charset="utf-8" src="{__ADMIN_PATH}plug/ueditor/ueditor.all.min.js"></script>
  52. <script src="{__ADMIN_PATH}plug/aliyun-upload-sdk/aliyun-upload-sdk-1.5.0.min.js"></script>
  53. <script src="{__ADMIN_PATH}plug/aliyun-upload-sdk/lib/es6-promise.min.js"></script>
  54. <script src="{__ADMIN_PATH}plug/aliyun-upload-sdk/lib/aliyun-oss-sdk-5.3.1.min.js"></script>
  55. <script src="//g.alicdn.com/de/prismplayer/2.9.21/aliplayer-min.js"></script>
  56. {/block}
  57. {block name="content"}
  58. <div v-cloak id="app" class="layui-fluid">
  59. <div class="layui-card">
  60. <div class="layui-card-body">
  61. <form class="layui-form" action="">
  62. <div class="layui-tab layui-tab-brief" lay-filter="tab">
  63. <ul class="layui-tab-title">
  64. <li class="layui-this" lay-id="0">基本设置</li>
  65. <li lay-id="1">添加内容</li>
  66. <li lay-id="2">专题配置</li>
  67. <li lay-id="3">价格设置</li>
  68. </ul>
  69. <div class="layui-tab-content">
  70. <div class="layui-tab-item layui-show">
  71. <div class="layui-form-item required">
  72. <label class="layui-form-label">专题名称:</label>
  73. <div class="layui-input-block">
  74. <input type="text" name="title" required v-model.trim="formData.title" autocomplete="off" placeholder="请输入专题名称" maxlength="30" class="layui-input">
  75. </div>
  76. </div>
  77. <div class="layui-form-item required">
  78. <label class="layui-form-label">课程分类:</label>
  79. <div class="layui-input-block" style="width: 300px">
  80. <select name="subject_id" v-model="formData.subject_id" lay-search="" lay-filter="subject_id" lay-verify="required">
  81. <option value="0">请选分类</option>
  82. <option v-for="item in subject_list" :value="item.id" :disabled="item.grade_id==0 ? true : false">{{item.html}}{{item.name}}</option>
  83. </select>
  84. </div>
  85. </div>
  86. <div class="layui-form-item">
  87. <label class="layui-form-label">讲师:</label>
  88. <div class="layui-input-block">
  89. <select name="lecturer_id" v-model="formData.lecturer_id" lay-search="" lay-filter="lecturer_id">
  90. <option value="0">请选讲师</option>
  91. <option v-for="item in lecturer_list" :value="item.id" :disabled="item.grade_id==0 ? true : false">{{item.html}}{{item.lecturer_name}}</option>
  92. </select>
  93. </div>
  94. </div>
  95. <div class="layui-form-item required">
  96. <label class="layui-form-label">专题标签:</label>
  97. <div class="layui-input-inline">
  98. <input type="text" v-model="label" name="price_min" placeholder="最多6个字" autocomplete="off" maxlength="6" class="layui-input">
  99. </div>
  100. <div class="layui-input-inline" style="width: auto;">
  101. <button type="button" class="layui-btn layui-btn-normal" @click="addLabrl" >
  102. <i class="layui-icon">&#xe654;</i>
  103. </button>
  104. </div>
  105. <div class="layui-form-mid layui-word-aux">输入标签名称后点击”+“号按钮添加;最多写入6个字;点击标签即可删除</div>
  106. </div>
  107. <div v-if="formData.label.length" class="layui-form-item">
  108. <div class="layui-input-block">
  109. <button v-for="(item,index) in formData.label" :key="index" type="button" class="layui-btn layui-btn-normal layui-btn-sm" @click="delLabel(index)">{{item}}</button>
  110. </div>
  111. </div>
  112. <div class="layui-form-item required">
  113. <label class="layui-form-label">专题封面:(250*140)</label>
  114. <div class="layui-input-block">
  115. <div class="upload-image-box" v-if="formData.image">
  116. <img :src="formData.image" alt="">
  117. <div class="mask">
  118. <p>
  119. <i class="fa fa-eye" @click="look(formData.image)"></i>
  120. <i class="fa fa-trash-o" @click="delect('image')"></i>
  121. </p>
  122. </div>
  123. </div>
  124. <div class="upload-image" v-show="!formData.image" @click="upload('image')">
  125. <div class="fiexd"><i class="fa fa-plus"></i></div>
  126. <p>选择图片</p>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="layui-form-item required">
  131. <label class="layui-form-label">推广海报:(600*740)</label>
  132. <div class="layui-input-block">
  133. <div class="upload-image-box" v-if="formData.poster_image">
  134. <img :src="formData.poster_image" alt="">
  135. <div class="mask">
  136. <p><i class="fa fa-eye" @click="look(formData.poster_image)"></i>
  137. <i class="fa fa-trash-o" @click="delect('poster_image')"></i></p>
  138. </div>
  139. </div>
  140. <div class="upload-image" v-show="!formData.poster_image" @click="upload('poster_image')">
  141. <div class="fiexd"><i class="fa fa-plus"></i></div>
  142. <p>选择图片</p>
  143. </div>
  144. </div>
  145. </div>
  146. <!-- <div class="layui-form-item">
  147. <label class="layui-form-label">客服二维码:(200*200)</label>
  148. <div class="layui-input-block">
  149. <div class="upload-image-box" v-if="formData.service_code">
  150. <img :src="formData.service_code" alt="">
  151. <div class="mask">
  152. <p><i class="fa fa-eye" @click="look(formData.service_code)"></i>
  153. <i class="fa fa-trash-o" @click="delect('service_code')"></i></p>
  154. </div>
  155. </div>
  156. <div class="upload-image" v-show="!formData.service_code" @click="upload('service_code')">
  157. <div class="fiexd"><i class="fa fa-plus"></i></div>
  158. <p>选择图片</p>
  159. </div>
  160. </div>
  161. </div> -->
  162. <div class="layui-form-item required">
  163. <label class="layui-form-label">专题详情:</label>
  164. <div class="layui-input-block">
  165. <textarea id="editor2">{{formData.abstract}}</textarea>
  166. </div>
  167. </div>
  168. </div>
  169. <div class="layui-tab-item">
  170. <div class="layui-form-item">
  171. <label class="layui-form-label" >素材类型:</label>
  172. <div class="layui-input-block">
  173. <input type="radio" name="light_type" lay-filter="light_type" v-model="formData.light_type" value="1" title="图文">
  174. <input type="radio" name="light_type" lay-filter="light_type" v-model="formData.light_type" value="2" title="音频">
  175. <input type="radio" name="light_type" lay-filter="light_type" v-model="formData.light_type" value="3" title="视频">
  176. </div>
  177. </div>
  178. <div class="layui-form-item" v-show="formData.light_type==3">
  179. <div>
  180. <div class="layui-inline">
  181. <label class="layui-form-label">视频素材:</label>
  182. <div class="layui-input-inline" style="width: 600px">
  183. <input v-model.trim="link" type="text" name="title" autocomplete="off" placeholder="请输入视频链接" class="layui-input">
  184. </div>
  185. </div>
  186. <div class="layui-inline">
  187. <div class="layui-btn-container">
  188. <button type="button" class="layui-btn layui-btn-sm layui-btn-normal" @click="confirmAdd()" v-show="is_upload==false">确认添加</button>
  189. <button v-show="is_upload==false" type="button" class="layui-btn layui-btn-normal layui-btn-sm ossupload" id="ossupload_video">上传视频</button>
  190. <button type="button" class="layui-btn layui-btn-sm layui-btn-danger" v-show="is_upload" @click="delVideo()">删除</button>
  191. <button type="button" class="layui-btn layui-btn-sm layui-btn-warm" v-show="link" @click="previewSource">预览</button>
  192. </div>
  193. </div>
  194. </div>
  195. <div style="margin-left: 120px;" class="layui-word-aux">输入链接将视为添加视频直接添加,请确保视频链接的正确性</div>
  196. <div style="margin: 15px 0 0 120px;" v-show="is_video">
  197. <div style="width: 600px;" class="layui-progress">
  198. <div class="layui-progress-bar layui-bg-blue" :style="{width: videoWidth + '%'}"></div>
  199. </div>
  200. <div style="margin: 15px 0 0;" class="layui-btn-container">
  201. <button type="button" class="layui-btn layui-btn-sm layui-btn-danger" v-show="demand_switch==2 && is_video" @click="cancelUpload">取消</button>
  202. <button type="button" class="authUpload layui-btn layui-btn-sm layui-btn-danger" v-show="demand_switch==1 && is_video">开始上传</button>
  203. <button type="button" class="pauseUpload layui-btn layui-btn-sm layui-btn-danger" v-show="demand_switch==1 && is_video">暂停</button>
  204. <button type="button" class="resumeUpload layui-btn layui-btn-sm layui-btn-danger" v-show="is_suspend">恢复上传</button>
  205. </div>
  206. </div>
  207. </div>
  208. <div class="layui-form-item" v-show="formData.light_type==2">
  209. <div>
  210. <div class="layui-inline">
  211. <label class="layui-form-label">音频素材:</label>
  212. <div class="layui-input-inline" style="width: 600px">
  213. <input v-model.trim="link" type="text" name="title" autocomplete="off" placeholder="请输入音频链接" class="layui-input">
  214. </div>
  215. </div>
  216. <div class="layui-inline">
  217. <div class="layui-btn-container">
  218. <button type="button" class="layui-btn layui-btn-sm layui-btn-normal" @click="confirmAdd()" v-show="is_upload==false">确认添加</button>
  219. <button v-show="is_upload==false" type="button" class="layui-btn layui-btn-normal layui-btn-sm ossupload" id="ossupload_audio">上传音频</button>
  220. <button type="button" class="layui-btn layui-btn-sm layui-btn-danger" v-show="is_upload" @click="delVideo">删除</button>
  221. <button type="button" class="layui-btn layui-btn-sm layui-btn-warm" v-show="link" @click="previewSource">预览</button>
  222. </div>
  223. </div>
  224. </div>
  225. <div style="margin-left: 120px;" class="layui-word-aux">输入链接将视为添加音频直接添加,请确保音频链接的正确性</div>
  226. <div style="margin: 15px 0 0 120px;" v-show="is_video">
  227. <div style="width: 600px;" class="layui-progress">
  228. <div class="layui-progress-bar layui-bg-blue" :style="{width: videoWidth + '%'}"></div>
  229. </div>
  230. <div style="margin: 15px 0 0;" class="layui-btn-container">
  231. <button type="button" class="layui-btn layui-btn-sm layui-btn-danger" v-show="demand_switch==2 && is_video" @click="cancelUpload">取消</button>
  232. <button type="button" class="authUpload layui-btn layui-btn-sm layui-btn-danger" v-show="demand_switch==1 && is_video">开始上传</button>
  233. <button type="button" class="pauseUpload layui-btn layui-btn-sm layui-btn-danger" v-show="demand_switch==1 && is_video">暂停</button>
  234. <button type="button" class="resumeUpload layui-btn layui-btn-sm layui-btn-danger" v-show="is_suspend">恢复上传</button>
  235. </div>
  236. </div>
  237. </div>
  238. <div class="layui-form-item">
  239. <label class="layui-form-label">试看:</label>
  240. <div class="layui-input-block">
  241. <input :checked="formData.is_try" type="checkbox" name="is_try" lay-skin="switch" lay-text="开启|关闭" lay-filter="isTry">
  242. </div>
  243. </div>
  244. <div v-show="formData.is_try && formData.light_type != 1" class="layui-form-item required">
  245. <label class="layui-form-label">试看时间:</label>
  246. <div class="layui-input-inline">
  247. <input v-model.number="formData.try_time" type="number" min="0" max="5" class="layui-input">
  248. </div>
  249. <div class="layui-form-mid layui-word-aux">分钟</div>
  250. </div>
  251. <div v-show="formData.is_try && formData.light_type == 1" class="layui-form-item required">
  252. <label class="layui-form-label">试看内容:</label>
  253. <div class="layui-input-block">
  254. <textarea id="editor3">{{ formData.try_content }}</textarea>
  255. </div>
  256. </div>
  257. <div v-show="formData.light_type == 1" class="layui-form-item required" >
  258. <label class="layui-form-label">素材内容:</label>
  259. <div class="layui-input-block">
  260. <textarea id="editor1">{{formData.content}}</textarea>
  261. </div>
  262. </div>
  263. </div>
  264. <div class="layui-tab-item">
  265. <div class="layui-form-item">
  266. <label class="layui-form-label">专题排序:</label>
  267. <div class="layui-input-inline">
  268. <input type="number" name="sort" v-model="formData.sort" autocomplete="off" min="0"
  269. class="layui-input" v-sort>
  270. </div>
  271. </div>
  272. <div class="layui-form-item">
  273. <label class="layui-form-label">虚拟学习人数:</label>
  274. <div class="layui-input-inline">
  275. <input type="number" name="fake_sales" v-model="formData.fake_sales"
  276. autocomplete="off" min="0" class="layui-input">
  277. </div>
  278. </div>
  279. <div class="layui-form-item">
  280. <label class="layui-form-label">有效期:</label>
  281. <div class="layui-input-inline">
  282. <input type="number" name="validity" lay-verify="number" v-model="formData.validity"
  283. autocomplete="off" class="layui-input" min="0" max="99999">
  284. </div>
  285. <div class="layui-form-mid">天</div>
  286. <div class="layui-form-mid layui-word-aux">有效期为用户购买后可以观看时间,0为时间不限;</div>
  287. </div>
  288. <div class="layui-form-item">
  289. <label class="layui-form-label">学分:</label>
  290. <div class="layui-input-inline">
  291. <input type="number" name="xuefen" lay-verify="number" v-model="formData.xuefen"
  292. autocomplete="off" class="layui-input" min="0" max="99999">
  293. </div>
  294. <div class="layui-form-mid">分</div>
  295. <div class="layui-form-mid layui-word-aux">购买学习完成后课获得学分;</div>
  296. </div>
  297. <div class="layui-form-item">
  298. <label class="layui-form-label">热门推荐:</label>
  299. <div class="layui-input-inline">
  300. <input type="radio" name="ishot" lay-filter="ishot" v-model="formData.ishot" value="1" title="是">
  301. <input type="radio" name="ishot" lay-filter="ishot" v-model="formData.ishot" value="0" title="否" checked="">
  302. </div>
  303. <div class="layui-form-mid"></div>
  304. <div class="layui-form-mid layui-word-aux"></div>
  305. </div>
  306. <div class="layui-form-item">
  307. <label class="layui-form-label">最新推荐:</label>
  308. <div class="layui-input-inline">
  309. <input type="radio" name="isnew" lay-filter="isnew" v-model="formData.isnew" value="1" title="是">
  310. <input type="radio" name="isnew" lay-filter="isnew" v-model="formData.isnew" value="0" title="否" checked="">
  311. </div>
  312. <div class="layui-form-mid"></div>
  313. <div class="layui-form-mid layui-word-aux"></div>
  314. </div>
  315. <!-- <div class="layui-form-item">
  316. <label class="layui-form-label">仅会员可见:</label>
  317. <div class="layui-input-block">
  318. <input type="radio" name="is_mer_visible" lay-filter="is_mer_visible"
  319. v-model="formData.is_mer_visible" value="1" title="是">
  320. <input type="radio" name="is_mer_visible" lay-filter="is_mer_visible"
  321. v-model="formData.is_mer_visible" value="0" title="否">
  322. </div>
  323. </div> -->
  324. </div>
  325. <div class="layui-tab-item">
  326. <div class="layui-form-item">
  327. <label class="layui-form-label">付费方式:</label>
  328. <div class="layui-input-block">
  329. <input type="radio" name="pay_type" lay-filter="pay_type" v-model="formData.pay_type" value="1" title="付费">
  330. <input type="radio" name="pay_type" lay-filter="pay_type" v-model="formData.pay_type" value="0" title="免费">
  331. </div>
  332. </div>
  333. <div class="layui-form-item" v-show="formData.pay_type == 1">
  334. <label class="layui-form-label">购买金额:</label>
  335. <div class="layui-input-inline">
  336. <input type="number" name="money" lay-verify="number" v-model="formData.money" autocomplete="off" class="layui-input">
  337. </div>
  338. </div>
  339. <!-- <div class="layui-form-item" v-show="formData.pay_type == 1">
  340. <label class="layui-form-label">会员付费方式:</label>
  341. <div class="layui-input-block">
  342. <input type="radio" name="member_pay_type" lay-filter="member_pay_type" v-model="formData.member_pay_type" value="1" title="付费">
  343. <input type="radio" name="member_pay_type" lay-filter="member_pay_type" v-model="formData.member_pay_type" value="0" title="免费">
  344. </div>
  345. </div>
  346. <div class="layui-form-item" v-show="formData.member_pay_type == 1">
  347. <label class="layui-form-label">会员购买金额:</label>
  348. <div class="layui-input-inline">
  349. <input type="number" name="member_money" lay-verify="number" v-model="formData.member_money" autocomplete="off" class="layui-input" min="0">
  350. </div>
  351. </div>
  352. <div class="layui-form-item" v-show="formData.pay_type == 1">
  353. <label class="layui-form-label">单独分销:</label>
  354. <div class="layui-input-block">
  355. <input type="radio" name="is_alone" lay-filter="is_alone" v-model="formData.is_alone" :disabled="formData.pay_type == 0" value="1" title="开启">
  356. <input type="radio" name="is_alone" lay-filter="is_alone" v-model="formData.is_alone" :disabled="formData.pay_type == 0" value="0" title="关闭">
  357. </div>
  358. </div>
  359. <div class="layui-form-item" v-show="formData.is_alone == 1">
  360. <label class="layui-form-label">一级返佣比例[5%=5]:</label>
  361. <div class="layui-input-block">
  362. <input style="width: 300px" type="number" name="brokerage_ratio" lay-verify="number" v-model="formData.brokerage_ratio" autocomplete="off" class="layui-input" min="0">
  363. </div>
  364. </div>
  365. <div class="layui-form-item" v-show="formData.is_alone == 1">
  366. <label class="layui-form-label">二级返佣比例[5%=5]:</label>
  367. <div class="layui-input-block">
  368. <input style="width: 300px" type="number" name="brokerage_two" lay-verify="number" v-model="formData.brokerage_two" autocomplete="off" class="layui-input" min="0">
  369. </div>
  370. </div>
  371. <div class="layui-form-item" v-show="formData.pay_type == 1">
  372. <label class="layui-form-label">拼团状态:</label>
  373. <div class="layui-input-block">
  374. <input type="radio" name="is_pink" lay-filter="is_pink" v-model="formData.is_pink" value="1" title="开启">
  375. <input type="radio" name="is_pink" lay-filter="is_pink" v-model="formData.is_pink" value="0" title="关闭" checked="">
  376. </div>
  377. </div>
  378. <div class="layui-form-item" v-show="formData.is_pink">
  379. <div class="layui-inline">
  380. <label class="layui-form-label">拼团金额:</label>
  381. <div class="layui-input-inline">
  382. <input type="number" name="pink_money" v-model="formData.pink_money" autocomplete="off" class="layui-input">
  383. </div>
  384. </div>
  385. <div class="layui-inline">
  386. <label class="layui-form-label">拼团人数:</label>
  387. <div class="layui-input-inline">
  388. <input type="number" name="pink_number" v-model="formData.pink_number" autocomplete="off" class="layui-input">
  389. </div>
  390. </div>
  391. </div>
  392. <div class="layui-form-item" v-show="formData.is_pink">
  393. <div class="layui-inline">
  394. <label class="layui-form-label">开始时间:</label>
  395. <div class="layui-input-inline">
  396. <input type="text" name="pink_strar_time" v-model="formData.pink_strar_time" id="start_time" autocomplete="off" class="layui-input">
  397. </div>
  398. </div>
  399. <div class="layui-inline">
  400. <label class="layui-form-label">结束时间:</label>
  401. <div class="layui-input-inline">
  402. <input type="text" name="pink_end_time" v-model="formData.pink_end_time" id="end_time" autocomplete="off" class="layui-input">
  403. </div>
  404. </div>
  405. </div>
  406. <div class="layui-form-item" v-show="formData.is_pink">
  407. <label class="layui-form-label">拼团时间:</label>
  408. <div class="layui-input-inline">
  409. <input type="number" v-model="formData.pink_time" autocomplete="off" class="layui-input">
  410. </div>
  411. <div class="layui-form-mid">小时</div>
  412. </div>
  413. <div class="layui-form-item" v-show="formData.is_pink">
  414. <label class="layui-form-label">模拟成团:</label>
  415. <div class="layui-input-block">
  416. <input type="radio" name="is_fake_pink" lay-filter="is_fake_pink" v-model="formData.is_fake_pink" value="1" title="开启" checked="">
  417. <input type="radio" name="is_fake_pink" lay-filter="is_fake_pink" v-model="formData.is_fake_pink" value="0" title="关闭">
  418. </div>
  419. </div>
  420. <div class="layui-form-item" v-show="formData.is_fake_pink && formData.is_pink">
  421. <label class="layui-form-label">补齐比例:</label>
  422. <div class="layui-input-inline">
  423. <input type="number" v-model="formData.fake_pink_number" autocomplete="off" class="layui-input">
  424. </div>
  425. <div class="layui-form-mid" style="color: red;">注:可设置成团的补齐比例,拼团结束前实际拼团人数达不到拼团要求时,可根据补齐比例自动添加人数,达到拼团成功的目的</div>
  426. </div> -->
  427. </div>
  428. </div>
  429. </div>
  430. <div class="layui-form-item">
  431. <div class="layui-input-block">
  432. <button type="button" class="layui-btn layui-btn-primary" @click="clone_form">取消</button>
  433. <button v-show="tabIndex" type="button" class="layui-btn layui-btn-primary" @click="tabChange(-1)">上一步</button>
  434. <button v-show="tabIndex != 3" type="button" class="layui-btn layui-btn-normal" @click="tabChange(1)">下一步</button>
  435. <button v-show="tabIndex == 3" type="button" class="layui-btn layui-btn-normal" @click="save">{$id ?'确认修改':'立即提交'}</button>
  436. </div>
  437. </div>
  438. </form>
  439. </div>
  440. </div>
  441. <div class="prism-player" id="J_prismPlayer"></div>
  442. </div>
  443. <script type="text/javascript" src="{__ADMIN_PATH}js/layuiList.js"></script>
  444. {/block}
  445. {block name='script'}
  446. <script>
  447. var id = {$id}, special =<?=isset($special) ? $special : "{}"?>, special_type ="{$special_type}",alicloud_account_id="{$alicloud_account_id}",configuration_item_region="{$configuration_item_region}",demand_switch="{$demand_switch}";
  448. require(['vue','helper','zh-cn','request','plupload','aliyun-oss','OssUpload'], function (Vue,$h) {
  449. new Vue({
  450. el: "#app",
  451. directives: {
  452. sort: {
  453. bind: function (el, binding, vnode) {
  454. var vm = vnode.context;
  455. el.addEventListener('change', function () {
  456. if (!this.value || this.value < 0) {
  457. vm.formData.sort = 0;
  458. } else if (this.value > 9999) {
  459. vm.formData.sort = 9999;
  460. } else {
  461. vm.formData.sort = parseInt(this.value);
  462. }
  463. });
  464. }
  465. }
  466. },
  467. data: {
  468. subject_list: [],
  469. lecturer_list: [],
  470. formData: {
  471. label: special.label || [],
  472. abstract: special.abstract || '',
  473. title: special.title || '',
  474. subject_id: special.subject_id || 0,
  475. lecturer_id: special.lecturer_id || 0,
  476. is_light: special.is_light || 0,
  477. light_type: special.light_type || 1,
  478. image: special.image || '',
  479. banner: special.banner || [],
  480. poster_image: special.poster_image || '',
  481. service_code: special.service_code || '',
  482. money: special.money || 0.00,
  483. pink_money: special.pink_money || 0.00,
  484. pink_number: special.pink_number || 0,
  485. pink_strar_time: special.pink_strar_time || '',
  486. pink_end_time: special.pink_end_time || '',
  487. fake_pink_number: special.fake_pink_number || 0,
  488. sort: special.sort || 0,
  489. is_mer_visible: special.is_mer_visible || 0,
  490. is_pink: special.is_pink || 0,
  491. is_fake_pink: special.is_fake_pink || 1,
  492. fake_sales: special.fake_sales || 0,
  493. validity: special.validity || 0,
  494. browse_count: special.browse_count || 0,
  495. pink_time: special.pink_time || 0,
  496. pay_type: special.pay_type == 1 ? 1 : 0,
  497. member_pay_type: special.member_pay_type == 1 ? 1 : 0,
  498. member_money: special.member_money || 0.00,
  499. xuefen:special.xuefen || 0,
  500. isnew:special.isnew || 0,
  501. ishot:special.ishot || 0,
  502. content: special.singleProfile ? (special.singleProfile.content || '') : '',
  503. link:special.singleProfile ? (special.singleProfile.link || '') : '',
  504. videoId:special.singleProfile ? (special.singleProfile.videoId || '') : '',
  505. file_type:special.singleProfile ? (special.singleProfile.file_type || '') : '',
  506. file_name:special.singleProfile ? (special.singleProfile.file_name || '') : '',
  507. is_alone:special.pay_type == 1 ? (special.is_alone == 1 ? 1 : 0) : 0,
  508. brokerage_ratio:special.pay_type == 1 ? (special.brokerage_ratio || 0) : 0,
  509. brokerage_two:special.pay_type == 1 ? (special.brokerage_two || 0) : 0,
  510. is_try: special.singleProfile ? (special.singleProfile.is_try || 0) : 0,
  511. try_time: special.singleProfile ? (special.singleProfile.try_time || 0) : 0,
  512. try_content: special.singleProfile ? (special.singleProfile.try_content || '') : ''
  513. },
  514. demand_switch:demand_switch,
  515. link: '',
  516. label: '',
  517. host: ossUpload.host + '/',
  518. mask: {
  519. poster_image: false,
  520. image: false,
  521. service_code: false,
  522. },
  523. ue: null,
  524. is_video: false,
  525. is_upload:false,
  526. is_suspend:false,
  527. //上传类型
  528. mime_types: {
  529. Image: "jpg,gif,png,JPG,GIF,PNG",
  530. Video: "mp4,MP4",
  531. Audio: "mp3,MP3",
  532. },
  533. videoWidth: 0,
  534. uploader: null,
  535. tabIndex: 0
  536. },
  537. watch:{
  538. 'formData.validity':function (v) {
  539. if (v.indexOf('.')!=-1) {
  540. return layList.msg('不能输入小数');
  541. }
  542. if(v<0) return layList.msg('不能小于0');
  543. if(v>99999) return layList.msg('不能大于99999');
  544. }
  545. },
  546. methods: {
  547. // 预览音视频
  548. previewSource: function () {
  549. if (this.link.indexOf('http')) {
  550. layList.msg('请输入正确的'+ (this.formData.light_type == '2' ? '音' : '视') +'频链接');
  551. } else {
  552. new Aliplayer({
  553. id: 'J_prismPlayer',
  554. source: this.link || '',
  555. height: '100%',
  556. cover: this.formData.light_type == '2' ? '' : this.formData.image,
  557. autoplay: false,
  558. format: this.formData.light_type == '2' ? 'mp3' : ''
  559. }, function (player) {
  560. layList.layer.open({
  561. type: 1,
  562. title: false,
  563. resize: false,
  564. content: $('#J_prismPlayer'),
  565. area: ['500px', '300px'],
  566. end: function () {
  567. player.dispose();
  568. }
  569. });
  570. });
  571. }
  572. },
  573. //取消
  574. cancelUpload: function () {
  575. this.uploader.stop();
  576. this.is_video = false;
  577. this.videoWidth = 0;
  578. this.is_upload = false;
  579. },
  580. //删除图片
  581. delect: function (key, index) {
  582. var that = this;
  583. if (index != undefined) {
  584. that.formData[key].splice(index, 1);
  585. that.$set(that.formData, key, that.formData[key]);
  586. } else {
  587. that.$set(that.formData, key, '');
  588. }
  589. },
  590. //查看图片
  591. look: function (pic) {
  592. parent.$eb.openImage(pic);
  593. },
  594. //鼠标移入事件
  595. enter: function (item) {
  596. if (item) {
  597. item.is_show = true;
  598. } else {
  599. this.mask = true;
  600. }
  601. },
  602. //鼠标移出事件
  603. leave: function (item) {
  604. if (item) {
  605. item.is_show = false;
  606. } else {
  607. this.mask = false;
  608. }
  609. },
  610. changeIMG: function (key, value, multiple) {
  611. if (multiple) {
  612. var that = this;
  613. value.map(function (v) {
  614. that.formData[key].push({pic: v, is_show: false});
  615. });
  616. this.$set(this.formData, key, this.formData[key]);
  617. } else {
  618. this.$set(this.formData, key, value);
  619. }
  620. },
  621. confirmAdd:function(){
  622. var link = this.link.trim();
  623. if (link) {
  624. if (!link.indexOf('http://') || !link.indexOf('https://')) {
  625. this.is_upload=true;
  626. this.uploadVideo();
  627. } else {
  628. layList.msg('请输入正确的' + (this.formData.light_type === 2 ? '音' : '视') + '频链接');
  629. }
  630. }
  631. },
  632. uploadVideo: function () {
  633. var link = this.link.trim();
  634. if (link) {
  635. if (!link.indexOf('http://') || !link.indexOf('https://')) {
  636. this.setContent(this.link);
  637. } else {
  638. layList.msg('请输入正确的' + (this.formData.light_type === 2 ? '音' : '视') + '频链接');
  639. }
  640. }
  641. },
  642. setContent:function(link){
  643. this.formData.link = link;
  644. },
  645. //上传图片
  646. upload: function (key, count) {
  647. ossUpload.createFrame('请选择图片', {fodder: key, max_count: count === undefined ? 0 : count},{w:800,h:550});
  648. },
  649. //获取分类
  650. get_subject_list: function () {
  651. var that = this;
  652. layList.baseGet(layList.U({a: 'get_subject_list'}), function (res) {
  653. that.$set(that, 'subject_list', res.data);
  654. that.$nextTick(function () {
  655. layList.form.render('select');
  656. })
  657. });
  658. },
  659. //获取讲师
  660. get_lecturer_list: function () {
  661. var that = this;
  662. layList.baseGet(layList.U({a: 'get_lecturer_list'}), function (res) {
  663. that.$set(that, 'lecturer_list', res.data);
  664. that.$nextTick(function () {
  665. layList.form.render('select');
  666. })
  667. });
  668. },
  669. delLabel: function (index) {
  670. this.formData.label.splice(index, 1);
  671. this.$set(this.formData, 'label', this.formData.label);
  672. },
  673. addLabrl: function () {
  674. if (this.label) {
  675. if (this.label.length > 6) return layList.msg('您输入的标签字数太长');
  676. var length = this.formData.label.length;
  677. if (length >= 2) return layList.msg('标签最多添加2个');
  678. for (var i = 0; i < length; i++) {
  679. if (this.formData.label[i] == this.label) return layList.msg('请勿重复添加');
  680. }
  681. this.formData.label.push(this.label);
  682. this.$set(this.formData, 'label', this.formData.label);
  683. this.label = '';
  684. }
  685. },
  686. save: function () {
  687. var that = this;
  688. that.formData.content = that.editor1.getContent();
  689. that.formData.abstract = that.editor2.getContent();
  690. that.formData.try_content = that.editor3.getContent();
  691. that.$nextTick(function () {
  692. if (!that.formData.title) return layList.msg('请输入专题名称');
  693. if (!that.formData.subject_id) return layList.msg('请选择分类');
  694. if (!that.formData.label.length) return layList.msg('请输入标签');
  695. if (!that.formData.image) return layList.msg('请上传专题封面');
  696. if (!that.formData.poster_image) return layList.msg('请上传推广海报');
  697. if (!that.formData.abstract) return layList.msg('请输入专题简介');
  698. if (that.formData.light_type == 1) {
  699. if (!that.formData.content) return layList.msg('请编辑内容在进行保存');
  700. } else {
  701. if (!that.formData.link) return layList.msg('请上传素材');
  702. }
  703. if (that.formData.validity < 0) return layList.msg('专题有效期不能小于0');
  704. if (that.formData.validity > 99999) return layList.msg('专题有效期不能大于99999');
  705. if ((that.formData.validity+'').indexOf('.')!=-1) return layList.msg('专题有效期不能为小数');
  706. if (that.formData.is_pink) {
  707. if (!that.formData.pink_money) return layList.msg('请填写拼团金额');
  708. if (!that.formData.pink_number) return layList.msg('请填写拼团人数');
  709. if (!that.formData.pink_strar_time) return layList.msg('请选择拼团开始时间');
  710. if (!that.formData.pink_end_time) return layList.msg('请选择拼团结束时间');
  711. if (!that.formData.pink_time) return layList.msg('请填写拼团时间');
  712. if (that.formData.is_fake_pink && !that.formData.fake_pink_number) return layList.msg('请填写补齐比例');
  713. }
  714. if (that.formData.pay_type == 1) {
  715. if (!that.formData.money || that.formData.money == 0.00) return layList.msg('请填写购买金额');
  716. }
  717. if (that.formData.member_pay_type == 1) {
  718. if (!that.formData.member_money || that.formData.member_money == 0.00) return layList.msg('请填写会员购买金额');
  719. }
  720. if (that.formData.is_alone == 1) {
  721. if (that.formData.brokerage_ratio<0 || !that.formData.brokerage_two<0) return layList.msg('推广人返佣比例不能小于0');
  722. if (!that.formData.brokerage_ratio || !that.formData.brokerage_two) return layList.msg('请填写推广人返佣比例');
  723. }
  724. if (this.formData.is_try) {
  725. if (this.formData.light_type == 1) {
  726. if (!this.formData.try_content) {
  727. layList.msg('请输入试看内容');
  728. return;
  729. }
  730. } else {
  731. if (typeof this.formData.try_time == 'number') {
  732. if (this.formData.try_time > 30) {
  733. layList.msg('试看时间不能大于30分钟');
  734. return;
  735. }
  736. } else {
  737. layList.msg('请输入正确的试看时间');
  738. return;
  739. }
  740. }
  741. }
  742. layList.loadFFF();
  743. layList.basePost(layList.U({
  744. a: 'save_single_special',
  745. q: {id: id, special_type: special_type}
  746. }), that.formData, function (res) {
  747. layList.loadClear();
  748. if (parseInt(id) == 0) {
  749. if (that.demand_switch == '1') {
  750. layList.layer.alert('添加成功。', { closeBtn: 0 }, function (index) {
  751. parent.layer.closeAll();
  752. });
  753. } else {
  754. layList.layer.confirm('添加成功,您要继续添加专题吗?', {
  755. btn: ['继续添加', '立即提交'] //按钮
  756. }, function (index) {
  757. layList.layer.close(index);
  758. }, function () {
  759. parent.layer.closeAll();
  760. });
  761. }
  762. } else {
  763. layList.msg('修改成功', function () {
  764. parent.layer.closeAll();
  765. })
  766. }
  767. }, function (res) {
  768. layList.msg(res.msg);
  769. layList.loadClear();
  770. });
  771. })
  772. },
  773. clone_form: function () {
  774. if (parseInt(id) == 0) {
  775. var that = this;
  776. if (that.formData.image.pic) return layList.msg('请先删除上传的图片在尝试取消');
  777. if (that.formData.poster_image.pic) return layList.msg('请先删除上传的图片在尝试取消');
  778. if (that.formData.service_code.pic) return layList.msg('请先删除上传的图片在尝试取消');
  779. parent.layer.closeAll();
  780. }
  781. parent.layer.closeAll();
  782. },
  783. createUploader:function () {
  784. var that=this;
  785. var uploader = new AliyunUpload.Vod({
  786. timeout: 60000,//请求过期时间(配置项 timeout, 默认 60000)
  787. partSize: 1048576,//分片大小(配置项 partSize, 默认 1048576)
  788. parallel: 5,//上传分片数(配置项 parallel, 默认 5)
  789. retryCount:3,//网络失败重试次数(配置项 retryCount, 默认 3)
  790. retryDuration:2,//网络失败重试间隔(配置项 retryDuration, 默认 2)
  791. region: configuration_item_region,//配置项 region, 默认 cn-shanghai
  792. userId: alicloud_account_id,//阿里云账号ID
  793. // 添加文件成功
  794. addFileSuccess: function (uploadInfo) {
  795. if (alicloud_account_id=='') {
  796. return layList.msg('请配置阿里云账号ID!');
  797. }
  798. var type=uploadInfo.file.type;
  799. var arr=type.split('/');
  800. if(that.formData.light_type==2 && arr[0]!='audio'){
  801. that.is_video=false;
  802. that.videoWidth = 0;
  803. return layList.msg('请上传音频');
  804. }else if(that.formData.light_type==3 && arr[0]!='video'){
  805. that.is_video=false;
  806. that.videoWidth = 0;
  807. return layList.msg('请上传视频');
  808. }else{
  809. that.is_video=true;
  810. that.videoWidth = 0;
  811. }
  812. },
  813. // 开始上传
  814. onUploadstarted: function (uploadInfo) {
  815. var videoId='';
  816. if(uploadInfo.videoId){
  817. videoId= uploadInfo.videoId;
  818. }
  819. layList.basePost(layList.U({a: 'video_upload_address_voucher'}),
  820. {
  821. FileName:uploadInfo.file.name,type:1,image:that.formData.image,videoId:videoId
  822. }, function (res) {
  823. var url=res.msg;
  824. $.ajax({
  825. url:url,
  826. data:{},
  827. type:"GET",
  828. dataType:'json',
  829. success:function (data) {
  830. if(data.RequestId){
  831. var uploadAuth = data.UploadAuth;
  832. var uploadAddress = data.UploadAddress;
  833. var videoId = data.VideoId;
  834. uploader.setUploadAuthAndAddress(uploadInfo, uploadAuth, uploadAddress,videoId)
  835. }
  836. },
  837. error:function (err) {
  838. return layList.msg(err.responseJSON.Message);
  839. }
  840. });
  841. });
  842. },
  843. // 文件上传成功
  844. onUploadSucceed: function (uploadInfo) {
  845. that.formData.videoId=uploadInfo.videoId;
  846. that.formData.file_name=uploadInfo.file.name;
  847. that.formData.file_type=uploadInfo.file.type;
  848. that.videoWidth = 0;
  849. that.is_video = false;
  850. that.is_suspend = false;
  851. that.is_upload = true;
  852. that.playbackAddress(uploadInfo.videoId);
  853. },
  854. // 文件上传失败
  855. onUploadFailed: function (uploadInfo, code, message) {
  856. },
  857. // 取消文件上传
  858. onUploadCanceled: function (uploadInfo, code, message) {
  859. that.formData.file_name='';
  860. that.is_suspend = false;
  861. },
  862. // 文件上传进度,单位:字节, 可以在这个函数中拿到上传进度并显示在页面上
  863. onUploadProgress: function (uploadInfo, totalSize, progress) {
  864. that.videoWidth = Math.ceil(progress * 100);
  865. },
  866. // 上传凭证超时
  867. onUploadTokenExpired: function (uploadInfo) {
  868. var videoId='';
  869. if(uploadInfo.videoId){
  870. videoId= uploadInfo.videoId;
  871. }
  872. layList.basePost(layList.U({a: 'video_upload_address_voucher'}),{
  873. FileName:uploadInfo.file.name,type:1,image:that.formData.image,videoId:videoId
  874. }, function (res) {
  875. var url=res.msg;
  876. $.ajax({
  877. url:url,
  878. data:{},
  879. type:"GET",
  880. dataType:'json',
  881. success:function (data) {
  882. if(data.RequestId){
  883. var uploadAuth = data.UploadAuth;
  884. uploader.resumeUploadWithAuth(uploadAuth);
  885. }
  886. },
  887. error:function (err) {
  888. return layList.msg(err.responseJSON.Message);
  889. }
  890. });
  891. });
  892. },
  893. // 全部文件上传结束
  894. onUploadEnd: function (uploadInfo) {
  895. that.videoWidth = 0;
  896. that.is_video = false;
  897. that.is_suspend = false;
  898. that.is_upload = true;
  899. console.log("onUploadEnd: uploaded all the files")
  900. }
  901. });
  902. return uploader;
  903. },
  904. delVideo:function(){
  905. var that=this;
  906. if(that.demand_switch=='1' && that.formData.videoId){
  907. layList.basePost(layList.U({a: 'video_upload_address_voucher'}),{
  908. FileName:'',type:4,image:'',videoId:that.formData.videoId
  909. }, function (res) {
  910. var url=res.msg;
  911. $.ajax({
  912. url:url,
  913. data:{},
  914. type:"GET",
  915. dataType:'json',
  916. success:function (data) {
  917. if(data.RequestId){
  918. that.link='';
  919. that.formData.content='';
  920. that.formData.videoId='';
  921. that.formData.file_type='';
  922. that.formData.file_name='';
  923. that.editor1.setContent('');
  924. $("input[type='file']").val('');
  925. that.is_upload = false;
  926. }
  927. },
  928. error:function (err) {
  929. return layList.msg(err.responseJSON.Message);
  930. }
  931. });
  932. });
  933. }else{
  934. that.formData.videoId='';
  935. that.link='';
  936. that.editor1.setContent('');
  937. that.is_upload = false;
  938. }
  939. },
  940. playbackAddress:function (videoId) {
  941. var that=this;
  942. if(videoId=='') return false;
  943. layList.basePost(layList.U({a: 'video_upload_address_voucher'}), {
  944. FileName: '', type: 3, image: '', videoId: videoId
  945. }, function (res) {
  946. var url = res.msg;
  947. $.ajax({
  948. url: url,
  949. data: {},
  950. type: "GET",
  951. dataType: 'json',
  952. success: function (data) {
  953. that.link = data.PlayInfoList.PlayInfo[0].PlayURL;
  954. that.uploadVideo();
  955. },
  956. error: function (err) {
  957. that.link = '';
  958. that.formData.content = '';
  959. that.formData.videoId = '';
  960. that.formData.file_type = '';
  961. that.formData.file_name = '';
  962. that.is_upload = false;
  963. return layList.msg(err.responseJSON.Message);
  964. }
  965. });
  966. });
  967. },
  968. audio_video_upload:function () {
  969. var that=this;
  970. if (that.uploader) {
  971. that.uploader.destroy();
  972. }
  973. that.uploader = ossUpload.upload({
  974. id: that.formData.light_type == 2 ? 'ossupload_audio' : 'ossupload_video',
  975. mime_types: [
  976. that.formData.light_type == 2 ? {title: "Mp3 files", extensions: "mp3"} : {title: "Mp4 files", extensions: "mp4,m3u8"}
  977. ],
  978. FilesAddedSuccess: function () {
  979. that.is_video = true;
  980. },
  981. uploadIng: function (file) {
  982. that.videoWidth = file.percent;
  983. },
  984. success: function (res) {
  985. layList.msg('上传成功');
  986. that.videoWidth = 0;
  987. that.is_video = false;
  988. that.formData.videoId='';
  989. that.is_upload = true;
  990. that.link = res.url;
  991. that.uploadVideo();
  992. },
  993. fail: function (err) {
  994. that.videoWidth = 0;
  995. that.is_video = false;
  996. that.is_upload = false;
  997. layList.msg(err);
  998. }
  999. })
  1000. },
  1001. // 上一步、下一步
  1002. tabChange: function (value) {
  1003. layui.element.tabChange('tab', this.tabIndex + value);
  1004. }
  1005. },
  1006. mounted: function () {
  1007. var that = this;
  1008. window.changeIMG = that.changeIMG;
  1009. layList.date({
  1010. elem: '#start_time',
  1011. type: 'datetime',
  1012. done: function (value) {
  1013. that.formData.pink_strar_time = value;
  1014. }
  1015. });
  1016. layList.date({
  1017. elem: '#end_time',
  1018. type: 'datetime',
  1019. done: function (value) {
  1020. that.formData.pink_end_time = value;
  1021. }
  1022. });
  1023. //选择图片
  1024. function changeIMG(index, pic) {
  1025. $(".image_img").css('background-image', "url(" + pic + ")");
  1026. $(".active").css('background-image', "url(" + pic + ")");
  1027. $('#image_input').val(pic);
  1028. }
  1029. //选择图片插入到编辑器中
  1030. window.insertEditor = function(list,fodder){
  1031. that[fodder].execCommand('insertimage', list);
  1032. };
  1033. if(that.formData.link && that.formData.videoId=='' && that.formData.light_type!=1){
  1034. that.is_upload=true;
  1035. that.link = that.formData.link;
  1036. }else if(that.formData.videoId && that.formData.link== '' && that.formData.light_type!=1){
  1037. that.is_upload=true;
  1038. that.playbackAddress(that.formData.videoId);
  1039. }
  1040. this.$nextTick(function () {
  1041. var form = layList.form;
  1042. form.render();
  1043. form.on('switch(isTry)', function (data) {
  1044. that.formData.is_try = data.elem.checked ? 1 : 0;
  1045. });
  1046. //实例化编辑器
  1047. UE.registerUI('选择图片', function (editor, uiName) {
  1048. var btn = new UE.ui.Button({
  1049. name: uiName,
  1050. title: uiName,
  1051. cssRules: 'background-position: -380px 0;',
  1052. onclick: function() {
  1053. ossUpload.createFrame(uiName, { fodder: editor.key }, { w: 800, h: 550 });
  1054. }
  1055. });
  1056. return btn;
  1057. });
  1058. var textareaElements = document.getElementsByTagName('textarea');
  1059. var textareaId = '';
  1060. for (var i = textareaElements.length; i--;) {
  1061. textareaId = textareaElements[i].id;
  1062. that[textareaId] = UE.getEditor(textareaId);
  1063. }
  1064. layui.element.on('tab(tab)', function (data) {
  1065. that.tabIndex = data.index;
  1066. });
  1067. });
  1068. //获取科目
  1069. that.get_subject_list();
  1070. //获取讲师
  1071. that.get_lecturer_list();
  1072. //图片上传和视频上传
  1073. layList.form.on('radio(is_pink)', function (data) {
  1074. that.formData.is_pink = parseInt(data.value);
  1075. });
  1076. layList.form.on('radio(ishot)', function (data) {
  1077. that.formData.ishot = parseInt(data.value);
  1078. });
  1079. layList.form.on('radio(isnew)', function (data) {
  1080. that.formData.isnew = parseInt(data.value);
  1081. });
  1082. layList.form.on('radio(is_mer_visible)', function (data) {
  1083. that.formData.is_mer_visible = parseInt(data.value);
  1084. });
  1085. layList.form.on('radio(pay_type)', function (data) {
  1086. that.formData.pay_type = parseInt(data.value);
  1087. if (that.formData.pay_type != 1) {
  1088. that.formData.is_pink = 0;
  1089. that.formData.member_pay_type = 0;
  1090. that.formData.member_money = 0;
  1091. that.formData.is_alone = 0;
  1092. that.formData.brokerage_ratio = 0;
  1093. that.formData.brokerage_two = 0;
  1094. };
  1095. that.$nextTick(function () {
  1096. layList.form.render('radio');
  1097. });
  1098. });
  1099. layList.form.on('radio(is_alone)', function (data) {
  1100. that.formData.is_alone = parseInt(data.value);
  1101. if (that.formData.is_alone != 1) {
  1102. that.formData.brokerage_ratio = 0;
  1103. that.formData.brokerage_two = 0;
  1104. };
  1105. that.$nextTick(function () {
  1106. layList.form.render('radio');
  1107. });
  1108. });
  1109. layList.form.on('radio(member_pay_type)', function (data) {
  1110. that.formData.member_pay_type = parseInt(data.value);
  1111. if (that.formData.member_pay_type != 1) {
  1112. that.formData.member_money = 0;
  1113. };
  1114. that.$nextTick(function () {
  1115. layList.form.render('radio');
  1116. });
  1117. });
  1118. layList.select('subject_id', function (obj) {
  1119. that.formData.subject_id = obj.value;
  1120. });
  1121. layList.select('lecturer_id', function (obj) {
  1122. that.formData.lecturer_id = obj.value;
  1123. });
  1124. layList.form.on('radio(is_fake_pink)', function (data) {
  1125. that.formData.is_fake_pink = parseInt(data.value);
  1126. });
  1127. layList.form.on('radio(light_type)', function (data) {
  1128. that.formData.light_type = parseInt(data.value);
  1129. if(that.demand_switch=='1') {
  1130. that.uploadInst.reload({
  1131. accept: that.formData.light_type == 2 ? 'audio' : 'video',
  1132. acceptMime: that.formData.light_type == 2 ? 'audio/mp3' : 'video/mp4,video/m3u8',
  1133. exts: that.formData.light_type == 2 ? 'mp3' : 'mp4|m3u8'
  1134. });
  1135. }
  1136. if(that.demand_switch=='2') {
  1137. that.audio_video_upload();
  1138. }
  1139. that.$nextTick(function () {
  1140. layList.form.render('radio');
  1141. });
  1142. });
  1143. //图片上传和视频上传
  1144. var uploader = null;
  1145. if(that.demand_switch=='1'){
  1146. that.uploadInst = layui.upload.render({
  1147. elem: '.ossupload',
  1148. accept: that.formData.light_type == 2 ? 'audio' : 'video',
  1149. acceptMime: that.formData.light_type == 2 ? 'audio/mp3' : 'video/mp4,video/m3u8',
  1150. exts: that.formData.light_type == 2 ? 'mp3' : 'mp4|m3u8',
  1151. auto: false,
  1152. choose: function (obj) {
  1153. obj.preview(function(index, file, result){
  1154. var userData = '{"Vod":{}}';
  1155. uploader = that.createUploader();
  1156. uploader.addFile(file, null, null, null, userData);
  1157. });
  1158. }
  1159. });
  1160. // 第一种方式 UploadAuth 上传
  1161. $('.authUpload').on('click', function () {
  1162. if (uploader !== null) {
  1163. uploader.startUpload();
  1164. }
  1165. });
  1166. // 暂停上传
  1167. $('.pauseUpload').on('click', function () {
  1168. if (uploader !== null) {
  1169. uploader.stopUpload();
  1170. that.is_suspend = true;
  1171. that.formData.file_name='';
  1172. layList.msg('暂停上传!');
  1173. }
  1174. });
  1175. //恢复上传
  1176. $('.resumeUpload').on('click', function () {
  1177. if (uploader !== null) {
  1178. uploader.startUpload();
  1179. that.is_suspend = false;
  1180. layList.msg('恢复上传成功!');
  1181. }
  1182. });
  1183. }else if(that.demand_switch=='2' && id>0){
  1184. that.audio_video_upload();
  1185. }
  1186. }
  1187. })
  1188. })
  1189. </script>
  1190. {/block}