123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- <template>
- <view>
- <!-- <dropdownPanel :filterData='filterData' @confirm="confirmA" @reset="resetA" @onChange="onChangeA"
- style="flex: 1;">
- <view class="p20 fs28 column flex-1 hb hidden" v-if="searchbarNav == 0">
- <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnabledA"
- :refresher-triggered="triggeredA" refresher-background="rgba(0,0,0,0)"
- @refresherrefresh="pullDownRefreshA" @refresherrestore="triggeredA = false" :upper-threshold="100"
- :lower-threshold="100" @refresherabort="triggeredA = false" @scrolltolower="reachBottomA">
- <view v-for="(item,index) in courseListA" :key="item.index" class="m10 p10 center"
- :class="courseListAid==item.periodId?'select':''" style="border-bottom: 2rpx solid #eee;"
- @click="getCourseOne(item)">
- {{item.periodName}}
- </view>
- <u-loadmore :status="statusA" />
- </scroll-view>
- </view>
- <view class="p20 fs28 column flex-1 hb hidden" v-if="searchbarNav == 1">
- <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnabledC"
- :refresher-triggered="triggeredC" refresher-background="rgba(0,0,0,0)"
- @refresherrefresh="pullDownRefreshC" @refresherrestore="triggeredC = false" :upper-threshold="100"
- :lower-threshold="100" @refresherabort="triggeredC = false" @scrolltolower="reachBottomC">
- <view v-for="(item,index) in courseListC" :key="item.index" class="m10 p10 center"
- :class="actC==index?'select':''" style="border-bottom: 2rpx solid #eee;"
- @click="getCoursetwo(item,index)">
- {{item.courseName}}
- </view>
- <u-loadmore :status="statusC" />
- </scroll-view>
- </view>
- </dropdownPanel> -->
- <view>
- <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnabled"
- :refresher-triggered="triggered" refresher-background="rgba(0,0,0,0)"
- @refresherrefresh="pullDownRefresh" @refresherrestore="triggere = false" :upper-threshold="100"
- :lower-threshold="100" @refresherabort="triggered = false" @scrolltolower="reachBottom">
- <view class="list-box" v-for="(item,index) in userlist" :key="index">
- <view class="justify-start align-center">
- <u-avatar :src="item.avatar" size="50"></u-avatar>
- <view class="ml20">
- <view>{{item.name}}</view>
- <view class="fs24 mt10 base-color">{{item.title}}</view>
- </view>
- </view>
- </view>
- <u-loadmore :status="status" />
- </scroll-view>
- </view>
- </view>
- </template>
- <script>
- import dropdownPanel from "@/components/dropdownPanel.vue"
- import {
- getFsCourseList,
- getCourseVdieoList,
- getWorkTask
- } from "@/api/courseManage.js";
- export default {
- name: "userUrgeCourse",
- components: {
- dropdownPanel
- },
- data() {
- return {
- filterData: [{
- name: '营期',
- value: 0,
- }, {
- name: '课程',
- value: 1,
- }],
- searchbarNav: 0,
- //营期分页
- triggeredA: false,
- isEnabledA: true,
- statusA: 'nomore',
- pageNumA: 1,
- pageSizeA: 6,
- //课程分页
- triggeredC: false,
- isEnabledC: true,
- statusC: 'nomore',
- pageNumC: 1,
- pageSizeC: 6,
- //获取营期/课程列表
- courseListA: [],
- courseListAid: '',
- courseListC: [],
- courseListCid: '',
- actC: '',
- //获取会员列表
- //课程分页
- triggered: false,
- isEnabled: true,
- status: 'nomore',
- pageNum: 1,
- pageSize: 8,
- userlist:[]
- };
- },
- mounted() {
- this.getcourseA()
- this.getlist()
- },
- methods: {
- reachBottom() {
- if (this.status === 'loadmore') {
- this.status = 'loading'
- uni.showNavigationBarLoading()
- setTimeout(() => {
- this.pageNum++
- this.getlist()
- uni.hideNavigationBarLoading()
- }, 1000);
- }
- },
- //列表展示下拉
- pullDownRefresh() {
- this.triggered = true; //下拉了状态为true
- setTimeout(() => {
- this.triggered = false;
- uni.stopPullDownRefresh()
- this.pageNum = 1;
- this.getlist('refresh')
- }, 1000)
- },
- getlist(type){
- const data={
- pageNum:this.pageNum,
- pageSize:this.pageSize
- }
- getWorkTask(data).then(res=>{
- if (res.code == 200) {
- if (type == 'refresh') {
- this.userlist = res.data.list
- } else {
- this.userlist = [...this.userlist, ...res.data.list]
- }
- if (res.data.isLastPage) {
- this.status = 'nomore'
- } else {
- this.status = 'loadmore'
- }
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- })
- },
- onChangeA(index) {
- this.searchbarNav = index
- if(index==1){
- if(this.courseListAid==''){
- uni.showToast({
- icon: 'none',
- title: '请先选择营期'
- })
- }
- }
- },
- confirmA() {
- },
- resetA() {
- this.courseListAid = ''
- },
- getCourseOne(item) {
- //获取营期列表
- this.courseListAid = item.periodId
- this.filterData[0].name = item.periodName
- this.courseListC=[]
- this.pageNumC=1
- this.getcourseB()
- // console.log(this.courseListAid)
- },
- getCoursetwo(item, index) {
- //获取课程列表
- this.actC = index
- this.courseListCid = item.courseId
- this.filterData[1].name = item.courseName
- // console.log(item)
- },
- reachBottomA() {
- // status这个是加载状态
- if (this.statusA === 'loadmore') {
- this.statusA = 'loading'
- uni.showNavigationBarLoading()
- setTimeout(() => {
- this.pageNumA++
- this.getcourseA() //触底 不穿执行else
- uni.hideNavigationBarLoading()
- }, 1000);
- }
- },
- //列表展示下拉
- pullDownRefreshA() {
- // 下拉
- this.triggeredA = true; //下拉了状态为true
- setTimeout(() => {
- this.triggeredA = false;
- uni.stopPullDownRefresh()
- this.pageNumA = 1;
- this.getcourseA('refresh') //触底 不穿执行else
- // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
- // 请求接口
- }, 1000)
- },
- reachBottomC() {
- // status这个是加载状态
- if (this.statusC === 'loadmore') {
- this.statusC = 'loading'
- uni.showNavigationBarLoading()
- setTimeout(() => {
- this.pageNumC++
- this.getcourseB() //触底 不穿执行else
- uni.hideNavigationBarLoading()
- }, 1000);
- }
- },
- //列表展示下拉
- pullDownRefreshC() {
- // 下拉
- this.triggeredC = true; //下拉了状态为true
- setTimeout(() => {
- this.triggeredC = false;
- uni.stopPullDownRefresh()
- this.pageNumC = 1;
- this.getcourseB('refresh') //触底 不穿执行else
- // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
- // 请求接口
- }, 1000)
- },
- getcourseA(type) {
- //获取营期列表
- const data = {
- pageNum: this.pageNumA,
- pageSize: this.pageSizeA,
- }
- getFsCourseList(data).then(res => {
- if (res.code == 200) {
- if (type == 'refresh') {
- this.courseListA = res.data.list
- } else {
- this.courseListA = [...this.courseListA, ...res.data.list]
- }
- if (res.data.isLastPage) {
- this.statusA = 'nomore'
- } else {
- this.statusA = 'loadmore'
- }
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- })
- },
- getcourseB(type) {
- //获取课程列表
- const data = {
- pageNum: this.pageNumC,
- pageSize: this.pageSizeC,
- periodId: this.courseListAid,
- keyword: ''
- }
- getCourseVdieoList(data).then(res => {
- if (res.code == 200) {
- if (type == 'refresh') {
- this.courseListC = res.data.list
- } else {
- this.courseListC = [...this.courseListC, ...res.data.list]
- }
- if (res.data.isLastPage) {
- this.statusC = 'nomore'
- } else {
- this.statusC = 'loadmore'
- }
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- })
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .select {
- color: #1773ff;
- background-color: #e6ecff;
- }
- .list-box {
- background-color: #fff;
- padding: 28rpx;
- margin-bottom: 12rpx;
- }
- </style>
|