123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <template>
- <view class="main pt0">
- <view class="tab">
- <u-tabs :list="tab" @click="tabClick"></u-tabs>
- <view class="filters" @click="show = true">
- <text class="icon"></text>
- <text>筛选</text>
- </view>
- </view>
- <view class="list">
- <job :list="list"></job>
- <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
- <u-empty v-if="!loadMore && list.length == 0"></u-empty>
- </view>
- <filters v-model="show" @confirm="confirm"></filters>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- tab: [
- { name: '最新', orderBy: 'id' },
- { name: '附近', orderBy: 'distance' }
- ],
- list: [],
- param: { pageNum: 1, pageSize: 10, type: 0, orderBy: 'id' },
- loadMore: true,
- show: false
- };
- },
- onLoad(e) {
- this.param.enterpriseId = e.id;
- if (this.getLocation()) {
- this.param.latitude = this.getLocation().latitude;
- this.param.longitude = this.getLocation().longitude;
- }
- setTimeout(() => {
- uni.setNavigationBarTitle({ title: e.name });
- }, 300);
- this.getData();
- },
- methods: {
- getData() {
- this.http.request({
- url: '/app/position/list',
- data: this.param,
- loading: 'false',
- success: (res) => {
- this.loadMore = res.data.pages > this.param.pageNum ? true : false;
- this.list.push(...res.data.rows);
- }
- });
- },
- tabClick(e) {
- this.param.orderBy = e.orderBy;
- this.refresh();
- },
- confirm(e) {
- this.param.experience = e.experience.map((item) => item.name).toString() || '';
- this.param.salary = e.salary.map((item) => item.name).toString() || '';
- this.param.positionId = e.positionId || '';
- this.refresh();
- },
- go(url) {
- uni.navigateTo({ url: url });
- },
- //刷新数据
- refresh() {
- this.loadMore = true;
- this.param.pageNum = 1;
- this.list = [];
- this.getData();
- }
- },
- //下拉刷新
- onPullDownRefresh() {
- setTimeout(() => {
- this.refresh();
- uni.stopPullDownRefresh();
- }, 1000);
- },
- //上拉加载
- onReachBottom() {
- if (this.loadMore) {
- this.param.pageNum++;
- this.getData();
- }
- }
- };
- </script>
- <style lang="scss"></style>
|