myBasicTraining.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <view>
  3. <image class="bg" src="../../../static/img/banner-myBasicTraining.png" mode="widthFix"></image>
  4. <view class="title u-flex u-row-between">
  5. <view class="left">
  6. 学习进度
  7. </view>
  8. <!-- <view class="right">
  9. 查看全部
  10. </view> -->
  11. </view>
  12. <view class="course">
  13. <view class="course-item u-flex u-row-between"
  14. v-for="(item,index) in onlineData"
  15. :class="{ 'unstudy':item.flag == 0, 'studying':item.flag == 1, 'studyed':item.flag == 2 }"
  16. @click="courseClick(item)">
  17. <view class="left">
  18. <view class="course-item-title">
  19. 第{{index + 1}}节
  20. </view>
  21. <view class="course-item-name">
  22. {{item.adaptName}}
  23. </view>
  24. </view>
  25. <view class="right">
  26. <u-icon v-if="item.flag == 2" name="checkbox-mark" color="#00a046" size="28" ></u-icon>
  27. <u-icon v-else name="arrow-right" color="#2683e5" size="28" ></u-icon>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. export default{
  35. data(){
  36. return{
  37. onlineData:[],
  38. }
  39. },
  40. onLoad(){
  41. },
  42. onShow(){
  43. this.getAdaptTrainOnline();
  44. },
  45. methods:{
  46. getAdaptTrainOnline(){
  47. this.$u.api.getAdaptTrainOnline().then(res=>{
  48. if(res.code == 200){
  49. this.onlineData = res.data;
  50. }else{
  51. uni.showToast({
  52. icon:'none',
  53. title:res.msg
  54. })
  55. }
  56. console.log('getAdaptTrainOnline',JSON.parse(JSON.stringify(res)));
  57. })
  58. },
  59. courseClick(item){
  60. this.$u.route({
  61. url: 'pages/basicTraining/basicTrainingDetails/basicTrainingDetails',
  62. params: {
  63. id: item.id
  64. }
  65. });
  66. },
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. page{padding-bottom: 48rpx;background-color: #eee;}
  72. .bg{width: 100%;}
  73. .title {padding: 24rpx;;background-color: #fff;border-bottom: 1px solid #ddd;}
  74. .title .left{font-size: 36rpx;}
  75. .course{background-color: #fff;}
  76. .course-item{margin-bottom: 24rpx;padding: 20rpx 24rpx;}
  77. .course-item + .course-item{border-top: 1px solid #ddd;}
  78. .course-item.studyed .left{color: #c5c5c5;}
  79. // @import './myBasicTraining.scss'
  80. </style>