skillsTraining.vue 2.7 KB

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