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