courseAdjust.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948
  1. <!-- -->
  2. <template>
  3. <div>
  4. <save-form
  5. :inline="true"
  6. class="searchForm"
  7. save-key="liveClassManager-courseAdjust"
  8. @submit="search"
  9. @reset="onReSet"
  10. :model="searchForm"
  11. ref="searchForm"
  12. >
  13. <el-form-item prop="shareMode">
  14. <el-select
  15. v-model="searchForm.shareMode"
  16. filterable
  17. clearable
  18. placeholder="请选择分享方式"
  19. >
  20. <el-option
  21. v-for="(item, index) in shareModeList"
  22. :key="index"
  23. :label="item.label"
  24. :value="item.value"
  25. ></el-option>
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item>
  29. <el-button @click="search" type="danger">搜索</el-button>
  30. <el-button type="primary" native-type="reset">重置</el-button>
  31. </el-form-item>
  32. </save-form>
  33. <el-button type="primary" style="margin-bottom: 12px" @click="onAdjustment"
  34. >批量调整</el-button
  35. >
  36. <div class="tableWrap">
  37. <el-table
  38. style="width: 100%"
  39. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  40. :data="tableList"
  41. @selection-change="handleSelectionChange"
  42. >
  43. <el-table-column
  44. type="selection"
  45. :selectable="isDisabled"
  46. width="55"
  47. ></el-table-column>
  48. <el-table-column align="center" label="课程编号">
  49. <template slot-scope="scope">
  50. <div>{{ scope.row.id || "" }}</div>
  51. </template>
  52. </el-table-column>
  53. <el-table-column align="center" label="课程名称">
  54. <template slot-scope="scope">
  55. <div>{{ scope.row.name }}</div>
  56. </template>
  57. </el-table-column>
  58. <el-table-column align="center" label="课程状态">
  59. <template slot-scope="scope">
  60. <div>{{ scope.row.status | coursesStatus }}</div>
  61. </template>
  62. </el-table-column>
  63. <el-table-column align="center" prop="classDate" label="上课日期">
  64. <template slot-scope="scope">
  65. {{ scope.row.classDate | dayjsFormat }}
  66. {{ scope.row.startClassTime | dayjsFormat("HH:mm") }}~{{
  67. scope.row.endClassTime | dayjsFormat("HH:mm")
  68. }}
  69. </template>
  70. </el-table-column>
  71. <el-table-column align="center" label="分享状态">
  72. <template slot-scope="scope">
  73. <div>{{ scope.row.shareMode | shareLiveTypeFilter }}</div>
  74. </template>
  75. </el-table-column>
  76. <!-- <el-table-column align="center" prop="startClassTime" label="开始时间"></el-table-column>
  77. <el-table-column align="center" prop="endClassTime" label="结束时间"></el-table-column> -->
  78. <el-table-column label="操作" align="center">
  79. <template slot-scope="scope">
  80. <div>
  81. <el-dropdown
  82. trigger="click"
  83. placement="bottom"
  84. :hide-on-click="false"
  85. v-if="scope.row.id"
  86. >
  87. <span class="el-dropdown-link">
  88. 操作<i class="el-icon-arrow-down el-icon--right"></i>
  89. </span>
  90. <el-dropdown-menu slot="dropdown" style="width: 100px">
  91. <el-dropdown-item
  92. style="width: 100px"
  93. v-if="
  94. scope.row.id &&
  95. !scope.row.isSettlement &&
  96. scope.row.status != 'UNDERWAY' &&
  97. $helpers.permission('courseSchedule/classStartDateAdjust/liveReset')
  98. "
  99. @click.native="resetClass(scope.row)"
  100. >
  101. <el-button type="text">调整</el-button>
  102. </el-dropdown-item>
  103. <el-dropdown-item
  104. style="width: 100px"
  105. @click.native="
  106. () => {
  107. if (scope.row.status == 'OVER') {
  108. return;
  109. } else {
  110. startShare(scope.row);
  111. }
  112. }
  113. "
  114. v-if="
  115. scope.row.id &&
  116. $helpers.permission('courseSchedule/updateCourseScheduleShareMode')
  117. "
  118. >
  119. <el-button type="text" :disabled="scope.row.status == 'OVER'"
  120. >分享</el-button
  121. >
  122. </el-dropdown-item>
  123. <el-dropdown-item
  124. v-if="
  125. scope.row.id &&
  126. $helpers.permission('courseSchedule/classStartDateAdjust/liveReset')
  127. "
  128. @click.native="
  129. () => {
  130. if (
  131. scope.row.status == 'OVER' ||
  132. scope.row.shareMode == 'NO_SHARE'
  133. ) {
  134. return;
  135. } else {
  136. lookCode(scope.row);
  137. }
  138. }
  139. "
  140. >
  141. <el-button
  142. type="text"
  143. :disabled="
  144. scope.row.status == 'OVER' || scope.row.shareMode == 'NO_SHARE'
  145. "
  146. >二维码</el-button
  147. >
  148. </el-dropdown-item>
  149. <el-dropdown-item
  150. v-if="
  151. scope.row.id &&
  152. $helpers.permission('courseShare/queryCourseSharedStudent')
  153. "
  154. @click.native="
  155. () => {
  156. if (
  157. scope.row.status == 'OVER' ||
  158. scope.row.shareMode !== 'PRIVATE'
  159. ) {
  160. return;
  161. } else {
  162. gotoShareList(scope.row);
  163. }
  164. }
  165. "
  166. >
  167. <el-button
  168. type="text"
  169. :disabled="
  170. scope.row.status == 'OVER' || scope.row.shareMode !== 'PRIVATE'
  171. "
  172. >分享列表</el-button
  173. >
  174. </el-dropdown-item>
  175. <el-dropdown-item
  176. @click.native="lookViedoList(scope.row)"
  177. v-if="
  178. scope.row.videoNum > 0 &&
  179. $helpers.permission('courseShare/queryCourseSharedStudent')
  180. "
  181. >
  182. <el-button type="text">回放</el-button>
  183. </el-dropdown-item>
  184. </el-dropdown-menu>
  185. </el-dropdown>
  186. <!-- -->
  187. </div>
  188. </template>
  189. </el-table-column>
  190. </el-table>
  191. </div>
  192. <el-dialog :title="adjustmentName" width="800px" :visible.sync="adjustmentVisible">
  193. <el-form
  194. :model="adjustmentForm"
  195. label-position="right"
  196. label-width="120px"
  197. ref="adjustmentForm"
  198. :rules="adjustmentRules"
  199. :inline="true"
  200. >
  201. <el-form-item label="已选择课时数">
  202. <el-input disabled v-model.trim="adjustmentForm.count"></el-input>
  203. </el-form-item>
  204. <!-- <el-form-item label="课程类型" prop="courseType">
  205. <el-select clearable v-model.trim="adjustmentForm.courseType" disabled>
  206. <el-option label="线上课" value="ONLINE"></el-option>
  207. <el-option label="线下课" value="OFFLINE"></el-option>
  208. </el-select>
  209. </el-form-item> -->
  210. <!-- <el-form-item label="教学地点" v-if="adjustmentForm.courseType == 'OFFLINE'">
  211. <el-select v-model.trim="adjustmentForm.address" filterable clearable>
  212. <el-option v-for="(item, index) in schoolList" :key="index" :value="item.id" :label="item.name"></el-option>
  213. </el-select>
  214. </el-form-item> -->
  215. <br />
  216. <el-form-item label="排课起始时间" prop="courseTime">
  217. <el-date-picker
  218. v-model.trim="adjustmentForm.courseTime"
  219. :picker-options="pickerOptions()"
  220. style="width: 200px !important"
  221. type="date"
  222. value-format="yyyy-MM-dd"
  223. placeholder="选择日期"
  224. ></el-date-picker>
  225. <el-checkbox style="margin-left: 10px" v-model.trim="adjustmentForm.checked"
  226. >是否跳过节假日</el-checkbox
  227. >
  228. </el-form-item>
  229. </el-form>
  230. <div class="WeekWrap">
  231. <h3 style="margin-bottom: 20px">
  232. 循环次数
  233. <el-button type="text" style="margin-left: 10px" @click="addWeek"
  234. >添加</el-button
  235. >
  236. </h3>
  237. <div class="countWrap" style="margin-bottom: 10px">
  238. <div
  239. class="countItem"
  240. style="margin-bottom: 20px"
  241. v-for="(item, index) in weekList"
  242. :key="index"
  243. >
  244. <span>循环周期:</span>
  245. <el-select v-model.trim="item.dayOfWeek" filterable clearable>
  246. <el-option
  247. v-for="(item, index) in weekDateList"
  248. :key="index"
  249. :label="item.label"
  250. :value="item.value"
  251. ></el-option>
  252. </el-select>
  253. <span style="margin-left: 10px">开始时间</span>
  254. <el-time-picker
  255. style="margin-left: 10px"
  256. placeholder
  257. v-model.trim="item.startClassTime"
  258. @change="
  259. (val) => {
  260. changeStartTimes(val, item);
  261. }
  262. "
  263. format="HH:mm"
  264. value-format="HH:mm"
  265. :picker-options="{
  266. selectableRange: '06:00:00 - 21:00:00',
  267. }"
  268. ></el-time-picker>
  269. <span style="margin-left: 10px">结束时间</span>
  270. <el-time-picker
  271. style="margin-left: 10px"
  272. placeholder
  273. v-model.trim="item.endClassTime"
  274. format="HH:mm"
  275. value-format="HH:mm"
  276. disabled
  277. :picker-options="{
  278. selectableRange: '06:00:00 - 21:00:00',
  279. }"
  280. ></el-time-picker>
  281. <el-button
  282. style="margin-left: 10px"
  283. type="danger"
  284. :disabled="index < 1"
  285. @click="removeWeek(item)"
  286. icon="el-icon-delete"
  287. circle
  288. ></el-button>
  289. </div>
  290. </div>
  291. </div>
  292. <div slot="footer" class="dialog-footer">
  293. <el-button @click="adjustmentVisible = false">取 消</el-button>
  294. <el-button type="primary" @click="submitAdjustment">确 定</el-button>
  295. </div>
  296. </el-dialog>
  297. <el-dialog
  298. title="课程调整"
  299. width="400px"
  300. :before-close="handleClose"
  301. :visible.sync="courseVisible"
  302. >
  303. <el-form
  304. :model="maskForm"
  305. class="maskForm"
  306. ref="maskForm"
  307. :rules="maskRules"
  308. label-position="right"
  309. label-width="80px"
  310. :inline="true"
  311. >
  312. <el-form-item label="上课日期" prop="date">
  313. <el-date-picker
  314. v-model.trim="maskForm.date"
  315. type="date"
  316. :picker-options="coursesDate()"
  317. value-format="yyyy-MM-dd"
  318. placeholder="选择日期"
  319. ></el-date-picker>
  320. </el-form-item>
  321. <el-form-item label="开始时间" prop="startTime">
  322. <el-time-picker
  323. placeholder="起始时间"
  324. v-model.trim="startTime"
  325. @change="changeStartTime"
  326. format="HH:mm"
  327. value-format="HH:mm"
  328. :picker-options="{
  329. selectableRange: `${nowTime} - 23:30:00`,
  330. }"
  331. ></el-time-picker>
  332. </el-form-item>
  333. <el-form-item label="结束时间" prop="endTime">
  334. <el-time-picker
  335. placeholder="结束时间"
  336. format="HH:mm"
  337. value-format="HH:mm"
  338. v-model="maskForm.endTime"
  339. disabled
  340. >
  341. </el-time-picker>
  342. </el-form-item>
  343. </el-form>
  344. <div slot="footer" class="dialog-footer">
  345. <el-button @click="courseVisible = false">取 消</el-button>
  346. <el-button type="primary" @click="submitResetClass">确 定</el-button>
  347. </div>
  348. </el-dialog>
  349. <el-dialog title="分享模式" width="400px" :visible.sync="shareModeVisible">
  350. <el-form
  351. :model="shareModeForm"
  352. class="maskForm"
  353. ref="shareModeForm"
  354. label-position="right"
  355. label-width="80px"
  356. :inline="true"
  357. >
  358. <el-form-item label="分享模式" prop="shareMode">
  359. <el-radio-group v-model="shareModeForm.shareMode">
  360. <el-radio label="OPEN">公开</el-radio>
  361. <el-radio label="PRIVATE">私密</el-radio>
  362. </el-radio-group>
  363. </el-form-item>
  364. </el-form>
  365. <div slot="footer" class="dialog-footer">
  366. <el-button @click="shareModeVisible = false">取 消</el-button>
  367. <el-button type="primary" @click="createShareCode">确 定</el-button>
  368. </div>
  369. </el-dialog>
  370. <qr-code v-model="codeStatus" title="二维码" :codeUrl="qrCodeUrl">
  371. <div class="codeType">
  372. {{ actvieRow.shareMode == "OPEN" ? "公开二维码" : "私密二维码" }}
  373. </div>
  374. </qr-code>
  375. <el-dialog
  376. :visible.sync="payVisible"
  377. v-if="payVisible"
  378. width="500px"
  379. title="直播回放"
  380. >
  381. <div class="lineWrap">
  382. <div
  383. class="linkItem"
  384. v-for="(item, index) in videoList"
  385. :key="index"
  386. @click="opneVideo(item)"
  387. >
  388. <div class="linkItemWrap">
  389. <!-- <video width="110px" :src="item.url"></video> -->
  390. <img width="110px" :src="videoPlace" alt="" />
  391. <i class="el-icon-video-play linkIcon"></i>
  392. </div>
  393. <p :underline="false" type="text" class="lineTitle">
  394. {{ item.endTime | dateForMinFormat }}
  395. </p>
  396. </div>
  397. </div>
  398. <div slot="footer" class="dialog-footer">
  399. <!-- <el-button @click="payVisible = false">取 消</el-button> -->
  400. <el-button type="primary" @click="payVisible = false">确 定</el-button>
  401. </div></el-dialog
  402. >
  403. <el-dialog
  404. :title="activeVideo.endTime | dateForMinFormat"
  405. width="680px"
  406. append-to-body
  407. :visible.sync="videoVisible"
  408. v-if="videoVisible"
  409. >
  410. <!-- activeUrl -->
  411. <div class="activeVideoWrap">
  412. <vue-core-video-player
  413. v-if="activeVideo.os == 'mobile' && activeVideo.videoType != 'm3u8'"
  414. style="width: 480px"
  415. :src="activeVideo.url"
  416. ref="dialogVideo"
  417. >
  418. 您的浏览器不支持视频播放
  419. </vue-core-video-player>
  420. <vue-core-video-player
  421. v-if="activeVideo.os == 'mobile' && activeVideo.videoType == 'm3u8'"
  422. style="width: 480px"
  423. :src="activeVideo.url"
  424. ref="dialogVideo"
  425. :core="HLSCore"
  426. >
  427. 您的浏览器不支持视频播放
  428. </vue-core-video-player>
  429. <vue-core-video-player
  430. v-if="activeVideo.os == 'client'"
  431. style="width: 640px"
  432. :src="activeVideo.url"
  433. ref="dialogVideo"
  434. :core="HLSCore"
  435. >
  436. 您的浏览器不支持视频播放
  437. </vue-core-video-player>
  438. <vue-core-video-player
  439. v-if="activeVideo.os == 'pc'"
  440. style="width: 640px"
  441. :src="activeVideo.url"
  442. ref="dialogVideo"
  443. >
  444. 您的浏览器不支持视频播放
  445. </vue-core-video-player>
  446. </div>
  447. </el-dialog>
  448. </div>
  449. </template>
  450. <script>
  451. import { resetCourse } from "@/api/buildTeam";
  452. import { vipCourseAdjust } from "@/api/vipSeting";
  453. import { liveCourseList, createLiveGroupShare, getCourseVideoList } from "../../api";
  454. import { diffTimerFormMinute, addTimerFormMinute } from "@/utils/date";
  455. import { shareLiveTypeList } from "@/utils/searchArray";
  456. import { vaildStudentUrl } from "@/utils/validate";
  457. import dayjs from "dayjs";
  458. import qrCode from "@/components/QrCode/index";
  459. import videoPlace from "../../images/video-place.png";
  460. import HLSCore from "@core-player/playcore-hls";
  461. export default {
  462. components: {
  463. qrCode,
  464. },
  465. data() {
  466. return {
  467. shareModeList: shareLiveTypeList,
  468. searchForm: {
  469. id: this.$route.query.id,
  470. shareMode: "",
  471. },
  472. adjustmentName: "",
  473. tableList: [],
  474. rules: {
  475. // 分页规则
  476. limit: 10, // 限制显示条数
  477. page: 1, // 当前页
  478. total: 0, // 总条数
  479. page_size: [10, 20, 40, 50], // 选择限制显示条数
  480. },
  481. chioseVipList: [],
  482. activeList: [],
  483. adjustmentVisible: false,
  484. adjustmentForm: {
  485. count: "",
  486. courseTime: "",
  487. checked: false,
  488. addCount: "",
  489. courseType: "ONLINE",
  490. fee: "",
  491. address: "",
  492. },
  493. adjustmentRules: {
  494. courseTime: [{ required: true, message: "请选择开始时间" }],
  495. addCount: [{ required: true, message: "请输入加课次数" }],
  496. courseType: [{ required: true, message: "请选择课程类型" }],
  497. fee: [{ required: true, message: "请输入费用" }],
  498. address: [{ required: true, message: "请选择教学地点" }],
  499. },
  500. weekDateList: [
  501. { value: "1", label: "星期一" },
  502. { value: "2", label: "星期二" },
  503. { value: "3", label: "星期三" },
  504. { value: "4", label: "星期四" },
  505. { value: "5", label: "星期五" },
  506. { value: "6", label: "星期六" },
  507. { value: "7", label: "星期日" },
  508. ],
  509. weekList: [
  510. {
  511. dayOfWeek: "",
  512. startTime: "",
  513. endTime: "",
  514. moid: new Date().getTime(),
  515. },
  516. ],
  517. courseVisible: false,
  518. maskForm: {
  519. date: "",
  520. startTime: "",
  521. endTime: "",
  522. id: "",
  523. address: "",
  524. teachMode: "",
  525. },
  526. maskRules: {
  527. date: [{ required: true, message: "请选择上课时间", trigger: "blur" }],
  528. },
  529. startTime: "",
  530. shareModeForm: {
  531. shareMode: "OPEN",
  532. courseId: "",
  533. },
  534. shareModeVisible: false,
  535. codeStatus: false,
  536. qrCodeUrl: "",
  537. actvieRow: { shareMode: "" },
  538. payVisible: false,
  539. videoVisible: false,
  540. videoList: [],
  541. videoPlace,
  542. HLSCore,
  543. };
  544. },
  545. mounted() {
  546. this.getList();
  547. },
  548. methods: {
  549. lookCode(row) {
  550. this.actvieRow = row;
  551. this.qrCodeUrl =
  552. vaildStudentUrl() + `/mlive/?courseId=${row.id}&isLogin=true#/login`;
  553. this.codeStatus = true;
  554. },
  555. gotoShareList(row) {
  556. this.$router.push({
  557. path: "/business/liveShareStudentList",
  558. query: { ...this.$route.query, courseId: row.id },
  559. });
  560. },
  561. search() {
  562. this.rules.page = 1;
  563. this.getList();
  564. },
  565. onReSet() {
  566. this.$refs.searchForm.resetFields();
  567. (this.searchForm.id = this.$route.query.id), this.search();
  568. },
  569. async getList() {
  570. try {
  571. const { data } = await liveCourseList({
  572. liveGroupId: this.searchForm.id,
  573. rows: this.rules.limit,
  574. page: this.rules.page,
  575. ...this.searchForm,
  576. });
  577. this.tableList = data.list;
  578. // this.rules.total = data.pageInfo.total;
  579. this.courseTime = data.singleClassMinutes;
  580. } catch {}
  581. },
  582. isDisabled(row, index) {
  583. if (row.isSettlement || !row.id || row.status == "UNDERWAY") {
  584. return false;
  585. } else {
  586. return true;
  587. }
  588. },
  589. addWeek() {
  590. // 添加循环周期
  591. this.weekList.push({
  592. dayOfWeek: "",
  593. startClassTime: "",
  594. endClassTime: "",
  595. id: new Date(),
  596. });
  597. },
  598. // 删除循环周
  599. removeWeek(item) {
  600. for (let i in this.weekList) {
  601. if (this.weekList[i].id == item.id) {
  602. this.weekList.splice(i, 1);
  603. }
  604. }
  605. },
  606. handleSelectionChange(val) {
  607. this.chioseVipList = val;
  608. this.adjustmentForm.count = val.length;
  609. this.activeList = val;
  610. },
  611. onAdjustment() {
  612. this.adjustmentName = "批量调整";
  613. if (this.adjustmentForm.count <= 0) {
  614. this.$message.error("请至少勾选一节课");
  615. } else {
  616. this.adjustmentVisible = true;
  617. }
  618. },
  619. coursesDate(dateStr) {
  620. let self = this;
  621. return {
  622. firstDayOfWeek: 1,
  623. disabledDate: (time) => {
  624. return time.getTime() + 86400000 <= new Date().getTime();
  625. },
  626. };
  627. },
  628. pickerOptions(dateStr) {
  629. return {
  630. firstDayOfWeek: 1,
  631. disabledDate(time) {
  632. return time.getTime() + 86400000 <= new Date().getTime();
  633. },
  634. };
  635. },
  636. resetClass(row) {
  637. /**
  638. * maskForm.startTime
  639. */
  640. this.maskForm.date = row.classDate.split(" ")[0];
  641. this.startTime = row.startClassTimeStr.substring(0, 5);
  642. this.maskForm.endTime = row.endClassTimeStr.substring(0, 5);
  643. // this.maskForm.endTime = row.endClassTimeStr;
  644. this.maskForm.id = row.id;
  645. this.maskForm.address = row.schoolId || null;
  646. this.maskForm.teachMode = row.teachMode;
  647. // 修改课时
  648. this.courseVisible = true;
  649. },
  650. handleClose() {
  651. this.courseVisible = false;
  652. this.startTime = "";
  653. this.maskForm = {
  654. date: "",
  655. startTime: "",
  656. endTime: "",
  657. id: "",
  658. address: "",
  659. teachMode: "",
  660. };
  661. this.$refs["maskForm"].resetFields();
  662. },
  663. submitResetClass() {
  664. // endClassTimeStr: this.maskForm.endTime,
  665. if (!this.startTime) {
  666. this.$message.error("请填写修改时间");
  667. return;
  668. }
  669. let classTime = this.maskForm.date ? new Date(this.maskForm.date) : new Date();
  670. let ymd =
  671. classTime.getFullYear() +
  672. "-" +
  673. (classTime.getMonth() + 1) +
  674. "-" +
  675. classTime.getDate();
  676. let tempStartTime = this.startTime;
  677. if (this.startTime.length <= 5) {
  678. tempStartTime = tempStartTime + ":00";
  679. }
  680. let obj = {
  681. startClassTime: ymd + " " + this.startTime,
  682. // startClassTimeStr: this.startTime,
  683. id: this.maskForm.id,
  684. classDate: this.maskForm.date,
  685. schoolId: this.maskForm.address || null,
  686. teachMode: this.maskForm.teachMode || null,
  687. groupType: "LIVE",
  688. };
  689. resetCourse(obj).then((res) => {
  690. if (res.code == 200) {
  691. this.$message.success("修改成功");
  692. this.courseVisible = false;
  693. this.getList();
  694. } //else {
  695. // this.$message.error(res.msg)
  696. // }
  697. });
  698. },
  699. submitAdjustment() {
  700. this.$refs["adjustmentForm"].validate((item) => {
  701. if (item) {
  702. let week = this.weekList;
  703. if (!week[0] || !week[0].startClassTime || !week[0].dayOfWeek) {
  704. this.$message.error("至少排一节课");
  705. return;
  706. }
  707. // 开始
  708. let obj = {};
  709. obj.courseCreateStartTime = this.adjustmentForm.courseTime;
  710. let idArr = this.activeList.map((item) => {
  711. return item.id;
  712. });
  713. let courseScheduleIds = idArr.join(",");
  714. obj.courseScheduleIds = courseScheduleIds;
  715. obj.courseTimes = this.weekList;
  716. obj.holiday = this.adjustmentForm.checked;
  717. obj.teachMode = this.adjustmentForm.courseType || null;
  718. obj.groupType = "LIVE";
  719. obj.vipGroupId = this.searchForm.id;
  720. obj.schoolId = this.adjustmentForm.address || null;
  721. vipCourseAdjust(obj).then((res) => {
  722. if (res.code == 200) {
  723. this.$message.success("恭喜您修改成功");
  724. this.adjustmentVisible = false;
  725. this.getList();
  726. }
  727. });
  728. }
  729. });
  730. },
  731. changeStartTime(val) {
  732. this.$nextTick((res) => {
  733. if (val) {
  734. this.$set(
  735. this.maskForm,
  736. "endTime",
  737. addTimerFormMinute(this.maskForm.date, val, this.courseTime)
  738. );
  739. } else {
  740. this.$set(this.maskForm, "endTime", "");
  741. }
  742. if (!this.maskForm.endTime) {
  743. this.$set(this, "startTime", "");
  744. }
  745. });
  746. },
  747. changeStartTimes(val, item) {
  748. this.$nextTick((res) => {
  749. if (val) {
  750. let str = dayjs(new Date()).format("YYYY-MM-DD");
  751. this.$set(item, "endClassTime", addTimerFormMinute(str, val, this.courseTime));
  752. } else {
  753. this.$set(item, "endClassTime", "");
  754. }
  755. if (!item.endClassTime) {
  756. console.log(item.startClassTime);
  757. this.$set(item, "startClassTime", "");
  758. }
  759. });
  760. },
  761. startShare(row) {
  762. this.actvieRow = row;
  763. this.shareModeForm.courseId = row.id;
  764. console.log(row.shareMode, "row.shareMode");
  765. this.shareModeForm.shareMode = row.shareMode || "OPEN";
  766. if (row.shareMode == "NO_SHARE") {
  767. this.shareModeForm.shareMode = "OPEN";
  768. }
  769. this.shareModeVisible = true;
  770. },
  771. async createShareCode() {
  772. try {
  773. const res = await createLiveGroupShare({
  774. ...this.shareModeForm,
  775. shareMode: this.shareModeForm.shareMode,
  776. });
  777. this.shareModeVisible = false;
  778. this.$message.success("创建成功");
  779. if (this.shareModeForm.shareMode == "PRIVATE") {
  780. this.actvieRow.shareMode = "PRIVATE";
  781. this.gotoShareList(this.actvieRow);
  782. }
  783. if (this.shareModeForm.shareMode == "OPEN") {
  784. this.actvieRow.shareMode = "OPEN";
  785. this.lookCode(this.actvieRow);
  786. }
  787. this.getList();
  788. } catch (e) {}
  789. },
  790. opneVideo(row) {
  791. console.log(row, "opneVideo");
  792. this.activeVideo = row;
  793. this.videoVisible = true;
  794. },
  795. async lookViedoList(row) {
  796. try {
  797. const res = await getCourseVideoList({ roomUid: row.liveRoomId });
  798. this.videoList = res.data;
  799. this.payVisible = true;
  800. } catch (e) {
  801. console.log(e);
  802. }
  803. },
  804. },
  805. computed: {
  806. nowTime() {
  807. // console.log(that.maskForm.date)
  808. let str = "06:00:00";
  809. if (this.maskForm.date == dayjs(new Date()).format("YYYY-MM-DD")) {
  810. str = dayjs(new Date()).format("HH:mm:ss");
  811. }
  812. return str;
  813. },
  814. },
  815. filters: {
  816. formatterTime(val) {
  817. let result;
  818. if (val) {
  819. result = val.split(" ")[0];
  820. } else {
  821. result = "";
  822. }
  823. return result;
  824. },
  825. formatterStatus(val) {
  826. let arr = ["未开始", "报名中", "进行中", "取消", "已结束", "报名结束", "暂停"];
  827. return arr[val];
  828. },
  829. },
  830. };
  831. </script>
  832. <style lang="scss" scoped>
  833. .codeType {
  834. text-align: center;
  835. font-weight: 600;
  836. font-size: 16px;
  837. margin-bottom: 10px;
  838. }
  839. ::v-deep .el-dropdown-link {
  840. cursor: pointer;
  841. color: var(--color-primary);
  842. }
  843. ::v-deep .el-icon-arrow-down {
  844. font-size: 12px;
  845. }
  846. .vipwrap {
  847. display: flex;
  848. flex-direction: row;
  849. justify-content: flex-start;
  850. .newBand {
  851. margin-right: 20px;
  852. }
  853. }
  854. .resetClassForm {
  855. ::v-deep .el-date-editor.el-input,
  856. ::v-deep .el-date-editor.el-input__inner {
  857. width: 180px !important;
  858. }
  859. }
  860. .countWrap {
  861. ::v-deep .el-date-editor.el-input,
  862. ::v-deep .el-date-editor.el-input__inner {
  863. width: 100px !important;
  864. }
  865. }
  866. .maskForm {
  867. ::v-deep .el-input {
  868. width: 220px !important;
  869. }
  870. }
  871. .titlewrap {
  872. display: flex;
  873. flex-direction: row;
  874. justify-content: flex-start;
  875. align-items: center;
  876. }
  877. .lineWrap {
  878. display: flex;
  879. flex-direction: row;
  880. align-items: center;
  881. flex-wrap: wrap;
  882. .linkItem {
  883. display: flex;
  884. flex-direction: column;
  885. align-items: center;
  886. margin-right: 5px;
  887. cursor: pointer;
  888. position: relative;
  889. &:hover {
  890. color: var(--color-primary);
  891. .lineTitle {
  892. color: var(--color-primary);
  893. font-weight: bold;
  894. }
  895. }
  896. .linkItemWrap {
  897. position: relative;
  898. .linkIcon {
  899. font-size: 25px;
  900. position: absolute;
  901. top: 50%;
  902. margin-top: -13px;
  903. left: 50%;
  904. margin-left: -13px;
  905. color: #fff;
  906. }
  907. }
  908. }
  909. .lineTitle {
  910. height: 40px;
  911. line-height: 40px;
  912. color: rgba(102, 102, 102, 0.9);
  913. padding: 0 17px;
  914. overflow: hidden;
  915. margin-bottom: 10px;
  916. position: relative;
  917. border-radius: 4px;
  918. }
  919. }
  920. .activeVideoWrap {
  921. display: flex;
  922. flex-direction: column;
  923. align-items: center;
  924. }
  925. </style>