123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <template>
- <view class="pageCon">
- <view class="top dfsb">
- <view @click="sectionChange(item.id)" :class="[type == item.id ? 'sel' : '', 'li']" v-for="(item, index) in school_type" :key="index">{{ item.name }}</view>
- </view>
- <view class="conwarp"><list :flag="1" :list="schoolList"></list></view>
- </view>
- </template>
- <script>
- import list from './componets/list.vue';
- export default {
- components: {
- list
- },
- data() {
- return {
- school_type: [],
- type: 0,
- schoolList: [
- // { image: '/static/img/pro/indnotice.png', name: '知识过关', path: '/pages/knowledge/knowledge' },
- ],
- page: 1,
- pagnum: 6
- };
- },
- onPullDownRefresh() {
- this.page = 1;
- this.schoolList = [];
- setTimeout(res => {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- onLoad(opt) {
- this.type = opt.type || '';
- this.getInfoList();
- },
- onReachBottom() {
- if (this.status == 'nomore') return;
- this.status = 'loading';
- this.page = ++this.page;
- this.getInfoList();
- },
- methods: {
- sectionChange(index) {
- this.type = index;
- this.page = 1;
- this.schoolList = [];
- this.getInfoList();
- },
- getInfoList() {
- this.status = 'loadmore';
- this.$api
- .request('index/getSchoolList', {
- type: this.type,
- page: this.page,
- limit: this.pagnum
- })
- .then(data => {
- console.log(data);
- if (data.code == 200) {
- this.school_type = data.data.school_type;
- this.schoolList = this.schoolList.concat(data.data.list);
- if (data.data.list.length < this.pagnum) {
- this.status = 'nomore';
- }
- } else {
- this.$api.toast(data.msg);
- }
- });
- },
- toNext(url) {
- uni.navigateTo({
- url: url
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .pageCon {
- .top {
- padding: 22rpx 0;
- background-color: #fff;
- justify-content: center;
- .li {
- padding: 11rpx 18rpx;
- border: 1px solid #666666;
- margin-left: -1rpx;
- &:first-of-type {
- border-radius: 8rpx 0 0 8rpx;
- }
- &:last-of-type {
- border-radius: 0 8rpx 8rpx 0;
- }
- }
- .sel {
- border: 1px solid #025b58;
- background: rgba(2, 91, 88, 0.1);
- color: #025b58;
- }
- }
- .conwarp {
- background: #ffffff;
- margin-top: 20rpx;
- padding: 0 30rpx;
- }
- }
- </style>
|