123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- <template>
- <div class="my-bank">
- <div class="my-bank__header">
- <el-tabs :value="activeName" @tab-click="tabChange">
- <el-tab-pane
- v-for="(tab, tabIndex) in tabList"
- :key="tabIndex"
- :label="tab.educationName"
- :name="tab.id"
- ></el-tab-pane>
- </el-tabs>
- </div>
- <div class="my-bank__body">
- <div class="no-data" v-if="list.length == 0">暂无可以学习的题库哦~</div>
- <div class="list" v-else>
- <div class="bank-item" v-for="(item, index) in list" :key="index">
- <div class="bank-item__header">
- {{ item.goodsName }}
- <div
- class="time"
- v-if="item.serviceStartTime && item.serviceEndTime"
- >
- 学习服务期:{{
- $tools.timestampToTime(item.serviceStartTime, true, true)
- }}-{{ $tools.timestampToTime(item.serviceEndTime, true, true) }}
- </div>
- </div>
- <div class="bank-item__body clearfix">
- <div class="img">
- <img :src="$tools.splitImgHost(item.coverUrl, true)" alt="" />
- </div>
- <div class="text">
- <!-- <div class="title">
- <div class="note">60学时</div>
- </div> -->
- <div class="progress">
- 学习进度
- <el-progress
- class="progress-line"
- :stroke-width="16"
- :format="progressText(item)"
- :percentage="
- item.totalNum != 0 ? (item.doNum / item.totalNum) * 100 : 0
- "
- ></el-progress>
- </div>
- </div>
- <div class="btns-wrap">
- <div class="btns">
- <el-button type="primary" class="btn" @click="goStudy(item)"
- >进入学习</el-button
- >
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="pagination">
- <el-pagination
- @current-change="currentChange"
- background
- layout="prev, pager, next"
- :total="total"
- :pager-count="5"
- :page-size="param.pageSize"
- >
- </el-pagination>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: "Mybank",
- data() {
- return {
- param: {
- pageNum: 1,
- pageSize: 10,
- },
- tabList: [],
- list: [],
- activeName: "-1",
- total: 0,
- };
- },
- async mounted() {
- // await this.orderUserEduList();
- this.bankQuestionListFreeGoodsList();
- },
- methods: {
- tabChange(e) {
- if (this.activeName == e.name) {
- return;
- }
- console.log(e.name);
- this.activeName = e.name;
- this.bankQuestionListFreeGoodsList();
- },
- orderUserEduList() {
- return new Promise((resolve) => {
- this.$request
- .orderUserEduList({
- goodsType: 2,
- })
- .then((res) => {
- res.rows.forEach((row) => {
- row.id = row.id + "";
- });
- this.tabList.push(
- {
- educationName: "全部题库",
- id: "-1",
- },
- ...res.rows
- );
- resolve();
- });
- });
- },
- progressText(item) {
- return () => {
- return item.doNum + "/" + item.totalNum;
- };
- },
- currentChange(e) {
- this.param.pageNum = e;
- this.bankQuestionListFreeGoodsList();
- },
- bankQuestionListFreeGoodsList() {
- let param = JSON.parse(JSON.stringify(this.param));
- if (this.activeName == "-1") {
- param.educationTypeId = "";
- } else {
- param.educationTypeId = this.activeName;
- }
- this.$request.bankQuestionListFreeGoodsList(param).then((res) => {
- res.rows.forEach((item) => {
- console.log(`${item.goodsName}:${item.doNum}/${item.totalNum}`);
- });
- this.list = res.rows;
- this.total = res.total;
- });
- },
- pay() {
- this.$router.push({
- path: "payment-success",
- });
- },
- goStudy(item) {
- this.$router.push({
- path: "/person-center/free-bank/bank-detail/" + item.goodsId,
- query: {
- orderGoodsId: item.orderGoodsId,
- },
- });
- },
- },
- };
- </script>
- <!-- Add "scoped" attribute to limit CSS to this component only -->
- <style scoped lang="scss">
- .my-bank {
- &__header {
- /deep/ .el-tabs__header {
- margin-bottom: 0;
- }
- }
- &__body {
- .list {
- .bank-item {
- margin-top: 24px;
- background: #fafbfc;
- border-radius: 8px;
- overflow: hidden;
- &__header {
- height: 40px;
- line-height: 40px;
- border-bottom: 1px solid #eee;
- padding: 0 18px;
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- color: #333333;
- .time {
- float: right;
- line-height: 40px;
- text-align: right;
- font-size: 12px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #666666;
- }
- }
- &__body {
- .img {
- float: left;
- width: 160px;
- height: 90px;
- display: table-cell;
- img {
- max-width: 100%;
- max-height: 100%;
- display: inline-block;
- vertical-align: middle;
- }
- }
- .text {
- float: left;
- margin-left: 12px;
- .title {
- margin-top: 10px;
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- color: #333333;
- .note {
- display: inline-block;
- vertical-align: middle;
- border: 1px solid #333333;
- border-radius: 4px;
- font-size: 12px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #333333;
- padding: 2px 5px;
- }
- }
- .progress {
- margin-top: 30px;
- font-size: 14px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #333333;
- &-line {
- width: 250px;
- display: inline-block;
- }
- /deep/ .el-progress-bar {
- padding-right: 100px;
- margin-right: -100px;
- }
- }
- }
- .btns-wrap {
- display: table;
- float: right;
- height: 90px;
- width: 130px;
- .btns {
- display: table-cell;
- vertical-align: middle;
- text-align: center;
- .btn {
- cursor: pointer;
- margin: 2px 0;
- width: 122px;
- height: 32px;
- border-radius: 16px;
- display: inline-block;
- text-align: center;
- line-height: 32px;
- padding: 0;
- }
- }
- }
- }
- }
- }
- .no-data {
- text-align: center;
- padding: 50px 0;
- color: #666;
- font-size: 16px;
- }
- .pagination {
- padding: 30px 0;
- text-align: center;
- }
- }
- }
- </style>
|