UrgeIndex.vue 7.1 KB

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