courseDetails.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <!--课程详情-->
  2. <template>
  3. <div class="page-container courseDetails">
  4. <div class="page-top-title-box">
  5. <p class="page-top-title-name-p"></p>
  6. <p class="page-top-title-out-p" @click="backPage">返回</p>
  7. </div>
  8. <div class="chapter-page-one" v-if="pageType == 1">
  9. <div class="learn-list scrollbar-box">
  10. <div class="course-info">
  11. <div class="name-max-box">
  12. <p>{{infoData.title}}{{infoData.cateTitle}}</p>
  13. <!--<p>已学习时长:{{infoData.learnDurationStr}}</p>-->
  14. </div>
  15. <div class="time-box">
  16. <div>
  17. <img src="@/assets/ZDimages/safetyEducationExam/icon_ksxt_xxsc.png">
  18. <p>课程时长:{{infoData.durationStr}}</p>
  19. </div>
  20. <div>
  21. <img src="@/assets/ZDimages/safetyEducationExam/icon_ksxt_yxq.png">
  22. <p>有效期:{{infoData.ceType==0?'永久有效':infoData.ceTime}}</p>
  23. </div>
  24. </div>
  25. <p class="num-p">已有{{infoData.learns}}人学习</p>
  26. </div>
  27. <div class="for-chapter-box" v-for="(item,index) in infoData.chapterList" v-if="item.children[0]">
  28. <div class="title-max-p">
  29. <p class="position-p">{{index+1}}</p>
  30. <p class="title-p">{{item.title}}</p>
  31. </div>
  32. <div class="for-festival-max-box">
  33. <div class="for-festival-box" v-for="(minItem,minIndex) in item.children">
  34. <p class="festival-p"></p>
  35. <p class="name-p cursor-p" @click="goPage(2,minItem)">{{minItem.title}}</p>
  36. <p class="time-p" v-if="minItem.duration>0">时长:{{minItem.hour>0?minItem.hour+'小时':''}}{{minItem.minute>0?minItem.minute+'分钟':''}}{{minItem.second>0?minItem.second+'秒':''}}</p>
  37. <p class="null-p"></p>
  38. <p @click="goPage(3,minItem)" class="button-right-p" :class="minItem.isAssess == 1?'button-right-p-one':'button-right-p-two'">{{minItem.isAssess == 1?'课后考核':'未设置考核'}}</p>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <course-preview v-if="pageType == 2" :exerciseData="exerciseData"></course-preview>
  45. <assessment-preview v-if="pageType == 3" :exerciseData="exerciseData"></assessment-preview>
  46. </div>
  47. </template>
  48. <script>
  49. import { examElCourse, } from "@/api/safetyEducationExam/index";
  50. import coursePreview from "./coursePreview.vue";
  51. import assessmentPreview from "./assessmentPreview.vue";
  52. export default {
  53. name: 'courseDetails',
  54. props:{
  55. infoId:{},
  56. },
  57. components: {
  58. coursePreview,
  59. assessmentPreview
  60. },
  61. data() {
  62. return {
  63. pageType:1,
  64. infoData:{},
  65. exerciseData:{},
  66. }
  67. },
  68. created() {
  69. },
  70. mounted() {
  71. this.getInfo();
  72. },
  73. methods: {
  74. // 页面跳转
  75. goPage(type,row){
  76. if(type == 2){
  77. this.exerciseData = row;
  78. this.pageType = 2;
  79. }else if(type == 3){
  80. if(row.isAssess == 1){
  81. this.exerciseData = row;
  82. this.pageType = 3;
  83. }
  84. }else if(type == 1){
  85. this.pageType = 1;
  86. }
  87. },
  88. //返回
  89. backPage(){
  90. if(this.pageType != 1){
  91. this.$set(this,'pageType',1);
  92. }else{
  93. this.$parent.goPageEdit(4);
  94. }
  95. },
  96. /** 查询详情 */
  97. getInfo() {
  98. let self = this;
  99. examElCourse(this.infoId.id).then( res => {
  100. let newList = res.data;
  101. for(let i=0;i<newList.chapterList.length;i++){
  102. for(let o=0;o<newList.chapterList[i].children.length;o++){
  103. let hour = parseInt(newList.chapterList[i].children[o].duration/3600);
  104. let hourNum = newList.chapterList[i].children[o].duration - this.accMul(hour,3600);
  105. let minute = parseInt(hourNum/60);
  106. let second = hourNum - this.accMul(minute,60);
  107. newList.chapterList[i].children[o].hour = hour;
  108. newList.chapterList[i].children[o].minute = minute;
  109. newList.chapterList[i].children[o].second = second;
  110. }
  111. }
  112. self.infoData = newList;
  113. });
  114. },
  115. //乘法
  116. accMul(arg1,arg2){
  117. var m=0,s1=arg1.toString(),s2=arg2.toString();
  118. try{m+=s1.split(".")[1].length}catch(e){}
  119. try{m+=s2.split(".")[1].length}catch(e){}
  120. return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
  121. },
  122. }
  123. }
  124. </script>
  125. <style scoped lang="scss">
  126. .courseDetails{
  127. flex:1;
  128. display: flex;
  129. flex-direction: column;
  130. overflow: hidden;
  131. .title-box{
  132. display: flex;
  133. border-bottom: 1px solid #E0E0E0;
  134. p:nth-child(1){
  135. flex:1;
  136. line-height:80px;
  137. color:#0045AF;
  138. font-size:18px;
  139. margin-left:20px;
  140. }
  141. p:nth-child(2){
  142. margin:20px;
  143. }
  144. }
  145. .chapter-page-one{
  146. flex:1;
  147. display: flex;
  148. flex-direction: column;
  149. overflow: hidden;
  150. *{
  151. margin:0;
  152. padding:0;
  153. font-weight:500;
  154. color:#333;
  155. }
  156. .learn-top-user-info-box{
  157. display: flex;
  158. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  159. .logo-img{
  160. height:57px;
  161. width:57px;
  162. margin:21px 20px 0 40px;
  163. }
  164. .title-p{
  165. width: 300px;
  166. font-size:18px;
  167. font-weight:700;
  168. line-height:100px;
  169. }
  170. .time-p{
  171. flex:1;
  172. font-weight:700;
  173. line-height:100px;
  174. font-size:14px;
  175. }
  176. .home-box{
  177. width:100px;
  178. display: flex;
  179. margin-top:35px;
  180. margin-right:30px;
  181. img{
  182. width:30px;
  183. height:30px;
  184. margin-right:20px;
  185. }
  186. p{
  187. line-height:30px;
  188. }
  189. }
  190. .user-box{
  191. min-width:100px;
  192. display: flex;
  193. margin-top:35px;
  194. margin-right:30px;
  195. img{
  196. width:30px;
  197. height:30px;
  198. margin-right:20px;
  199. }
  200. p{
  201. line-height:30px;
  202. }
  203. }
  204. .button-p{
  205. width:82px;
  206. height:34px;
  207. background: #0045af;
  208. color:#fff;
  209. text-align: center;
  210. line-height:34px;
  211. margin:33px 20px 0 0;
  212. border-radius:4px;
  213. cursor:pointer;
  214. }
  215. }
  216. .learn-list{
  217. flex:1;
  218. overflow-y:scroll;
  219. margin:0;
  220. /*box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);*/
  221. .course-info{
  222. .name-max-box{
  223. display: flex;
  224. margin:0 42px;
  225. p{
  226. flex:1;
  227. font-size:18px;
  228. line-height:52px;
  229. font-weight:700;
  230. }
  231. p:nth-child(1){
  232. color:#333;
  233. }
  234. p:nth-child(2){
  235. text-align: right;
  236. color:#0183fa;
  237. }
  238. }
  239. .time-box{
  240. display: flex;
  241. margin:0 40px;
  242. div{
  243. display: flex;
  244. margin-right:100px;
  245. img{
  246. width:20px;
  247. height:20px;
  248. margin:15px 10px 0 0;
  249. }
  250. p{
  251. line-height:50px;
  252. font-size:16px;
  253. color:#333;
  254. font-weight:700;
  255. }
  256. }
  257. }
  258. .num-p{
  259. font-size:16px;
  260. line-height:52px;
  261. margin:0 40px;
  262. padding-bottom:10px;
  263. color:#0183fa;
  264. font-weight:700;
  265. border-bottom:3px dashed #dedede;
  266. }
  267. }
  268. .for-chapter-box{
  269. margin:5px 0 20px;
  270. .title-max-p{
  271. display: flex;
  272. .position-p{
  273. width:80px;
  274. height:50px;
  275. line-height: 50px;
  276. text-align: center;
  277. background: #0045af;
  278. border-top-right-radius: 25px;
  279. border-bottom-right-radius: 25px;
  280. color:#fff;
  281. font-size:24px;
  282. margin-top:15px;
  283. margin-right:37px;
  284. }
  285. .title-p{
  286. line-height:85px;
  287. font-size:19px;
  288. p{
  289. color:#02A7F0;
  290. text-align: right;
  291. margin-right:20px;
  292. flex:1;
  293. }
  294. }
  295. }
  296. .for-festival-max-box{
  297. padding:10px 0;
  298. background: #eaf5ff;
  299. margin:0 120px;
  300. .for-festival-box{
  301. padding:0 10px;
  302. display: flex;
  303. .festival-p{
  304. border-radius:50%;
  305. width:18px;
  306. height:18px;
  307. margin:26px 21px 0 38px;
  308. background: #349cfb;
  309. }
  310. .name-p{
  311. line-height: 67px;
  312. font-size:17px;
  313. color:#349cfb;
  314. width:550px;
  315. display:block;
  316. overflow:hidden;
  317. text-overflow:ellipsis;
  318. white-space:nowrap;
  319. }
  320. .cursor-p{
  321. cursor:pointer;
  322. }
  323. .time-p{
  324. width:400px;
  325. line-height: 67px;
  326. font-size:16px;
  327. }
  328. .null-p{
  329. flex:1;
  330. }
  331. .festival-img{
  332. height:52px;
  333. width:60px;
  334. margin:7px 54px 0 0;
  335. }
  336. .button-right-p{
  337. margin:13px 28px 0 0;
  338. line-height:40px;
  339. width:120px;
  340. height:40px;
  341. font-size:16px;
  342. text-align: center;
  343. border-radius:10px;
  344. cursor:pointer;
  345. }
  346. .button-right-p-one{
  347. color:#fff;
  348. background: #349cfb;
  349. }
  350. .button-right-p-two{
  351. color:#999;
  352. background: #dedede;
  353. }
  354. }
  355. }
  356. }
  357. }
  358. }
  359. }
  360. </style>