userUrgeCourse.vue 8.5 KB

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