| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- import {
- getPositionDetail,
- positionApply,
- groupApply,
- groupList
- } from '../../services/index.js'
- import {
- imgServerUrl
- } from '../../config/config.js'
- import {
- showToast
- } from '../../utils/tips.js'
- const WxParse = require('../../plugins/wxParse/wxParse.js');
- // var $ = require('../../libs/gdconf.js');
- const app = getApp();
- Page({
- data: {
- imgServerUrl: imgServerUrl,
- hpPositionId: 0,
- positionCategory: 0, //0:全职 1:兼职 2:入职奖励 3:高薪急聘 4:拼团岗位 5:福利岗位
- isShowList: false,
- clearTimer: false,
- comScale: '',
- comType: '',
- myFormat: ['天', ':', ':', ' '],
- authMask: false,
- detailArray: [],
- canIUse: wx.canIUse('button.open-type.getUserInfo'),
- },
- onLoad: function(options) {
- console.log(options)
- this.setData({
- hpPositionId: options.hpPositionId,
- positionCategory: options.cate || 0,
- })
- },
- onShow: function() {
- if (app.globalData.userInfo) {
- console.log('有info===', app.globalData)
- this.fetchData()
- } else if (this.data.canIUse) {
- // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
- // 所以此处加入 callback 以防止这种情况
- app.userInfoReadyCallback = res => {
- console.log('userInfoReadyCallback===', app.globalData)
- this.fetchData()
- }
- } else {
- // 在没有 open-type=getUserInfo 版本的兼容处理
- wx.getUserInfo({
- success: res => {
- app.globalData.userInfo = res.userInfo
- console.log('兼容处理===', app.globalData)
- this.fetchData()
- }
- })
- }
- },
- onShareAppMessage: function() {
- var shareToken = wx.getStorageSync('shareToken')
- return {
- title: '开心工作入职有奖',
- path: `/pages/detail/index?shareToken=${shareToken}&positionCategory=${this.data.positionCategory}&hpPositionId=${this.data.hpPositionId}`,
- imageUrl: ''
- }
- },
- //获取岗位详情
- fetchData() {
- let paramsObj = {
- position_category: this.data.positionCategory,
- id: this.data.hpPositionId,
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken
- }
- Object.assign(paramsObj);
- getPositionDetail(paramsObj).then(data => {
- console.log(data)
- let postitionDetail = {};
- switch (this.data.positionCategory) {
- case "0":
- postitionDetail = data.data.hpFulltimePosition
- break;
- case "1":
- postitionDetail = data.data.hpParttimePosition
- break;
- case "2":
- postitionDetail = data.data.hpRewardPosition
- break;
- case "3":
- postitionDetail = data.data.hpGoodmoneyPosition
- break;
- case "4":
- postitionDetail = data.data.hpGroupPosition
- break;
- case "5":
- postitionDetail = data.data.hpWelfarePosition
- break;
- }
- // let isOpen;
- // if (this.data.positionCategory != 4) {
- // isOpen = Date.parse(new Date()) < Date.parse(postitionDetail.endTime);
- // } else {
- // isOpen = Date.parse(new Date()) < postitionDetail.groupEndTime;
- // }
- this.setData({
- postitionDetail: postitionDetail,
- // isOpen: isOpen,
- isApply: data.data.isApply
- })
- //富文本转义
- var detailArray = [];
- if (postitionDetail.hpWelfarePositionDetailList != null && postitionDetail.hpWelfarePositionDetailList.length > 0) {
- for (var i = 0; i < postitionDetail.hpWelfarePositionDetailList.length; i++) {
- var ss = WxParse.wxParse('positionDetail', 'html', postitionDetail.hpWelfarePositionDetailList[i].positionDetail, this);
- detailArray.push(ss);
- }
- this.setData({
- detailArray: detailArray
- })
- }
- //富文本转义
- if (postitionDetail.applyCondition) {
- WxParse.wxParse('applyCondition', 'html', postitionDetail.applyCondition, this);
- }
- })
- },
- //获取拼团列表
- fetchPtList() {
- // if (!this.data.isOpen) {
- // showToast('拼团已结束')
- // return false
- // }
- groupList(this.data.hpPositionId).then(data => {
- console.log(data)
- this.setData({
- isShowList: true,
- ptList: data.list.map(item => {
- item.leftTime = new Date().getTime() + item.leftTime * 1000
- item.leaderName = decodeURIComponent(item.leaderName)
- return item
- })
- })
- })
- },
- //申请工作
- applyJob(e) {
- var self = this;
- wx.showModal({
- title: '提示',
- content: '确定提交申请吗?',
- success: function(res) {
- if (res.confirm) {
- let {
- formId
- } = e.detail;
- let paramsObj = {
- positionCategory: self.data.positionCategory,
- positionId: self.data.hpPositionId,
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken
- }
- Object.assign(paramsObj);
- wx.setStorageSync('resumeUrl', '/pages/user-info/user-info?hpPositionId=' + self.data.hpPositionId + "&positionCategory=" + self.data.positionCategory)
- positionApply(paramsObj).then(data => {
- showToast('申请职位成功', 'success')
- wx.navigateBack();
- })
- } else if (res.cancel) {
- }
- }
- })
- },
- //申请开团
- applyPt(e) {
- wx.showModal({
- title: '提示',
- content: '确定提交申请吗?',
- success: function(res) {
- if (res.confirm) {
- let {
- formId
- } = e.detail;
- let paramsObj = {
- positionCategory: this.data.positionCategory,
- positionId: this.data.hpPositionId,
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken
- }
- Object.assign(paramsObj);
- wx.setStorageSync('resumeUrl', '/pages/user-info/user-info?hpPositionId=' + this.data.hpPositionId + "&positionCategory=" + this.data.positionCategory)
- groupApply(paramsObj).then(data => {
- // var hpPositionGroupId = data.data.hpPositionGroupId
- console.log("ff22", data);
- wx.navigateTo({
- url: '../result/index?positionCategory=' + this.data.positionCategory + '&status=1&hpPositionGroupId=' + this.data.hpPositionId,
- })
- })
- } else if (res.cancel) {
- }
- }
- })
- },
- //参与拼团
- joinTuan(e) {
- let {
- formId
- } = e.detail
- let {
- groupid
- } = e.currentTarget.dataset;
- let paramsObj = {
- positionCategory: this.data.positionCategory,
- positionId: this.data.hpPositionId,
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken,
- groupId: e.currentTarget.dataset.groupid
- }
- Object.assign(paramsObj);
- wx.setStorageSync('resumeUrl', '/pages/user-info/user-info?hpPositionGroupId=' + groupid + "&formId=" + formId)
- groupApply(paramsObj).then(data => {
- wx.navigateTo({
- url: '../pt-detail/index?hpPositionGroupId=' + groupid,
- })
- })
- },
- //查看拼团
- catPt() {
- wx.navigateTo({
- url: '../pt-detail/index?hpPositionGroupId=' + this.data.hpPositionGroupId,
- })
- },
- //隐藏拼团列表模态框
- hideModal() {
- this.setData({
- isShowList: false
- })
- },
- //拨打手机号
- phoneCall() {
- if (this.data.postitionDetail.contactPhone) {
- wx.makePhoneCall({
- phoneNumber: this.data.postitionDetail.contactPhone,
- success: function(data) {
- console.log(data)
- },
- fail: function(data) {
- console.log(data)
- }
- })
- } else {
- showToast('暂无手机号')
- }
- },
- //查看线路
- toRoadsLine() {
- wx.navigateTo({
- url: '../roadsLine/index',
- })
- },
- //倒计时回调
- myLinsterner() {
- this.fetchPtList()
- },
- // 获取公司规模描述
- getComScale(lower, high) {
- if (!lower || lower == 0) {
- return high + '人以下'
- }
- if (!high || high == 0) {
- return lower + '人以上'
- }
- return lower + '-' + high + '人'
- },
- //获取位置
- getNodePos() {
- var query = wx.createSelectorQuery()
- query.select('#base').boundingClientRect()
- query.select('#require').boundingClientRect()
- query.select('#otherWelfare').boundingClientRect()
- query.select('#jieshao').boundingClientRect()
- var that = this;
- query.exec(function(res) {
- console.log(res)
- that.setData({
- basePos: res[0].top - 40,
- requirePos: res[1].top - 40,
- otherWelfarePos: res[2].top - 40,
- jieshaoPos: res[3].top - 40
- })
- })
- },
- //距离页面滚动
- scrollTop(e) {
- let top = e.currentTarget.dataset.top
- wx.pageScrollTo({
- scrollTop: top,
- duration: 0
- })
- },
- // tomap() {
- // var that = this
- // wx.showLoading({ title: 'loading', mask: true });
- // //获得当前位置坐标
- // $.map.getRegeo({
- // success(data) {
- // wx.hideLoading();
- // var data = data[0], cityd = data.regeocodeData.addressComponent.province;
- // let POIlongitude = that.data.comLocation.split(",")[0]
- // let POIlatitude = that.data.comLocation.split(",")[1]
- // let obj = {
- // POIlocation: that.data.comLocation,
- // POIlongitude: POIlongitude,
- // POIlatitude: POIlatitude,
- // address: '',
- // city: that.data.cityName,
- // cityd: cityd,
- // fromhistory: "0",
- // latitude: data.latitude,
- // longitude: data.longitude,
- // name: that.data.addrDetail,
- // saddress: data.name,
- // sname: "我的位置",
- // }
- // let params = ''
- // for (let key in obj) {
- // params += key + "=" + obj[key] + "&"
- // }
- // wx.navigateTo({
- // url: '../gdmap/index?' + params,
- // })
- // },
- // fail(data){
- // wx.hideLoading();
- // that.setData({
- // authMask:true
- // })
- // }
- // });
- // },
- hideAuth() {
- this.setData({
- authMask: false
- })
- },
- submitInfo(e) {
- console.log('form发生了submit事件,事件数据为:', e)
- },
- toPt() {
- wx.navigateTo({
- url: '../document/pt'
- })
- },
- toFanxian() {
- wx.navigateTo({
- url: '../document/fanxian'
- })
- },
- imageLoad() {
- var that = this
- var query = wx.createSelectorQuery()
- query.select('.wel_top').boundingClientRect()
- query.exec(function(res) {
- console.log(res)
- that.setData({
- swiperH: res[0].height
- })
- })
- },
- onError(err) {
- app.aldstat.sendEvent('报错', {
- 'err': err
- });
- },
- })
|