courseList.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="course-list-container">
  3. <view class="wechat-info" @tap="changeFun">
  4. <view class="wechat-icon">
  5. <image src="/static/image/course/icon_qiyewechat.png" mode=""></image>
  6. </view>
  7. <view class="wechat-name">
  8. <view>{{this.selectData && this.selectData.qwUserName}}</view>
  9. <view>{{this.selectData && this.selectData.companyName}}</view>
  10. </view>
  11. <view class="switch-button">
  12. <image src="/static/image/course/icon_switch.png" mode=""></image>
  13. </view>
  14. </view>
  15. <view class="course-list" v-if="courseList.length>0">
  16. <view v-for="(item, index) in courseList" :key="index" class="course-item" @tap="detail(item)">
  17. <view class="course-icon">
  18. <image src="/static/image/course/icon_class_video.png" mode=""></image>
  19. </view>
  20. <view class="course-name">{{ item.dictLabel }}</view>
  21. <view class="arrow-icon">
  22. <image src="/static/image/course/icon_more_right.png" mode=""></image>
  23. </view>
  24. </view>
  25. </view>
  26. <u-empty style="padding-top: 20vh;" mode="data" v-else="imgurl"
  27. icon="https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png" text="暂无数据"></u-empty>
  28. <u-picker :show="show" @close="show=false" @cancel="show=false" :closeOnClickOverlay="true" @confirm="confirm"
  29. :columns="columns"></u-picker>
  30. </view>
  31. </template>
  32. <script>
  33. import {
  34. getQwUserListByCompanyUserId,
  35. getCourseListByCompany,
  36. } from '@/api/course.js'
  37. export default {
  38. data() {
  39. return {
  40. courseList: [],
  41. show: false,
  42. columns: [],
  43. userList: [],
  44. selectData: '',
  45. sendUserId: null,
  46. };
  47. },
  48. onLoad(options) {
  49. if (options.userId) {
  50. this.sendUserId = options.userId
  51. }
  52. this.selectData = uni.getStorageSync('sendCourseQiWeiData')
  53. if(!this.selectData){
  54. this.getQwUserListByCompanyUserIdFun()
  55. }
  56. this.getCourseListByCompanyFun()
  57. },
  58. methods: {
  59. changeFun() {
  60. this.getQwUserListByCompanyUserIdFun()
  61. this.show=true
  62. },
  63. confirm(e) {
  64. const index = e.indexs[0]
  65. this.selectData = this.userList[index]
  66. uni.setStorageSync('sendCourseQiWeiData',this.selectData)
  67. this.show = false
  68. },
  69. detail(e) {
  70. uni.navigateTo({
  71. url: `/pages_im/pages/conversation/course/courseSend?id=${e.dictValue}&corpId=${this.selectData.corpId}&qwUserId=${this.selectData.id}&sendUserId=${this.sendUserId}`
  72. })
  73. },
  74. async getQwUserListByCompanyUserIdFun() {
  75. let params = {
  76. userId: this.sendUserId
  77. }
  78. const res = await getQwUserListByCompanyUserId(params)
  79. if (res.code == 200) {
  80. if (res.data.length <= 0) {
  81. uni.showToast({
  82. icon: 'none',
  83. title: '当前用户未与销售绑定'
  84. })
  85. setTimeout(() => {
  86. uni.navigateBack()
  87. }, 2000)
  88. return
  89. }
  90. this.columns = []
  91. this.columns.push(res.data.map(item => {
  92. return `${item.qwUserName}-${item.companyName}`
  93. }))
  94. this.userList = res.data
  95. this.show = true
  96. } else {
  97. uni.showToast({
  98. icon: 'none',
  99. title: res.msg
  100. })
  101. }
  102. },
  103. async getCourseListByCompanyFun() {
  104. const res = await getCourseListByCompany()
  105. if (res.code == 200) {
  106. this.courseList = res.list
  107. } else {
  108. uni.showToast({
  109. icon: 'none',
  110. title: res.msg
  111. })
  112. }
  113. }
  114. }
  115. };
  116. </script>
  117. <style lang="scss">
  118. .course-list-container {
  119. padding: 20rpx;
  120. .wechat-info {
  121. display: flex;
  122. align-items: center;
  123. padding: 20rpx;
  124. background-color: #ff7f00;
  125. border-radius: 10rpx;
  126. color: #fff;
  127. .wechat-icon {
  128. width: 80rpx;
  129. height: 80rpx;
  130. margin-right: 20rpx;
  131. image {
  132. width: 100%;
  133. height: 100%;
  134. }
  135. }
  136. .wechat-name {
  137. flex: 1;
  138. }
  139. .switch-button {
  140. width: 40rpx;
  141. height: 40rpx;
  142. image {
  143. width: 100%;
  144. height: 100%;
  145. }
  146. }
  147. }
  148. .course-list {
  149. margin-top: 20rpx;
  150. .course-item {
  151. display: flex;
  152. align-items: center;
  153. padding: 20rpx;
  154. background-color: #fff;
  155. border-radius: 10rpx;
  156. margin-bottom: 20rpx;
  157. .course-icon {
  158. width: 40rpx;
  159. height: 40rpx;
  160. margin-right: 20rpx;
  161. image {
  162. width: 100%;
  163. height: 100%;
  164. }
  165. }
  166. .course-name {
  167. flex: 1;
  168. white-space: nowrap;
  169. overflow: hidden;
  170. text-overflow: ellipsis;
  171. }
  172. .arrow-icon {
  173. width: 30rpx;
  174. height: 30rpx;
  175. image {
  176. width: 100%;
  177. height: 100%;
  178. }
  179. }
  180. }
  181. }
  182. }
  183. </style>