userUrgeCourse.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <view>
  3. <dropdownPanel :filterData='filterData' @confirm="confirmA" @reset="resetA" @onChange="onChangeA"
  4. style="flex: 1;">
  5. <view class="p20 fs28 column flex-1 hb hidden" v-if="searchbarNav == 0">
  6. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnabledA"
  7. :refresher-triggered="triggeredA" refresher-background="rgba(0,0,0,0)"
  8. @refresherrefresh="pullDownRefreshA" @refresherrestore="triggeredA = false" :upper-threshold="100"
  9. :lower-threshold="100" @refresherabort="triggeredA = false" @scrolltolower="reachBottomA">
  10. <view v-for="(item,index) in courseListA" :key="item.index" class="m10 p10 center"
  11. :class="courseListAid==item.periodId?'select':''" style="border-bottom: 2rpx solid #eee;"
  12. @click="getCourseOne(item)">
  13. {{item.periodName}}
  14. </view>
  15. <u-loadmore :status="statusA" />
  16. </scroll-view>
  17. </view>
  18. <view class="p20 fs28 column flex-1 hb hidden" v-if="searchbarNav == 1">
  19. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnabledC"
  20. :refresher-triggered="triggeredC" refresher-background="rgba(0,0,0,0)"
  21. @refresherrefresh="pullDownRefreshC" @refresherrestore="triggeredC = false" :upper-threshold="100"
  22. :lower-threshold="100" @refresherabort="triggeredC = false" @scrolltolower="reachBottomC">
  23. <view v-for="(item,index) in courseListC" :key="item.index" class="m10 p10 center"
  24. :class="actC==index?'select':''" style="border-bottom: 2rpx solid #eee;"
  25. @click="getCoursetwo(item,index)">
  26. {{item.courseName}}
  27. </view>
  28. <u-loadmore :status="statusC" />
  29. </scroll-view>
  30. </view>
  31. </dropdownPanel>
  32. <view>
  33. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnabled"
  34. :refresher-triggered="triggered" refresher-background="rgba(0,0,0,0)"
  35. @refresherrefresh="pullDownRefresh" @refresherrestore="triggere = false" :upper-threshold="100"
  36. :lower-threshold="100" @refresherabort="triggered = false" @scrolltolower="reachBottom">
  37. <view class="list-box" v-for="(item,index) in userlist" :key="index">
  38. <view class="justify-start align-center">
  39. <u-avatar :src="item.avatar" size="50"></u-avatar>
  40. <view class="ml20">
  41. <view>{{item.name}}</view>
  42. <view class="fs24 mt10 base-color">{{item.title}}</view>
  43. </view>
  44. </view>
  45. </view>
  46. <u-loadmore :status="status" />
  47. </scroll-view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import dropdownPanel from "@/components/dropdownPanel.vue"
  53. import {
  54. getFsCourseList,
  55. getCourseVdieoList,
  56. getWorkTask
  57. } from "@/api/courseManage.js";
  58. export default {
  59. name: "userUrgeCourse",
  60. components: {
  61. dropdownPanel
  62. },
  63. data() {
  64. return {
  65. filterData: [{
  66. name: '营期',
  67. value: 0,
  68. }, {
  69. name: '课程',
  70. value: 1,
  71. }],
  72. searchbarNav: 0,
  73. //营期分页
  74. triggeredA: false,
  75. isEnabledA: true,
  76. statusA: 'nomore',
  77. pageNumA: 1,
  78. pageSizeA: 6,
  79. //课程分页
  80. triggeredC: false,
  81. isEnabledC: true,
  82. statusC: 'nomore',
  83. pageNumC: 1,
  84. pageSizeC: 6,
  85. //获取营期/课程列表
  86. courseListA: [],
  87. courseListAid: '',
  88. courseListC: [],
  89. courseListCid: '',
  90. actC: '',
  91. //获取会员列表
  92. //课程分页
  93. triggered: false,
  94. isEnabled: true,
  95. status: 'nomore',
  96. pageNum: 1,
  97. pageSize: 8,
  98. userlist:[]
  99. };
  100. },
  101. mounted() {
  102. this.getcourseA()
  103. this.getlist()
  104. },
  105. methods: {
  106. reachBottom() {
  107. if (this.status === 'loadmore') {
  108. this.status = 'loading'
  109. uni.showNavigationBarLoading()
  110. setTimeout(() => {
  111. this.pageNum++
  112. this.getlist()
  113. uni.hideNavigationBarLoading()
  114. }, 1000);
  115. }
  116. },
  117. //列表展示下拉
  118. pullDownRefresh() {
  119. this.triggered = true; //下拉了状态为true
  120. setTimeout(() => {
  121. this.triggered = false;
  122. uni.stopPullDownRefresh()
  123. this.pageNum = 1;
  124. this.getlist('refresh')
  125. }, 1000)
  126. },
  127. getlist(type){
  128. const data={
  129. pageNum:this.pageNum,
  130. pageSize:this.pageSize
  131. }
  132. getWorkTask(data).then(res=>{
  133. if (res.code == 200) {
  134. if (type == 'refresh') {
  135. this.userlist = res.data.list
  136. } else {
  137. this.userlist = [...this.userlist, ...res.data.list]
  138. }
  139. if (res.data.isLastPage) {
  140. this.status = 'nomore'
  141. } else {
  142. this.status = 'loadmore'
  143. }
  144. } else {
  145. uni.showToast({
  146. icon: 'none',
  147. title: res.msg
  148. })
  149. }
  150. })
  151. },
  152. onChangeA(index) {
  153. this.searchbarNav = index
  154. if(index==1){
  155. if(this.courseListAid==''){
  156. uni.showToast({
  157. icon: 'none',
  158. title: '请先选择营期'
  159. })
  160. }
  161. }
  162. },
  163. confirmA() {
  164. },
  165. resetA() {
  166. this.courseListAid = ''
  167. },
  168. getCourseOne(item) {
  169. //获取营期列表
  170. this.courseListAid = item.periodId
  171. this.filterData[0].name = item.periodName
  172. this.courseListC=[]
  173. this.pageNumC=1
  174. this.getcourseB()
  175. // console.log(this.courseListAid)
  176. },
  177. getCoursetwo(item, index) {
  178. //获取课程列表
  179. this.actC = index
  180. this.courseListCid = item.courseId
  181. this.filterData[1].name = item.courseName
  182. // console.log(item)
  183. },
  184. reachBottomA() {
  185. // status这个是加载状态
  186. if (this.statusA === 'loadmore') {
  187. this.statusA = 'loading'
  188. uni.showNavigationBarLoading()
  189. setTimeout(() => {
  190. this.pageNumA++
  191. this.getcourseA() //触底 不穿执行else
  192. uni.hideNavigationBarLoading()
  193. }, 1000);
  194. }
  195. },
  196. //列表展示下拉
  197. pullDownRefreshA() {
  198. // 下拉
  199. this.triggeredA = true; //下拉了状态为true
  200. setTimeout(() => {
  201. this.triggeredA = false;
  202. uni.stopPullDownRefresh()
  203. this.pageNumA = 1;
  204. this.getcourseA('refresh') //触底 不穿执行else
  205. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  206. // 请求接口
  207. }, 1000)
  208. },
  209. reachBottomC() {
  210. // status这个是加载状态
  211. if (this.statusC === 'loadmore') {
  212. this.statusC = 'loading'
  213. uni.showNavigationBarLoading()
  214. setTimeout(() => {
  215. this.pageNumC++
  216. this.getcourseB() //触底 不穿执行else
  217. uni.hideNavigationBarLoading()
  218. }, 1000);
  219. }
  220. },
  221. //列表展示下拉
  222. pullDownRefreshC() {
  223. // 下拉
  224. this.triggeredC = true; //下拉了状态为true
  225. setTimeout(() => {
  226. this.triggeredC = false;
  227. uni.stopPullDownRefresh()
  228. this.pageNumC = 1;
  229. this.getcourseB('refresh') //触底 不穿执行else
  230. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  231. // 请求接口
  232. }, 1000)
  233. },
  234. getcourseA(type) {
  235. //获取营期列表
  236. const data = {
  237. pageNum: this.pageNumA,
  238. pageSize: this.pageSizeA,
  239. }
  240. getFsCourseList(data).then(res => {
  241. if (res.code == 200) {
  242. if (type == 'refresh') {
  243. this.courseListA = res.data.list
  244. } else {
  245. this.courseListA = [...this.courseListA, ...res.data.list]
  246. }
  247. if (res.data.isLastPage) {
  248. this.statusA = 'nomore'
  249. } else {
  250. this.statusA = 'loadmore'
  251. }
  252. } else {
  253. uni.showToast({
  254. icon: 'none',
  255. title: res.msg
  256. })
  257. }
  258. })
  259. },
  260. getcourseB(type) {
  261. //获取课程列表
  262. const data = {
  263. pageNum: this.pageNumC,
  264. pageSize: this.pageSizeC,
  265. periodId: this.courseListAid,
  266. keyword: ''
  267. }
  268. getCourseVdieoList(data).then(res => {
  269. if (res.code == 200) {
  270. if (type == 'refresh') {
  271. this.courseListC = res.data.list
  272. } else {
  273. this.courseListC = [...this.courseListC, ...res.data.list]
  274. }
  275. if (res.data.isLastPage) {
  276. this.statusC = 'nomore'
  277. } else {
  278. this.statusC = 'loadmore'
  279. }
  280. } else {
  281. uni.showToast({
  282. icon: 'none',
  283. title: res.msg
  284. })
  285. }
  286. })
  287. },
  288. }
  289. }
  290. </script>
  291. <style scoped lang="scss">
  292. .select {
  293. color: #1773ff;
  294. background-color: #e6ecff;
  295. }
  296. .list-box {
  297. background-color: #fff;
  298. padding: 28rpx;
  299. margin-bottom: 12rpx;
  300. }
  301. </style>