courseSend.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="course-send-container">
  3. <view class="course-list" v-if="courseList.length>0">
  4. <view v-for="(item, index) in courseList" :key="index" class="course-item">
  5. <view class="course-content es-mr-10">
  6. <view class="course-desc textTwo">{{ item.dictLabel }}
  7. </view>
  8. </view>
  9. <view class="send-button es-fs-28 u-f-ajc" @tap="sendCourseAppFun(item)">发送</view>
  10. </view>
  11. </view>
  12. <u-empty style="padding-top: 20vh;" mode="data" v-else="imgurl"
  13. icon="https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png" text="暂无数据"></u-empty>
  14. </view>
  15. </template>
  16. <script>
  17. import {
  18. getVideoListByCourse,
  19. sendCourseApp
  20. } from '@/api/course.js'
  21. export default {
  22. data() {
  23. return {
  24. courseList: [],
  25. courseId: null,
  26. corpId: null,
  27. qwUserId: null,
  28. sendUserId: null,
  29. };
  30. },
  31. onLoad(options) {
  32. if (options.sendUserId) {
  33. this.sendUserId = options.sendUserId
  34. }
  35. if (options.id) {
  36. this.courseId = options.id
  37. this.getVideoListByCourseFun(options.id)
  38. }
  39. if (options.corpId) {
  40. this.corpId = options.corpId
  41. }
  42. if (options.qwUserId) {
  43. this.qwUserId = options.qwUserId
  44. }
  45. },
  46. methods: {
  47. async getVideoListByCourseFun(id) {
  48. const res = await getVideoListByCourse(id)
  49. if (res.code == 200) {
  50. this.courseList = res.list
  51. } else {
  52. uni.showToast({
  53. icon: 'none',
  54. title: res.msg
  55. })
  56. }
  57. },
  58. async sendCourseAppFun(e) {
  59. let params = {
  60. userId: this.sendUserId,
  61. courseId: this.courseId,
  62. videoId: e.dictValue,
  63. companyUserId: uni.getStorageSync('companyUserId') || '',
  64. qwUserId: this.qwUserId,
  65. corpId: this.corpId
  66. }
  67. const res = await sendCourseApp(params)
  68. if (res.code == 200) {
  69. uni.showToast({
  70. icon: 'none',
  71. title: '发送成功!'
  72. })
  73. setTimeout(() => {
  74. uni.navigateBack({
  75. delta: 2
  76. })
  77. }, 1000)
  78. } else {
  79. uni.showToast({
  80. icon: 'none',
  81. title: res.msg
  82. })
  83. }
  84. }
  85. }
  86. };
  87. </script>
  88. <style lang="scss">
  89. .course-send-container {
  90. padding: 20rpx;
  91. .course-list {
  92. .course-item {
  93. display: flex;
  94. justify-content: space-between;
  95. align-items: center;
  96. padding: 20rpx;
  97. background-color: #fff;
  98. border-radius: 10rpx;
  99. margin-bottom: 20rpx;
  100. .course-content {
  101. flex: 1;
  102. .course-title {
  103. font-size: 32rpx;
  104. font-weight: bold;
  105. }
  106. .course-desc {
  107. font-size: 28rpx;
  108. color: #222222;
  109. }
  110. }
  111. .send-button {
  112. width: 104rpx;
  113. height: 56rpx;
  114. background-color: #ff7f00;
  115. color: #fff;
  116. border-radius: 30rpx;
  117. }
  118. }
  119. }
  120. }
  121. </style>