index.js 20 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. // var $ = require('../../libs/gdconf.js');
  18. import Poster from '../../components/wxa-plugin-canvas/poster/poster';
  19. const app = getApp();
  20. Page({
  21. data: {
  22. imgServerUrl: imgServerUrl,
  23. imgServerUrl_new: imgServerUrl_new,
  24. hpPositionId: 0,
  25. positionCategory: 0, //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. console.log('detail=>', 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 ? '/images/happyjob/share-fuli.jpeg' : '/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.basicSalary || this.data.postitionDetail.totalSalary) {
  237. y += 80;
  238. posterConfig.texts.push({
  239. x: 146,
  240. y,
  241. text: this.data.postitionDetail.salary || this.data.postitionDetail.basicSalary || this.data.postitionDetail.totalSalary,
  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.reward) {
  290. y += 112;
  291. blocks.push({
  292. x: 146,
  293. y,
  294. height: 42,
  295. // fontWight:'500',
  296. text: {
  297. 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 || ''}`:''}`,
  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. console.log(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. console.log("该岗位已结束")
  407. } else {
  408. console.log("该岗位未结束")
  409. }
  410. this.setData({
  411. postitionDetail: postitionDetail,
  412. isApply: data.data.isApply,
  413. leftTime: leftTime,
  414. storeAction: groupLessList,
  415. myGroupId: myGroupId,
  416. isFarovite: data.data.isFarovite,
  417. qrcodeUrl: data.data.qrcodeUrl
  418. })
  419. //富文本转义
  420. var detailArray = [];
  421. if (postitionDetail.hpWelfarePositionDetailList != null && postitionDetail.hpWelfarePositionDetailList.length > 0) {
  422. for (var i = 0; i < postitionDetail.hpWelfarePositionDetailList.length; i++) {
  423. var ss = WxParse.wxParse('positionDetail', 'html', postitionDetail.hpWelfarePositionDetailList[i].positionDetail, this);
  424. detailArray.push(ss);
  425. }
  426. this.setData({
  427. detailArray: detailArray
  428. })
  429. }
  430. //富文本转义
  431. if (postitionDetail.applyCondition) {
  432. WxParse.wxParse('applyCondition', 'html', postitionDetail.applyCondition, this);
  433. }
  434. this.getNodePos();
  435. })
  436. },
  437. //获取所有拼工列表
  438. fetchPtList() {
  439. if (this.data.isEnd == 1) {
  440. showToast('拼团已结束')
  441. return false
  442. }
  443. let paramsObj = {
  444. positionCategory: this.data.positionCategory,
  445. positionId: this.data.hpPositionId,
  446. }
  447. Object.assign(paramsObj);
  448. groupList(paramsObj).then(data => {
  449. console.log("allpt", data)
  450. this.setData({
  451. allPtList: data.data.groupList
  452. })
  453. })
  454. },
  455. //申请工作
  456. applyJob(e) {
  457. var self = this;
  458. if (!self.data.isLogin) {
  459. wx.navigateTo({
  460. url: '/pages/login/login',
  461. })
  462. return;
  463. }
  464. wx.showModal({
  465. title: '提示',
  466. content: '确定提交申请吗?',
  467. success: function(res) {
  468. if (res.confirm) {
  469. let {
  470. formId
  471. } = e.detail;
  472. let paramsObj = {
  473. positionCategory: self.data.positionCategory,
  474. positionId: self.data.hpPositionId,
  475. user_id: app.globalData.userId,
  476. user_token: app.globalData.userToken,
  477. member_id: app.globalData.memberId
  478. }
  479. Object.assign(paramsObj);
  480. positionApply(paramsObj).then(data => {
  481. console.log("sdfg", data);
  482. showToast('申请职位成功', 'success')
  483. setTimeout(function() {
  484. wx.navigateBack();
  485. }, 2000)
  486. }).catch(data => {
  487. console.log('No!', data)
  488. //没有简历
  489. if (data.errcode == 1015) {
  490. showToast(data.errmsg);
  491. wx.navigateTo({
  492. url: '/pages/user-info/user-info',
  493. })
  494. }
  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. console.log("ff22", data);
  531. showToast("开团成功");
  532. wx.navigateTo({
  533. url: '../pt-detail/index?gd=' + hpPositionGroupId + '&pc=' + self.data.positionCategory + '&pd=' + self.data.hpPositionId,
  534. })
  535. }).catch(data => {
  536. console.log('No!', data)
  537. //没有简历
  538. if (data.errcode == 1015) {
  539. showToast(data.errmsg);
  540. wx.navigateTo({
  541. url: '/pages/user-info/user-info',
  542. })
  543. }
  544. })
  545. } else if (res.cancel) {
  546. }
  547. }
  548. })
  549. },
  550. //我的拼团
  551. myApply() {
  552. var self = this;
  553. if (!self.data.isLogin) {
  554. wx.navigateTo({
  555. url: '/pages/login/login',
  556. })
  557. return;
  558. }
  559. wx.navigateTo({
  560. url: '../pt-detail/index?gd=' + self.data.myGroupId + '&pc=' + self.data.positionCategory + '&pd=' + self.data.hpPositionId,
  561. })
  562. },
  563. //拨打手机号
  564. phoneCall() {
  565. if (this.data.postitionDetail.contactPhone) {
  566. wx.makePhoneCall({
  567. phoneNumber: this.data.postitionDetail.contactPhone,
  568. success: function(data) {
  569. console.log(data)
  570. },
  571. fail: function(data) {
  572. console.log(data)
  573. }
  574. })
  575. } else {
  576. showToast('暂无手机号')
  577. }
  578. },
  579. //查看线路
  580. toRoadsLine() {
  581. wx.navigateTo({
  582. url: '../roadsLine/index',
  583. })
  584. },
  585. // 获取公司规模描述
  586. getComScale(lower, high) {
  587. if (!lower || lower == 0) {
  588. return high + '人以下'
  589. }
  590. if (!high || high == 0) {
  591. return lower + '人以上'
  592. }
  593. return lower + '-' + high + '人'
  594. },
  595. //获取位置
  596. getNodePos() {
  597. if (this.data.positionCategory != 5) {
  598. var query = wx.createSelectorQuery()
  599. query.select('#base').boundingClientRect()
  600. query.select('#require').boundingClientRect()
  601. query.select('#otherWelfare').boundingClientRect()
  602. query.select('#jieshao').boundingClientRect()
  603. var that = this;
  604. query.exec(function(res) {
  605. console.log(res)
  606. that.setData({
  607. basePos: res[0].top - 40,
  608. requirePos: res[1].top - 40,
  609. otherWelfarePos: res[2].top - 40,
  610. jieshaoPos: res[3].top - 40
  611. })
  612. })
  613. }
  614. },
  615. //距离页面滚动
  616. goDeatil: function(e) {
  617. var index = e.currentTarget.dataset.index;
  618. this.setData({
  619. detailIndex: index
  620. })
  621. let top = e.currentTarget.dataset.top
  622. wx.pageScrollTo({
  623. scrollTop: top,
  624. duration: 0
  625. })
  626. },
  627. // 加入拼工
  628. joinPt(e) {
  629. var index = e.currentTarget.dataset.index;
  630. console.log("joinptindex", index)
  631. this.setData({
  632. showAllPt: false,
  633. showJoinPt: true,
  634. joinPtList: this.data.storeAction[index]
  635. })
  636. console.log("DFD", this.data.joinPtList)
  637. },
  638. // 加入拼工(所有拼工)
  639. joinPt_1(e) {
  640. var index = e.currentTarget.dataset.index;
  641. console.log("joinptindex", index)
  642. this.setData({
  643. showAllPt: false,
  644. showJoinPt: true,
  645. joinPtList: this.data.storeAction[index]
  646. })
  647. },
  648. hideJoinPt() {
  649. this.setData({
  650. showJoinPt: false
  651. })
  652. },
  653. cancelPt() {
  654. this.setData({
  655. showJoinPt: false
  656. })
  657. },
  658. //加入拼工,进入拼工详情
  659. confirmPt(e) {
  660. var self = this;
  661. if (!self.data.isLogin) {
  662. self.setData({
  663. showJoinPt: false
  664. })
  665. wx.navigateTo({
  666. url: '/pages/login/login',
  667. })
  668. return;
  669. }
  670. var groupId = e.currentTarget.dataset.groupid;
  671. self.setData({
  672. showJoinPt: false
  673. })
  674. wx.navigateTo({
  675. url: '../pt-detail/index?gd=' + groupId + '&pc=' + self.data.positionCategory + '&pd=' + self.data.hpPositionId,
  676. })
  677. },
  678. // 所有拼工
  679. allPt(e) {
  680. if (this.data.storeAction.length > 0) {
  681. this.setData({
  682. showAllPt: true
  683. })
  684. } else {
  685. showToast("拼工都已经完成啦,您可以申请开团哦!")
  686. }
  687. },
  688. hideAllPt() {
  689. this.setData({
  690. showAllPt: false
  691. })
  692. },
  693. hideAuth() {
  694. this.setData({
  695. authMask: false
  696. })
  697. },
  698. submitInfo(e) {
  699. console.log('form发生了submit事件,事件数据为:', e)
  700. },
  701. toPt() {
  702. wx.navigateTo({
  703. url: '../document/pt'
  704. })
  705. },
  706. toFanxian() {
  707. wx.navigateTo({
  708. url: '../document/fanxian'
  709. })
  710. },
  711. imageLoad() {
  712. var that = this
  713. var query = wx.createSelectorQuery()
  714. query.select('.wel_top').boundingClientRect()
  715. query.exec(function(res) {
  716. console.log(res)
  717. that.setData({
  718. swiperH: res[0].height
  719. })
  720. })
  721. },
  722. onError(err) {
  723. app.aldstat.sendEvent('报错', {
  724. 'err': err
  725. });
  726. },
  727. //跳转工作地址列表
  728. toaddressdetail() {
  729. wx.setStorageSync("addressList", this.data.postitionDetail.hpPositionAddressList);
  730. wx.navigateTo({
  731. url: '../address/index',
  732. })
  733. },
  734. //收藏岗位
  735. favourate() {
  736. var self = this;
  737. if (!self.data.isLogin) {
  738. wx.navigateTo({
  739. url: '/pages/login/login',
  740. })
  741. return;
  742. }
  743. var isFavorite = self.data.isFarovite ? 0 : 1;
  744. let paramsObj = {
  745. positionCategory: self.data.positionCategory,
  746. positionId: self.data.hpPositionId,
  747. user_id: app.globalData.userId,
  748. user_token: app.globalData.userToken,
  749. isFavorite: isFavorite,
  750. member_id: app.globalData.memberId
  751. }
  752. Object.assign(paramsObj);
  753. saveFavoritePosition(paramsObj).then(data => {
  754. console.log("sssccc", data.data.isFavorite);
  755. if (data.data.isFavorite) {
  756. showToast('收藏成功');
  757. } else {
  758. showToast('取消收藏');
  759. }
  760. self.setData({
  761. isFarovite: data.data.isFavorite
  762. })
  763. })
  764. },
  765. })