newLiveClass.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <el-page-header @back="onCancel" :content="name"></el-page-header>
  5. </h2>
  6. <div class="m-core">
  7. <el-form
  8. :model="form"
  9. ref="form"
  10. label-width="300px"
  11. :inline="true"
  12. label-position="left"
  13. >
  14. <el-alert
  15. title="直播设备配置"
  16. type="info"
  17. :closable="false"
  18. style="margin-bottom: 20px"
  19. ></el-alert>
  20. <el-row class="row">
  21. <el-form-item
  22. class="mline"
  23. label="直播设备"
  24. prop="os"
  25. label-width="130px"
  26. :rules="[{ required: true, message: '请选择推广类型' }]"
  27. >
  28. <el-radio-group v-model="form.os" @input="changeOs">
  29. <!-- value="rongCloud"></el-option>
  30. <el-option label="腾讯云" value="tencentCloud" -->
  31. <el-radio v-if="serviceProvider === 'rongCloud'" label="pc">web</el-radio>
  32. <el-radio v-if="serviceProvider === 'tencentCloud'" label="client"
  33. >客户端</el-radio
  34. >
  35. <el-radio label="mobile">手机</el-radio>
  36. </el-radio-group>
  37. </el-form-item>
  38. </el-row>
  39. <el-alert
  40. title="直播课信息"
  41. type="info"
  42. :closable="false"
  43. style="margin-bottom: 20px"
  44. ></el-alert>
  45. <el-row class="row">
  46. <el-form-item
  47. label="直播课标题"
  48. class="nomb"
  49. prop="roomTitle"
  50. :rules="[{ required: true, message: '请输入直播课标题' }]"
  51. >
  52. <el-input
  53. maxlength="10"
  54. show-word-limit
  55. placeholder="请输入直播课标题"
  56. v-model.trim="form.roomTitle"
  57. ></el-input>
  58. </el-form-item>
  59. <!-- <el-form-item
  60. label="直播方案"
  61. class="nomb"
  62. prop="serviceProvider"
  63. :rules="[{ required: true, message: '请选择直播方案' }]"
  64. >
  65. <el-select
  66. placeholder="请选择直播方案"
  67. v-model="form.serviceProvider"
  68. clearable
  69. @change="
  70. (value) => {
  71. if (value === 'rongCloud') {
  72. form.os = 'pc';
  73. } else if (value === 'tencentCloud') {
  74. form.os = 'client';
  75. }
  76. }
  77. "
  78. >
  79. <el-option label="融云" value="rongCloud"></el-option>
  80. <el-option label="腾讯云" value="tencentCloud"></el-option>
  81. </el-select>
  82. </el-form-item> -->
  83. <el-form-item
  84. label="直播开始时间"
  85. class="nomb"
  86. prop="liveStartTime"
  87. :rules="[{ required: true, message: '请选择直播开始时间' }]"
  88. >
  89. <el-date-picker
  90. v-model="form.liveStartTime"
  91. :picker-options="pickerOptions"
  92. type="datetime"
  93. format="yyyy-MM-dd HH:mm"
  94. value-format="yyyy-MM-dd HH:mm"
  95. placeholder="请选择直播开始时间"
  96. >
  97. </el-date-picker>
  98. <p style="color: red">主讲人可提前30分钟进入直播间准备直播</p>
  99. </el-form-item>
  100. </el-row>
  101. <el-row class="row">
  102. <el-form-item
  103. label="主讲人身份"
  104. class="nomb"
  105. prop="clientType"
  106. :rules="[{ required: true, message: '请选择直播方案' }]"
  107. >
  108. <el-select
  109. placeholder="请选择主讲人身份"
  110. v-model="form.clientType"
  111. :disabled="form.os == 'mobile'"
  112. clearable
  113. @change="
  114. (value) => {
  115. form.speakerId = '';
  116. }
  117. "
  118. >
  119. <el-option label="老师" value="TEACHER"></el-option>
  120. <el-option label="员工" value="EDUCATION"></el-option>
  121. </el-select>
  122. </el-form-item>
  123. <el-form-item
  124. label="主讲人"
  125. class="nomb"
  126. prop="speakerId"
  127. :rules="[{ required: true, message: '请输入主讲人' }]"
  128. v-if="form.clientType == 'TEACHER'"
  129. >
  130. <el-select
  131. v-model.trim="form.speakerId"
  132. collapse-tags
  133. clearable
  134. placeholder="请输入主讲人"
  135. remote
  136. filterable
  137. :remote-method="remoteMethod"
  138. :loading="remoteLoading"
  139. @change="changeTeacher"
  140. >
  141. <el-option
  142. v-for="item in teacherList"
  143. :key="item.id"
  144. :label="item.realName"
  145. :value="item.id"
  146. >
  147. <span style="float: left">{{ item.realName }}</span>
  148. <span style="float: right; color: #8492a6; font-size: 13px">{{
  149. item.phone
  150. }}</span>
  151. </el-option>
  152. </el-select>
  153. </el-form-item>
  154. <el-form-item
  155. v-else
  156. label="主讲人"
  157. class="nomb"
  158. prop="speakerId"
  159. :rules="[{ required: true, message: '请输入主讲人' }]"
  160. >
  161. <el-select
  162. v-model.trim="form.speakerId"
  163. collapse-tags
  164. clearable
  165. placeholder="请输入主讲人"
  166. remote
  167. filterable
  168. :remote-method="remoteMethodEduc"
  169. :loading="remoteLoading"
  170. @change="changeTeacher"
  171. >
  172. <el-option
  173. v-for="item in educationList"
  174. :key="item.id"
  175. :label="item.realName"
  176. :value="item.id"
  177. >
  178. <span style="float: left">{{ item.realName }}</span>
  179. <span style="float: right; color: #8492a6; font-size: 13px">{{
  180. item.phone
  181. }}</span>
  182. </el-option>
  183. </el-select>
  184. </el-form-item>
  185. </el-row>
  186. <el-row class="row">
  187. <el-form-item
  188. label="直播课内容"
  189. prop="liveRemark"
  190. :rules="[{ required: true, message: '请输入直播课内容' }]"
  191. >
  192. <el-input
  193. :rows="3"
  194. placeholder="请输入直播课内容"
  195. v-model.trim="form.liveRemark"
  196. type="textarea"
  197. maxlength="200"
  198. show-word-limit
  199. ></el-input>
  200. </el-form-item>
  201. </el-row>
  202. <el-row class="row">
  203. <el-form-item
  204. label="预热模板(模板使用于分享宣传图片)"
  205. prop="preTemplate"
  206. :rules="[{ required: true, message: '请选择预热模板' }]"
  207. >
  208. <el-checkbox-group v-model="checkList" @change="bindCheckBox">
  209. <div class="chioseWrap">
  210. <div class="chioseItem" @click="setPreTemplate(1)">
  211. <img src="./images/img1.png" alt="" />
  212. <!-- v-model="form.preTemplate" -->
  213. <div class="remberBox">
  214. <div class="wrap"></div>
  215. <el-checkbox
  216. class="chioseBox"
  217. :label="1"
  218. :checked="form.preTemplate == 1"
  219. ><br
  220. /></el-checkbox>
  221. <!-- <div
  222. class="dotWrap"
  223. :class="[form.preTemplate == 1 ? 'checked' : '']"
  224. ></div> -->
  225. </div>
  226. </div>
  227. <div class="chioseItem" @click="setPreTemplate(2)">
  228. <img src="./images/img2.png" alt="" />
  229. <div class="remberBox">
  230. <!-- v-model="form.preTemplate" -->
  231. <div class="wrap"></div>
  232. <el-checkbox
  233. name="2"
  234. class="chioseBox"
  235. :label="2"
  236. :checked="form.preTemplate == 2"
  237. ><br
  238. /></el-checkbox>
  239. <!-- <div
  240. class="dotWrap"
  241. :class="[form.preTemplate == 2 ? 'checked' : '']"
  242. ></div> -->
  243. </div>
  244. </div>
  245. <div class="chioseItem" @click="setPreTemplate(3)">
  246. <img src="./images/img3.png" alt="" />
  247. <div class="remberBox">
  248. <div class="wrap"></div>
  249. <el-checkbox
  250. class="chioseBox"
  251. :label="3"
  252. :checked="form.preTemplate == 3"
  253. ><br
  254. /></el-checkbox>
  255. <!-- <div
  256. class="dotWrap"
  257. :class="[form.preTemplate == 3 ? 'checked' : '']"
  258. ></div> -->
  259. </div>
  260. </div>
  261. </div>
  262. </el-checkbox-group>
  263. </el-form-item>
  264. </el-row>
  265. <el-alert
  266. title="观看权限配置"
  267. type="info"
  268. :closable="false"
  269. style="margin-bottom: 20px"
  270. ></el-alert>
  271. <el-row class="row">
  272. <el-form-item
  273. class="mline"
  274. label="观看权限信息"
  275. prop="popularizeType"
  276. label-width="130px"
  277. :rules="[{ required: true, message: '请选择推广类型' }]"
  278. >
  279. <el-radio-group v-model="form.popularizeType" @change="changeType">
  280. <el-radio label="ALL">全员</el-radio>
  281. <el-radio label="PRIVATE">部分</el-radio>
  282. </el-radio-group>
  283. </el-form-item>
  284. </el-row>
  285. <el-row class="row">
  286. <el-form-item
  287. v-if="
  288. form.popularizeType == 'SCHOOL' ||
  289. form.popularizeType == 'ORGAN' ||
  290. form.popularizeType == 'TEAM'
  291. "
  292. label="分部"
  293. prop="organIds"
  294. :rules="[{ required: true, message: '请选择分部' }]"
  295. >
  296. <select-all
  297. v-model.trim="form.organIds"
  298. filterable
  299. clearable
  300. placeholder="请选择分部"
  301. @change="changeSection"
  302. >
  303. <el-option
  304. v-for="(item, index) in selects.branchs"
  305. :key="index"
  306. :label="item.name"
  307. :value="item.id"
  308. ></el-option>
  309. </select-all>
  310. </el-form-item>
  311. </el-row>
  312. <el-row class="row">
  313. <el-form-item
  314. v-if="form.popularizeType == 'SCHOOL'"
  315. label="合作单位"
  316. prop="schoolIds"
  317. :rules="[{ required: true, message: '请选择合作单位' }]"
  318. >
  319. <select-all
  320. v-model.trim="form.schoolIds"
  321. :disabled="form.organIds.length <= 0"
  322. filterable
  323. clearable
  324. multiple
  325. >
  326. <!-- @change="changeSchool" -->
  327. <el-option
  328. v-for="(item, index) in cooperationList"
  329. :key="index"
  330. :label="item.name"
  331. :value="item.id"
  332. ></el-option>
  333. </select-all>
  334. </el-form-item>
  335. </el-row>
  336. <el-row class="row">
  337. <el-form-item
  338. v-if="form.popularizeType == 'TEAM'"
  339. label="乐团"
  340. prop="teamIds"
  341. :rules="[{ required: true, message: '请选择乐团' }]"
  342. >
  343. <select-all
  344. v-model.trim="form.teamIds"
  345. :disabled="form.organIds.length <= 0"
  346. filterable
  347. clearable
  348. multiple
  349. >
  350. <el-option
  351. v-for="(item, index) in teamList"
  352. :key="index"
  353. :label="item.name"
  354. :value="item.id"
  355. ></el-option>
  356. </select-all>
  357. </el-form-item>
  358. </el-row>
  359. <el-alert
  360. title="直播间信息"
  361. type="info"
  362. :closable="false"
  363. style="margin-bottom: 20px"
  364. ></el-alert>
  365. <!-- <el-row class="row">
  366. <el-form-item
  367. prop="roomConfig.whether_like"
  368. label-width="130px"
  369. class="mline"
  370. label="允许点赞"
  371. :rules="[{ required: true, message: '是否允许点赞' }]"
  372. >
  373. <el-radio-group v-model="form.roomConfig.whether_like">
  374. <el-radio :label="0">是</el-radio>
  375. <el-radio :label="1">否</el-radio>
  376. </el-radio-group>
  377. </el-form-item>
  378. </el-row>
  379. <el-row class="row">
  380. <el-form-item
  381. prop="roomConfig.whether_chat"
  382. label-width="130px"
  383. class="mline"
  384. label="允许聊天互动"
  385. :rules="[{ required: true, message: '是否允许聊天互动' }]"
  386. >
  387. <el-radio-group v-model="form.roomConfig.whether_chat">
  388. <el-radio :label="0">是</el-radio>
  389. <el-radio :label="1">否</el-radio>
  390. </el-radio-group>
  391. </el-form-item>
  392. </el-row>
  393. <el-row class="row">
  394. <el-form-item
  395. prop="roomConfig.whether_mic"
  396. label-width="130px"
  397. class="mline"
  398. label="允许连麦"
  399. :rules="[{ required: true, message: '是否允许连麦' }]"
  400. >
  401. <el-radio-group v-model="form.roomConfig.whether_mic">
  402. <el-radio :label="0">是</el-radio>
  403. <el-radio :label="1">否</el-radio>
  404. </el-radio-group>
  405. </el-form-item>
  406. </el-row> -->
  407. <el-row class="row">
  408. <el-form-item
  409. prop="roomConfig.whether_video"
  410. label-width="130px"
  411. class="mline"
  412. label="保存直播回放"
  413. :rules="[{ required: true, message: '是否保存直播回放' }]"
  414. >
  415. <el-radio-group v-model="form.roomConfig.whether_video">
  416. <el-radio :label="0">是</el-radio>
  417. <el-radio :label="1">否</el-radio>
  418. </el-radio-group>
  419. </el-form-item>
  420. </el-row>
  421. <el-row class="row">
  422. <el-form-item
  423. prop="roomConfig.whether_view_shop_cart"
  424. label-width="130px"
  425. class="mline"
  426. label="是否展示购物车"
  427. :rules="[{ required: true, message: '是否展示购物车' }]"
  428. >
  429. <el-radio-group v-model="form.roomConfig.whether_view_shop_cart">
  430. <el-radio :label="0">是</el-radio>
  431. <el-radio :label="1">否</el-radio>
  432. </el-radio-group>
  433. </el-form-item>
  434. </el-row>
  435. </el-form>
  436. <el-row class="row">
  437. <el-button type="primary" @click="preLook">预览</el-button>
  438. <el-button type="primary" @click="submit">提交</el-button>
  439. </el-row>
  440. </div>
  441. <el-dialog
  442. title="预览"
  443. width="415px"
  444. :close-on-click-modal="false"
  445. append-to-body
  446. :visible.sync="preLookVisible"
  447. >
  448. <preview :form="form" />
  449. </el-dialog>
  450. </div>
  451. </template>
  452. <script>
  453. import preview from "./modals/preview.vue";
  454. import axios from "axios";
  455. import { getToken, getTenantId } from "@/utils/auth";
  456. import {
  457. createLiveBroadcast,
  458. resetLiveBroadcastRoomList,
  459. getRoomInfo,
  460. sysTenantConfigAll,
  461. } from "./api";
  462. import { queryByOrganId } from "@/api/systemManage";
  463. import { getTeamList } from "@/api/teamServer";
  464. export default {
  465. components: { preview },
  466. data() {
  467. return {
  468. name: "新建直播课",
  469. preLookVisible: false,
  470. form: {
  471. organIds: [],
  472. schoolIds: [],
  473. teamIds: [],
  474. roomTitle: "",
  475. speakerId: "",
  476. liveStartTime: "",
  477. liveRemark: "",
  478. preTemplate: null,
  479. popularizeType: "ALL",
  480. clientType: "TEACHER",
  481. os: "client",
  482. roomConfig: {
  483. whether_like: 0,
  484. whether_chat: 0,
  485. whether_video: 0,
  486. whether_mic: 0,
  487. whether_view_shop_cart: 0,
  488. },
  489. checkList: [],
  490. },
  491. serviceProvider: "tencentCloud",
  492. remoteLoading: false,
  493. teacherList: [],
  494. checkList: [],
  495. cooperationList: [],
  496. teamList: [],
  497. isinit: true,
  498. pickerOptions: {
  499. firstDayOfWeek: 1,
  500. disabledDate(time) {
  501. return time.getTime() + 86400000 <= new Date().getTime();
  502. },
  503. },
  504. educationList: [],
  505. };
  506. },
  507. async mounted() {
  508. this.$store.dispatch("setBranchs");
  509. try {
  510. const findName = await sysTenantConfigAll({
  511. group: "LIVE_CLIENT",
  512. });
  513. if (findName.data && findName.data.length > 0) {
  514. findName.data.forEach((item) => {
  515. if (item.paramName == "live_client") {
  516. this.serviceProvider = item.paranValue;
  517. this.form.os = this.serviceProvider == "tencentCloud" ? "client" : "pc";
  518. }
  519. });
  520. }
  521. } catch {
  522. //
  523. }
  524. if (this.$route.query.id) {
  525. // this.name = "修改直播间";
  526. await this.getDetail();
  527. // console.log()
  528. // this.form = {
  529. // ...this.$route.query,
  530. // organIds: [],
  531. // schoolIds: [],
  532. // teamIds: [],
  533. // };
  534. // this.form.roomConfig = JSON.parse(this.$route.query.roomConfig);
  535. // if (this.$route.query.popularizeOrgIds) {
  536. // this.form.organIds = this.$route.query.popularizeOrgIds
  537. // .split(",")
  538. // .map((item) => {
  539. // return item * 1;
  540. // });
  541. // }
  542. // this.changeSection(this.form.organIds);
  543. // if (this.$route.query.popularizeSchoolIds) {
  544. // this.form.schoolIds = this.$route.query.popularizeSchoolIds
  545. // .split(",")
  546. // .map((item) => {
  547. // return item * 1;
  548. // });
  549. // }
  550. // if (this.$route.query.popularizeTeamIds) {
  551. // let arr = this.$route.query.popularizeTeamIds.split(",");
  552. // this.$set(this.form, "teamIds", arr);
  553. // console.log(this.form.teamIds);
  554. // }
  555. // // this.form.popularizeType = "SCHOOL";
  556. // this.remoteMethod(this.$route.query.speakerName);
  557. // this.checkList.push(this.form.preTemplate * 1);
  558. // this.isinit = false;
  559. }
  560. console.log(this.form, "form");
  561. },
  562. methods: {
  563. changeOs(e) {
  564. if (e == "mobile") {
  565. this.form.clientType = "TEACHER";
  566. this.form.speakerId = "";
  567. }
  568. },
  569. async getDetail() {
  570. try {
  571. const res = await getRoomInfo({ roomUid: this.$route.query.roomUid });
  572. this.name = "修改直播间";
  573. // console.log()
  574. this.form = {
  575. ...res.data,
  576. organIds: [],
  577. schoolIds: [],
  578. teamIds: [],
  579. catIds: [],
  580. studentIds: [],
  581. };
  582. this.form.roomConfig = JSON.parse(res.data.roomConfig);
  583. if (res.data.popularizeOrgIds) {
  584. this.form.organIds = res.data.popularizeOrgIds.split(",").map((item) => {
  585. return item * 1;
  586. });
  587. }
  588. if (res.data.popularizeSchoolIds) {
  589. this.form.schoolIds = res.data.popularizeSchoolIds.split(",").map((item) => {
  590. return item * 1;
  591. });
  592. }
  593. if (res.data.popularizeTeamIds) {
  594. let arr = res.data.popularizeTeamIds.split(",");
  595. this.$set(this.form, "teamIds", arr);
  596. }
  597. // this.form.popularizeType = "SCHOOL";
  598. this.changeSection(this.form.organIds);
  599. if (res.data.clientType == "TEACHER") {
  600. this.remoteMethod(res.data.speakerName);
  601. } else {
  602. this.remoteMethodEduc(res.data.speakerName);
  603. }
  604. this.checkList.push(this.form.preTemplate * 1);
  605. this.isinit = false;
  606. } catch (e) {
  607. console.log(e);
  608. }
  609. },
  610. onCancel() {
  611. this.$store.dispatch("delVisitedViews", this.$route);
  612. this.$router.push("/liveClassManager");
  613. },
  614. changeTeacher(val) {
  615. this.teacherList.forEach((item) => {
  616. if (val == item.id) {
  617. this.form.speakerName = item.realName;
  618. }
  619. });
  620. },
  621. preLook() {
  622. this.$refs.form.validate((flag) => {
  623. if (flag) {
  624. this.preLookVisible = true;
  625. console.log("预览", this.form);
  626. }
  627. });
  628. },
  629. setPreTemplate(index) {
  630. this.$set(this.form, "preTemplate", index);
  631. if (this.checkList.indexOf(index) == -1) {
  632. this.checkList.push(index);
  633. } else {
  634. this.checkList.splice(this.checkList.indexOf(index), 1);
  635. }
  636. // console.log("调用结束", index);
  637. this.bindCheckBox();
  638. },
  639. remoteMethod(query) {
  640. this.teacherList = [];
  641. if (query !== "") {
  642. this.remoteLoading = true;
  643. // 发请求搜索
  644. const url = "/api-web/teacher/queryPage";
  645. const options = {
  646. method: "get",
  647. headers: {
  648. Authorization: getToken(),
  649. tenantId: getTenantId(),
  650. },
  651. params: {
  652. rows: 9999,
  653. search: query,
  654. lockFlag: 0,
  655. demissionFlag: false,
  656. },
  657. url,
  658. };
  659. this.remoteLoading = true;
  660. // this.studentList = []
  661. axios(options).then((res) => {
  662. this.remoteLoading = false;
  663. let result = res.data;
  664. if (result.code == 200) {
  665. // Array.prototype.splice.apply(this.studentList, result.data.rows);
  666. if (result.data && result.data.rows.length > 0) {
  667. result.data.rows.forEach((item) => {
  668. this.teacherList.unshift(item);
  669. });
  670. this.teacherList = this.deweight(this.teacherList, "phone");
  671. }
  672. // this.studentList = this.studentList.concat(result.data.rows);
  673. }
  674. });
  675. // queryStudentList({ rows: 100, search: query }).then(res => {
  676. // if (res.code == 200) {
  677. // this.remoteLoading = false;
  678. // this.studentList = this.studentList.concat(res.data.rows);
  679. // this.unique(this.studentList, "userId");
  680. // }
  681. // });
  682. }
  683. },
  684. remoteMethodEduc(query) {
  685. this.educationList = [];
  686. if (query !== "") {
  687. this.remoteLoading = true;
  688. // 发请求搜索
  689. const url = "/api-web/employee/queryEmployByOrganId";
  690. const options = {
  691. method: "get",
  692. headers: {
  693. Authorization: getToken(),
  694. tenantId: getTenantId(),
  695. },
  696. params: {
  697. rows: 9999,
  698. search: query,
  699. lockFlag: 0,
  700. demissionFlag: false,
  701. },
  702. url,
  703. };
  704. this.remoteLoading = true;
  705. axios(options).then((res) => {
  706. this.remoteLoading = false;
  707. let result = res.data;
  708. if (result.code == 200) {
  709. // Array.prototype.splice.apply(this.studentList, result.data.rows);
  710. if (result.data && result.data.rows.length > 0) {
  711. result.data.rows.forEach((item) => {
  712. this.educationList.unshift(item);
  713. });
  714. this.educationList = this.deweight(this.educationList, "phone");
  715. }
  716. // this.studentList = this.studentList.concat(result.data.rows);
  717. }
  718. });
  719. }
  720. },
  721. deweight(arr, key) {
  722. let res = [];
  723. arr.forEach((item) => {
  724. let list = [];
  725. res.forEach((resitem) => {
  726. list.push(resitem[key]);
  727. });
  728. if (list.indexOf(item[key]) === -1) {
  729. res.push(item);
  730. }
  731. });
  732. return res;
  733. },
  734. bindCheckBox() {
  735. if (this.checkList.length > 1) {
  736. this.checkList.splice(0, 1);
  737. }
  738. this.$set(this.form, "preTemplate", this.checkList[0] || null);
  739. },
  740. async submit() {
  741. this.form.popularizeOrgIds = this.form.organIds.join(",");
  742. this.form.popularizeSchoolIds = this.form.schoolIds.join(",");
  743. this.form.popularizeTeamIds = this.form.teamIds.join(",");
  744. this.$refs.form.validate(async (flag) => {
  745. if (!flag) return;
  746. if (this.$route.query.id) {
  747. // 修改
  748. try {
  749. const res = await resetLiveBroadcastRoomList(this.form);
  750. this.$message.success("修改成功");
  751. this.$store.dispatch("delVisitedViews", this.$route);
  752. this.$router.push("/liveClassManager");
  753. } catch (e) {
  754. console.log(e);
  755. }
  756. } else {
  757. try {
  758. const res = await createLiveBroadcast(this.form);
  759. this.$message.success("创建成功");
  760. this.$store.dispatch("delVisitedViews", this.$route);
  761. this.$router.push("/liveClassManager");
  762. } catch (e) {
  763. console.log(e);
  764. }
  765. }
  766. });
  767. // createLiveBroadcast
  768. },
  769. changeType() {
  770. this.$set(this.form, "organIds", []);
  771. this.$set(this.form, "schoolIds", []);
  772. this.$set(this.form, "teamIds", []);
  773. },
  774. async changeSection(val) {
  775. // if (!this.isinit) {
  776. this.form.schoolIds = [];
  777. this.form.teamIds = [];
  778. // }
  779. if (this.form.popularizeType == "SCHOOL" && val && val.length > 0) {
  780. let organId = val.join(",");
  781. try {
  782. await queryByOrganId({ organId }).then((res) => {
  783. if (res.code == 200) {
  784. this.cooperationList = res.data;
  785. }
  786. });
  787. } catch (e) {
  788. console.log(e);
  789. }
  790. }
  791. if (this.form.popularizeType == "TEAM" && val && val.length > 0) {
  792. let organId = val.join(",");
  793. try {
  794. await getTeamList({ organId, page: 1, rows: 9999 }).then((res) => {
  795. if (res.code == 200) {
  796. this.teamList = res.data.rows;
  797. }
  798. });
  799. } catch (e) {
  800. console.log(e);
  801. }
  802. }
  803. },
  804. },
  805. };
  806. </script>
  807. <style lang="scss" scoped>
  808. .nomb {
  809. margin-bottom: 0px !important;
  810. }
  811. ::v-deep .mline {
  812. .el-form-item__content {
  813. display: inline-block !important;
  814. }
  815. }
  816. ::v-deep .el-form--inline {
  817. .el-form-item__content {
  818. display: block;
  819. }
  820. }
  821. ::v-deep .el-select {
  822. width: 300px !important;
  823. }
  824. ::v-deep .el-date-editor {
  825. width: 300px !important;
  826. }
  827. ::v-deep .el-checkbox {
  828. margin-left: 15px !important;
  829. }
  830. ::v-deep .el-input {
  831. position: relative;
  832. font-size: 14px;
  833. display: inline-block;
  834. width: 300px;
  835. }
  836. .row {
  837. padding-left: 24px;
  838. }
  839. ::v-deep .el-textarea__inner {
  840. width: 600px;
  841. }
  842. .chioseWrap {
  843. display: flex;
  844. flex-direction: row;
  845. justify-content: flex-start;
  846. .chioseItem {
  847. border-radius: 4px;
  848. overflow: hidden;
  849. position: relative;
  850. margin-right: 10px;
  851. width: 188px;
  852. height: 188px;
  853. cursor: pointer;
  854. .remberBox {
  855. .wrap {
  856. width: 100px;
  857. height: 100px;
  858. z-index: 100;
  859. position: absolute;
  860. // background-color: red;
  861. }
  862. display: flex;
  863. flex-direction: row;
  864. justify-content: flex-start;
  865. margin-bottom: 30px;
  866. padding-top: 10px;
  867. align-items: center;
  868. position: relative;
  869. color: #6d7278;
  870. font-size: 16px;
  871. position: absolute;
  872. top: 1px;
  873. right: 1px;
  874. .chioseBox {
  875. ::v-deep .el-checkbox__inner {
  876. width: 20px;
  877. height: 20px;
  878. border-radius: 50%;
  879. &::after {
  880. height: 8px;
  881. left: 6px;
  882. position: absolute;
  883. top: 3px;
  884. width: 4px;
  885. }
  886. }
  887. }
  888. .dotWrap {
  889. width: 21px;
  890. height: 21px;
  891. background: url("../../assets/images/icon_checkbox_default.png") no-repeat center;
  892. background-size: contain;
  893. margin-right: 8px;
  894. position: relative;
  895. overflow: hidden;
  896. &.checked {
  897. background: url("../../assets/images/icon_checkbox.png") no-repeat center;
  898. background-size: contain;
  899. }
  900. }
  901. }
  902. }
  903. }
  904. </style>