index.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794
  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: '/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. wx.showLoading({
  168. title: '加载中...',
  169. })
  170. var detail = e.detail;
  171. this.setData({
  172. shareImg: detail,
  173. showShare: true
  174. })
  175. wx.hideLoading()
  176. },
  177. onPosterFail(err) {
  178. console.error(err);
  179. },
  180. share() {
  181. let blocks = [];
  182. let block = [];
  183. let y = 598;
  184. let _arr = this.creatBlock();
  185. let bg = this.data.positionCategory == 5 ? '/images/happyjob/share-fuli.jpeg' : '/images/happyjob/share_img_fulltime.jpeg';
  186. let posterConfig = {
  187. width: 908,
  188. height: 1502,
  189. debug: false,
  190. blocks,
  191. texts: [{
  192. x: 146,
  193. y,
  194. width: 600,
  195. text: this.data.postitionDetail.positionName,
  196. fontSize: 62,
  197. color: '#333333',
  198. zIndex: 2,
  199. },
  200. {
  201. x: 504,
  202. y: 1234,
  203. text: '一站式求职平台',
  204. fontSize: 34,
  205. // fontWight:'500',
  206. color: '#666666',
  207. zIndex: 2,
  208. }
  209. ],
  210. images: [{
  211. width: 908,
  212. height: 1502,
  213. x: 0,
  214. y: 0,
  215. url: bg,
  216. zIndex: 1,
  217. }, {
  218. width: 264,
  219. height: 264,
  220. x: 158,
  221. y: 1030,
  222. url: `${this.data.qrcodeUrl}`,
  223. zIndex: 3
  224. }],
  225. }
  226. if (this.data.postitionDetail.hpCompany) {
  227. y += 61;
  228. posterConfig.texts.push({
  229. x: 146,
  230. y,
  231. width: 600,
  232. text: this.data.postitionDetail.hpCompany ? this.data.postitionDetail.hpCompany.companyName : '',
  233. fontSize: 32,
  234. color: '#666666',
  235. zIndex: 2,
  236. })
  237. }
  238. if (this.data.postitionDetail.salary || this.data.postitionDetail.basicSalary || this.data.postitionDetail.totalSalary) {
  239. y += 80;
  240. posterConfig.texts.push({
  241. x: 146,
  242. y,
  243. text: this.data.postitionDetail.salary || this.data.postitionDetail.basicSalary || this.data.postitionDetail.totalSalary,
  244. fontSize: 62,
  245. // fontWight:'500',
  246. color: '#FE7235',
  247. zIndex: 2,
  248. })
  249. }
  250. if (_arr.length) {
  251. y += 35;
  252. _arr.forEach(val => {
  253. block.push({
  254. y,
  255. height: 76,
  256. paddingLeft: 30,
  257. borderWidth: 2,
  258. borderColor: '#0177FF',
  259. borderRadius: 10,
  260. marginLeft: 24,
  261. text: {
  262. text: val,
  263. fontSize: 38,
  264. color: '#0177FF',
  265. baseLine: 'middle'
  266. },
  267. zIndex: 2,
  268. })
  269. })
  270. blocks.push({
  271. x: 146,
  272. y,
  273. height: 76,
  274. width: 542,
  275. block,
  276. beyond: {
  277. y: 770,
  278. width: 56,
  279. height: 56,
  280. zIndex: 3,
  281. text: {
  282. text: '...',
  283. fontSize: 38,
  284. color: '#0177FF',
  285. baseLine: 'middle'
  286. },
  287. },
  288. zIndex: 2,
  289. })
  290. }
  291. if (this.data.postitionDetail.reward) {
  292. y += 112;
  293. blocks.push({
  294. x: 146,
  295. y,
  296. height: 42,
  297. // fontWight:'500',
  298. text: {
  299. 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 || ''}`:''}`,
  300. fontSize: 26,
  301. color: '#fff',
  302. baseLine: 'middle'
  303. },
  304. paddingLeft: 15,
  305. backgroundColor: '#FE7235',
  306. borderRadius: 10,
  307. zIndex: 2,
  308. })
  309. }
  310. this.setData({
  311. posterConfig
  312. }, _ => {
  313. this.onCreatePoster()
  314. })
  315. },
  316. cloaseShare() {
  317. this.setData({
  318. showShare: false
  319. })
  320. },
  321. saveShareImg() {
  322. wx.saveImageToPhotosAlbum({
  323. filePath: this.data.shareImg,
  324. success: (res) => {
  325. showToast('已保存到相册,快去分享吧!');
  326. this.setData({
  327. showShare: false
  328. })
  329. },
  330. fail(err) {
  331. showToast('请授权保存到相册')
  332. that.setData({
  333. hasAuth: false
  334. })
  335. }
  336. })
  337. },
  338. //获取岗位详情
  339. fetchData() {
  340. let paramsObj = {
  341. position_category: this.data.positionCategory,
  342. id: this.data.hpPositionId,
  343. member_id: app.globalData.memberId
  344. }
  345. Object.assign(paramsObj);
  346. getPositionDetail(paramsObj).then(data => {
  347. console.log(data)
  348. let postitionDetail = {};
  349. let groupLessList = {};
  350. var leftTime = 0;
  351. var myGroupId = '';
  352. switch (this.data.positionCategory) {
  353. case "0":
  354. postitionDetail = data.data.hpFulltimePosition
  355. break;
  356. case "1":
  357. postitionDetail = data.data.hpParttimePosition
  358. break;
  359. case "2":
  360. postitionDetail = data.data.hpRewardPosition
  361. break;
  362. case "3":
  363. postitionDetail = data.data.hpGoodmoneyPosition
  364. break;
  365. case "4":
  366. postitionDetail = data.data.hpGroupPosition;
  367. leftTime = data.data.hpGroupPosition.groupEndTime;
  368. groupLessList = data.data.groupLessList;
  369. myGroupId = data.data.myGroupId;
  370. var maxReward;
  371. var minReward;
  372. var femaleReward = data.data.hpGroupPosition.femaleReward;
  373. var maleReward = data.data.hpGroupPosition.maleReward;
  374. var fiveGroupCashback = data.data.hpGroupPosition.fiveGroupCashback;
  375. var threeGroupCashback = data.data.hpGroupPosition.threeGroupCashback;
  376. var hasReward = data.data.hpGroupPosition.hasReward;
  377. if (hasReward == 1) {
  378. if (maleReward >= femaleReward) {
  379. maxReward = fiveGroupCashback + maleReward;
  380. minReward = femaleReward;
  381. } else {
  382. maxReward = fiveGroupCashback + femaleReward;
  383. minReward = maleReward;
  384. }
  385. } else {
  386. maxReward = fiveGroupCashback;
  387. minReward = 0;
  388. }
  389. this.setData({
  390. maxReward: maxReward,
  391. minReward: minReward
  392. })
  393. break;
  394. case "5":
  395. postitionDetail = data.data.hpWelfarePosition
  396. break;
  397. case "8":
  398. postitionDetail = data.data.hpFulltimePosition
  399. break;
  400. case "9":
  401. postitionDetail = data.data.hpParttimePosition
  402. break;
  403. }
  404. if (data.data.isEnd == 1) {
  405. this.setData({
  406. isEnd: data.data.isEnd
  407. })
  408. console.log("该岗位已结束")
  409. } else {
  410. console.log("该岗位未结束")
  411. }
  412. this.setData({
  413. postitionDetail: postitionDetail,
  414. isApply: data.data.isApply,
  415. leftTime: leftTime,
  416. storeAction: groupLessList,
  417. myGroupId: myGroupId,
  418. isFarovite: data.data.isFarovite,
  419. qrcodeUrl: data.data.qrcodeUrl
  420. })
  421. //富文本转义
  422. var detailArray = [];
  423. if (postitionDetail.hpWelfarePositionDetailList != null && postitionDetail.hpWelfarePositionDetailList.length > 0) {
  424. for (var i = 0; i < postitionDetail.hpWelfarePositionDetailList.length; i++) {
  425. var ss = WxParse.wxParse('positionDetail', 'html', postitionDetail.hpWelfarePositionDetailList[i].positionDetail, this);
  426. detailArray.push(ss);
  427. }
  428. this.setData({
  429. detailArray: detailArray
  430. })
  431. }
  432. //富文本转义
  433. if (postitionDetail.applyCondition) {
  434. WxParse.wxParse('applyCondition', 'html', postitionDetail.applyCondition, this);
  435. }
  436. this.getNodePos();
  437. })
  438. },
  439. //获取所有拼工列表
  440. fetchPtList() {
  441. if (this.data.isEnd == 1) {
  442. showToast('拼团已结束')
  443. return false
  444. }
  445. let paramsObj = {
  446. positionCategory: this.data.positionCategory,
  447. positionId: this.data.hpPositionId,
  448. }
  449. Object.assign(paramsObj);
  450. groupList(paramsObj).then(data => {
  451. console.log("allpt", data)
  452. this.setData({
  453. allPtList: data.data.groupList
  454. })
  455. })
  456. },
  457. //申请工作
  458. applyJob(e) {
  459. var self = this;
  460. if (!self.data.isLogin) {
  461. wx.navigateTo({
  462. url: '/pages/login/login',
  463. })
  464. return;
  465. }
  466. wx.showModal({
  467. title: '提示',
  468. content: '确定提交申请吗?',
  469. success: function(res) {
  470. if (res.confirm) {
  471. let {
  472. formId
  473. } = e.detail;
  474. let paramsObj = {
  475. positionCategory: self.data.positionCategory,
  476. positionId: self.data.hpPositionId,
  477. user_id: app.globalData.userId,
  478. user_token: app.globalData.userToken,
  479. member_id: app.globalData.memberId
  480. }
  481. Object.assign(paramsObj);
  482. positionApply(paramsObj).then(data => {
  483. console.log("sdfg", data);
  484. showToast('申请职位成功', 'success')
  485. setTimeout(function() {
  486. wx.navigateBack();
  487. }, 2000)
  488. }).catch(data => {
  489. console.log('No!', data)
  490. //没有简历
  491. if (data.errcode == 1015) {
  492. showToast(data.errmsg);
  493. wx.navigateTo({
  494. url: '/pages/user-info/user-info',
  495. })
  496. }
  497. })
  498. } else if (res.cancel) {
  499. }
  500. }
  501. })
  502. },
  503. //申请开团
  504. applyPt(e) {
  505. var self = this;
  506. if (!self.data.isLogin) {
  507. wx.navigateTo({
  508. url: '/pages/login/login',
  509. })
  510. return;
  511. }
  512. wx.showModal({
  513. title: '提示',
  514. content: '确定提交开团申请吗?',
  515. success: function(res) {
  516. if (res.confirm) {
  517. let {
  518. formId
  519. } = e.detail;
  520. let paramsObj = {
  521. // groupId: self.data.groupId,
  522. // inviteUser_id: self.data.inviteUser_id,
  523. positionCategory: self.data.positionCategory,
  524. positionId: self.data.hpPositionId,
  525. user_id: app.globalData.userId,
  526. user_token: app.globalData.userToken,
  527. member_id: app.globalData.memberId
  528. }
  529. Object.assign(paramsObj);
  530. groupApply(paramsObj).then(data => {
  531. var hpPositionGroupId = data.data.hpApplyPosition.groupId
  532. console.log("ff22", data);
  533. showToast("开团成功");
  534. wx.navigateTo({
  535. url: '../pt-detail/index?gd=' + hpPositionGroupId + '&pc=' + self.data.positionCategory + '&pd=' + self.data.hpPositionId,
  536. })
  537. }).catch(data => {
  538. console.log('No!', data)
  539. //没有简历
  540. if (data.errcode == 1015) {
  541. showToast(data.errmsg);
  542. wx.navigateTo({
  543. url: '/pages/user-info/user-info',
  544. })
  545. }
  546. })
  547. } else if (res.cancel) {
  548. }
  549. }
  550. })
  551. },
  552. //我的拼团
  553. myApply() {
  554. var self = this;
  555. if (!self.data.isLogin) {
  556. wx.navigateTo({
  557. url: '/pages/login/login',
  558. })
  559. return;
  560. }
  561. wx.navigateTo({
  562. url: '../pt-detail/index?gd=' + self.data.myGroupId + '&pc=' + self.data.positionCategory + '&pd=' + self.data.hpPositionId,
  563. })
  564. },
  565. //拨打手机号
  566. phoneCall() {
  567. if (this.data.postitionDetail.contactPhone) {
  568. wx.makePhoneCall({
  569. phoneNumber: this.data.postitionDetail.contactPhone,
  570. success: function(data) {
  571. console.log(data)
  572. },
  573. fail: function(data) {
  574. console.log(data)
  575. }
  576. })
  577. } else {
  578. showToast('暂无手机号')
  579. }
  580. },
  581. //查看线路
  582. toRoadsLine() {
  583. wx.navigateTo({
  584. url: '../roadsLine/index',
  585. })
  586. },
  587. // 获取公司规模描述
  588. getComScale(lower, high) {
  589. if (!lower || lower == 0) {
  590. return high + '人以下'
  591. }
  592. if (!high || high == 0) {
  593. return lower + '人以上'
  594. }
  595. return lower + '-' + high + '人'
  596. },
  597. //获取位置
  598. getNodePos() {
  599. if (this.data.positionCategory != 5) {
  600. var query = wx.createSelectorQuery()
  601. query.select('#base').boundingClientRect()
  602. query.select('#require').boundingClientRect()
  603. query.select('#otherWelfare').boundingClientRect()
  604. query.select('#jieshao').boundingClientRect()
  605. var that = this;
  606. query.exec(function(res) {
  607. console.log(res)
  608. that.setData({
  609. basePos: res[0].top - 40,
  610. requirePos: res[1].top - 40,
  611. otherWelfarePos: res[2].top - 40,
  612. jieshaoPos: res[3].top - 40
  613. })
  614. })
  615. }
  616. },
  617. //距离页面滚动
  618. goDeatil: function(e) {
  619. var index = e.currentTarget.dataset.index;
  620. this.setData({
  621. detailIndex: index
  622. })
  623. let top = e.currentTarget.dataset.top
  624. wx.pageScrollTo({
  625. scrollTop: top,
  626. duration: 0
  627. })
  628. },
  629. // 加入拼工
  630. joinPt(e) {
  631. var index = e.currentTarget.dataset.index;
  632. console.log("joinptindex", index)
  633. this.setData({
  634. showAllPt: false,
  635. showJoinPt: true,
  636. joinPtList: this.data.storeAction[index]
  637. })
  638. console.log("DFD", this.data.joinPtList)
  639. },
  640. // 加入拼工(所有拼工)
  641. joinPt_1(e) {
  642. var index = e.currentTarget.dataset.index;
  643. console.log("joinptindex", index)
  644. this.setData({
  645. showAllPt: false,
  646. showJoinPt: true,
  647. joinPtList: this.data.storeAction[index]
  648. })
  649. },
  650. hideJoinPt() {
  651. this.setData({
  652. showJoinPt: false
  653. })
  654. },
  655. cancelPt() {
  656. this.setData({
  657. showJoinPt: false
  658. })
  659. },
  660. //加入拼工,进入拼工详情
  661. confirmPt(e) {
  662. var self = this;
  663. if (!self.data.isLogin) {
  664. self.setData({
  665. showJoinPt: false
  666. })
  667. wx.navigateTo({
  668. url: '/pages/login/login',
  669. })
  670. return;
  671. }
  672. var groupId = e.currentTarget.dataset.groupid;
  673. self.setData({
  674. showJoinPt: false
  675. })
  676. wx.navigateTo({
  677. url: '../pt-detail/index?gd=' + groupId + '&pc=' + self.data.positionCategory + '&pd=' + self.data.hpPositionId,
  678. })
  679. },
  680. // 所有拼工
  681. allPt(e) {
  682. if (this.data.storeAction.length > 0) {
  683. this.setData({
  684. showAllPt: true
  685. })
  686. } else {
  687. showToast("拼工都已经完成啦,您可以申请开团哦!")
  688. }
  689. },
  690. hideAllPt() {
  691. this.setData({
  692. showAllPt: false
  693. })
  694. },
  695. hideAuth() {
  696. this.setData({
  697. authMask: false
  698. })
  699. },
  700. submitInfo(e) {
  701. console.log('form发生了submit事件,事件数据为:', e)
  702. },
  703. toPt() {
  704. wx.navigateTo({
  705. url: '../document/pt'
  706. })
  707. },
  708. toFanxian() {
  709. wx.navigateTo({
  710. url: '../document/fanxian'
  711. })
  712. },
  713. imageLoad() {
  714. var that = this
  715. var query = wx.createSelectorQuery()
  716. query.select('.wel_top').boundingClientRect()
  717. query.exec(function(res) {
  718. console.log(res)
  719. that.setData({
  720. swiperH: res[0].height
  721. })
  722. })
  723. },
  724. onError(err) {
  725. app.aldstat.sendEvent('报错', {
  726. 'err': err
  727. });
  728. },
  729. //跳转工作地址列表
  730. toaddressdetail() {
  731. wx.setStorageSync("addressList", this.data.postitionDetail.hpPositionAddressList);
  732. wx.navigateTo({
  733. url: '../address/index',
  734. })
  735. },
  736. //收藏岗位
  737. favourate() {
  738. var self = this;
  739. if (!self.data.isLogin) {
  740. wx.navigateTo({
  741. url: '/pages/login/login',
  742. })
  743. return;
  744. }
  745. var isFavorite = self.data.isFarovite ? 0 : 1;
  746. let paramsObj = {
  747. positionCategory: self.data.positionCategory,
  748. positionId: self.data.hpPositionId,
  749. user_id: app.globalData.userId,
  750. user_token: app.globalData.userToken,
  751. isFavorite: isFavorite,
  752. member_id: app.globalData.memberId
  753. }
  754. Object.assign(paramsObj);
  755. saveFavoritePosition(paramsObj).then(data => {
  756. console.log("sssccc", data.data.isFavorite);
  757. if (data.data.isFavorite) {
  758. showToast('收藏成功');
  759. } else {
  760. showToast('取消收藏');
  761. }
  762. self.setData({
  763. isFarovite: data.data.isFavorite
  764. })
  765. })
  766. },
  767. })