| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- import {
- getBanner,
- getIndexList
- } from '../../services/index.js'
- import {
- imgServerUrl
- } from '../../config/config.js'
- Page({
- data: {
- //banner图
- imgList: [],
- activity: [{
- src: imgServerUrl + "/images/happyjob/quanzhi.png",
- text: "全职工作"
- },
- {
- src: imgServerUrl + "/images/happyjob/jianzhi.png",
- text: "兼职工作"
- },
- {
- src: imgServerUrl + "/images/happyjob/fanxian.png",
- text: "入职奖励"
- },
- {
- src: imgServerUrl + "/images/happyjob/jipin.png",
- text: "高薪急聘"
- }
- ],
- activity_two: [{
- src: imgServerUrl + "/images/happyjob/fuli.png"
- },
- {
- src: imgServerUrl + "/images/happyjob/quanmin.png"
- }
- ],
- cityCode: '',
- keyWord: '',
- pageNo: 1, //当前分页
- isScroll: true, //是否可以滚动
- filter: -1, //岗位类型
- userInfo: {},
- hasUserInfo: false,
- canIUse: wx.canIUse('button.open-type.getUserInfo'),
- list: [],
- showNoMore: "没有更多信息...", //显示已无更多
- broadcastList: [],
- imgServerUrl: imgServerUrl,
- hasLocation1: true,
- disclaimer: false, //是否展示防欺诈弹窗 默认不弹出
- },
- onLoad: function () {
- // 如果传进来的值是 '1' 则展示防欺诈弹窗
- if (!wx.getStorageSync('disclaimer')) {
- wx.hideTabBar({
- success: () => {
- this.setData({
- disclaimer: true
- })
- }
- })
- }
- },
- reload() {
- this.onPullDownRefresh();
- },
- start() {
- this.fetchBanner();
- this.fetchList();
- },
- onShow: function () {
- this.setData({
- cityName: wx.getStorageSync('city') || '无锡',
- cityCode: wx.getStorageSync('cityCode') || '320200',
- pageNo: 1, //当前分页
- isScroll: true, //是否可以滚动
- filter: -1, //岗位类型
- list: [],
- }, _ => {
- this.start();
- })
- },
- //下拉刷新
- onPullDownRefresh: function () {
- this.setData({
- pageNo: 1, //当前分页
- isScroll: true, //是否可以滚动
- filter: -1, //岗位类型
- list: [],
- }, _ => {
- this.start();
- })
- },
- //上拉加载
- onReachBottom: function () {
- var pageNo = this.data.pageNo + 1;
- this.setData({
- pageNo
- })
- this.fetchList();
- },
- onShareAppMessage: function () {
- },
- // 获取banner图
- fetchBanner() {
- let paramsObj = {
- application: 0
- }
- Object.assign(paramsObj);
- getBanner(paramsObj).then(data => {
- this.setData({
- imgList: data.data.bannerList,
- broadcastList: data.data.broadcastList
- })
- })
- },
- //获取热门列表数据
- fetchList() {
- if (!this.data.isScroll) {
- return false
- }
- let paramsObj = {
- cityCode: this.data.cityCode,
- pageNo: this.data.pageNo
- }
- getIndexList(Object.assign(paramsObj)).then(data => {
- var pageNo = data.data.pageNo;
- let setData = {};
- // 是否可以滚动加载数据
- if (data.data.isLast) {
- setData.isScroll = false
- }
- if (data.data.hotPosition.length != 0) {
- setData.list = this.data.list.concat(data.data.hotPosition)
- setData.pageNo = pageNo;
- } else {
- setData.list = this.data.list;
- }
- this.setData({
- offline: false,
- ...setData
- })
- }).catch(() => {
- this.setData({
- offline: true
- })
- })
- },
- //改变列表
- changeList(e) {
- const {
- index
- } = e.currentTarget.dataset
- this.workType(index)
- if (index === 1) {
- wx.aldPushSubscribeMessage({
- eventId: '5ea271177739104342928e99'
- });
- }
- },
- //判断当前工作类型
- workType(index) {
- switch (index) {
- case 0:
- wx.navigateTo({
- url: '../fulltime/index',
- })
- break;
- case 1:
- wx.navigateTo({
- url: '../parttime/index',
- })
- break;
- case 2:
- wx.navigateTo({
- url: '../reward/index',
- })
- break;
- case 3:
- wx.navigateTo({
- url: '../jipin/index',
- })
- break;
- }
- },
- changeList2(e) {
- const {
- index
- } = e.currentTarget.dataset
- this.workType2(index)
- },
- workType2(index) {
- switch (index) {
- case 0:
- wx.navigateTo({
- url: '../fuli/index',
- })
- break;
- case 1:
- wx.navigateTo({
- url: '../agent/index',
- })
- break;
- }
- },
- //去详情页
- toDetail(e) {
- const {
- id,
- cate
- } = e.detail;
- wx.navigateTo({
- url: '../detail/index?hpPositionId=' + id + "&cate=" + cate
- })
- },
- //轮播图跳转详情页
- toDetail_slide(e) {
- var id = e.currentTarget.dataset.id;
- var url = e.currentTarget.dataset.url;
- var arr;
- if (id) {
- arr = id.split(",");
- var positionId = arr[1];
- var cate = arr[0];
- wx.navigateTo({
- url: '../detail/index?hpPositionId=' + positionId + "&cate=" + cate,
- })
- } else if (url) {
- wx.navigateTo({
- url: '../web-view/web-view?url=' + url,
- })
- }
- },
- // 去搜索页
- toSearch() {
- wx.navigateTo({
- url: '../search/index',
- })
- },
- // 去城市选择页
- toCity() {
- wx.navigateTo({
- url: '../city/index',
- })
- },
- // 知晓规则
- knowDisclaimer() {
- this.setData({
- disclaimer: false
- })
- wx.showTabBar({
- success: _ => {
- wx.setStorageSync('disclaimer', true)
- }
- })
- }
- })
|