| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479 | <!-- * @Description: 技能培训 * @Author: 空白格 * @Date: 2022-08-11 17:53:41 * @LastEditors: 空白格 * @LastEditTime: 2022-12-21 14:29:18 * @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="skill-training-content-banner">        <div class="left">          我的培训          <span>学习时长:{{ learnTime || 0 }}小时</span>        </div>        <div class="right" @click="jumpPage('/personalcenter/skilltraining')">          更多>        </div>      </div>      <!-- <div class="skill-training-content-slider">        <el-carousel height="200px" :autoplay="false" arrow="never">          <el-carousel-item            class="stcs-left-item"            v-for="(item, index) in classNoticeList"            :key="index"          >            <div class="stcs-left-item-left">              <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="stcs-left-item-right">              <div class="class-name">{{ item.name }}</div>              <div class="school-name">{{ item.schoolName }}</div>              <div class="description" v-html="item.description"></div>              <div class="sign-up">                <el-button round class="sign-up-btn" @click="signUp(item.id)"                  >报名</el-button                >              </div>            </div>          </el-carousel-item>        </el-carousel>      </div> -->      <!-- 技能包 -->      <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,                      schoolName: item.schoolName,                    },                    item                  )                "              >                <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 class="skill-training-chat" @click="openChatPage">      <div class="skill-training-chat-icon">        <el-image          style="width: 33px; height: 33px"          :src="require('@/assets/images/question-consult-icon.svg')"          fit="fill"        />      </div>      <div class="skill-training-chat-font">问题咨询</div>    </div>  </div></template><script>import { mapState } from "vuex";import BannerBreadcrumb from "@/components/BannerBreadcrumb";import { jumpPageAuth } from "@/utils";import { getDictData } from "@/api/Dict";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,      chatUrl: "http://localhost:8080",    };  },  computed: {    ...mapState({      isLogin: (state) => state.user.isLogin,      userInfo: (state) => state.user.userInfo,    }),  },  mounted() {    this.getClassNotice();    this.getPackageList();    this.getDictData();    setTimeout(() => {      if (this.isLogin) {        this.getDuration();      }    }, 500);  },  methods: {    getDictData() {      getDictData({ key: "portal_site_chat_url" }).then((res) => {        this.chatUrl = res?.data[0].text;      });    },    /**     * 获取报班通知     * @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, item) {      const params = {        platform: "4", // 平台:1-H5 2-APP 3-小程序 4-PC端        pages: location.href, // 页面路径        btnName: "查看技能包详情", // 按钮名称        btnEvent: "1", //按钮事件: 1-点击 2-长按 3-滑动        ipAddress: "", //IP地址        typeName: "技能培训关注度", //类型名称 例:学校关注度 、适应性考试等        typeCode: "JNPXGZD", // 类型编码 例:类型名称首字母缩写(XXGZD)        categoryName: item?.name, //类别名称 例:XX学校,SS考试      };      if (item) {        jumpPageAuth(path, query, true, params, false);      } else {        this.$router.push({          path,          query,        });      }    },    /**     * 分页切换     * @date 2022-08-12     * @param {any} page     * @returns {any}     */    currentChange(page) {      this.queryParams.pageNum = page;      this.getPackageList();    },    openChatPage() {      if (this.userInfo.id) {        window.open(`${this.chatUrl}?userID=${this.userInfo.id}&permission=2`);      } else {        this.$message.warning('请先登录!')      }    },  },};</script><style lang="scss" scoped>.skill-training {  &-content {    padding-bottom: 30px;    &-banner {      width: calc(100% - 40px);      padding: 0 20px;      height: 66px;      line-height: 66px;      background-image: url("@/assets/images/my-skill-bg.svg");      background-size: cover;      background-repeat: no-repeat;      background-position: center;      color: #fff;      display: flex;      justify-content: space-between;      margin-bottom: 20px;      .left {        font-size: 20px;        span {          font-size: 14px;          margin-left: 20px;        }      }      .right {        font-size: 14px;        cursor: pointer;      }    }    &-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;              overflow: hidden;              white-space: nowrap;              text-overflow: ellipsis;            }            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;          }        }      }    }  }  &-chat {    position: fixed;    bottom: 100px;    right: 0;    width: 90px;    height: 90px;    background: #659789;    border-radius: 4px;    cursor: pointer;    display: flex;    flex-direction: column;    align-items: center;    justify-content: center;    &-font {      font-size: 13px;      color: #fff;    }    &:hover {      opacity: 0.8;    }  }}</style>
 |