| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- // pages/jipin/index.js
- import {
- getGoodMoneyList
- } from '../../services/index.js'
- import {
- imgServerUrl,
- imgServerUrl_new
- } from '../../config/config.js'
- var $ = require('../../libs/gdconf.js');
- var app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- list: [],
- pageNo: 1, //当前分页
- isScroll: true, //是否可以滚动
- showNoMore: "没有更多信息...", //显示已无更多
- cityCode: '320200',
- cityName: '无锡',
- selectId: -1, //选中筛选的条件
- totalSalary: '', //薪资待遇排序(1:正序;2:倒序)
- sort: '', //距离排序(1:正序;2:倒序)
- longitude: '', //经度
- latitude: '', //纬度
- imgServerUrl: imgServerUrl,
- canIUse: wx.canIUse('button.open-type.getUserInfo'),
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
- this.start();
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function() {
- },
- start() {
- let cityName = wx.getStorageSync('city') || '无锡';
- let cityCode = wx.getStorageSync('cityCode') || '320200';
- console.log(cityName)
- this.setData({
- cityName: cityName,
- cityCode: cityCode
- })
- this.goodMoneyList();
- },
- //获取高薪急聘奖励列表数据
- goodMoneyList(params) {
- if (!this.data.isScroll) {
- return false
- }
- let paramsObj = {
- longitude: this.data.longitude,
- latitude: this.data.latitude,
- sort: this.data.sort,
- totalSalary: this.data.totalSalary,
- cityCode: this.data.cityCode,
- pageNo: this.data.pageNo,
- }
- Object.assign(paramsObj);
- getGoodMoneyList(paramsObj).then(data => {
- var pageNo = data.data.pageNo;
- let setData = {}
- // 是否可以滚动加载数据
- if (data.data.isLast) {
- setData.isScroll = false
- }
- if (data.data.goodmoneyPosition.length != 0) {
- setData.list = this.data.list.concat(data.data.goodmoneyPosition)
- setData.pageNo = pageNo;
- } else {
- setData.list = this.data.list;
- }
- this.setData({
- ...setData
- })
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
- },
- //获取当前定位
- cxgps: function(e) {
- var that = this;
- wx.showLoading({
- title: 'loading',
- mask: true
- });
- var distance = wx.getStorageSync('distance');
- if (distance) {
- console.log("fg22", distance)
- wx.hideLoading();
- that.setData({
- longitude: distance.longitude,
- latitude: distance.latitude
- })
- that.start();
- } else {
- wx.getSetting({
- success: function(res) {
- if (!res.authSetting['scope.userInfo'] || !res.authSetting['scope.userLocation']) {
- wx.hideLoading();
- wx.showModal({
- title: '授权提示',
- content: '当前服务需要获取您的位置信息,请确认授权',
- confirmText: '去授权',
- cancelText: '暂不授权',
- success: function(res) {
- if (res.confirm) {
- wx.openSetting();
- } else if (res.cancel) {
- }
- }
- })
- } else {
- $.map.getRegeo({
- success(data) {
- console.log("fg", data)
- wx.hideLoading();
- var data = data[0];
- that.setData({
- longitude: data.longitude,
- latitude: data.latitude
- })
- wx.setStorageSync('distance', data);
- that.start();
- }
- })
- }
- }
- })
- }
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- this.setData({
- pageNo: 1, //当前分页
- isScroll: true, //是否可以滚动
- list: [],
- selectId: -1, //选中筛选的条件
- totalSalary: '', //薪资待遇排序(1:正序;2:倒序)
- sort: '', //距离排序(1:正序;2:倒序)
- longitude: "",
- latitude: ""
- })
- this.start();
- wx.stopPullDownRefresh();
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
- var pageNo = this.data.pageNo + 1;
- this.setData({
- pageNo
- })
- this.goodMoneyList();
- },
- /**
- * 用户点击右上角分享
- */
- 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: [],
- longitude: "",
- latitude: ""
- })
- 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: '', //重置
- pageNo: 1, //当前分页
- isScroll: true, //是否可以滚动
- list: [],
- })
- console.log("sort", this.data.sort)
- this.cxgps();
- },
- //去详情页
- toDetail(e) {
- const {
- id,
- cate
- } = e.currentTarget.dataset
- wx.navigateTo({
- url: '../detail/index?hpPositionId=' + id + "&cate=" + cate,
- })
- },
- })
|