| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- // pages/fulltime/index.js
- import {
- getFullList
- } from '../../services/index.js'
- import {
- imgServerUrl,
- imgServerUrl_new
- } from '../../config/config.js'
- var app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- list: [],
- pageNo: 1, //当前分页
- isScroll: true, //是否可以滚动
- showNoMore: "没有更多信息...", //显示已无更多
- cityCode: '320200',
- cityName: '无锡',
- selectId: -1, //选中筛选的条件
- totalSalary: '', //薪资待遇排序(1:正序;2:倒序)
- sort: '', //距离排序(1:正序;2:倒序)
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
- if (app.globalData.userInfo) {
- console.log('有info===', app.globalData)
- this.start();
- } else if (this.data.canIUse) {
- // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
- // 所以此处加入 callback 以防止这种情况
- app.userInfoReadyCallback = res => {
- console.log('userInfoReadyCallback===', res.userInfo)
- app.globalData.userInfo = res.userInfo;
- this.start();
- }
- } else {
- // 在没有 open-type=getUserInfo 版本的兼容处理
- wx.getUserInfo({
- success: res => {
- app.globalData.userInfo = res.userInfo
- console.log('兼容处理===', app.globalData)
- this.start();
- }
- })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function() {
- },
- start() {
- this.fullList();
- },
- //获取全职列表数据
- fullList(params) {
- if (!this.data.isScroll) {
- return false
- }
- let paramsObj = {
- totalSalary: this.data.totalSalary,
- cityCode: this.data.cityCode,
- pageNo: this.data.pageNo,
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken
- }
- Object.assign(paramsObj);
- getFullList(paramsObj).then(data => {
- var pageNo = data.data.pageNo;
- let setData = {}
- // 是否可以滚动加载数据
- if (data.data.isLast) {
- setData.isScroll = false
- }
- if (data.data.fullPosition.length != 0) {
- setData.list = this.data.list.concat(data.data.fullPosition)
- setData.pageNo = pageNo;
- } else {
- setData.list = this.data.list;
- }
- this.setData({
- ...setData
- })
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- this.setData({
- pageNo: 1, //当前分页
- isScroll: true, //是否可以滚动
- list: [],
- selectId: -1, //选中筛选的条件
- totalSalary: '', //薪资待遇排序(1:正序;2:倒序)
- sort: '', //距离排序(1:正序;2:倒序)
- })
- this.start();
- wx.stopPullDownRefresh();
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
- var pageNo = this.data.pageNo + 1;
- this.setData({
- pageNo
- })
- this.fullList();
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function() {
- },
- doSalay: function(e) {
- var totalSalary;
- if (this.data.totalSalary == 1) {
- totalSalary = 2;
- } else {
- totalSalary = 1;
- }
- this.setData({
- selectId: 0,
- totalSalary: totalSalary,
- sort: '', //重置
- pageNo: 1, //当前分页
- isScroll: true, //是否可以滚动
- list: [],
- })
- console.log("totalSalary", this.data.totalSalary)
- this.start();
- },
- doDistince: function(e) {
- var sort;
- if (this.data.sort == 1) {
- sort = 2;
- } else {
- sort = 1;
- }
- this.setData({
- selectId: 1,
- sort: sort,
- totalSalary: '', //重置
- })
- console.log("sort", this.data.sort)
- }
- })
|