skillsTraining.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <!-- 我的技能培训 -->
  2. <template>
  3. <view class="training">
  4. <u-navbar back-text="" title="" back-icon-color="#FFFFFF" :background="{ background: '#3D5D4C' }" :border-bottom="false"></u-navbar>
  5. <z-paging ref="paging" v-model="trainingList" @query="queryList">
  6. <!-- 选项卡 -->
  7. <view class="training-tab" slot="top">
  8. <u-tabs
  9. :list="tabList"
  10. :is-scroll="true"
  11. :current="current"
  12. @change="tabChange"
  13. bg-color="#f2f2f2"
  14. inactive-color="#000000"
  15. active-color="#709078"
  16. :bold="false"
  17. bar-width="40"
  18. bar-height="6"
  19. :active-item-style="{ color: '#000000' }"
  20. ></u-tabs>
  21. </view>
  22. <!-- 列表 -->
  23. <view class="training-list">
  24. <view
  25. class="training-list-item"
  26. v-for="(item, index) in trainingList"
  27. :key="index"
  28. @click="jumpPage('/pages/mine/skillsTraining/skillsTrainingDetails/skillsTrainingDetails', { id: item.id })"
  29. >
  30. <view class="left">
  31. <u-image :src="item.img" mode="aspectFill" width="204" height="220" border-radius="10"></u-image>
  32. </view>
  33. <view class="right">
  34. <view class="name wrap">{{ item.name || '-' }}</view>
  35. <view class="school wrap">培训学校:{{ item.schoolName || '-' }}</view>
  36. <view class="flex wrap">
  37. <view class="rate">
  38. 难度<u-rate
  39. :count="5"
  40. v-model="item.difficult"
  41. inactive-color="#EF651F"
  42. active-color="#EF651F"
  43. disabled
  44. size="30"
  45. gutter="6"
  46. ></u-rate>
  47. </view>
  48. <!-- <view>报名人数:{{ item.people }}</view> -->
  49. </view>
  50. <view class="wrap">开始时间:{{ item.applyTime || '-' }}</view>
  51. <view class="wrap">培训周期:{{ item.cycle || '-' }}个月</view>
  52. </view>
  53. </view>
  54. </view>
  55. </z-paging>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. data() {
  61. return {
  62. current: 0,
  63. tabList: [
  64. { value: 1, name: '培训中' },
  65. { value: 0, name: '已报名' }
  66. ],
  67. trainingList: []
  68. };
  69. },
  70. methods: {
  71. /**
  72. * tab切换
  73. * @param { Number } cur
  74. */
  75. tabChange(cur) {
  76. this.current = cur;
  77. this.getList(1, 10, this.tabList[cur].value);
  78. },
  79. /**
  80. * 下拉分页组件触发
  81. * @param {Number} pageNum
  82. * @param {Number} pageSize
  83. */
  84. queryList(pageNum, pageSize) {
  85. this.getList(pageNum, pageSize, this.tabList[this.current].value);
  86. },
  87. /**
  88. * 获取列表
  89. * @param {Object} pageNum
  90. * @param {Object} pageSize
  91. */
  92. getList(pageNum, pageSize, type) {
  93. this.$u.api.skillTraining.getMyTrainingListApi({ pageNum, pageSize, type }).then((res) => {
  94. if (res.code === 200) {
  95. this.$refs.paging.complete(res.rows);
  96. } else {
  97. this.$refs.paging.complete([]);
  98. this.$refs.uToast.show({
  99. title: res.msg,
  100. type: 'error'
  101. });
  102. }
  103. });
  104. },
  105. /**
  106. * @param {Object} url
  107. * @param {Object} params
  108. */
  109. jumpPage(url, params) {
  110. this.$u.route({ url, params });
  111. }
  112. }
  113. };
  114. </script>
  115. <style lang="scss" scoped>
  116. @import './skillsTraining.scss';
  117. </style>