index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <div class="pptEasyClass">
  3. <div class="pec_main" v-loading="pageLoading">
  4. <div class="pec_header">
  5. <div class="pec_h_left">
  6. <div class="pec_h_l_title">
  7. <span>{{ courseDetail.title }}</span>
  8. </div>
  9. <div v-if="tcid && inviteCode" class="inviteBox" style="margin-left: 20px;">
  10. <span>随机码:{{ inviteCode }}</span>
  11. </div>
  12. </div>
  13. <div class="pec_h_right">
  14. <div class="pec_h_r_btnArea">
  15. <el-tooltip effect="light" content="刷新" placement="top">
  16. <div class="pec_h_r_btn_refresh" @click="refreshCourse">
  17. <img src="../../assets/icon/newIcons/refresh.png" alt="" />
  18. <span>刷新</span>
  19. </div>
  20. </el-tooltip>
  21. <div
  22. @click.stop="back"
  23. >
  24. <img src="../../assets/icon/newIcon/return.png" alt="" />
  25. <span style="color: #000">返回</span>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="pec_content">
  31. <iframe allow="camera *; microphone *;display-capture;midi;encrypted-media;clipboard-write;clipboard-read" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" frameborder="no" border="0" :src="iframeSrc" v-if="showIframe" style="width: 100%; height: 100%; border: none"></iframe>
  32. </div>
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. id: this.$route.query.courseId,
  41. userid: this.$route.query.userid,
  42. classId: this.$route.query.cid,
  43. role: this.$route.query.role,
  44. oid: this.$route.query.oid,
  45. org: this.$route.query.org,
  46. tType: this.$route.query.tType,
  47. courseType: this.$route.query.type,
  48. screenType: this.$route.query.screenType,
  49. tcid2: this.$route.query.tcid,
  50. tcid:"",
  51. showIframe: false,
  52. iframeSrc: "",
  53. courseDetail: {},
  54. pageLoading: false,
  55. inviteCode:"",
  56. };
  57. },
  58. methods: {
  59. goTo(path) {
  60. this.$router.push(path);
  61. },
  62. refreshCourse() {
  63. this.getCourseDetail();
  64. },
  65. getCourseDetail() {
  66. this.pageLoading = true;
  67. let params = {
  68. courseId: this.id
  69. };
  70. this.ajax
  71. .get(this.$store.state.api + "selectCourseDetail3", params)
  72. .then(res => {
  73. console.log("getCourseDetail", res);
  74. this.courseDetail = res.data[0][0];
  75. this.courseDetail.chapters = JSON.parse(this.courseDetail.chapters);
  76. this.tcid = this.arrayToArray(
  77. this.courseDetail.juri ? this.courseDetail.juri.split(",") : [],
  78. this.tcid2 ? this.tcid2.split(",") : []
  79. )[0] || "";
  80. if (this.tcid && res.data[1].length) {
  81. let _inviteA = [];
  82. for (var ik = 0; ik < res.data[1].length; ik++) {
  83. _inviteA.push({
  84. cid: res.data[1][ik].classid,
  85. ic: res.data[1][ik].code,
  86. });
  87. }
  88. for (var ik = 0; ik < _inviteA.length; ik++) {
  89. if (
  90. this.arrayToArray(
  91. _inviteA[ik].cid.split(","),
  92. this.tcid.split(",")
  93. ).length
  94. ) {
  95. this.inviteCode = _inviteA[ik].ic;
  96. break;
  97. }
  98. }
  99. }
  100. this.setPptIframe()
  101. this.pageLoading = false;
  102. })
  103. .catch(err => {
  104. console.log(err);
  105. this.$message.error("获取课程数据失败");
  106. this.pageLoading = false;
  107. });
  108. },
  109. setPptIframe() {
  110. this.showIframe = false;
  111. this.$nextTick(() => {
  112. let _url = `https://ppt.cocorobo.cn/?mode=student&courseid=${this.id}&userid=${this.userid}&oid=${this.oid}&org=${this.org}&cid=${this.tcid}&type=${this.tType}`;
  113. this.iframeSrc = _url;
  114. this.showIframe = true;
  115. });
  116. },
  117. arrayToArray(arrayo, arrayt) {
  118. let array1 = arrayo;
  119. let array2 = arrayt;
  120. let commonElements = [];
  121. for (let i = 0; i < array1.length; i++) {
  122. for (let j = 0; j < array2.length; j++) {
  123. if (array1[i] === array2[j]) {
  124. commonElements.push(array1[i]);
  125. }
  126. }
  127. }
  128. return commonElements;
  129. },
  130. back(){
  131. if(this.tType!=2){
  132. this.goTo(
  133. '/courseDetail?userid=' +
  134. this.userid +
  135. '&oid=' +
  136. this.oid +
  137. '&org=' +
  138. this.org +
  139. '&cid=' +
  140. this.classId +
  141. '&courseId=' +
  142. this.id +
  143. '&tType=' +
  144. this.tType +
  145. '&screenType=' +
  146. this.screenType
  147. )
  148. }else{
  149. this.goTo(
  150. '/index?userid=' +
  151. this.userid +
  152. '&oid=' +
  153. this.oid +
  154. '&org=' +
  155. this.org +
  156. '&cid=' +
  157. this.classId +
  158. '&tType=' +
  159. this.tType +
  160. '&screenType=' +
  161. this.screenType
  162. )
  163. }
  164. }
  165. },
  166. mounted() {
  167. this.getCourseDetail();
  168. }
  169. };
  170. </script>
  171. <style scoped>
  172. .pptEasyClass {
  173. width: 100vw;
  174. height: 100vh;
  175. display: flex;
  176. flex-direction: column;
  177. overflow: hidden;
  178. box-sizing: border-box;
  179. padding: 20px;
  180. background-color: #f2f2f2;
  181. }
  182. .pec_main {
  183. width: 100%;
  184. height: 100%;
  185. background-color: #fff;
  186. border-radius: 12px;
  187. }
  188. .pec_header {
  189. width: 100%;
  190. height: 80px;
  191. border-radius: 12px 12px 0 0;
  192. box-sizing: border-box;
  193. border-bottom: solid 1px #cad1dc;
  194. display: flex;
  195. align-items: center;
  196. justify-content: space-between;
  197. }
  198. .pec_h_left {
  199. width: auto;
  200. height: 100%;
  201. display: flex;
  202. align-items: center;
  203. justify-content: center;
  204. margin-left: 20px;
  205. font-weight: bold;
  206. font-size: 20px;
  207. color: #0e1e33;
  208. }
  209. .pec_h_right {
  210. width: auto;
  211. height: 100%;
  212. display: flex;
  213. align-items: center;
  214. justify-content: center;
  215. margin-right: 20px;
  216. }
  217. .pec_h_r_btnArea {
  218. display: flex;
  219. align-items: center;
  220. justify-content: center;
  221. }
  222. .pec_h_r_btnArea > div {
  223. width: auto;
  224. height: auto;
  225. display: flex;
  226. align-items: center;
  227. justify-content: center;
  228. padding: 10px 20px;
  229. background-color: #f0f4fa;
  230. border-radius: 4px;
  231. cursor: pointer;
  232. margin-right: 10px;
  233. font-size: 14px;
  234. font-weight: 400;
  235. color: #000;
  236. border: 1px solid #cad1dc;
  237. }
  238. .pec_h_r_btnArea > div > img {
  239. width: 15px;
  240. height: 15px;
  241. margin-right: 5px;
  242. }
  243. .pec_h_r_btnArea > .pec_h_r_btn_refresh {
  244. color: #fff;
  245. background-color: #0061ff;
  246. border-color: #0061ff;
  247. }
  248. .pec_content {
  249. width: 100%;
  250. height: calc(100% - 80px);
  251. border-radius: 0 0 12px 12px;
  252. background-color: #fff;
  253. }
  254. .inviteBox {
  255. font-size: 14px;
  256. /* margin-top: 5px; */
  257. color: #00000099;
  258. text-align: center;
  259. }
  260. </style>