myBasicTraining.vue 2.0 KB

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