index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <!-- 学习任务 -->
  2. <template>
  3. <div class="app-container learningTasks">
  4. <div class="page-container learningTasksPage">
  5. <p class="pageTitle">学习任务</p>
  6. <div class="page-form-title-box">
  7. <el-form :model="queryParams" class="form-box" ref="queryForm"
  8. :inline="true" style="width:100%;">
  9. <div class="table-top-button-box">
  10. <div>
  11. <p :class="learnStatus === ''?'check-table-button':''" @click="tableTypeButton('')">全部</p>
  12. <p :class="learnStatus === 0?'check-table-button':''" @click="tableTypeButton(0)">未学习</p>
  13. <p :class="learnStatus === 1?'check-table-button':''" @click="tableTypeButton(1)">学习中</p>
  14. <p :class="learnStatus === 2?'check-table-button':''" @click="tableTypeButton(2)">已学完</p>
  15. </div>
  16. </div>
  17. <el-form-item label="" prop="knowledgePointId">
  18. <el-cascader
  19. v-model="queryParams.knowledgePointId"
  20. :options="optionListB"
  21. :props="{
  22. emitPath:false,
  23. checkStrictly: true,
  24. value: 'id',
  25. label: 'knowledgePointName',
  26. children: 'children',
  27. }"
  28. style="width: 180px"
  29. :show-all-levels="false"
  30. filterable
  31. placeholder="知识点"
  32. ></el-cascader>
  33. </el-form-item>
  34. <el-form-item label="" prop="courseName">
  35. <el-input
  36. maxLength="30"
  37. v-model="queryParams.courseName"
  38. placeholder="搜索名称"
  39. style="width: 200px"
  40. />
  41. </el-form-item>
  42. <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
  43. <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
  44. </el-form>
  45. </div>
  46. <div class="page-content-box">
  47. <div class="for-max-big-box scrollbar-box">
  48. <div class="for-big-box" v-for="(item,index) in dataList" :key="index" @click="tableButton(item)">
  49. <img :src="item.coverAttachmentPath">
  50. <div class="bottom-big-box">
  51. <p class="name-p">{{item.courseName}}</p>
  52. <p class="time-p">{{secondsToMinutes(item.totalDuration)}}分钟 丨 {{item.totalCreditHours}}学时 丨 {{item.totalPoints}}积分</p>
  53. <div class="text-box">
  54. <p>已学 {{item.learnedCoursewareCount}} <span> / 总 {{item.totalCoursewareCount}} 课件</span></p>
  55. </div>
  56. </div>
  57. <p class="type-p" :class="item.learnStatus=='0'?'type-p-1':(item.learnStatus=='1'?'type-p-2':(item.learnStatus=='2'?'type-p-3':''))">{{item.learnStatus=='0'?'未学习':(item.learnStatus=='1'?'学习中':(item.learnStatus=='2'?'已学完':''))}}</p>
  58. <el-progress
  59. class="num-p" type="circle"
  60. :stroke-width="4"
  61. :width="60" :percentage="item.progress">
  62. </el-progress>
  63. <p class="position-p-1">{{item.examName}}</p>
  64. </div>
  65. <p class="null-text-p" v-if="!dataList[0]">暂无数据</p>
  66. </div>
  67. <pagination :page-sizes="[20, 30, 40, 50]"
  68. v-show="total>0"
  69. :total="total"
  70. :page.sync="queryParams.page"
  71. :limit.sync="queryParams.pageSize"
  72. @pagination="getList"
  73. />
  74. </div>
  75. </div>
  76. </div>
  77. </template>
  78. <script>
  79. //import { getDicts } from "@/api/commonality/noPermission";
  80. //import { systemUserSelect } from "@/api/commonality/permission";
  81. import { examUserCourseLearningList,examElKnowledgePointTreeList, } from "@/api/safetyEducationExaminationNew/index";
  82. export default {
  83. name: 'index',
  84. data() {
  85. return {
  86. //页面状态
  87. pageType: 1,
  88. //下拉列表数据
  89. optionListB: [],
  90. //查询条件
  91. learnStatus:'',
  92. queryParams: {
  93. page: 1,
  94. pageSize: 20,
  95. knowledgePointId: '',
  96. courseName: null
  97. },
  98. //列表数据
  99. dataList: [],
  100. //数据数量
  101. total: 0,
  102. }
  103. },
  104. created() {
  105. },
  106. mounted() {
  107. this.getList();
  108. this.examElKnowledgePointTreeList();
  109. },
  110. methods: {
  111. //切换按钮
  112. tableTypeButton(val){
  113. if(this.learnStatus !== val){
  114. this.$set(this,'learnStatus',val);
  115. this.handleQuery();
  116. }
  117. },
  118. //查询按钮
  119. handleQuery() {
  120. this.$set(this.queryParams, 'page', 1)
  121. this.getList()
  122. },
  123. //重置按钮
  124. resetQuery() {
  125. this.$set(this,'learnStatus','');
  126. this.$set(this, 'queryParams', {
  127. page: 1,
  128. pageSize: 20,
  129. knowledgePointId: '',
  130. courseName: null
  131. })
  132. this.getList()
  133. },
  134. //获取数据列表
  135. getList() {
  136. let obj = JSON.parse(JSON.stringify(this.queryParams))
  137. obj.learnStatus = this.learnStatus;
  138. examUserCourseLearningList(obj).then(response => {
  139. this.$set(this, 'dataList', response.data.records)
  140. this.$set(this, 'total', response.data.total)
  141. })
  142. },
  143. //操作按钮
  144. tableButton(item) {
  145. let self = this;
  146. if(item.conditionType == 1){
  147. this.$confirm('还未达到学时要求,是否现在去学习?', "警告", {
  148. confirmButtonText: "确认",
  149. cancelButtonText: "取消",
  150. type: "warning"
  151. }).then(function() {
  152. }).then(() => {
  153. //学时要求
  154. self.$router.push({
  155. name: 'knowledgeLearning',
  156. params: {}
  157. })
  158. }).catch(() => {});
  159. }else{
  160. //学习课程
  161. this.$router.push({
  162. name: 'learningCourse',
  163. params: {
  164. courseId: item.courseId,
  165. examId: item.examId,
  166. }
  167. })
  168. }
  169. },
  170. examElKnowledgePointTreeList(){
  171. examElKnowledgePointTreeList({}).then(response => {
  172. const list = response.data || [];
  173. this.formatTreeData(list);
  174. this.$set(this, 'optionListB', list);
  175. });
  176. },
  177. //换算分钟
  178. secondsToMinutes(totalSeconds) {
  179. if (typeof totalSeconds !== 'number' || totalSeconds <= 0) {
  180. return 1;
  181. }
  182. return Math.ceil(totalSeconds / 60);
  183. },
  184. }
  185. }
  186. </script>
  187. <style scoped lang="scss">
  188. .learningTasks {
  189. .learningTasksPage {
  190. .pageTitle{
  191. height:60px;
  192. line-height:60px;
  193. padding:0 20px;
  194. border-bottom:1px solid #dedede;
  195. }
  196. .table-top-button-box{
  197. display: inline-block;
  198. vertical-align: top;
  199. margin-right:10px;
  200. div{
  201. display: flex;
  202. p{
  203. border:1px solid #DCDFE6;
  204. width:80px;
  205. text-align: center;
  206. height:40px;
  207. line-height:40px;
  208. cursor: pointer;
  209. font-size:14px;
  210. }
  211. p:nth-child(1){
  212. border-top-left-radius:4px;
  213. border-bottom-left-radius:4px;
  214. }
  215. p:nth-child(2){
  216. border-left:none;
  217. }
  218. p:nth-child(3){
  219. border-left:none;
  220. border-right:none;
  221. }
  222. p:nth-child(4){
  223. border-top-right-radius:4px;
  224. border-bottom-right-radius:4px;
  225. }
  226. .check-table-button{
  227. border:1px solid #0183fa;
  228. background-color: #0183fa;
  229. color:#fff;
  230. }
  231. }
  232. }
  233. .page-content-box{
  234. padding:20px 0;
  235. }
  236. .for-max-big-box{
  237. flex:1;
  238. .null-text-p{
  239. line-height:200px;
  240. text-align: center;
  241. color:#999;
  242. font-size:14px;
  243. }
  244. .for-big-box{
  245. cursor: pointer;
  246. display: inline-block;
  247. width:370px;
  248. margin:0 0 20px 20px;
  249. border-radius:6px;
  250. overflow: hidden;
  251. box-shadow: 0 0 8px 1px rgba(0, 0, 0, 0.1);
  252. position: relative;
  253. img{
  254. display: inline-block;
  255. width:370px;
  256. height:180px;
  257. }
  258. .bottom-big-box{
  259. padding:10px 0 10px 10px;
  260. .name-p{
  261. line-height:30px;
  262. font-size:16px;
  263. font-weight:700;
  264. display:block;
  265. overflow:hidden;
  266. text-overflow:ellipsis;
  267. white-space:nowrap;
  268. }
  269. .time{
  270. line-height:30px;
  271. font-size:14px;
  272. }
  273. .text-box{
  274. display: flex;
  275. p{
  276. line-height:30px;
  277. font-size:14px;
  278. font-weight:700;
  279. span{
  280. color:#666;
  281. font-weight:500;
  282. }
  283. }
  284. }
  285. }
  286. .type-p{
  287. position: absolute;
  288. right:20px;
  289. top:15px;
  290. padding:5px 10px;
  291. border-radius:4px;
  292. font-size:14px;
  293. }
  294. .type-p-1{
  295. color:#fff;
  296. background-color: #999;
  297. }
  298. .type-p-2{
  299. color:#fff;
  300. background-color: #7CCD7C;
  301. }
  302. .type-p-3{
  303. color:#fff;
  304. background-color: #0183fa;
  305. }
  306. .num-p{
  307. position: absolute;
  308. right:20px;
  309. bottom:20px;
  310. }
  311. .num-p ::v-deep .el-progress__text {
  312. margin-left:0!important;
  313. font-size:12px!important;
  314. }
  315. .position-p-1{
  316. position: absolute;
  317. top:140px;
  318. left:10px;
  319. /*单行省略号*/
  320. display:block;
  321. overflow:hidden;
  322. text-overflow:ellipsis;
  323. white-space:nowrap;
  324. line-height:20px;
  325. border:1px solid #0183fa;
  326. max-width:350px;
  327. border-radius:4px;
  328. padding:4px 10px;
  329. font-size:14px;
  330. /*background-color: rgba(1, 131, 250,0.2);*/
  331. background-color: #0183fa;
  332. color:#fff;
  333. }
  334. }
  335. }
  336. }
  337. }
  338. </style>