index.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792
  1. import {
  2. getPositionDetail,
  3. positionApply,
  4. groupApply,
  5. groupList,
  6. saveFavoritePosition,
  7. saveTask
  8. } from '../../services/index.js'
  9. import {
  10. imgServerUrl,
  11. imgServerUrl_new
  12. } from '../../config/config.js'
  13. import {
  14. showToast
  15. } from '../../utils/tips.js'
  16. const WxParse = require('../../plugins/wxParse/wxParse.js');
  17. import Poster from '../../components/wxa-plugin-canvas/poster/poster';
  18. const app = getApp();
  19. Page({
  20. data: {
  21. hasShare: true,
  22. imgServerUrl: imgServerUrl,
  23. imgServerUrl_new: imgServerUrl_new,
  24. hpPositionId: 0,
  25. positionCategory: -1, //0:全职 1:兼职 2:入职奖励 3:高薪急聘 4:拼团岗位 5:福利岗位 8:自发布全职 9:自发布兼职
  26. isShowList: false,
  27. clearTimer: false,
  28. comScale: '',
  29. comType: '',
  30. myFormat: ['天', '时', '分', '秒'],
  31. authMask: false,
  32. detailArray: [],
  33. canIUse: wx.canIUse('button.open-type.getUserInfo'),
  34. detailIndex: 0, //详情指引
  35. isApply: false,
  36. storeAction: [],
  37. showJoinPt: false, //显示加入拼工
  38. showAllPt: false, //显示所有拼工
  39. allPtList: [],
  40. leftTime: 0,
  41. isEnd: 0, //岗位是否已结束0:未结束;1:结束
  42. myGroupId: '', //我的拼团id
  43. groupId: '', //拼团id
  44. inviteUser_id: '', //拼团邀请人
  45. isFarovite: false, //是否收藏
  46. maxReward: 0, //入职最高奖励
  47. minReward: 0, //入职最低奖励
  48. isLogin: false,
  49. showShare: false,
  50. shareImg: '',
  51. },
  52. onLoad: function (options) {
  53. if (options.scene) {
  54. const _data = this.getQuery(options.scene);
  55. this.setData({
  56. hpPositionId: _data.pd,
  57. positionCategory: _data.pc || 0,
  58. })
  59. return
  60. }
  61. if (options.query) {
  62. this.setData({
  63. hpPositionId: options.query.pd,
  64. positionCategory: options.query.pc || 0,
  65. })
  66. return
  67. }
  68. this.setData({
  69. hpPositionId: options.hpPositionId || options.pd,
  70. positionCategory: options.cate || options.pc || 0,
  71. })
  72. },
  73. onShow: function () {
  74. var userId = wx.getStorageSync("user_id");
  75. var userToken = wx.getStorageSync("user_token");
  76. var memberId = wx.getStorageSync("member_id");
  77. var isLogin = false;
  78. if (userId && memberId) {
  79. isLogin = true;
  80. app.globalData.userId = userId;
  81. app.globalData.userToken = userToken;
  82. app.globalData.memberId = memberId;
  83. }
  84. this.setData({
  85. isLogin: isLogin
  86. })
  87. this.fetchData();
  88. // this.fetchPtList();
  89. },
  90. onShareAppMessage: function () {
  91. // 调用分享接口 task_id 10代表转发
  92. saveTask({
  93. user_id: wx.getStorageSync('user_id'),
  94. user_token: wx.getStorageSync('user_token'),
  95. member_id: wx.getStorageSync('member_id'),
  96. task_id: 10
  97. })
  98. this.setData({
  99. showShare: false
  100. })
  101. return {
  102. title: this.data.postitionDetail.positionName,
  103. path: '/pages/detail/index?pc=' + this.data.positionCategory + '&pd=' + this.data.hpPositionId,
  104. imageUrl: this.data.imgServerUrl + '/images/happyjob/detail_share.jpg'
  105. }
  106. },
  107. getQuery(data) {
  108. const _data = decodeURIComponent(data);
  109. const json = _data.split('&').reduce((json, val, key) => {
  110. const arr = val.split('=');
  111. json[arr[0]] = arr[1];
  112. return json
  113. }, {})
  114. return json
  115. },
  116. toCompanyDesc() {
  117. wx.setStorage({
  118. key: 'CompanyDesc',
  119. data: this.data.postitionDetail.hpCompany.companyDescription,
  120. success: function (res) {
  121. wx.navigateTo({
  122. url: '/pages/company-desc/company-desc'
  123. })
  124. }
  125. })
  126. },
  127. toBusDetail() {
  128. wx.setStorage({
  129. key: 'BusDetail',
  130. data: this.data.postitionDetail.busDetail,
  131. success: function (res) {
  132. wx.navigateTo({
  133. url: '/pages/bus-detail/bus-detail'
  134. })
  135. }
  136. })
  137. },
  138. creatBlock() {
  139. let arr = [this.data.postitionDetail.accommodation, this.data.postitionDetail.socialSecurity, this.data.postitionDetail.workDinner, this.data.postitionDetail.regularBus, '']
  140. if (this.data.postitionDetail.specialWelfare) {
  141. arr = this.data.postitionDetail.specialWelfare.split(',').concat(arr)
  142. }
  143. arr.push(this.data.postitionDetail.settlementMethod);
  144. return arr.filter(val => !!val)
  145. },
  146. // getTime(start, end) {
  147. // if (!start || !end) {
  148. // return ''
  149. // }
  150. // let _start = start.replace(/-/g, '/');
  151. // let _end = end.replace(/-/g, '/');
  152. // let _start_time = new Date(_start);
  153. // let _end_time = new Date(_end);
  154. // var month = _start_time.getMonth() + 1;
  155. // var day = _start_time.getDate();
  156. // return [_start_time.getMonth() + 1, _start_time.getDate()].map(this.formatNumber).join('-') + ' 至 ' + [_end_time.getMonth() + 1, _end_time.getDate()].map(this.formatNumber).join('-');
  157. // },
  158. // formatNumber(n) {
  159. // n = n.toString()
  160. // return n[1] ? n : '0' + n
  161. // },
  162. onCreatePoster() {
  163. Poster.create();
  164. },
  165. onPosterSuccess(e) {
  166. var detail = e.detail;
  167. this.setData({
  168. shareImg: detail,
  169. showShare: true
  170. })
  171. wx.hideLoading()
  172. },
  173. onPosterFail(err) {
  174. wx.hideLoading()
  175. console.error(err);
  176. },
  177. share() {
  178. let blocks = [];
  179. let block = [];
  180. let y = 598;
  181. let _arr = this.creatBlock();
  182. let bg = this.data.positionCategory == 5 ? imgServerUrl + '/images/happyjob/share-fuli.jpeg' : imgServerUrl + '/images/happyjob/share_img_fulltime.jpeg';
  183. let posterConfig = {
  184. width: 908,
  185. height: 1502,
  186. debug: false,
  187. blocks,
  188. texts: [{
  189. x: 146,
  190. y,
  191. width: 600,
  192. text: this.data.postitionDetail.positionName,
  193. fontSize: 62,
  194. color: '#333333',
  195. zIndex: 2,
  196. },
  197. {
  198. x: 504,
  199. y: 1234,
  200. text: '一站式求职平台',
  201. fontSize: 34,
  202. // fontWight:'500',
  203. color: '#666666',
  204. zIndex: 2,
  205. }
  206. ],
  207. images: [{
  208. width: 908,
  209. height: 1502,
  210. x: 0,
  211. y: 0,
  212. url: bg,
  213. zIndex: 1,
  214. }, {
  215. width: 264,
  216. height: 264,
  217. x: 158,
  218. y: 1030,
  219. url: `${this.data.qrcodeUrl}`,
  220. zIndex: 3
  221. }],
  222. }
  223. if (this.data.postitionDetail.hpCompany) {
  224. y += 61;
  225. posterConfig.texts.push({
  226. x: 146,
  227. y,
  228. width: 600,
  229. text: this.data.postitionDetail.hpCompany ? this.data.postitionDetail.hpCompany.companyName : '',
  230. fontSize: 32,
  231. color: '#666666',
  232. zIndex: 2,
  233. })
  234. }
  235. if (this.data.postitionDetail.salary || this.data.postitionDetail.totalSalary || this.data.postitionDetail.basicSalary) {
  236. y += 80;
  237. posterConfig.texts.push({
  238. x: 146,
  239. y,
  240. text: this.data.postitionDetail.salary || this.data.postitionDetail.totalSalary || this.data.postitionDetail.basicSalary,
  241. fontSize: 62,
  242. // fontWight:'500',
  243. color: '#FE7235',
  244. zIndex: 2,
  245. })
  246. }
  247. if (_arr.length) {
  248. y += 35;
  249. _arr.forEach(val => {
  250. block.push({
  251. y,
  252. height: 76,
  253. paddingLeft: 30,
  254. borderWidth: 2,
  255. borderColor: '#0177FF',
  256. borderRadius: 10,
  257. marginLeft: 24,
  258. text: {
  259. text: val,
  260. fontSize: 38,
  261. color: '#0177FF',
  262. baseLine: 'middle'
  263. },
  264. zIndex: 2,
  265. })
  266. })
  267. blocks.push({
  268. x: 146,
  269. y,
  270. height: 76,
  271. width: 542,
  272. block,
  273. beyond: {
  274. y: 770,
  275. width: 56,
  276. height: 56,
  277. zIndex: 3,
  278. text: {
  279. text: '...',
  280. fontSize: 38,
  281. color: '#0177FF',
  282. baseLine: 'middle'
  283. },
  284. },
  285. zIndex: 2,
  286. })
  287. }
  288. if (this.data.postitionDetail.maleReward || this.data.postitionDetail.femaleReward || this.data.postitionDetail.platformAllowance || this.data.maxReward) {
  289. y += 112;
  290. let text = `入职最高奖励${this.data.postitionDetail.maleReward ? `男 ${this.data.postitionDetail.maleReward}` : ''} ${this.data.postitionDetail.femaleReward ? `女${this.data.postitionDetail.femaleReward}` : ''} ${this.data.postitionDetail.platformAllowance ? `+${this.data.postitionDetail.platformAllowance || ''}` : ''}`;
  291. blocks.push({
  292. x: 146,
  293. y,
  294. height: 42,
  295. // fontWight:'500',
  296. text: {
  297. text: `${text.trim() === '入职最高奖励' ? `${this.data.maxReward ? `拼团成功最高可得${this.data.maxReward}` : ''}` : `${text} ${this.data.maxReward ? `拼团成功最高可得${this.data.maxReward}` : ''}`} `,
  298. fontSize: 26,
  299. color: '#fff',
  300. baseLine: 'middle'
  301. },
  302. paddingLeft: 15,
  303. backgroundColor: '#FE7235',
  304. borderRadius: 10,
  305. zIndex: 2,
  306. })
  307. }
  308. this.setData({
  309. posterConfig
  310. }, _ => {
  311. this.onCreatePoster()
  312. })
  313. },
  314. cloaseShare() {
  315. this.setData({
  316. showShare: false
  317. })
  318. },
  319. saveShareImg() {
  320. wx.saveImageToPhotosAlbum({
  321. filePath: this.data.shareImg,
  322. success: (res) => {
  323. showToast('已保存到相册,快去分享吧!');
  324. this.setData({
  325. showShare: false
  326. })
  327. },
  328. fail(err) {
  329. showToast('请授权保存到相册')
  330. that.setData({
  331. hasAuth: false
  332. })
  333. }
  334. })
  335. },
  336. //获取岗位详情
  337. fetchData() {
  338. let paramsObj = {
  339. position_category: this.data.positionCategory,
  340. id: this.data.hpPositionId,
  341. member_id: app.globalData.memberId
  342. }
  343. Object.assign(paramsObj);
  344. getPositionDetail(paramsObj).then(data => {
  345. let postitionDetail = {};
  346. let groupLessList = {};
  347. var leftTime = 0;
  348. var myGroupId = '';
  349. switch (this.data.positionCategory) {
  350. case "0":
  351. postitionDetail = data.data.hpFulltimePosition
  352. break;
  353. case "1":
  354. postitionDetail = data.data.hpParttimePosition
  355. break;
  356. case "2":
  357. postitionDetail = data.data.hpRewardPosition
  358. break;
  359. case "3":
  360. postitionDetail = data.data.hpGoodmoneyPosition
  361. break;
  362. case "4":
  363. postitionDetail = data.data.hpGroupPosition;
  364. leftTime = data.data.hpGroupPosition.groupEndTime;
  365. groupLessList = data.data.groupLessList;
  366. myGroupId = data.data.myGroupId;
  367. var maxReward;
  368. var minReward;
  369. var femaleReward = data.data.hpGroupPosition.femaleReward;
  370. var maleReward = data.data.hpGroupPosition.maleReward;
  371. var fiveGroupCashback = data.data.hpGroupPosition.fiveGroupCashback;
  372. var threeGroupCashback = data.data.hpGroupPosition.threeGroupCashback;
  373. var hasReward = data.data.hpGroupPosition.hasReward;
  374. if (hasReward == 1) {
  375. if (maleReward >= femaleReward) {
  376. maxReward = fiveGroupCashback + maleReward;
  377. minReward = femaleReward;
  378. } else {
  379. maxReward = fiveGroupCashback + femaleReward;
  380. minReward = maleReward;
  381. }
  382. } else {
  383. maxReward = fiveGroupCashback;
  384. minReward = 0;
  385. }
  386. this.setData({
  387. maxReward: maxReward,
  388. minReward: minReward
  389. })
  390. break;
  391. case "5":
  392. postitionDetail = data.data.hpWelfarePosition
  393. break;
  394. case "8":
  395. postitionDetail = data.data.hpFulltimePosition
  396. break;
  397. case "9":
  398. postitionDetail = data.data.hpParttimePosition
  399. break;
  400. }
  401. if (data.data.isEnd == 1) {
  402. this.setData({
  403. isEnd: data.data.isEnd
  404. })
  405. } else {
  406. console.log("该岗位未结束")
  407. }
  408. this.setData({
  409. postitionDetail: postitionDetail,
  410. isApply: data.data.isApply,
  411. leftTime: leftTime,
  412. storeAction: groupLessList,
  413. myGroupId: myGroupId,
  414. isFarovite: data.data.isFarovite,
  415. qrcodeUrl: data.data.qrcodeUrl
  416. })
  417. //富文本转义
  418. var detailArray = [];
  419. if (postitionDetail.hpWelfarePositionDetailList != null && postitionDetail.hpWelfarePositionDetailList.length > 0) {
  420. for (var i = 0; i < postitionDetail.hpWelfarePositionDetailList.length; i++) {
  421. var ss = WxParse.wxParse('positionDetail', 'html', postitionDetail.hpWelfarePositionDetailList[i].positionDetail, this);
  422. detailArray.push(ss);
  423. }
  424. this.setData({
  425. detailArray: detailArray
  426. })
  427. }
  428. //富文本转义
  429. if (postitionDetail.applyCondition) {
  430. WxParse.wxParse('applyCondition', 'html', postitionDetail.applyCondition, this);
  431. }
  432. // this.getNodePos();
  433. })
  434. },
  435. //获取所有拼工列表
  436. fetchPtList() {
  437. if (this.data.isEnd == 1) {
  438. showToast('拼团已结束')
  439. return false
  440. }
  441. let paramsObj = {
  442. positionCategory: this.data.positionCategory,
  443. positionId: this.data.hpPositionId,
  444. }
  445. Object.assign(paramsObj);
  446. groupList(paramsObj).then(data => {
  447. this.setData({
  448. allPtList: data.data.groupList
  449. })
  450. })
  451. },
  452. //申请工作
  453. applyJob(e) {
  454. var self = this;
  455. if (!self.data.isLogin) {
  456. wx.navigateTo({
  457. url: '/pages/login/login',
  458. })
  459. return;
  460. }
  461. wx.showModal({
  462. title: '提示',
  463. content: '确定投递简历吗?',
  464. success: function (res) {
  465. if (res.confirm) {
  466. let {
  467. formId
  468. } = e.detail;
  469. let paramsObj = {
  470. positionCategory: self.data.positionCategory,
  471. positionId: self.data.hpPositionId,
  472. user_id: app.globalData.userId,
  473. user_token: app.globalData.userToken,
  474. member_id: app.globalData.memberId
  475. }
  476. Object.assign(paramsObj);
  477. positionApply(paramsObj).then(data => {
  478. showToast('申请职位成功', 'success')
  479. setTimeout(function () {
  480. wx.navigateBack();
  481. }, 2000)
  482. }).catch(data => {
  483. //没有简历
  484. if (data.errcode == 1015) {
  485. showToast(data.errmsg);
  486. wx.navigateTo({
  487. url: '/pages/user-info/user-info',
  488. })
  489. }
  490. })
  491. // 上报投递岗位订阅消息
  492. wx.aldPushSubscribeMessage({
  493. eventId: '5e57819c599957a85868aacc',
  494. });
  495. } else if (res.cancel) {
  496. }
  497. }
  498. })
  499. },
  500. //申请开团
  501. applyPt(e) {
  502. var self = this;
  503. if (!self.data.isLogin) {
  504. wx.navigateTo({
  505. url: '/pages/login/login',
  506. })
  507. return;
  508. }
  509. wx.showModal({
  510. title: '提示',
  511. content: '确定提交开团申请吗?',
  512. success: function (res) {
  513. if (res.confirm) {
  514. let {
  515. formId
  516. } = e.detail;
  517. let paramsObj = {
  518. // groupId: self.data.groupId,
  519. // inviteUser_id: self.data.inviteUser_id,
  520. positionCategory: self.data.positionCategory,
  521. positionId: self.data.hpPositionId,
  522. user_id: app.globalData.userId,
  523. user_token: app.globalData.userToken,
  524. member_id: app.globalData.memberId
  525. }
  526. Object.assign(paramsObj);
  527. groupApply(paramsObj).then(data => {
  528. var hpPositionGroupId = data.data.hpApplyPosition.groupId
  529. showToast("开团成功");
  530. wx.navigateTo({
  531. url: '../pt-detail/index?gd=' + hpPositionGroupId + '&pc=' + self.data.positionCategory + '&pd=' + self.data.hpPositionId,
  532. })
  533. }).catch(data => {
  534. //没有简历
  535. if (data.errcode == 1015) {
  536. showToast(data.errmsg);
  537. wx.navigateTo({
  538. url: '/pages/user-info/user-info',
  539. })
  540. }
  541. })
  542. } else if (res.cancel) {
  543. }
  544. }
  545. })
  546. },
  547. //我的拼团
  548. myApply() {
  549. var self = this;
  550. if (!self.data.isLogin) {
  551. wx.navigateTo({
  552. url: '/pages/login/login',
  553. })
  554. return;
  555. }
  556. wx.navigateTo({
  557. url: '../pt-detail/index?gd=' + self.data.myGroupId + '&pc=' + self.data.positionCategory + '&pd=' + self.data.hpPositionId,
  558. })
  559. },
  560. //拨打手机号
  561. phoneCall() {
  562. if (this.data.postitionDetail.contactPhone) {
  563. wx.makePhoneCall({
  564. phoneNumber: this.data.postitionDetail.contactPhone,
  565. success: function (data) {
  566. console.log(data)
  567. },
  568. fail: function (data) {
  569. console.log(data)
  570. }
  571. })
  572. } else {
  573. showToast('暂无手机号')
  574. }
  575. },
  576. //查看线路
  577. toRoadsLine() {
  578. wx.navigateTo({
  579. url: '../roadsLine/index',
  580. })
  581. },
  582. // 获取公司规模描述
  583. getComScale(lower, high) {
  584. if (!lower || lower == 0) {
  585. return high + '人以下'
  586. }
  587. if (!high || high == 0) {
  588. return lower + '人以上'
  589. }
  590. return lower + '-' + high + '人'
  591. },
  592. //获取位置
  593. getNodePos() {
  594. if (this.data.positionCategory != 5) {
  595. var query = wx.createSelectorQuery()
  596. query.select('#base').boundingClientRect()
  597. query.select('#require').boundingClientRect()
  598. query.select('#otherWelfare').boundingClientRect()
  599. query.select('#jieshao').boundingClientRect()
  600. var that = this;
  601. query.exec(function (res) {
  602. that.setData({
  603. basePos: res[0].top - 40,
  604. requirePos: res[1].top - 40,
  605. otherWelfarePos: res[2].top - 40,
  606. jieshaoPos: res[3].top - 40
  607. })
  608. })
  609. }
  610. },
  611. //距离页面滚动
  612. goDeatil: function (e) {
  613. var index = e.currentTarget.dataset.index;
  614. this.setData({
  615. detailIndex: index
  616. })
  617. let top = e.currentTarget.dataset.top
  618. wx.pageScrollTo({
  619. scrollTop: top,
  620. duration: 0
  621. })
  622. },
  623. // 加入拼工
  624. joinPt(e) {
  625. var index = e.currentTarget.dataset.index;
  626. this.setData({
  627. showAllPt: false,
  628. showJoinPt: true,
  629. joinPtList: this.data.storeAction[index]
  630. })
  631. },
  632. // 加入拼工(所有拼工)
  633. joinPt_1(e) {
  634. var index = e.currentTarget.dataset.index;
  635. this.setData({
  636. showAllPt: false,
  637. showJoinPt: true,
  638. joinPtList: this.data.storeAction[index]
  639. })
  640. },
  641. hideJoinPt() {
  642. this.setData({
  643. showJoinPt: false
  644. })
  645. },
  646. cancelPt() {
  647. this.setData({
  648. showJoinPt: false
  649. })
  650. },
  651. //加入拼工,进入拼工详情
  652. confirmPt(e) {
  653. var self = this;
  654. if (!self.data.isLogin) {
  655. self.setData({
  656. showJoinPt: false
  657. })
  658. wx.navigateTo({
  659. url: '/pages/login/login',
  660. })
  661. return;
  662. }
  663. var groupId = e.currentTarget.dataset.groupid;
  664. self.setData({
  665. showJoinPt: false
  666. })
  667. wx.navigateTo({
  668. url: '../pt-detail/index?gd=' + groupId + '&pc=' + self.data.positionCategory + '&pd=' + self.data.hpPositionId,
  669. })
  670. },
  671. // 所有拼工
  672. allPt(e) {
  673. if (this.data.storeAction.length > 0) {
  674. this.setData({
  675. showAllPt: true
  676. })
  677. } else {
  678. showToast("拼工都已经完成啦,您可以申请开团哦!")
  679. }
  680. },
  681. hideAllPt() {
  682. this.setData({
  683. showAllPt: false
  684. })
  685. },
  686. hideAuth() {
  687. this.setData({
  688. authMask: false
  689. })
  690. },
  691. submitInfo(e) {
  692. console.log('form发生了submit事件,事件数据为:', e)
  693. },
  694. toPt() {
  695. wx.navigateTo({
  696. url: '../document/pt'
  697. })
  698. },
  699. toFanxian() {
  700. wx.navigateTo({
  701. url: '../document/fanxian'
  702. })
  703. },
  704. imageLoad() {
  705. var that = this
  706. var query = wx.createSelectorQuery()
  707. query.select('.wel_top').boundingClientRect()
  708. query.exec(function (res) {
  709. that.setData({
  710. swiperH: res[0].height
  711. })
  712. })
  713. },
  714. onError(err) {
  715. app.aldstat.sendEvent('报错', {
  716. 'err': err
  717. });
  718. },
  719. //跳转工作地址列表
  720. toaddressdetail() {
  721. wx.setStorageSync("addressList", this.data.postitionDetail.hpPositionAddressList);
  722. wx.navigateTo({
  723. url: '../address/index',
  724. })
  725. },
  726. //收藏岗位
  727. favourate() {
  728. var self = this;
  729. if (!self.data.isLogin) {
  730. wx.navigateTo({
  731. url: '/pages/login/login',
  732. })
  733. return;
  734. }
  735. var isFavorite = self.data.isFarovite ? 0 : 1;
  736. let paramsObj = {
  737. positionCategory: self.data.positionCategory,
  738. positionId: self.data.hpPositionId,
  739. user_id: app.globalData.userId,
  740. user_token: app.globalData.userToken,
  741. isFavorite: isFavorite,
  742. member_id: app.globalData.memberId
  743. }
  744. Object.assign(paramsObj);
  745. saveFavoritePosition(paramsObj).then(data => {
  746. if (data.data.isFavorite) {
  747. showToast('收藏成功');
  748. // 上报收藏订阅消息
  749. wx.aldPushSubscribeMessage({
  750. eventId: '5ea25b7f7739104342928e98',
  751. });
  752. } else {
  753. showToast('取消收藏');
  754. }
  755. self.setData({
  756. isFarovite: data.data.isFavorite
  757. })
  758. })
  759. },
  760. callPhone() {
  761. wx.makePhoneCall({
  762. phoneNumber: '4006900099',
  763. })
  764. }
  765. })