newLiveClass.vue 28 KB

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