啊啊啊啊啊
<wxs module="filters" src="/wxs/order.wxs" />
<van-dialog id="van-dialog" />
<view class="page" enable-flex="{{true}}" scroll-y="{{true}}" style="padding-top:{{height}}px;">
<nav title="职位详情" />
<view style="{{pyq?pheight:''}}"></view>
<view
class="si"
wx:if="{{info.thumbUrl&&info.isVideo}}"
catchtap="toPage"
data-url="/pages/users/video/index?url={{info.thumbUrl}}"
>
<image class="play" src="/images/users/play.png" />
<video
style="width:100%;height:100%;"
object-fit="fill"
show-fullscreen-btn="{{false}}"
controls="{{false}}"
show-center-play-btn="{{false}}"
mode="widthFix"
src="{{info.thumbUrl}}"
/>
</view>
<view class="si" wx:if="{{info.thumbUrl&&!info.isVideo}}">
<van-image
fit="cover"
width="100vw"
height="211"
bindtap="previewImgList1"
src="{{info.thumbUrl}}"
use-loading-slot
>
<van-loading slot="loading" type="spinner" size="20" vertical />
</van-image>
</view>
<view class="content">
<view class="flexac static">
<view class="pName ellipsis2">{{info.postName}}</view>
<view class="salary" wx:if="{{info.salaryType===3}}">
{{filters.salaryFormat(info.salaryMin,true)}}-{{filters.salaryFormat(info.salaryMax)}}/月
</view>
<view class="salary" wx:if="{{info.salaryType==2}}">
{{filters.salaryFormat(info.salaryMin)}}/天
</view>
<view class="salary" wx:if="{{info.salaryType==1}}">
{{filters.salaryFormat(info.salaryMin)}}/小时
</view>
</view>
<view class="flexac requires">
<view class="require">
<image class="ri" src="/images/users/position/r2.png"></image>
<text>{{degreeList[info.educationType].label}}</text>
</view>
<view class="require">
<image class="ri" src="/images/users/position/r1.png"></image>
<text>{{workYearsList[info.experienceType].label}}</text>
</view>
</view>
<view wx:if="{{!isTj}}">
<view class="kefu flexac" wx:if="{{info.kefu}}">
<image
class="avatarUrl"
wx:if="{{info.kefu.sex===0}}"
src="{{info.kefu.avatarUrl||'/images/users/man.png'}}"
/>
<image
class="avatarUrl"
wx:else
src="{{info.kefu.avatarUrl||'/images/service/girl.png'}}"
/>
<view class="info">
<view class="name">{{info.kefu.name}}</view>
<view class="position">客服经理</view>
</view>
<view class="operation">
<image
class="op-i"
src="/images/users/position/call.png"
bindtap="call"
data-mobile="{{info.kefu.mobile}}"
/>
<!--wx:if="{{!isSm}}" <button class="op-i" open-type="contact" style="padding: 0;display: inline-block;">
<image class="op-i" src="/images/users/position/wechat.png" />
</button> -->
</view>
</view>
</view>
<view class="enviroment" wx:if="{{info.images.length}}" wx:key="index">
<view class="iTitle">工作环境</view>
<scroll-view scroll-x="{{true}}" class="eiList" enable-flex="{{true}}">
<block wx:for="{{info.images}}" wx:for-item="img" wx:key="index">
<van-image
class="ei"
width="134"
height="85"
fit="cover"
use-loading-slot
radius="{{4}}"
bindtap="previewImgList"
src="{{img.fileUrl}}"
data-url="{{img.fileUrl}}"
data-index="{{index}}"
>
<van-loading slot="loading" type="spinner" size="20" vertical />
</van-image>
</block>
</scroll-view>
</view>
<view class="pDes">
<view class="iTitle">职位描述</view>
<view class="tagList" style="margin-top:{{!info.tags.length?'-20rpx':''}}">
<view class="tag" wx:for="{{info.tags}}" wx:key="index">{{item.tagName}}</view>
</view>
<view class="des">{{info.workContent}}</view>
</view>
<view class="pDes" wx:if="{{info.companyInfo}}">
<view class="iTitle">公司介绍</view>
<view class="des">{{info.companyInfo}}</view>
</view>
<view class="pDes" bindtap="getLocationDetail">
<block>
<view class="iTitle">公司地址</view>
<view class="des flexac" wx:if="{{info.workAddress||info.latitude||info.longitude}}">
<image class="ri" src="/images/users/position/l1.png"></image>
<text>{{info.workAddress}}</text>
</view>
</block>
<view class="mapWraper" wx:if="{{info.latitude}}">
<map
id="mapId"
class="map"
enable-scroll="{{false}}"
bindtap="getLocationDetail"
latitude="{{info.latitude}}"
longitude="{{info.longitude}}"
markers="{{markers}}"
enable-zoom="{{false}}"
></map>
</view>
</view>
</view>
<view class="bottom" wx:if="{{!isTj}}">
<view class="model-text" wx-if="{{info.startShareGuide*1 == 1 && info.shareRemark != ''}}">
<view class="model-txt">
<view class="close" bind:tap="modelTextClose">
<van-icon name="cross" color="white" />
</view>
{{info.shareRemark}}
</view>
<view class="model-triangle">
<view class="triangle"></view>
</view>
</view>
<block wx:if="{{info.postName}}">
<view class="bWraper flexac" style="width:250rpx;margin-right:12rpx;">
<button
wx:if="{{!access_token}}"
class="user-phone-btn"
data-tou="haibao"
bindtap="bindgetphonenumber1"
>
<view class="bi">
<image class="fenxiang" src="/images/users/position/fenxiang.png"></image>
<view class="label">分享海报</view>
</view>
</button>
<view wx:else class="bi" bindtap="initPotser">
<image class="fenxiang" src="/images/users/position/fenxiang.png"></image>
<view class="label">分享海报</view>
</view>
<button
class="user-phone-btn"
bindtap="bindgetphonenumber1"
data-tou="shoucang"
wx:if="{{!access_token}}"
>
<view class="bi">
<image class="shoucang" src="/images/users/position/shoucang.png"></image>
<view class="label">收藏职位</view>
</view>
</button>
<view wx:else class="bi">
<image
class="shoucang"
src="/images/users/position/shoucang.png"
wx:if="{{!Collected}}"
bind:tap="collect"
></image>
<image
class="shoucang"
src="/images/users/position/shoucang2.png"
wx:else
bind:tap="cancelCollect"
></image>
<view class="label">{{Collected?'收藏职位':'收藏职位'}}</view>
</view>
</view>
<block wx:if="{{!info.isAgentPost}}">
<button
wx:if="{{!isAgent}}"
class="info-btn"
bindtap="getDaiLi"
style="margin-right:16rpx;background:#2bc948"
>
{{'成为代理'}}
</button>
</block>
<block wx:else>
<button class="info-btn" bindtap="getDaiLi" style="margin-right:16rpx;background:#2bc948">
{{isAgent?'推荐名单':'成为代理'}}
</button>
</block>
<button
wx:if="{{!access_token}}"
class="info-btn"
data-tou="toudi"
bindtap="bindgetphonenumber1"
>
{{'一键报名'}}
</button>
<button wx:else class="info-btn" disabled="{{posted}}" bindtap="deliver">
{{posted?'已投递':'一键报名'}}
</button>
</block>
</view>
<popup wx:if="{{popupVisible}}" bindclose="closePopup" />
<share visible="{{shareVisible}}" imgUrl="{{imgUrl}}" bindclose="close" style="z-index:10;" />
<painter
wx:if="{{posterStartInit}}"
style="position:fixed;top:-9999rpx"
bindimgOK="onImgOk"
bindimgErr="onImgErr"
widthPixels="750"
palette="{{template}}"
/>
<van-popup show="{{ popupShow }}" round>
<view class="popup-box">
<image
bindtap="popupClose"
wx:if="{{isPopupClose}}"
class="popup-close"
src="/images/users/close.png"
/>
<view class="popup-title">提示 </view>
<view class="popup-con">该功能需要登录后才能使用 </view>
<view class="btnAll">
<view bindtap="popupClose" class="info-btn-gray">
暂不登录
</view>
<button class="info-btn" bindtap="goLogin">
立即登录
</button>
<!-- <button
class="user-phone-btn"
open-type="getPhoneNumber"
bindgetphonenumber="bindgetphonenumber"
>
<button class="info-btn" style="min-width: 220rpx !important;width: 220rpx !important">
立即登录
</button>
</button> -->
</view>
</view>
</van-popup>
</view>
import {
getPostDetail,
checkIsCanDeliver,
deliver,
setLog,
getCollectionStatus,
cancelCollect,
addCollect,
getQrCode,
getAccessToken,
UserPostScanView,
getWxmaParam,
} from '../../../models/user'
import { salaryFormat, tagFormat } from './posterFormat'
import wxApi from '../../../utils/wxApi'
import pageBehavior from '../../../behaviors/pageBehavior'
import Poster from './poster'
import { wxma } from '../../../models/user'
import Notify from '@vant/weapp/notify/notify'
import { dengLu } from '../../../utils/index'
const App = getApp()
Page({
behaviors: [pageBehavior],
data: {
longitude: 112.93886,
latitude: 28.22778,
markers: [
{
latitude: 28.22778,
longitude: 112.93886,
callout: {
content: '',
color: '#333333',
bgColor: '#fff',
padding: 6,
borderRadius: 10,
borderColor: '#fff',
fontSize: 14,
borderWidth: 5,
textAlign: 'center',
display: 'ALWAYS',
},
workYearsList: App.global.workYearsList,
sexList: App.global.sexList,
degreeList: App.global.degreeList,
info: {},
Collected: false,
posted: false,
imgUrl: '', // 海报链接
shareVisible: false, // 分享弹窗可见度
},
],
popupVisible: false,
access_token: '',
code: '',
popupShow: false,
isPopupClose: false,
isAgent: true,
pyq: false,
pheight: '',
isSm: false,
},
modelTextClose() {
this.setData({
'info.startShareGuide': 0,
})
},
onShow() {},
async onLoad(options) {
let that = this
var sceneCj = wx.getEnterOptionsSync()
console.log('sceneCj.scene', sceneCj.scene)
let pheight =
'padding-top:' +
(wx.getMenuButtonBoundingClientRect().height +
wx.getMenuButtonBoundingClientRect().top) +
'px'
console.log(options)
this.setData({
workYearsList: App.global.workYearsList,
sexList: App.global.sexList,
degreeList: App.global.degreeList,
pheight,
isSm: options?.isSm == 'true',
isTj: options?.isTj == 'true',
})
this.data.postId = options.postId
if (sceneCj.scene * 1 == 1154) {
this.setData({
pyq: true,
})
this.getInfo()
return
}
wx.login().then((res) => {
this.setData({
code: res.code,
})
})
let access_token = wx.getStorageSync('access_token')
if (access_token != '') {
this.getQrCode()
}
this.setData({
access_token,
})
if (this.data.postId) {
this.checkIsCanDeliver()
}
// if (App.globalData.noLogin) {
// that.onLoadFun(options)
// } else {
// App.employIdCallback = async (emp) => {
// that.onLoadFun(options)
// }
// }
that.onLoadFun(options)
},
async onLoadFun(options) {
this.setData({
workYearsList: App.global.workYearsList,
sexList: App.global.sexList,
degreeList: App.global.degreeList,
})
if (options.agentStaffId) this.data.agentStaffId = options.agentStaffId
if (options.agentPostId) this.data.agentPostId = options.agentPostId
if (options.scene) {
this.handleQuery(options.scene)
} else {
this.setData({
isPopupClose: true,
})
this.data.postId = options.postId
this.getInfo()
this.setLog()
this.checkIsCanDeliver()
this.getCollectionStatus()
}
},
goLogin() {
var pages = getCurrentPages()
var currentPage = pages[pages.length - 1]
var params = currentPage.options
params = JSON.stringify(params)
var redirectUrl = currentPage.route
let url = `/pages/users/quickLogin/index?redirectUrl=/${redirectUrl}&¶ms=${params}`
console.log(url)
wx.redirectTo({
url,
})
},
getDaiLi() {
let url = `/pages/common/addAgent/index?corpId=${this.data.info.corpId}`
if (this.data.isAgent) {
let userInfo = wx.getStorageSync('userInfo') || '{}'
userInfo = JSON.parse(userInfo)
url = `/pages/recruit/recommendMember/index?agentPostId=${userInfo.userId}&&postId=${this.data.postId}`
}
wx.navigateTo({
url,
})
},
popupClose() {
// wx.navigateBack({
// delta: 1,
// })
this.setData({
popupShow: false,
})
},
async bindgetphonenumber1() {
let access_token = wx.getStorageSync('access_token')
console.log(access_token)
if (access_token == '') {
this.setData({
popupShow: true,
})
} else {
this.setData({ access_token })
}
},
async bindgetphonenumber(res) {
if (res.detail.encryptedData) {
this.data.registerInfo = res.detail
//, userType: 2
let params = { loginType: 1 }
Object.assign(params, this.data.registerInfo)
params.code = this.data.code
params.appid = getApp().globalData.appid
await dengLu(3, params)
let access_token = wxApi.getStorageSync('access_token')
this.setData({
access_token,
})
let staffInfo = wxApi.getStorageSync('staffInfo')
staffInfo = JSON.parse(staffInfo)
let corp = staffInfo.corpList.find(
(o) => o.corpId == staffInfo.defaultCorpId
)
//let corp_id = wxApi.getStorageSync('corp_id')
let corp_id = this.data.info.corpId
if (corp_id) {
corp = staffInfo.corpList.find((o) => o.corpId * 1 == corp_id * 1) || []
}
let isAgent = corp?.roleList?.find((o) => o.roleKey == 'agent')
this.setData({
isAgent: isAgent ? true : false,
})
await this.getQrCode()
await this.UserPostScanView()
if (res.currentTarget.dataset.tou == 'toudi') {
this.deliver()
} else if (res.currentTarget.dataset.tou == 'shoucang') {
this.collect()
this.setData({
Collected: true,
})
} else if (res.currentTarget.dataset.tou == 'haibao') {
wxApi.showLoading({
title: '海报生成中请稍等',
})
setTimeout(() => {
this.initPotser()
}, 1000)
}
this.setData({
popupShow: false,
})
// let params=''
// for(let key in this.data.redirectParams) {
// params+=`${key}=${this.data.redirectParams[key]}&&`
// }
// let url=this.data.redirectUrl? this.data.redirectUrl:'/pages/bridge/home/index'
// url+=`?${params}`
// wx.switchTab({
// url,fail: () => {
// wx.redirectTo({
// url
// })
// }
// })
}
},
handleQuery(scene) {
scene = App.tools.getDecodeURIComponent(scene)
const params = scene.split('&')
let query = params[0] ? params[0] : ''
query = query.replace(/.*=/, '').split('/')
this.data.postId = query[0]
query[1] ? (this.data.agentStaffId = query[1]) : ''
query[2] ? (this.data.agentPostId = query[2]) : ''
console.log(query)
// const roles = wxApi.getStorageSync('roles') || []
// if (roles.indexOf('agent') > -1 || roles.indexOf('kefu') > -1) {
// // 从公司端扫码直接清空数据
// wx.removeStorageSync('access_token')
// wx.removeStorageSync('roles')
// wx.removeStorageSync('projects')
// wx.removeStorageSync('rule_isAgent')
// }
this.getWxmaParam()
},
UserPostScanView() {
if (!wx.getStorageSync('inviteUid')) return
UserPostScanView({
postId: this.data.postId,
inviteUid: wx.getStorageSync('inviteUid'),
}).then((res) => {})
},
async getWxmaParam() {
const res = await getWxmaParam(this.data.postId)
if (res.code === 200) {
let params = res.data.params.split('&')
console.log(res.data)
let inviteUid = params[1].split('=')[1]
this.data.postId = params[0].split('=')[1]
wxApi.setStorageSync('inviteUid', inviteUid)
this.getInfo()
this.setLog()
this.checkIsCanDeliver()
this.getCollectionStatus()
if (wx.getStorageSync('access_token')) {
this.UserPostScanView()
}
}
},
async getInfo() {
getPostDetail(this.data.postId).then((res) => {
const extension = res.data.thumbUrl
? res.data.thumbUrl.substring(res.data.thumbUrl.lastIndexOf('.') + 1)
: ''
const videoTypes = ['wmv', 'asf', 'asx', 'mp4', 'rm', 'rmvb']
res.data.isVideo = videoTypes.find((name) => extension.indexOf(name) > -1)
this.setData({
[`markers[0].latitude`]: res.data.latitude,
[`markers[0].longitude`]: res.data.longitude,
[`markers[0].callout.content`]: res.data.addressTips,
info: res.data,
})
console.log('页面详情', res.data)
let userInfo = wx.getStorageSync('userInfo') || '{}'
userInfo = JSON.parse(userInfo)
if (userInfo?.corpList && userInfo?.corpList?.length > 0) {
let corp = userInfo.corpList.find(
(o) => o.corpId == userInfo.defaultCorpId
)
//let corp_id = wxApi.getStorageSync('corp_id')
let corp_id = res.data.corpId
if (corp_id) {
corp =
userInfo.corpList.find((o) => o.corpId * 1 == corp_id * 1) || []
}
let isAgent = corp?.roleList?.find((o) => o.roleKey == 'agent')
this.setData({
isAgent: isAgent ? true : false,
corp,
})
}
})
},
setLog() {
// 记录用户操作数据
setLog({
action: 'look_post',
postId: this.data.postId,
})
},
openCustomer() {
wx.openCustomerServiceChat()
},
checkIsCanDeliver() {
checkIsCanDeliver(this.data.postId).then((res) => {
this.setData({
posted: !res.data,
})
})
},
getCollectionStatus() {
getCollectionStatus(this.data.postId).then((res) => {
this.setData({
Collected: !!res.data,
})
})
},
collect() {
// 收藏职位
addCollect(this.data.postId).then((res) => {
this.setData({
Collected: true,
})
})
},
cancelCollect() {
// 取消收藏
cancelCollect(this.data.postId).then((res) => {
this.setData({
Collected: false,
})
})
},
deliver() {
const params = {
postId: this.data.postId,
}
this.data.agentStaffId
? (params.createStaffId = this.data.agentStaffId)
: ''
this.data.agentPostId ? (params.agentPostId = this.data.agentPostId) : ''
let inviteUid = wx.getStorageSync('inviteUid')
if (inviteUid) {
params.inviteUid = inviteUid
}
deliver(params, { hideLoading: true, hideWarn: true })
.then((res) => {
this.setData({
popupVisible: true,
})
this.checkIsCanDeliver()
})
.catch((res) => {
if (res == '请先完善个人简历再投递该职位') {
wx.showToast({
title: res,
icon: 'none',
duration: 2000,
})
setTimeout(() => {
wx.navigateTo({
url:
'/pages/users/resume/index?postId=' +
this.data.postId +
'&isSm=' +
this.data.isSm,
})
}, 1000)
} else if (res == '该职位已投递过,7日之内不能重复投递') {
wx.showToast({
title: res,
icon: 'none',
duration: 2000,
})
this.setData({
posted: !res.data,
})
} else {
wx.showToast({
title: res,
icon: 'none',
duration: 2000,
})
}
})
},
initPotser() {
wxApi.showLoading({
title: '海报生成中请稍等',
})
let posterInfo = this.posterInfoFormat(this.data.info)
let posterFactory = new Poster()
let template = posterFactory.palette(posterInfo)
this.setData({
template,
posterStartInit: true,
})
},
posterInfoFormat(info) {
// 海报数据格式化函数
if (info.salaryType === 3) {
info.salary = `${salaryFormat(info.salaryMin, true)}-${salaryFormat(
info.salaryMax,
true
)}/月`
} else if (info.salaryType === 2) {
info.salary = `${salaryFormat(info.salaryMin, true)}/天`
} else if (info.salaryType === 1) {
info.salary = `${salaryFormat(info.salaryMin, true)}/小时`
}
let tagList1 = [],
tagList2 = []
// tagList1 = tagFormat(JSON.parse(JSON.stringify(info.tags)))
// tagList2 = tagFormat(JSON.parse(JSON.stringify(info.tags)).splice(tagList1.length), 2)
info.tagList = tagList1.concat(tagList2)
info.requres = `${this.data.degreeList[info.educationType].label} · ${
this.data.workYearsList[info.experienceType].label
}`
info.qrcode = this.data.qrcode
return info
},
onImgOk(e) {
this.setData({
imgUrl: e.detail.path,
shareVisible: true,
})
wx.hideLoading()
},
onImgErr(e) {
console.log('e', e)
},
close() {
// 关闭弹出框
this.setData({
shareVisible: false,
})
},
getQrCode() {
// 获取二维码
let userInfo = wx.getStorageSync('userInfo')
let userId = ''
if (userInfo) {
userId = JSON.parse(userInfo).userId
}
console.log(2222222222222, this.data)
let data = {
page: `pages/users/detail/index`,
argsMap: {
postId: this.data.postId,
inviteUid: userId,
},
appid: getApp().globalData.appid,
}
getQrCode(data).then((res) => {
this.data.qrcode = res.data.url
})
},
call(e) {
let that = this
if (this.data.posted) {
wx.makePhoneCall({
phoneNumber: e.target.dataset.mobile,
})
} else {
if (this.data.isSm) {
wx.showModal({
title: '提示',
content: '报名后可以联系客服了解职位更多信息',
confirmText: '立即报名',
success(res) {
if (res.confirm) {
that.deliver()
}
},
})
} else {
wx.makePhoneCall({
phoneNumber: e.target.dataset.mobile,
})
}
}
},
closePopup() {
this.setData({
popupVisible: false,
})
},
getLocationDetail() {
if (!this.data.info.latitude) {
return
}
wx.chooseLocation({
latitude: this.data.info.latitude,
longitude: this.data.info.longitude,
fail: (err) => {
console.log('err', err)
},
})
},
previewImgList(e) {
wx.previewImage({
urls: this.data.info.images.map((img) => img.fileUrl),
current: e.currentTarget.dataset.index,
})
},
previewImgList1() {
wx.previewImage({
urls: [this.data.info.thumbUrl],
})
},
onShareAppMessage: function () {
// 获取二维码
return {
title:
this.posterInfoFormat(this.data.info).salary + this.data.info.postName,
imageUrl: this.data.info.thumbUrl,
path: `pages/users/detail/index?postId=${this.data.postId}`,
}
},
onShareTimeline: function () {
return {
title:
this.posterInfoFormat(this.data.info).salary + this.data.info.postName,
imageUrl: this.data.info.thumbUrl,
path: `pages/users/detail/index?postId=${this.data.postId}`,
}
},
})
浙公网安备 33010602011771号