index.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998
  1. <template>
  2. <div id="festivalAdd">
  3. <div class="boxWidth">
  4. <el-form
  5. label-position="right"
  6. label-width="120px"
  7. :model="listData"
  8. :rules="rules"
  9. ref="listData"
  10. >
  11. <el-form-item label="适用业务层级">
  12. <el-select
  13. v-model="eduType"
  14. placeholder="请选择教育类型"
  15. @change="changeEduType"
  16. >
  17. <el-option
  18. v-for="(item, index) in eduTypeOptions"
  19. :key="index"
  20. :label="item.educationName"
  21. :value="item.id"
  22. >
  23. </el-option>
  24. </el-select>
  25. <el-select
  26. v-model="courType"
  27. placeholder="请选择业务层次"
  28. @change="changecourseType"
  29. >
  30. <el-option
  31. v-for="(item, index) in newCourTypeOptions"
  32. :key="index"
  33. :label="item.projectName + '-' + item.businessName"
  34. :value="item.id"
  35. >
  36. </el-option>
  37. </el-select>
  38. <el-popover
  39. ref="popovers"
  40. placement="bottom"
  41. width="200"
  42. trigger="click"
  43. @show="showHandle"
  44. @hide="hideHandle"
  45. :disabled="courType ? false : true"
  46. >
  47. <el-checkbox-group v-model="sujectArray" class="checkboxSty">
  48. <el-checkbox
  49. v-for="(item, index) in newSujectOption"
  50. :label="item.newId"
  51. :key="index"
  52. >{{ item.subjectName }}</el-checkbox
  53. >
  54. </el-checkbox-group>
  55. <div style="display: block; text-align: center; margin-top: 10px">
  56. <el-button size="mini" type="primary" @click="submitSujectArray"
  57. >确定</el-button
  58. >
  59. </div>
  60. <el-button
  61. slot="reference"
  62. style="margin-left: 12px"
  63. @click="getMessage"
  64. >请选择科目</el-button
  65. >
  66. </el-popover>
  67. <span style="margin-left: 10px">注:可多选</span>
  68. </el-form-item>
  69. <el-form-item label="">
  70. <div :class="changeHeight ? 'ach' : 'clh'">
  71. <div
  72. v-for="(item, index) in newSujectApis"
  73. :key="index"
  74. class="listBoxStys"
  75. >
  76. {{
  77. item.educationName +
  78. " - " +
  79. item.projectName +
  80. " - " +
  81. item.businessName +
  82. " - " +
  83. item.subjectName
  84. }}
  85. <i class="el-icon-error closeIcons" @click="closeType(index)"></i>
  86. </div>
  87. </div>
  88. <el-button
  89. size="mini"
  90. v-if="newSujectApis.length > 1"
  91. @click="changeType"
  92. >{{ changeHeight ? "展开" : "关闭" }}</el-button
  93. >
  94. <!-- <span v-if="newSujectApis.length === 0">未选项目类型</span> -->
  95. </el-form-item>
  96. <el-form-item label="标题前缀" prop="prefixName">
  97. <el-input v-model="listData.prefixName"></el-input>
  98. </el-form-item>
  99. <el-form-item label="节标题" prop="name">
  100. <el-input v-model="listData.name"></el-input>
  101. </el-form-item>
  102. <el-form-item label="节类型">
  103. <el-select
  104. clearable
  105. v-model="listData.sectionType"
  106. placeholder="请选择节类型"
  107. >
  108. <el-option
  109. v-for="(item, index) in sectionTypeOptions"
  110. :key="index"
  111. :label="item.label"
  112. :value="item.value"
  113. >
  114. </el-option>
  115. </el-select>
  116. </el-form-item>
  117. <el-form-item label="直播流地址" v-if="listData.sectionType === 2">
  118. <el-input
  119. style="width: 300px"
  120. v-model="listData.liveUrl"
  121. placeholder="请输入直播流地址"
  122. ></el-input>
  123. <el-select
  124. v-model="newActiveLiveUrl"
  125. placeholder="快捷选中直播流地址"
  126. @change="changeLiveUrl"
  127. >
  128. <el-option
  129. v-for="(item, index) in newLiveUrl"
  130. :key="index"
  131. :label="item.streamingName"
  132. :value="item.id"
  133. >
  134. </el-option>
  135. </el-select>
  136. <div v-if="listData.liveUrl" style="margin-top: 10px">
  137. <el-button
  138. size="small"
  139. type="warning"
  140. @click="watchZbVideo(listData.liveUrl)"
  141. >直播预览</el-button
  142. >
  143. </div>
  144. </el-form-item>
  145. <el-form-item label="直播开始时间" v-if="listData.sectionType === 2">
  146. <el-date-picker
  147. v-model="listData.liveStartTime"
  148. type="datetime"
  149. placeholder="请选择直播开始时间"
  150. value-format="timestamp"
  151. >
  152. </el-date-picker>
  153. </el-form-item>
  154. <el-form-item label="直播结束时间" v-if="listData.sectionType === 2">
  155. <el-date-picker
  156. v-model="listData.liveEndTime"
  157. type="datetime"
  158. placeholder="请选择直播结束时间"
  159. value-format="timestamp"
  160. >
  161. </el-date-picker>
  162. </el-form-item>
  163. <el-form-item label="节时长" v-if="listData.sectionType === 2">
  164. <el-input
  165. class="numInputs"
  166. type="age"
  167. v-model.number="listData.durationTime"
  168. ><template slot="append">分钟</template></el-input
  169. >
  170. </el-form-item>
  171. <el-form-item
  172. label="URL地址"
  173. v-if="listData.sectionType === 1 || listData.sectionType === 3"
  174. >
  175. <el-input
  176. style="width: 300px"
  177. v-model="listData.recordingUrl"
  178. placeholder="请输入URL地址"
  179. ></el-input>
  180. <label
  181. for="mobles"
  182. class="el-button el-button--primary"
  183. style="margin: 0px 6px; padding: 10px 20px"
  184. >上传</label
  185. ><input
  186. style="display: none"
  187. type="file"
  188. id="mobles"
  189. @change="importMoble"
  190. />
  191. <el-select
  192. v-if="listData.sectionType === 1"
  193. v-model="newActiveRecordingUrl1"
  194. placeholder="快捷选中录播URL地址"
  195. @change="changeRecordingUrl1"
  196. >
  197. <el-option
  198. v-for="(item, index) in newSteamUrl1"
  199. :key="index"
  200. :label="item.streamingName"
  201. :value="item.id"
  202. >
  203. </el-option>
  204. </el-select>
  205. <el-select
  206. v-if="listData.sectionType === 3"
  207. v-model="newActiveRecordingUrl2"
  208. placeholder="快捷选中回放URL地址"
  209. @change="changeRecordingUrl2"
  210. >
  211. <el-option
  212. v-for="(item, index) in newSteamUrl2"
  213. :key="index"
  214. :label="item.streamingName"
  215. :value="item.id"
  216. >
  217. </el-option>
  218. </el-select>
  219. <div v-if="listData.recordingUrl" style="margin-top: 10px">
  220. <el-button
  221. size="small"
  222. type="warning"
  223. @click="watchVideo(listData.recordingUrl)"
  224. >视频预览</el-button
  225. >
  226. </div>
  227. </el-form-item>
  228. <el-form-item
  229. label="节时长"
  230. v-if="listData.sectionType === 1 || listData.sectionType === 3"
  231. >
  232. <el-input
  233. class="numInputs"
  234. type="age"
  235. v-model.number="listData.durationTime"
  236. ><template slot="append">分钟</template></el-input
  237. >
  238. </el-form-item>
  239. <el-form-item label="节封面">
  240. <div class="imgBoxins">
  241. <img :src="$methodsTools.splitImgHost(listData.coverUrl)" alt="" />
  242. <div
  243. class="posimg"
  244. v-if="
  245. listData.coverUrl === null ||
  246. listData.coverUrl === '' ||
  247. listData.coverUrl === undefined
  248. "
  249. >
  250. <label for="uplose">
  251. <i class="el-icon-circle-plus-outline iconStsz"></i
  252. ></label>
  253. <input
  254. ref="file"
  255. type="file"
  256. style="display: none"
  257. id="uplose"
  258. @change="getImgFile"
  259. />
  260. <p>
  261. 注:请上传小于300kb,尺寸为750*440的图片,支持gif、jpg、jpeg、png等类型
  262. </p>
  263. </div>
  264. </div>
  265. <el-button
  266. v-if="
  267. listData.coverUrl !== null &&
  268. listData.coverUrl !== '' &&
  269. listData.coverUrl !== undefined
  270. "
  271. type="danger"
  272. size="mini"
  273. class="margin-top: 20px;"
  274. @click="clearImgs"
  275. >删除</el-button
  276. >
  277. </el-form-item>
  278. <el-form-item label="是否发布" prop="publishStatus">
  279. <el-radio-group v-model="listData.publishStatus">
  280. <el-radio :label="1">是</el-radio>
  281. <el-radio :label="0">否</el-radio>
  282. </el-radio-group>
  283. </el-form-item>
  284. <el-form-item>
  285. <el-button @click="backPage">取消</el-button>
  286. <el-button type="primary" @click="submit('listData')">确定</el-button>
  287. </el-form-item>
  288. </el-form>
  289. </div>
  290. <el-dialog
  291. :visible.sync="diavos"
  292. width="840px"
  293. @opened="isOkBf"
  294. :show-close="false"
  295. :close-on-click-modal="false"
  296. >
  297. <div slot="title" class="hearders">
  298. <div class="leftTitle">视频预览</div>
  299. <div class="rightBoxs">
  300. <img src="@/assets/images/Close@2x.png" alt="" @click="clears" />
  301. </div>
  302. </div>
  303. <div>
  304. <div id="player"></div>
  305. </div>
  306. <span slot="footer" class="dialog-footer">
  307. <el-button @click="clears">取 消</el-button>
  308. </span>
  309. </el-dialog>
  310. <el-dialog
  311. :visible.sync="diavoszb"
  312. width="840px"
  313. @opened="isOkBfzb"
  314. :show-close="false"
  315. :close-on-click-modal="false"
  316. >
  317. <div slot="title" class="hearders">
  318. <div class="leftTitle">直播预览</div>
  319. <div class="rightBoxs">
  320. <img src="@/assets/images/Close@2x.png" alt="" @click="clearszb" />
  321. </div>
  322. </div>
  323. <div>
  324. <div id="playerzb"></div>
  325. </div>
  326. <span slot="footer" class="dialog-footer">
  327. <el-button @click="clearszb">取 消</el-button>
  328. </span>
  329. </el-dialog>
  330. </div>
  331. </template>
  332. <script>
  333. import { uploadFile } from "@/utils/uopladFile.js";
  334. export default {
  335. data() {
  336. return {
  337. vodPlayerJs: "https://player.polyv.net/script/player.js",
  338. vid: "",
  339. playerJs:
  340. "https://player.polyv.net/resp/live-h5-player/latest/liveplayer.min.js",
  341. uidzb: "egsxlptzdq",
  342. vidzb: "",
  343. diavos: false,
  344. diavoszb: false,
  345. fileSetting: {
  346. desc: "i am desc", // 描述
  347. cataid: "1639399775001", // 分类ID 可以后端传递 也可以不写 或写死
  348. tag: "i am tag", // 标签
  349. luping: 0, // 是否开启视频课件优化处理,对于上传录屏类视频清晰度有所优化:0为不开启,1为开启
  350. keepsource: 1, // 是否源文件播放(不对视频进行编码):0为编码,1为不编码
  351. },
  352. sectionTypeOptions: [
  353. {
  354. label: "录播",
  355. value: 1,
  356. },
  357. {
  358. label: "直播",
  359. value: 2,
  360. },
  361. {
  362. label: "回放",
  363. value: 3,
  364. },
  365. ],
  366. // 弹窗数据
  367. changeHeight: true,
  368. bfImg: "oss/images/avatar/20211013/1634097664410_1397766697",
  369. listData: {
  370. publishStatus: 1,
  371. recordingUrl: "",
  372. liveUrl: "",
  373. coverUrl: "oss/images/avatar/20211013/1634097664410_1397766697",
  374. },
  375. newActiveLiveUrl: "",
  376. newLiveUrl: [], //直播流地址
  377. newActiveRecordingUrl1: "",
  378. newSteamUrl1: [], //录播流地址
  379. newActiveRecordingUrl2: "",
  380. newSteamUrl2: [], //回放流地址
  381. eduTypeOptions: [], //教育类型数据
  382. projectTypeOptions: [], //项目类型数据
  383. courTypeOptions: [], //业务层次数据
  384. newCourTypeOptions: [], //当前业务层次数据
  385. sujectOption: [], //科目数据
  386. newSujectOption: [], //当前科目数据数据
  387. eduType: "", //当前选中教育类型
  388. courType: "", //当前选中业务层次
  389. sujectApis: [], //当前存在的科目
  390. newSujectApis: [],
  391. sujectArray: [], //选中的科目
  392. //表单验证
  393. rules: {
  394. prefixName: [
  395. { required: true, message: "请输入标题前缀", trigger: "blur" },
  396. ],
  397. name: [{ required: true, message: "请输入节标题", trigger: "blur" }],
  398. // liveDuration: [
  399. // { required: true, message: "节时长不能为空" },
  400. // { type: "number", message: "节时长必须为数字值" },
  401. // ],
  402. publishStatus: [
  403. { required: true, message: "请选择是否发布", trigger: "change" },
  404. ],
  405. },
  406. };
  407. },
  408. watch: {
  409. sujectApis: {
  410. immediate: true,
  411. handler(newName, oldName) {
  412. this.changeTypes();
  413. },
  414. },
  415. },
  416. mounted() {
  417. this.getDict();
  418. },
  419. methods: {
  420. loadPlayerScript(callback) {
  421. if (!window.polyvPlayer) {
  422. const myScript = document.createElement("script");
  423. myScript.setAttribute("src", this.vodPlayerJs);
  424. myScript.onload = callback;
  425. document.body.appendChild(myScript);
  426. } else {
  427. callback();
  428. this.player.on("serverError", (...params) => {
  429. this.$message.error(returnTitle(params[1]));
  430. console.log(params);
  431. });
  432. }
  433. },
  434. loadPlayer() {
  435. var self = this;
  436. const polyvPlayer = window.polyvPlayer;
  437. self.player = polyvPlayer({
  438. wrap: "#player",
  439. width: 800,
  440. height: 533,
  441. vid: self.vid,
  442. teaser_show: 0,
  443. playsafe: function (vid, next) {
  444. self.$api.obtainpolyvvideosign(vid).then((res) => {
  445. next(res.data);
  446. });
  447. },
  448. });
  449. },
  450. /**
  451. * @param {String} 关闭视频窗口-销毁实例
  452. */
  453. clears() {
  454. this.diavos = false;
  455. if (this.player) {
  456. this.player.destroy();
  457. }
  458. },
  459. /**
  460. * @param {String} 视频查看
  461. */
  462. watchVideo(url) {
  463. if (!url) {
  464. this.$message.warning("请检查URL地址是否输入完整");
  465. return;
  466. }
  467. this.vid = url;
  468. this.diavos = true;
  469. },
  470. isOkBf() {
  471. this.loadPlayerScript(this.loadPlayer);
  472. },
  473. /**
  474. * @param {String} 直播预览
  475. */
  476. watchZbVideo(url) {
  477. if (!url) {
  478. this.$message.warning("请检查直播流地址是否输入完整");
  479. return;
  480. }
  481. this.vidzb = url;
  482. this.diavoszb = true;
  483. },
  484. loadPlayerScriptzb(callback) {
  485. if (!window.polyvLivePlayer) {
  486. const myScript = document.createElement("script");
  487. myScript.setAttribute("src", this.playerJs);
  488. myScript.onload = callback;
  489. document.body.appendChild(myScript);
  490. } else {
  491. callback();
  492. }
  493. },
  494. loadPlayerzb() {
  495. const polyvLivePlayer = window.polyvLivePlayer;
  496. this.playerzb = polyvLivePlayer({
  497. wrap: "#playerzb",
  498. width: 800,
  499. height: 533,
  500. uid: this.uidzb,
  501. vid: this.vidzb,
  502. });
  503. },
  504. clearszb() {
  505. this.diavoszb = false;
  506. if (this.playerzb) {
  507. this.playerzb.destroy();
  508. }
  509. },
  510. isOkBfzb() {
  511. this.loadPlayerScriptzb(this.loadPlayerzb);
  512. },
  513. importMoble(event) {
  514. // var self = this;
  515. var file = event.target.files[0];
  516. // let formData = new FormData();
  517. // formData.append("file", file);
  518. // console.log(formData);
  519. if (!event.target.value) {
  520. this.$message.error("请选择您要上传的文件");
  521. return false;
  522. }
  523. /**
  524. * @param: event.target.files -> 传递的文件list
  525. * @param: this.fileSetting -> 常规配置 上面有备注
  526. * @param: 回调
  527. */
  528. uploadFile(file, this.fileSetting, (index, event) => {
  529. this.listData.recordingUrl = event.vid;
  530. });
  531. },
  532. getMessage() {
  533. if (!this.courType) {
  534. this.$message.warning("请先选择业务层级");
  535. }
  536. },
  537. clearImgs() {
  538. this.listData.coverUrl = "";
  539. },
  540. changeTypes() {
  541. var self = this;
  542. var arrays = [];
  543. this.sujectApis.map((item, index) => {
  544. this.courTypeOptions.map((items) => {
  545. if (items.id === item.split("-").map(Number)[0]) {
  546. var obj = {
  547. educationTypeId: items.educationId,
  548. educationName: items.educationName,
  549. projectId: items.projectId,
  550. projectName: items.projectName,
  551. businessId: items.id,
  552. businessName: items.businessName,
  553. };
  554. self.sujectOption.map((i) => {
  555. if (
  556. i.id === item.split("-").map(Number)[1] &&
  557. i.courseArrays.indexOf(items.projectId) !== -1
  558. ) {
  559. obj.subjectName = i.subjectName;
  560. obj.subjectId = i.id;
  561. }
  562. });
  563. arrays.push(obj);
  564. }
  565. });
  566. });
  567. this.newSujectApis = arrays;
  568. },
  569. changeType() {
  570. this.changeHeight = !this.changeHeight;
  571. },
  572. submitSujectArray() {
  573. var self = this;
  574. this.sujectApis = this.sujectApis.filter((item, index) => {
  575. return item.split("-").map(Number)[0] !== Number(self.courType);
  576. });
  577. for (let i = 0; i < this.sujectArray.length; i++) {
  578. this.sujectApis.push(this.sujectArray[i]);
  579. }
  580. this.$refs.popovers.doClose();
  581. this.$nextTick(() => {
  582. this.changeUrl();
  583. });
  584. },
  585. changeUrl() {
  586. var arr = this.newSujectApis.map((val) => val.businessId);
  587. const unique = [...new Set(arr)];
  588. var busId = "";
  589. if (unique.length) {
  590. busId = unique.toString();
  591. } else {
  592. busId = "";
  593. }
  594. this.$api.inquireCourseStreaming({ status: 1 }).then((res) => {
  595. var arraystt = [];
  596. var newarrays1tt = [];
  597. var newarrays2tt = [];
  598. res.rows.map((item) => {
  599. if (item.streamingType === 1) {
  600. arraystt.push(item);
  601. }
  602. if (item.streamingType === 2) {
  603. newarrays1tt.push(item);
  604. }
  605. if (item.streamingType === 3) {
  606. newarrays2tt.push(item);
  607. }
  608. });
  609. this.$api
  610. .inquireCourseStreaming({ status: 1, businessId: busId })
  611. .then((result) => {
  612. var arrays = [];
  613. var newarrays1 = [];
  614. var newarrays2 = [];
  615. result.rows.map((item) => {
  616. if (item.streamingType === 1) {
  617. arrays.push(item);
  618. }
  619. if (item.streamingType === 2) {
  620. newarrays1.push(item);
  621. }
  622. if (item.streamingType === 3) {
  623. newarrays2.push(item);
  624. }
  625. });
  626. if (arrays.length) {
  627. this.newLiveUrl = arrays;
  628. } else {
  629. this.newLiveUrl = arraystt;
  630. }
  631. if (newarrays1.length) {
  632. this.newSteamUrl1 = newarrays1;
  633. } else {
  634. this.newSteamUrl1 = newarrays1tt;
  635. }
  636. if (newarrays2.length) {
  637. this.newSteamUrl2 = newarrays2;
  638. } else {
  639. this.newSteamUrl2 = newarrays2tt;
  640. }
  641. });
  642. });
  643. },
  644. showHandle() {
  645. var array = [];
  646. for (let i = 0; i < this.sujectApis.length; i++) {
  647. if (
  648. this.sujectApis[i].split("-").map(Number)[0] === Number(this.courType)
  649. ) {
  650. array.push(this.sujectApis[i]);
  651. }
  652. }
  653. this.sujectArray = array;
  654. this.newSujectOption.map((item) => {
  655. item.newId = this.courType + "-" + item.id;
  656. });
  657. },
  658. hideHandle() {},
  659. getDict() {
  660. this.$api.inquireCourseEducationType({ status: 1 }).then((res) => {
  661. this.eduTypeOptions = res.rows;
  662. });
  663. this.$api.inquireCourseProjectType({ status: 1 }).then((res) => {
  664. this.projectTypeOptions = res.rows;
  665. });
  666. this.$api.inquirebusinessList({ status: 1 }).then((res) => {
  667. this.courTypeOptions = res.rows;
  668. this.newCourTypeOptions = res.rows;
  669. });
  670. this.$api.inquireCourseSubject({ status: 1 }).then((res) => {
  671. res.rows.map((item, index) => {
  672. var array = [];
  673. item.courseProjectTypes.map((items, indexs) => {
  674. array.push(items.id);
  675. });
  676. item.courseArrays = array;
  677. });
  678. this.sujectOption = res.rows;
  679. });
  680. this.$api.inquireCourseStreaming({ status: 1 }).then((res) => {
  681. var arrays = [];
  682. var newarrays1 = [];
  683. var newarrays2 = [];
  684. res.rows.map((item) => {
  685. if (item.streamingType === 1) {
  686. arrays.push(item);
  687. }
  688. if (item.streamingType === 2) {
  689. newarrays1.push(item);
  690. }
  691. if (item.streamingType === 3) {
  692. newarrays2.push(item);
  693. }
  694. });
  695. this.newLiveUrl = arrays;
  696. this.newSteamUrl1 = newarrays1;
  697. this.newSteamUrl2 = newarrays2;
  698. });
  699. },
  700. changeEduType() {
  701. if (!(this.courType === undefined || this.courType === "")) {
  702. this.courType = "";
  703. }
  704. var arrays = [];
  705. this.courTypeOptions.map((item) => {
  706. if (item.educationId === this.eduType) {
  707. arrays.push(item);
  708. }
  709. });
  710. this.newCourTypeOptions = arrays;
  711. },
  712. changecourseType() {
  713. this.newCourTypeOptions.map((item, index) => {
  714. if (item.id === this.courType) {
  715. this.eduType = item.educationId;
  716. var array = [];
  717. this.sujectOption.map((items, indexs) => {
  718. if (items.courseArrays.indexOf(item.projectId) !== -1) {
  719. array.push(items);
  720. }
  721. });
  722. this.newSujectOption = array;
  723. }
  724. });
  725. var arrays = [];
  726. this.courTypeOptions.map((item) => {
  727. if (item.educationId === this.eduType) {
  728. arrays.push(item);
  729. }
  730. });
  731. this.newCourTypeOptions = arrays;
  732. this.$refs.popovers.doClose();
  733. },
  734. submit(formName) {
  735. this.$refs[formName].validate((valid) => {
  736. if (valid) {
  737. // if (
  738. // this.listData.coverUrl === "" ||
  739. // this.listData.coverUrl === null ||
  740. // this.listData.coverUrl === undefined
  741. // ) {
  742. // this.$message.error("请上传节封面");
  743. // return false;
  744. // }
  745. this.rulesTableSumbit();
  746. } else {
  747. return false;
  748. }
  749. });
  750. },
  751. async rulesTableSumbit() {
  752. var dataInfos = {
  753. status: 1,
  754. businessList: this.newSujectApis,
  755. coverUrl: this.listData.coverUrl,
  756. name: this.listData.name,
  757. prefixName: this.listData.prefixName,
  758. publishStatus: this.listData.publishStatus,
  759. };
  760. if (this.listData.sectionType === 2) {
  761. dataInfos.sectionType = 2;
  762. dataInfos.liveUrl = this.listData.liveUrl;
  763. dataInfos.liveStartTime = this.$methodsTools.time10to13(
  764. this.listData.liveStartTime,
  765. 1
  766. );
  767. dataInfos.liveEndTime = this.$methodsTools.time10to13(
  768. this.listData.liveEndTime,
  769. 1
  770. );
  771. dataInfos.durationTime = this.listData.durationTime;
  772. }
  773. if (this.listData.sectionType === 1) {
  774. dataInfos.sectionType = 1;
  775. dataInfos.recordingUrl = this.listData.recordingUrl;
  776. dataInfos.durationTime = this.listData.durationTime;
  777. }
  778. if (this.listData.sectionType === 3) {
  779. dataInfos.sectionType = 3;
  780. dataInfos.recordingUrl = this.listData.recordingUrl;
  781. dataInfos.durationTime = this.listData.durationTime;
  782. }
  783. this.$api.appCourseSection(dataInfos).then((res) => {
  784. this.$message.success("新增成功");
  785. setTimeout(() => {
  786. this.$router.push({
  787. path: "festival",
  788. });
  789. }, 500);
  790. });
  791. },
  792. backPage() {
  793. this.$router.push({
  794. path: "festival",
  795. });
  796. },
  797. closeType(index) {
  798. this.sujectApis.splice(index, 1);
  799. this.$nextTick(() => {
  800. this.changeUrl();
  801. });
  802. },
  803. changeLiveUrl() {
  804. this.newLiveUrl.map((item) => {
  805. if (item.id === this.newActiveLiveUrl) {
  806. this.listData.liveUrl = item.liveUrl;
  807. }
  808. });
  809. this.newActiveLiveUrl = "";
  810. },
  811. changeRecordingUrl1() {
  812. this.newSteamUrl1.map((item) => {
  813. if (item.id === this.newActiveRecordingUrl1) {
  814. this.listData.recordingUrl = item.recordingVideoId;
  815. }
  816. });
  817. this.newActiveRecordingUrl1 = "";
  818. },
  819. changeRecordingUrl2() {
  820. this.newSteamUrl2.map((item) => {
  821. if (item.id === this.newActiveRecordingUrl2) {
  822. this.listData.recordingUrl = item.playbackUrl;
  823. }
  824. });
  825. this.newActiveRecordingUrl2 = "";
  826. },
  827. getImgFile() {
  828. var self = this;
  829. var file = self.$refs.file.files[0];
  830. if (file === undefined) {
  831. self.$set(self.listData, "coverUrl", "");
  832. return;
  833. }
  834. if (file.size > 0.3 * 1024 * 1024) {
  835. self.$message.error("图片不得大于300kb");
  836. return;
  837. }
  838. var type = self.$refs.file.value.toLowerCase().split(".").splice(-1);
  839. if (
  840. type[0] != "jpg" &&
  841. type[0] != "png" &&
  842. type[0] != "jpeg" &&
  843. type[0] != "gif"
  844. ) {
  845. self.$message.error("上传格式需为:.jpg/.png/.jpeg/gif");
  846. self.$refs.file.value = "";
  847. return;
  848. }
  849. this.$upload.upload(file, 0).then((res) => {
  850. self.listData.coverUrl = res;
  851. });
  852. },
  853. },
  854. };
  855. </script>
  856. <style lang="less" scoped>
  857. /deep/.el-button {
  858. border-radius: 8px;
  859. }
  860. /deep/.el-dialog {
  861. border-radius: 8px;
  862. .el-dialog__header {
  863. padding: 0;
  864. .hearders {
  865. height: 40px;
  866. display: flex;
  867. align-items: center;
  868. justify-content: space-between;
  869. padding: 0px 18px 0px 20px;
  870. border-bottom: 1px solid #e2e2e2;
  871. .leftTitle {
  872. font-size: 14px;
  873. font-weight: bold;
  874. color: #2f4378;
  875. }
  876. .rightBoxs {
  877. display: flex;
  878. align-items: center;
  879. img {
  880. width: 14px;
  881. height: 14px;
  882. margin-left: 13px;
  883. cursor: pointer;
  884. }
  885. }
  886. }
  887. }
  888. .el-dialog__footer {
  889. padding: 0;
  890. .dialog-footer {
  891. padding: 0px 40px;
  892. height: 70px;
  893. border-top: 1px solid #e2e2e2;
  894. display: flex;
  895. align-items: center;
  896. justify-content: flex-end;
  897. }
  898. }
  899. }
  900. .imgBox {
  901. width: 100%;
  902. // height: 210px;
  903. border: 1px solid #e2e2e2;
  904. border-radius: 8px;
  905. padding: 8px 8px 3px;
  906. display: flex;
  907. flex-direction: column;
  908. align-items: center;
  909. .imgLabel {
  910. flex: 1;
  911. width: 100%;
  912. border: 1px dotted #e2e2e2;
  913. color: #999;
  914. font-size: 14px;
  915. cursor: pointer;
  916. border-radius: 8px;
  917. .msPhoto {
  918. display: flex;
  919. justify-content: center;
  920. align-items: center;
  921. max-width: 100%;
  922. max-height: 270px;
  923. img {
  924. max-width: 100%;
  925. max-height: 270px;
  926. }
  927. }
  928. .imgbbx {
  929. display: flex;
  930. flex-direction: column;
  931. align-items: center;
  932. justify-content: center;
  933. width: 100%;
  934. height: 100%;
  935. i {
  936. font-weight: bold;
  937. margin: 14px 0;
  938. font-size: 24px;
  939. }
  940. }
  941. }
  942. p {
  943. margin: 5px 0px;
  944. }
  945. }
  946. .boxWidth {
  947. width: 770px;
  948. }
  949. .numInputs {
  950. width: 150px;
  951. }
  952. .checkboxSty {
  953. max-height: 210px;
  954. overflow: auto;
  955. display: flex;
  956. flex-direction: column;
  957. }
  958. .listBoxStys {
  959. flex-shrink: 0;
  960. padding: 0px 10px;
  961. border-radius: 8px;
  962. border: 1px solid #eee;
  963. margin-right: 10px;
  964. margin-bottom: 6px;
  965. }
  966. .closeIcons {
  967. color: red;
  968. cursor: pointer;
  969. margin-left: 6px;
  970. }
  971. .ach {
  972. display: flex;
  973. align-items: center;
  974. overflow: hidden;
  975. }
  976. .clh {
  977. display: flex;
  978. align-items: center;
  979. flex-wrap: wrap;
  980. }
  981. .imgBoxins {
  982. width: 375px;
  983. height: 220px;
  984. text-align: center;
  985. img {
  986. height: 100%;
  987. }
  988. }
  989. .iconStsz {
  990. font-size: 40px;
  991. color: #67c23a;
  992. cursor: pointer;
  993. }
  994. </style>