offline.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view>
  3. <view class="status">
  4. <view class="title">{{offlineInfo.adaptStatus|verifyStatusFilter}}</view>
  5. <view class="tip">注:必须参加线下培训才能通过适应性培训</view>
  6. <!-- <u-parse :html="offlineInfo.offlineContent"></u-parse> -->
  7. </view>
  8. <view class="content">
  9. <!-- <dl>
  10. <dt>【培训名称】</dt>
  11. <dd>{{offlineInfo.adaptName}}</dd>
  12. </dl>
  13. <dl>
  14. <dt>【培训地址】</dt>
  15. <dd>{{offlineInfo.adaptAddress}}</dd>
  16. </dl>
  17. <dl>
  18. <dt>【培训时长】</dt>
  19. <dd>{{offlineInfo.timeLength}}</dd>
  20. </dl>
  21. <dl>
  22. <dt>【开始时间】</dt>
  23. <dd>{{offlineInfo.startTime}}</dd>小时
  24. </dl>
  25. <dl>
  26. <dt>【结束时间】</dt>
  27. <dd>{{offlineInfo.endTime}}</dd>
  28. </dl> -->
  29. <dl>
  30. <dt>【培训安排】</dt>
  31. <dd>
  32. <u-parse :html="offlineInfo.adaptPlan"></u-parse>
  33. </dd>
  34. <!-- <dd>{{offlineInfo.adaptPlan}}</dd> -->
  35. </dl>
  36. </view>
  37. <u-bottom>
  38. <view slot="content">
  39. <view @click="sign" v-if="offlineInfo.flag==0&&offlineId" class="status-btn fix-bottom">
  40. 确认签到
  41. </view>
  42. <view v-else-if="offlineInfo.flag==0&&!offlineId" class="status-btn fix-bottom">
  43. 未签到
  44. </view>
  45. <view slot="content" v-else-if="offlineInfo.flag==1" class="status-btn fix-bottom">
  46. 已签到
  47. </view>
  48. </view>
  49. </u-bottom>
  50. </view>
  51. </template>
  52. <script>
  53. export default{
  54. name: 'offlineTraining',
  55. props:{
  56. offlineId: {
  57. type: String,
  58. default: function() {
  59. return ''
  60. }
  61. }
  62. },
  63. data(){
  64. return{
  65. offlineInfo:'',
  66. params:{}
  67. }
  68. },
  69. onLoad(){
  70. },
  71. mounted() {
  72. if(this.offlineId){
  73. this.params.id = this.offlineId;
  74. this.getAdaptTrainIdOffline(this.params);
  75. }else{
  76. this.getAdaptTrainOffline();
  77. }
  78. },
  79. onShow(){
  80. },
  81. filters: {
  82. verifyStatusFilter(value) {
  83. if (value == 0) {
  84. return '未开始';
  85. }else if(value == 1){
  86. return '进行中';
  87. }else if(value == 2){
  88. return '已完成';
  89. }else {
  90. return '未知';
  91. }
  92. },
  93. verifyFlagFilter(value){
  94. if (value == 0) {
  95. return '未参与';
  96. }else if(value == 1){
  97. return '已参与';
  98. }else {
  99. return '未知';
  100. }
  101. }
  102. },
  103. methods:{
  104. getAdaptTrainOffline(){
  105. this.$u.api.getAdaptTrainOffline().then(res=>{
  106. this.offlineInfo = res.data||[];
  107. console.log('getAdaptTrainOffline',JSON.parse(JSON.stringify(res)));
  108. })
  109. },
  110. getAdaptTrainIdOffline(params){
  111. console.log('params',params)
  112. this.$u.api.getAdaptTrainIdOffline(params).then(res=>{
  113. this.offlineInfo = res.data||[];
  114. console.log('getAdaptTrainIdOffline',JSON.parse(JSON.stringify(res)));
  115. })
  116. },
  117. sign(){
  118. this.$u.api.postSignOffline({tabId:this.offlineId}).then(res=>{
  119. if(res.code == 200){
  120. this.getAdaptTrainIdOffline(this.params);
  121. }else{
  122. uni.showToast({
  123. icon:'none',
  124. title:res.msg
  125. })
  126. }
  127. console.log('postSignOffline',JSON.parse(JSON.stringify(res)));
  128. })
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped>
  134. .status{background-color: #fff;padding: 24rpx;border-radius: 8rpx;text-align: center;margin: 24rpx;}
  135. .status .title{font-size: 36rpx;color: #fc7a40;margin-bottom: 10rpx;}
  136. .status .tip{font-size: 18rpx;color: #bfbfbf;}
  137. .status-btn{background-color: #4433d9;color: #fff;margin: 0 24rpx;padding: 24rpx;border-radius: 8rpx;}
  138. .content{background-color: #fff;padding: 24rpx;margin: 24rpx;}
  139. .content dl{margin-bottom: 24rpx;}
  140. .content dt{font-size: 36rpx;margin-bottom: 24rpx;}
  141. .content dd{color: #5f5f5f;margin: 0;}
  142. // @import './offline.scss'
  143. </style>