selectTeachingClassDialog.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. <template>
  2. <div class="opkDialogHeader">
  3. <el-dialog v-model="show" :show-close="false">
  4. <template #header>
  5. <div class="b_head">
  6. <span>{{ lang.ssSelTeachClass }}</span>
  7. <svg
  8. @click="close()"
  9. t="1748587270371"
  10. class="icon"
  11. viewBox="0 0 1024 1024"
  12. version="1.1"
  13. xmlns="http://www.w3.org/2000/svg"
  14. p-id="5023"
  15. width="200"
  16. height="200"
  17. >
  18. <path
  19. d="M0 0h1024v1024H0z"
  20. fill="#FF0033"
  21. fill-opacity="0"
  22. p-id="5024"
  23. ></path>
  24. <path
  25. d="M240.448 168l2.346667 2.154667 289.92 289.941333 279.253333-279.253333a42.666667 42.666667 0 0 1 62.506667 58.026666l-2.133334 2.346667-279.296 279.210667 279.274667 279.253333a42.666667 42.666667 0 0 1-58.005333 62.528l-2.346667-2.176-279.253333-279.253333-289.92 289.962666a42.666667 42.666667 0 0 1-62.506667-58.005333l2.154667-2.346667 289.941333-289.962666-289.92-289.92a42.666667 42.666667 0 0 1 57.984-62.506667z"
  26. fill="#fff"
  27. p-id="5025"
  28. ></path>
  29. </svg>
  30. </div>
  31. </template>
  32. <div class="b_main" v-loading="loading">
  33. <template v-for="item in classList">
  34. <div
  35. class="b_m_classItem"
  36. :class="{ b_m_classItem_active: selectId == item.id }"
  37. :key="item.id"
  38. v-if="item.name"
  39. @click="
  40. selectId == item.id ? (selectId = '') : (selectId = item.id)
  41. "
  42. >
  43. <div>{{ item.name }}</div>
  44. <span v-if="item.studentNum >= 0"
  45. >{{ lang.ssStuCount.replace(/\*/g, item.studentNum) }}
  46. </span>
  47. </div>
  48. </template>
  49. <div
  50. class="b_m_classItem"
  51. @click="editClass"
  52. >
  53. <div>
  54. <span>+</span>
  55. <svg
  56. t="1756867649445"
  57. class="icon"
  58. viewBox="0 0 1024 1024"
  59. version="1.1"
  60. xmlns="http://www.w3.org/2000/svg"
  61. p-id="10274"
  62. width="200"
  63. height="200"
  64. >
  65. <path
  66. d="M417.664 921.6l317.184-824.32h-63.616L353.152 921.6z"
  67. fill="#999999"
  68. p-id="10275"
  69. ></path>
  70. </svg>
  71. <span>-</span>
  72. </div>
  73. <div>{{ lang.ssAddEditClass }}</div>
  74. </div>
  75. </div>
  76. <div class="b_bottom">
  77. <div @click="close()">{{ lang.ssCancel }}</div>
  78. <div class="b_b_submit" @click="selectClassSuccess()">{{selectId ? lang.ssConfirm : lang.ssEnterDirect}}</div>
  79. </div>
  80. </el-dialog>
  81. </div>
  82. <addClassDialog
  83. ref="addClassDialogRef"
  84. :courseDetail="courseDetail"
  85. @success="getCourseList"
  86. />
  87. </template>
  88. <script setup>
  89. import { ref, inject } from "vue";
  90. import { userInfoStore } from "../../stores/counter";
  91. import addClassDialog from "./addClassDialog.vue";
  92. const emit = defineEmits(["success", "changeClassList", "openCourse"]);
  93. import axios from '@/services/config'
  94. import { addOp3 } from '@/mixins/mixin'
  95. const lang = inject('lang')
  96. const checkStage = ref('0');
  97. const courseDetail = ref({});
  98. const loading = ref(false);
  99. const show = ref(false);
  100. const classList = ref([]);
  101. const selectId = ref("");
  102. const userInfo = userInfoStore();
  103. console.log('userInfo',userInfo.user)
  104. const addClassDialogRef = ref(null);
  105. const getClasslist = (options) => {
  106. courseDetail.value = JSON.parse(JSON.stringify(options));
  107. getCourseList();
  108. loading.value = true;
  109. show.value = true;
  110. };
  111. const getCourseList = () => {
  112. axios.get('https://pbl.cocorobo.cn/api/pbl/selectCourseDetail2',{
  113. params: { courseId: courseDetail.value.courseId }
  114. })
  115. .then(res => {
  116. console.log(res);
  117. classList.value = res[3]
  118. selectId.value = classList.value.length > 0 ? classList.value[0].id : ''
  119. loading.value = false
  120. })
  121. .catch(err=>{
  122. console.log(err);
  123. loading.value = false
  124. })
  125. };
  126. async function selectClassSuccess(){
  127. let data = await addInviteCodeOne(selectId.value)
  128. console.log("addInviteCodeOne",data)
  129. gotoCourse(selectId.value);
  130. close();
  131. }
  132. const gotoCourse = (id) => {
  133. // 埋点
  134. if(!id){
  135. insertMemorandum(`开始为<span class='variable'>全部班级</span>授课`)
  136. }else{
  137. let _classData = classList.value.find(item=>item.id == id)
  138. insertMemorandum(`开始为<span class='variable'>${_classData.name}</span>授课`,id)
  139. }
  140. addOp3('1', "", { courseid: courseDetail.value.courseId,classIdL: !id ? 'ssAll' : id ,type: "course_class_open" }, "success")
  141. let url = '';
  142. if (lang.lang == 'hk') {
  143. url = "https://pbl.cocorobo.hk"
  144. }else if (lang.lang == 'en') {
  145. url = "https://pbl.cocorobo.com"
  146. }else{
  147. url = "https://pbl.cocorobo.cn"
  148. }
  149. if (courseDetail.value.state == 1) {
  150. if (classList.value.length) {
  151. goto(
  152. url + "/pbl-student-table/dist/#/studyStudent?type=" +
  153. checkStage.value +
  154. "&courseId=" +
  155. courseDetail.value.courseId +
  156. "&userid=" +
  157. userInfo.user.userid +
  158. "&oid=" +
  159. userInfo.user.organizeid +
  160. "&org=" +
  161. userInfo.user.org +
  162. "&cid=" +
  163. id +
  164. "&tType=" +
  165. userInfo.user.type +
  166. "&screenType=" +
  167. '1' +
  168. "&tcid=" +
  169. id
  170. );
  171. } else {
  172. goto(
  173. url + "/pbl-student-table/dist/#/studyStudent?type=" +
  174. checkStage.value +
  175. "&courseId=" +
  176. courseDetail.value.courseId +
  177. "&userid=" +
  178. userInfo.user.userid +
  179. "&oid=" +
  180. userInfo.user.organizeid +
  181. "&org=" +
  182. userInfo.user.org +
  183. "&cid=" +
  184. id +
  185. "&tType=" +
  186. userInfo.user.type +
  187. "&screenType=" +
  188. '1'
  189. );
  190. }
  191. } else if (courseDetail.value.state == 2 || courseDetail.value.state == 5) {
  192. if (classList.value.length) {
  193. goto(
  194. url + "/pbl-student-table/dist/#/studystudentE2?type=" +
  195. checkStage.value +
  196. "&courseId=" +
  197. courseDetail.value.courseId +
  198. "&userid=" +
  199. userInfo.user.userid +
  200. "&oid=" +
  201. userInfo.user.organizeid +
  202. "&org=" +
  203. userInfo.user.org +
  204. "&cid=" +
  205. id +
  206. "&tType=" +
  207. userInfo.user.type +
  208. "&screenType=" +
  209. '1' +
  210. "&tcid=" +
  211. id
  212. );
  213. } else {
  214. goto(
  215. url + "/pbl-student-table/dist/#/studystudentE2?type=" +
  216. checkStage.value +
  217. "&courseId=" +
  218. courseDetail.value.courseId +
  219. "&userid=" +
  220. userInfo.user.userid +
  221. "&oid=" +
  222. userInfo.user.organizeid +
  223. "&org=" +
  224. userInfo.user.org +
  225. "&cid=" +
  226. id +
  227. "&tType=" +
  228. userInfo.user.type +
  229. "&screenType=" +
  230. '1'
  231. );
  232. }
  233. } else if (courseDetail.value.state == 3 || courseDetail.value.state == 4) {
  234. if (classList.value.length) {
  235. goto(
  236. url + "/pbl-student-table/dist/#/studystudentE3?type=" +
  237. checkStage.value +
  238. "&courseId=" +
  239. courseDetail.value.courseId +
  240. "&userid=" +
  241. userInfo.user.userid +
  242. "&oid=" +
  243. userInfo.user.organizeid +
  244. "&org=" +
  245. userInfo.user.org +
  246. "&cid=" +
  247. id +
  248. "&tType=" +
  249. userInfo.user.type +
  250. "&screenType=" +
  251. '1' +
  252. "&tcid=" +
  253. id
  254. );
  255. } else {
  256. goto(
  257. url + "/pbl-student-table/dist/#/studystudentE3?type=" +
  258. checkStage.value +
  259. "&courseId=" +
  260. courseDetail.value.courseId +
  261. "&userid=" +
  262. userInfo.user.userid +
  263. "&oid=" +
  264. userInfo.user.organizeid +
  265. "&org=" +
  266. userInfo.user.org +
  267. "&cid=" +
  268. id +
  269. "&tType=" +
  270. userInfo.user.type +
  271. "&screenType=" +
  272. '1'
  273. );
  274. }
  275. } else if (courseDetail.value.state == 6) {
  276. if (classList.value.length) {
  277. goto(
  278. url + "/pbl-student-table/dist/#/studySutdentClass?type=" +
  279. checkStage.value +
  280. "&courseId=" +
  281. courseDetail.value.courseId +
  282. "&userid=" +
  283. userInfo.user.userid +
  284. "&oid=" +
  285. userInfo.user.organizeid +
  286. "&org=" +
  287. userInfo.user.org +
  288. "&cid=" +
  289. id +
  290. "&tType=" +
  291. userInfo.user.type +
  292. "&screenType=" +
  293. '1' +
  294. "&tcid=" +
  295. id
  296. );
  297. } else {
  298. goto(
  299. url + "/pbl-student-table/dist/#/studySutdentClass?type=" +
  300. checkStage.value +
  301. "&courseId=" +
  302. courseDetail.value.courseId +
  303. "&userid=" +
  304. userInfo.user.userid +
  305. "&oid=" +
  306. userInfo.user.organizeid +
  307. "&org=" +
  308. userInfo.user.org +
  309. "&cid=" +
  310. id +
  311. "&tType=" +
  312. userInfo.user.type +
  313. "&screenType=" +
  314. '1'
  315. );
  316. }
  317. } else if (courseDetail.value.state == 7) {
  318. if(classList.value.length){
  319. goto(
  320. url + "/pbl-student-table/dist/#/pptEasyClass?type=" +
  321. checkStage.value +
  322. "&courseId=" +
  323. courseDetail.value.courseId +
  324. "&userid=" +
  325. userInfo.user.userid +
  326. "&oid=" +
  327. userInfo.user.organizeid +
  328. "&org=" +
  329. userInfo.user.org +
  330. "&cid=" +
  331. id +
  332. "&tType=" +
  333. userInfo.user.type +
  334. "&screenType=" +
  335. '2' +
  336. "&tcid=" +
  337. id
  338. );
  339. }else {
  340. goto(
  341. url + "/pbl-student-table/dist/#/pptEasyClass?type=" +
  342. checkStage.value +
  343. "&courseId=" +
  344. courseDetail.value.courseId +
  345. "&userid=" +
  346. userInfo.user.userid +
  347. "&oid=" +
  348. userInfo.user.organizeid +
  349. "&org=" +
  350. userInfo.user.org +
  351. "&cid=" +
  352. id +
  353. "&tType=" +
  354. userInfo.user.type +
  355. "&screenType=" +
  356. '2'
  357. );
  358. }
  359. }
  360. let params = [
  361. {
  362. courseId: courseDetail.value.courseId,
  363. },
  364. ];
  365. axios.post("https://pbl.cocorobo.cn/api/pbl/addOpenCoursenum", params)
  366. .then((res) => {})
  367. .catch((err) => {
  368. console.error(err);
  369. });
  370. }
  371. const goto = (val) => {
  372. emit('openCourse', val)
  373. }
  374. const insertMemorandum = (_html,tcid="") => {//保存行为操作
  375. //variable
  376. //btn
  377. let params = [{
  378. uid:userInfo.user.userid,
  379. courseId:courseDetail.value.courseId + tcid,
  380. content:_html
  381. }]
  382. // console.log('params',params);
  383. axios.post("https://pbl.cocorobo.cn/api/pbl/insert_systemOperation_countdownBehavior", params).then(res=>{
  384. console.log('res',res);
  385. if(res == 1){
  386. console.log("保存行为操作成功")
  387. }else{
  388. console.log("保存行为操作失败")
  389. }
  390. }).catch(e=>{
  391. console.log("保存行为操作失败")
  392. console.log(e)
  393. })
  394. }
  395. const close = () => {
  396. show.value = false;
  397. }
  398. // 添加随机码接口
  399. async function addInviteCodeOne(cid) {
  400. return new Promise((resolve)=>{
  401. let params = [
  402. {
  403. courseId: courseDetail.value.courseId,
  404. inviteCode: cid,
  405. },
  406. ];
  407. axios.post("https://pbl.cocorobo.cn/api/pbl/add_courseInviteCode2", params)
  408. .then((res) => {
  409. console.log(res.data)
  410. resolve(res.data)
  411. })
  412. .catch((err) => {
  413. resolve(err.messages)
  414. console.error(err);
  415. });
  416. })
  417. }
  418. const editClass = () => {
  419. addClassDialogRef.value.open({ classList: classList.value });
  420. };
  421. defineExpose({
  422. getClasslist,
  423. });
  424. </script>
  425. <style scoped>
  426. .opkDialogHeader >>> .el-dialog {
  427. width: 900px !important;
  428. border-radius: 8px;
  429. padding: 0;
  430. background-color: #fff;
  431. overflow: hidden;
  432. border-radius: 8px !important;
  433. }
  434. .opkDialogHeader >>> .el-dialog__body {
  435. padding: 0 !important;
  436. background: #fafafa !important;
  437. }
  438. .opkDialogHeader >>> .el-dialog__header { /* 注意这里没有 :deep,因为是全局 */
  439. /* background: #2575fc !important; */
  440. padding: 0 !important;margin: 0 !important;
  441. }
  442. .box {
  443. width: 900px;
  444. height: auto;
  445. background: #fafafa;
  446. border-radius: 15px;
  447. box-shadow:
  448. 0px 6px 30px 5px rgba(0, 0, 0, 0.05),
  449. 0px 16px 24px 2px rgba(0, 0, 0, 0.04),
  450. 0px 8px 10px -5px rgba(0, 0, 0, 0.08);
  451. }
  452. .b_head {
  453. width: 100%;
  454. height: 50px;
  455. /* border-radius: 15px 15px 0 0; */
  456. background: #1a1a1a;
  457. display: flex;
  458. align-items: center;
  459. justify-content: space-between;
  460. box-sizing: border-box;
  461. padding: 0 20px;
  462. color: #fff;
  463. }
  464. .b_head > span {
  465. font-size: 18px;
  466. font-weight: bold;
  467. color: #fff;
  468. }
  469. .b_head > img {
  470. width: 20px;
  471. height: 20px;
  472. cursor: pointer;
  473. }
  474. .b_head > svg {
  475. width: 20px;
  476. height: 20px;
  477. cursor: pointer;
  478. }
  479. .b_main {
  480. width: 100%;
  481. height: 400px;
  482. background: #fafafa;
  483. padding: 20px 20px 20px 20px;
  484. box-sizing: border-box;
  485. overflow: auto;
  486. }
  487. .b_bottom {
  488. width: 100%;
  489. height: 70px;
  490. display: flex;
  491. align-items: center;
  492. justify-content: flex-end;
  493. box-sizing: border-box;
  494. padding: 0 20px;
  495. }
  496. .b_bottom > div {
  497. padding: 10px 25px;
  498. /* background: #fff; */
  499. color: #000;
  500. border-radius: 4px;
  501. display: flex;
  502. align-items: center;
  503. justify-content: center;
  504. border: solid 1px #eeeeee;
  505. margin-left: 15px;
  506. cursor: pointer;
  507. font-size: 16px;
  508. }
  509. .b_bottom > .b_b_submit {
  510. background: #1a1a1a;
  511. color: #d4d4d4;
  512. border-color: #1a1a1a;
  513. }
  514. .b_m_classItem {
  515. width: 32%;
  516. height: 85px;
  517. float: left;
  518. margin-bottom: 20px;
  519. display: flex;
  520. align-items: center;
  521. justify-content: center;
  522. flex-direction: column;
  523. background: #fff;
  524. box-shadow:
  525. 0px 6px 30px 5px rgba(0, 0, 0, 0.05),
  526. 0px 16px 24px 2px rgba(0, 0, 0, 0.04),
  527. 0px 8px 10px -5px rgba(0, 0, 0, 0.08);
  528. border-radius: 12px;
  529. cursor: pointer;
  530. transition: 0.2s;
  531. }
  532. .b_m_classItem > div {
  533. color: #000;
  534. font-size: 16px;
  535. margin: 4px 0;
  536. display: flex;
  537. flex-wrap: wrap;
  538. align-content: center;
  539. }
  540. .b_m_classItem > div > span {
  541. display: flex;
  542. justify-content: center;
  543. align-items: center;
  544. width: 25px;
  545. height: 25px;
  546. border-radius: 4px;
  547. border: solid 1px #b0b0b0;
  548. }
  549. .b_m_classItem > div > svg {
  550. width: 20px;
  551. height: 25px;
  552. margin: 0 5px;
  553. }
  554. .b_m_classItem > span {
  555. color: #a3a3a3;
  556. font-size: 14px;
  557. }
  558. .b_main > div:nth-child(3n-1) {
  559. margin: 0 2%;
  560. }
  561. .b_m_classItem_active {
  562. background-color: #FCCF00;
  563. color: #000 !important;
  564. /* box-shadow: 4px 4px 4px 0px rgba(138, 238, 138, 0.555); */
  565. }
  566. .b_m_noClassMsg {
  567. width: 100%;
  568. height: 100%;
  569. display: flex;
  570. justify-content: center;
  571. align-items: center;
  572. }
  573. .b_bottom {
  574. width: 100%;
  575. height: 70px;
  576. display: flex;
  577. align-items: center;
  578. justify-content: flex-end;
  579. box-sizing: border-box;
  580. padding: 0 20px;
  581. }
  582. .b_bottom>div{
  583. padding: 10px 25px;
  584. background: #fff;
  585. color: #000;
  586. border-radius: 4px;
  587. display: flex;
  588. align-items: center;
  589. justify-content: center;
  590. border: solid 1px #EEEEEE;
  591. margin-left: 15px;
  592. cursor: pointer;
  593. font-size: 16px;
  594. }
  595. .b_bottom>.b_b_submit{
  596. background: #1A1A1A;
  597. color: #D4D4D4;
  598. border-color: #1A1A1A;
  599. }
  600. </style>