SkillTrainingIndex.vue 8.3 KB

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