index.js 21 KB

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