SkillTrainingIndex.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <!--
  2. * @Description: 技能培训
  3. * @Author: 空白格
  4. * @Date: 2022-08-11 17:53:41
  5. * @LastEditors: 空白格
  6. * @LastEditTime: 2022-08-16 13:33:13
  7. * @FilePath: \veterans_client_web\src\views\SkillTraining\SkillTrainingIndex.vue
  8. * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
  9. -->
  10. <template>
  11. <div class="app-main skill-training">
  12. <BannerBreadcrumb title="技能培训" />
  13. <div class="app-main-box skill-training-content">
  14. <!-- 轮播课程 -->
  15. <div class="app-main-box-content skill-training-content-slider">
  16. <el-row>
  17. <el-col :xs="24" :sm="24" :md="18" :lg="18" :xl="18">
  18. <div class="stcs-left">
  19. <el-carousel height="200px" :autoplay="false" arrow="never">
  20. <el-carousel-item
  21. class="stcs-left-item"
  22. v-for="(item, index) in classNoticeList"
  23. :key="index"
  24. >
  25. <div class="stcs-left-item-left">
  26. <el-image :src="item.img" class="image" fit="cover">
  27. <div slot="placeholder" class="image-slot">
  28. 加载中<span class="dot">...</span>
  29. </div>
  30. </el-image>
  31. </div>
  32. <div class="stcs-left-item-right">
  33. <div class="class-name">{{ item.name }}</div>
  34. <div class="school-name">{{ item.schoolName }}</div>
  35. <div class="description" v-html="item.description"></div>
  36. <div class="sign-up">
  37. <el-button
  38. round
  39. class="sign-up-btn"
  40. @click="signUp(item.id)"
  41. >报名</el-button
  42. >
  43. </div>
  44. </div>
  45. </el-carousel-item>
  46. </el-carousel>
  47. </div>
  48. </el-col>
  49. <el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="6">
  50. <div class="stcs-right">
  51. <div class="stcs-right-title">我的培训</div>
  52. <div class="stcs-right-duration">
  53. <div class="stcs-right-duration-left">学习<br />时长</div>
  54. <div class="stcs-right-duration-right">
  55. <span>{{ learnTime || 0 }}</span
  56. >小时
  57. </div>
  58. </div>
  59. </div>
  60. </el-col>
  61. </el-row>
  62. </div>
  63. <!-- 技能包 -->
  64. <div
  65. class="app-main-box-content skill-training-content-package"
  66. v-loading="loading"
  67. >
  68. <div class="stcp-title">技能包</div>
  69. <div class="stcp-list">
  70. <el-row :gutter="27">
  71. <el-col
  72. :xs="24"
  73. :sm="12"
  74. :md="12"
  75. :lg="6"
  76. :xl="6"
  77. v-for="(item, index) in packageList"
  78. :key="index"
  79. >
  80. <div
  81. class="stcp-list-item"
  82. @click="jumpPage('/coursevideo', { id: item.id })"
  83. >
  84. <div class="stcp-list-item-image">
  85. <el-image :src="item.img" class="image" fit="cover">
  86. <div slot="placeholder" class="image-slot">
  87. 加载中<span class="dot">...</span>
  88. </div>
  89. </el-image>
  90. </div>
  91. <div class="stcp-list-item-content">
  92. <div>{{ item.name || "-" }}</div>
  93. <div>{{ item.schoolName || "-" }}</div>
  94. </div>
  95. </div>
  96. </el-col>
  97. </el-row>
  98. <div class="pagination" v-if="total">
  99. <el-pagination
  100. background
  101. layout="prev, pager, next"
  102. :page-size="queryParams.pageSize"
  103. :total="total"
  104. @current-change="currentChange"
  105. />
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. </template>
  112. <script>
  113. import { mapState } from "vuex";
  114. import BannerBreadcrumb from "@/components/BannerBreadcrumb";
  115. import {
  116. getClassNoticeData,
  117. signUpClass,
  118. getPackageData,
  119. getDurationCount,
  120. } from "@/api/SkillTraining";
  121. export default {
  122. name: "SkillTrainingIndex",
  123. components: {
  124. BannerBreadcrumb,
  125. },
  126. data() {
  127. return {
  128. classNoticeList: [],
  129. queryParams: {
  130. pageNum: 1,
  131. pageSize: 8,
  132. },
  133. packageList: [],
  134. total: 0,
  135. loading: false,
  136. learnTime: 0,
  137. };
  138. },
  139. computed: {
  140. ...mapState({
  141. isLogin: (state) => state.user.isLogin,
  142. }),
  143. },
  144. created() {
  145. this.getClassNotice();
  146. this.getPackageList();
  147. if (this.isLogin) {
  148. this.getDuration();
  149. }
  150. },
  151. methods: {
  152. /**
  153. * 获取报班通知
  154. * @date 2022-08-12
  155. * @returns {any}
  156. */
  157. getClassNotice() {
  158. getClassNoticeData({ pageNum: 1, pageSize: 5 }).then((res) => {
  159. this.classNoticeList = res.rows;
  160. });
  161. },
  162. /**
  163. * 获取技能包
  164. * @date 2022-08-12
  165. * @returns {any}
  166. */
  167. getPackageList() {
  168. this.loading = true;
  169. getPackageData(this.queryParams).then((res) => {
  170. this.packageList = res.rows;
  171. this.total = Number(res.total);
  172. this.loading = false;
  173. });
  174. },
  175. /**
  176. * 报名操作
  177. * @date 2022-08-12
  178. * @param {any} packageId
  179. * @returns {any}
  180. */
  181. signUp(packageId) {
  182. signUpClass({ packageId }).then((res) => {
  183. console.log(res);
  184. });
  185. },
  186. /**
  187. * 获取学习时长
  188. * @date 2022-08-12
  189. * @returns {any}
  190. */
  191. getDuration() {
  192. getDurationCount().then((res) => {
  193. this.learnTime = (Number(res.data.learnTime) / 3600).toFixed(2);
  194. });
  195. },
  196. /**
  197. * 跳转指定页面
  198. * @date 2022-08-16
  199. * @param {any} path
  200. * @param {any} query
  201. * @returns {any}
  202. */
  203. jumpPage(path, query) {
  204. this.$router.push({
  205. path,
  206. query
  207. })
  208. },
  209. /**
  210. * 分页切换
  211. * @date 2022-08-12
  212. * @param {any} page
  213. * @returns {any}
  214. */
  215. currentChange(page) {
  216. this.queryParams.pageNum = page;
  217. this.getPackageList();
  218. },
  219. },
  220. };
  221. </script>
  222. <style lang="scss" scoped>
  223. .skill-training {
  224. &-content {
  225. padding-bottom: 30px;
  226. &-slider {
  227. margin-bottom: 20px;
  228. padding: 0;
  229. .stcs-left {
  230. padding: 40px;
  231. :deep(.el-carousel__indicators) {
  232. // 指示器
  233. right: -40px;
  234. left: auto;
  235. }
  236. :deep(.el-carousel__button) {
  237. // 指示器按钮
  238. width: 10px;
  239. height: 10px;
  240. border: none;
  241. border-radius: 50%;
  242. background-color: #d8d8d8;
  243. }
  244. :deep(.is-active .el-carousel__button) {
  245. // 指示器激活按钮
  246. width: 25px;
  247. border-radius: 10px;
  248. }
  249. &-item {
  250. display: flex;
  251. &-left {
  252. margin-right: 20px;
  253. border: solid 1px #e0e0e0;
  254. border-radius: 5px;
  255. margin-left: 10px;
  256. .image {
  257. height: 100%;
  258. width: 180px;
  259. }
  260. }
  261. &-right {
  262. width: calc(100% - 222px);
  263. .class-name {
  264. color: #101010;
  265. font-size: 30px;
  266. font-weight: 500;
  267. margin-bottom: 8px;
  268. }
  269. .school-name {
  270. color: #525252;
  271. font-size: 20px;
  272. margin-bottom: 8px;
  273. }
  274. .description {
  275. color: #9a9a9a;
  276. white-space: nowrap;
  277. overflow: hidden;
  278. text-overflow: ellipsis;
  279. word-break: break-all;
  280. margin-bottom: 30px;
  281. }
  282. .sign-up {
  283. &-btn {
  284. background-color: #709078;
  285. color: #fff;
  286. }
  287. }
  288. }
  289. }
  290. }
  291. .stcs-right {
  292. height: 240px;
  293. padding-top: 40px;
  294. background-image: linear-gradient(157deg, #287b4f 0%, #3d5d4c 100%);
  295. &-title {
  296. text-align: right;
  297. color: #fff;
  298. font-size: 30px;
  299. font-weight: 500;
  300. position: relative;
  301. width: 160px;
  302. margin: 0 auto 60px;
  303. &::before {
  304. content: "";
  305. display: block;
  306. width: 40px;
  307. height: 38px;
  308. background: url("./../../assets/images/my-training-icon.svg")
  309. no-repeat center center;
  310. position: absolute;
  311. left: -10px;
  312. }
  313. }
  314. &-duration {
  315. width: 155px;
  316. height: 60px;
  317. padding: 0 20px;
  318. margin: 0 auto;
  319. background: #fe7401;
  320. display: flex;
  321. align-items: center;
  322. justify-content: center;
  323. border-radius: 30px;
  324. color: #fff;
  325. &-left {
  326. border-right: solid 1px #fff;
  327. padding-right: 10px;
  328. font-size: 16px;
  329. }
  330. &-right {
  331. padding-left: 10px;
  332. font-size: 14px;
  333. span {
  334. font-size: 30px;
  335. }
  336. }
  337. }
  338. }
  339. }
  340. &-package {
  341. .stcp-title {
  342. color: #1a1a1a;
  343. font-size: 26px;
  344. padding-top: 10px;
  345. margin-bottom: 10px;
  346. }
  347. .stcp-list {
  348. &-item {
  349. cursor: pointer;
  350. &-image {
  351. height: 160px;
  352. padding: 10px 5;
  353. .image {
  354. width: 100%;
  355. height: 100%;
  356. }
  357. }
  358. &-content {
  359. font-size: 22px;
  360. color: #3f3f3f;
  361. div {
  362. margin: 5px 0;
  363. }
  364. div:last-child {
  365. color: #a2a2a2;
  366. font-size: 16px;
  367. }
  368. }
  369. }
  370. .pagination {
  371. text-align: center;
  372. margin-top: 20px;
  373. :deep(.el-pager .active) {
  374. background-color: #ff3939;
  375. }
  376. :deep(.el-pagination.is-background
  377. .el-pager
  378. li:not(.disabled).active) {
  379. background-color: #ff3939;
  380. }
  381. }
  382. }
  383. }
  384. }
  385. }
  386. </style>