123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344 |
- <!--
- * @Description: 技能培训
- * @Author: 空白格
- * @Date: 2022-08-11 17:53:41
- * @LastEditors: 空白格
- * @LastEditTime: 2022-08-26 17:25:03
- * @FilePath: \veterans_client_web\src\views\SkillTraining\SkillTrainingIndex.vue
- * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
- -->
- <template>
- <div class="app-main skill-training">
- <BannerBreadcrumb title="技能培训" />
- <div class="app-main-box skill-training-content">
- <!-- 技能包 -->
- <div
- class="app-main-box-content skill-training-content-package"
- v-loading="loading"
- >
- <div class="stcp-title">技能包</div>
- <div class="stcp-list">
- <el-row :gutter="27">
- <el-col
- :xs="24"
- :sm="12"
- :md="12"
- :lg="6"
- :xl="6"
- v-for="(item, index) in packageList"
- :key="index"
- >
- <div
- class="stcp-list-item"
- @click="
- jumpPage('/skilltraining/skillpackage', { id: item.id })
- "
- >
- <div class="stcp-list-item-image">
- <el-image :src="item.img" class="image" fit="cover">
- <div slot="placeholder" class="image-slot">
- 加载中<span class="dot">...</span>
- </div>
- </el-image>
- </div>
- <div class="stcp-list-item-content">
- <div>{{ item.name || "-" }}</div>
- <div>{{ item.schoolName || "-" }}</div>
- </div>
- </div>
- </el-col>
- </el-row>
- <div class="pagination" v-if="total">
- <el-pagination
- background
- layout="prev, pager, next"
- :page-size="queryParams.pageSize"
- :total="total"
- @current-change="currentChange"
- />
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { mapState } from "vuex";
- import BannerBreadcrumb from "@/components/BannerBreadcrumb";
- import {
- getClassNoticeData,
- signUpClass,
- getPackageData,
- getDurationCount,
- } from "@/api/SkillTraining";
- export default {
- name: "SkillTrainingIndex",
- components: {
- BannerBreadcrumb,
- },
- data() {
- return {
- classNoticeList: [],
- queryParams: {
- pageNum: 1,
- pageSize: 8,
- },
- packageList: [],
- total: 0,
- loading: false,
- learnTime: 0,
- };
- },
- computed: {
- ...mapState({
- isLogin: (state) => state.user.isLogin,
- }),
- },
- created() {
- this.getClassNotice();
- this.getPackageList();
- if (this.isLogin) {
- this.getDuration();
- }
- },
- methods: {
- /**
- * 获取报班通知
- * @date 2022-08-12
- * @returns {any}
- */
- getClassNotice() {
- getClassNoticeData({ pageNum: 1, pageSize: 5 }).then((res) => {
- this.classNoticeList = res.rows;
- });
- },
- /**
- * 获取技能包
- * @date 2022-08-12
- * @returns {any}
- */
- getPackageList() {
- this.loading = true;
- getPackageData(this.queryParams).then((res) => {
- this.packageList = res.rows;
- this.total = Number(res.total);
- this.loading = false;
- });
- },
- /**
- * 报名操作
- * @date 2022-08-12
- * @param {any} packageId
- * @returns {any}
- */
- signUp(packageId) {
- signUpClass({ packageId }).then((res) => {
- console.log(res);
- });
- },
- /**
- * 获取学习时长
- * @date 2022-08-12
- * @returns {any}
- */
- getDuration() {
- getDurationCount().then((res) => {
- this.learnTime = (Number(res.data.learnTime) / 3600).toFixed(2);
- });
- },
- /**
- * 跳转指定页面
- * @date 2022-08-16
- * @param {any} path
- * @param {any} query
- * @returns {any}
- */
- jumpPage(path, query) {
- this.$router.push({
- path,
- query,
- });
- },
- /**
- * 分页切换
- * @date 2022-08-12
- * @param {any} page
- * @returns {any}
- */
- currentChange(page) {
- this.queryParams.pageNum = page;
- this.getPackageList();
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .skill-training {
- &-content {
- padding-bottom: 30px;
- &-slider {
- margin-bottom: 20px;
- padding: 0;
- .stcs-left {
- padding: 40px;
- :deep(.el-carousel__indicators) {
- // 指示器
- right: -40px;
- left: auto;
- }
- :deep(.el-carousel__button) {
- // 指示器按钮
- width: 10px;
- height: 10px;
- border: none;
- border-radius: 50%;
- background-color: #d8d8d8;
- }
- :deep(.is-active .el-carousel__button) {
- // 指示器激活按钮
- width: 25px;
- border-radius: 10px;
- }
- &-item {
- display: flex;
- &-left {
- margin-right: 20px;
- border: solid 1px #e0e0e0;
- border-radius: 5px;
- margin-left: 10px;
- .image {
- height: 100%;
- width: 180px;
- }
- }
- &-right {
- width: calc(100% - 222px);
- .class-name {
- color: #101010;
- font-size: 30px;
- font-weight: 500;
- margin-bottom: 8px;
- }
- .school-name {
- color: #525252;
- font-size: 20px;
- margin-bottom: 8px;
- }
- .description {
- color: #9a9a9a;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- word-break: break-all;
- margin-bottom: 30px;
- }
- .sign-up {
- &-btn {
- background-color: #709078;
- color: #fff;
- }
- }
- }
- }
- }
- .stcs-right {
- height: 240px;
- padding-top: 40px;
- background-image: linear-gradient(157deg, #287b4f 0%, #3d5d4c 100%);
- &-title {
- text-align: right;
- color: #fff;
- font-size: 30px;
- font-weight: 500;
- position: relative;
- width: 160px;
- margin: 0 auto 60px;
- &::before {
- content: "";
- display: block;
- width: 40px;
- height: 38px;
- background: url("./../../assets/images/my-training-icon.svg")
- no-repeat center center;
- position: absolute;
- left: -10px;
- }
- }
- &-duration {
- width: 155px;
- height: 60px;
- padding: 0 20px;
- margin: 0 auto;
- background: #fe7401;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 30px;
- color: #fff;
- &-left {
- border-right: solid 1px #fff;
- padding-right: 10px;
- font-size: 16px;
- }
- &-right {
- padding-left: 10px;
- font-size: 14px;
- span {
- font-size: 30px;
- }
- }
- }
- }
- }
- &-package {
- .stcp-title {
- color: #1a1a1a;
- font-size: 22px;
- padding-top: 10px;
- margin-bottom: 10px;
- }
- .stcp-list {
- &-item {
- cursor: pointer;
- margin-bottom: 20px;
- &-image {
- height: 160px;
- padding: 10px 5px;
- .image {
- width: 100%;
- height: 100%;
- border-radius: 5px;
- border: solid 1px #d0d0d0;
- }
- }
- &-content {
- font-size: 18px;
- color: #3f3f3f;
- div {
- margin: 5px 0;
- }
- div:last-child {
- color: #a2a2a2;
- font-size: 14px;
- }
- }
- }
- .pagination {
- text-align: center;
- margin-top: 20px;
- :deep(.el-pager .active) {
- background-color: #ff3939;
- }
- :deep(.el-pagination.is-background
- .el-pager
- li:not(.disabled).active) {
- background-color: #ff3939;
- }
- }
- }
- }
- }
- }
- </style>
|