postJob.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925
  1. // pages/my/postJob/postJob.js
  2. const App = getApp();
  3. const util = require("../../utils/tool");
  4. var utils = require("../../utils/util.js");
  5. let CityArray0 = [];
  6. let CityArray1 = [];
  7. let CityArray2 = [];
  8. Page({
  9. /**
  10. * 页面的初始数据
  11. */
  12. data: {
  13. appAssetsUrl2: App.appAssetsUrl2,
  14. user: wx.getStorageSync("USER"),
  15. lng: null,
  16. lat: null,
  17. // 活动地址
  18. address: null,
  19. // 坐标
  20. coordinate: null,
  21. multiArray: [],
  22. multiIndex: [],
  23. // 省
  24. province: null,
  25. // 市
  26. city: null,
  27. // 区
  28. area: null,
  29. // 标题
  30. title: null,
  31. // 所属客户
  32. clientId: null,
  33. clientList: [],
  34. clientIndex: 0,
  35. // 兼职分类
  36. category: null,
  37. // 兼职类型
  38. type: null,
  39. categoryList: [],
  40. categoryIndex: 0,
  41. typeList: [],
  42. typeIndex: 0,
  43. // 工作兼职时间
  44. // worktimeStart: null,
  45. // worktimeEnd: null,
  46. workdateStart: null,
  47. workdateEnd: null,
  48. worktimeStart: null,
  49. worktimeEnd: null,
  50. // workStartTimeDate: null,
  51. // workStartTimeHS: null,
  52. // workEndTimeDate: null,
  53. // workEndTimeHS: null,
  54. // 报名截止
  55. registrationTime: null,
  56. registrationDate: null,
  57. registrationHS: null,
  58. // 集合时间
  59. meetingTime: null,
  60. // 集合日期
  61. meetingTimeDate: null,
  62. // 集合日期时间
  63. meetingTimeHS: null,
  64. // 是否推荐至首页
  65. isTop: null,
  66. arrayPrice: [],
  67. priceIndex: 0,
  68. // 工资价格
  69. price: null,
  70. // 结算方式
  71. cashMethod: null,
  72. cashMethodList: [],
  73. cashMethodIndex: 0,
  74. // 工资单位
  75. unit: null,
  76. // 性别要求
  77. sexlimit: null,
  78. // 是否需要会员
  79. isNeedVip: 0,
  80. heightList: [],
  81. heightIndex: 0,
  82. // 身高要求
  83. heightlimit: null,
  84. // 面试时间
  85. interviewTime: null,
  86. // 面试时间 hs
  87. interviewTimeHS: null,
  88. // 培训时间
  89. trainingTime: null,
  90. // 培训时间 hs
  91. trainingTimeHS: null,
  92. // 报名人数限制
  93. willnum: null,
  94. principal: null,
  95. activityjs: null,
  96. activityyq: null,
  97. activitysx: null,
  98. // 兼职banner图
  99. indexImg: null,
  100. // 联系二维码
  101. qrCodePicture: null,
  102. contactInstructions: null,
  103. // 注意事项
  104. attention: null,
  105. againType: null,
  106. },
  107. /**
  108. * 生命周期函数--监听页面加载
  109. */
  110. onLoad(options) {
  111. if (options && options.againType == 1 && options.jobId) {
  112. this.setData({
  113. againType: options.againType,
  114. });
  115. this.getAgainJobInfo(options.jobId);
  116. } else {
  117. this.init();
  118. }
  119. },
  120. init() {
  121. this.getProvince();
  122. this.getCoord();
  123. this.getWorkCategory();
  124. this.getType();
  125. this.getUnit();
  126. this.getHeightList();
  127. this.getclient();
  128. this.getCashMethod();
  129. },
  130. getAgainJobInfo(id) {
  131. let user = utils.getUser();
  132. let obj = {
  133. id: id,
  134. type: 1, //类型(1兼职 2活动)
  135. stuId: user ? user.id : "",
  136. };
  137. App._post_form("work/one", "", obj, (res) => {
  138. if (res.code === 0) {
  139. this.setData({
  140. title: res.data.title,
  141. address: res.data.address,
  142. clientId: res.data.clientId,
  143. category: res.data.category,
  144. type: res.data.type,
  145. province: res.data.province,
  146. city: res.data.city,
  147. area: res.data.area,
  148. coordinate: res.data.coordinate,
  149. workdateStart: res.data.workdateStart,
  150. workdateEnd: res.data.workdateEnd,
  151. worktimeStart: res.data.worktimeStart,
  152. worktimeEnd: res.data.worktimeEnd,
  153. registrationDate: res.data.registrationTime.split(' ')[0],
  154. registrationHS: res.data.registrationTime.split(' ')[1],
  155. meetingTimeDate: res.data.meetingTime.split(' ')[0],
  156. meetingTimeHS: res.data.meetingTime.split(' ')[1],
  157. isTop: res.data.isTop,
  158. price: res.data.price,
  159. cashMethod: res.data.cashMethod,
  160. unit: res.data.unit,
  161. sexlimit: res.data.sexlimit,
  162. isNeedVip: res.data.isNeedVip,
  163. heightlimit: res.data.heightlimit,
  164. interviewTime: res.data.interviewTime.split(' ')[0],
  165. interviewTimeHS: res.data.interviewTime.split(' ')[1],
  166. trainingTime: res.data.trainingTime.split(' ')[0],
  167. trainingTimeHS: res.data.trainingTime.split(' ')[1],
  168. willnum: res.data.willnum,
  169. principal: res.data.principal,
  170. activityjs: res.data.workAppletsDetailsList[0],
  171. activityyq: res.data.workAppletsDetailsList[1],
  172. activitysx: res.data.workAppletsDetailsList[2],
  173. indexImg: res.data.indexImg,
  174. qrCodePicture: res.data.qrCodePicture,
  175. contactInstructions: res.data.contactInstructions,
  176. attention: res.data.attention,
  177. });
  178. this.init();
  179. }
  180. });
  181. },
  182. /**
  183. * 生命周期函数--监听页面初次渲染完成
  184. */
  185. onReady() {},
  186. /**
  187. * 生命周期函数--监听页面显示
  188. */
  189. onShow() {},
  190. // 获取兼职分类
  191. getWorkCategory() {
  192. App._post_form("work/category", "", {}, (res) => {
  193. if (res.code === 0) {
  194. const arr = res.data;
  195. this.setData({
  196. categoryList: res.data,
  197. });
  198. if (this.data.againType == 1 && this.data.category) {
  199. this.getShow(arr, "itemcode", this.data.category, "categoryIndex");
  200. }
  201. }
  202. });
  203. },
  204. // 获取兼职类型
  205. getType() {
  206. App._post_form("bizlibrary/infoList/workType", "", {}, (res) => {
  207. if (res.code === 0) {
  208. const arr = res.dictList;
  209. this.setData({
  210. typeList: res.dictList,
  211. });
  212. if (this.data.againType == 1 && this.data.type) {
  213. this.getShow(arr, "itemcode", this.data.type, "typeIndex");
  214. }
  215. }
  216. });
  217. },
  218. // 获取结算方式
  219. getCashMethod() {
  220. App._post_form("work/cashMethod", "", {}, (res) => {
  221. if (res.code === 0) {
  222. const arr = res.data;
  223. this.setData({
  224. cashMethodList: res.data,
  225. });
  226. if (this.data.againType == 1 && this.data.cashMethod) {
  227. this.getShow(
  228. arr,
  229. "itemcode",
  230. this.data.cashMethod,
  231. "cashMethodIndex"
  232. );
  233. }
  234. }
  235. });
  236. },
  237. getUnit() {
  238. App._post_form("bizlibrary/infoList/workUnit", "", {}, (res) => {
  239. if (res.code === 0) {
  240. const arr = res.dictList;
  241. this.setData({
  242. arrayPrice: res.dictList,
  243. });
  244. if (this.data.againType == 1 && this.data.unit) {
  245. this.getShow(
  246. arr,
  247. "itemcode",
  248. this.data.unit,
  249. "priceIndex"
  250. );
  251. }
  252. }
  253. });
  254. },
  255. getHeightList() {
  256. App._post_form("bizlibrary/infoList/workHeightLimit", "", {}, (res) => {
  257. if (res.code === 0) {
  258. const arr = res.dictList;
  259. this.setData({
  260. heightList: res.dictList,
  261. });
  262. if (this.data.againType == 1 && this.data.heightlimit) {
  263. this.getShow(
  264. arr,
  265. "itemcode",
  266. this.data.heightlimit,
  267. "heightIndex"
  268. );
  269. }
  270. }
  271. });
  272. },
  273. getclient() {
  274. App._post_form("wgclientinfo/selectCiList", "", {}, (res) => {
  275. if (res.code === 0) {
  276. const arr = res.list;
  277. this.setData({
  278. clientList: res.list,
  279. });
  280. if (this.data.againType == 1 && this.data.clientId) {
  281. this.getShow(arr, "id", this.data.clientId, "clientIndex");
  282. }
  283. }
  284. });
  285. },
  286. getShow(arr, key, value, index) {
  287. console.log(arr, key, value, index, 22222);
  288. for (let i = 0; i < arr.length; i++) {
  289. if (arr[i][key] == value) {
  290. this.setData({
  291. [index]: i,
  292. });
  293. return false;
  294. }
  295. }
  296. },
  297. // 获取经纬度
  298. getCoord() {
  299. wx.getLocation({
  300. type: "gcj02",
  301. success: (res) => {
  302. const latitude = res.latitude;
  303. const longitude = res.longitude;
  304. this.setData({
  305. lng: Number(longitude),
  306. lat: Number(latitude),
  307. });
  308. },
  309. fail: (e) => {},
  310. });
  311. },
  312. // 获取省
  313. getProvince() {
  314. App._get("region/provinceList", {}, (res) => {
  315. let pId = "";
  316. let prov = "";
  317. if (res.code === 0) {
  318. let provice = res.data;
  319. this.data.multiArray[0] = provice;
  320. CityArray0 = provice;
  321. if (CityArray0.length) {
  322. for (let i = 0; i < CityArray0.length; i++) {
  323. if (CityArray0[i].id == this.data.province) {
  324. this.data.multiIndex[0] = i;
  325. break;
  326. } else {
  327. this.data.multiIndex[0] = 0;
  328. // break;
  329. }
  330. }
  331. }
  332. if (this.data.province) {
  333. pId = this.data.province;
  334. } else {
  335. //根据默认省,获取默认市
  336. if (this.data.multiArray[0].length) {
  337. pId = this.data.multiArray[0][0].id;
  338. }
  339. }
  340. this.getCity(pId);
  341. }
  342. });
  343. },
  344. getCity(pId) {
  345. App._get(`region/urbanDistrictList?id=${pId}`, {}, (res) => {
  346. // App._get(`region/urbanDistrictList?id=420000`, {}, res => {
  347. if (res.code === 0) {
  348. let city = res.data;
  349. this.data.multiArray[1] = city;
  350. CityArray1 = city;
  351. if (CityArray1.length) {
  352. for (let i = 0; i < CityArray1.length; i++) {
  353. // console.log(CityArray1[i].id, pId, 222)
  354. if (CityArray1[i].pid === pId) {
  355. this.data.multiIndex[1] = i;
  356. break;
  357. }
  358. }
  359. }
  360. let cityId = "";
  361. if (this.data.city) {
  362. cityId = this.data.city;
  363. } else {
  364. if (this.data.multiArray[1].length) {
  365. cityId = this.data.multiArray[1][0].id;
  366. }
  367. }
  368. this.getArea(cityId);
  369. this.setData({
  370. multiArray: this.data.multiArray,
  371. multiIndex: this.data.multiIndex,
  372. });
  373. }
  374. });
  375. },
  376. // 获取区
  377. getArea(cityId) {
  378. for (let i = 0; i < this.data.multiArray[1].length; i++) {
  379. console.log(this.data.multiArray[1], cityId, "area");
  380. if (this.data.multiArray[1][i].id === cityId) {
  381. CityArray2 = this.data.multiArray[1][i].childRegionList;
  382. this.data.multiArray[2] = this.data.multiArray[1][i].childRegionList;
  383. this.data.multiIndex[2] = i;
  384. break;
  385. }
  386. }
  387. if (this.data.area) {
  388. for (let j = 0; j < this.data.multiArray[2].length; j++) {
  389. if (this.data.multiArray[2][j].id === this.data.area) {
  390. this.data.multiIndex[2] = j;
  391. break;
  392. }
  393. }
  394. }
  395. this.setData({
  396. multiArray: this.data.multiArray,
  397. multiIndex: this.data.multiIndex,
  398. });
  399. console.log(this.data.multiArray, this.data.multiIndex, 1111);
  400. },
  401. // 兼职分类
  402. categoryChange(e) {
  403. console.log(e);
  404. let category = this.data.categoryList[e.detail.value].itemcode;
  405. this.setData({
  406. category: category,
  407. categoryIndex: e.detail.value,
  408. });
  409. },
  410. // 兼职类型
  411. typeChange(e) {
  412. let type = this.data.typeList[e.detail.value].itemcode;
  413. this.setData({
  414. type: type,
  415. typeIndex: e.detail.value,
  416. });
  417. },
  418. // 结算方式
  419. cashMethodChange(e) {
  420. console.log(e);
  421. let cashMethod = this.data.cashMethodList[e.detail.value].itemcode;
  422. this.setData({
  423. cashMethod: cashMethod,
  424. cashMethodIndex: e.detail.value,
  425. });
  426. },
  427. // 工资选择
  428. priceChange(e) {
  429. console.log(e, 111);
  430. let unit = this.data.arrayPrice[e.detail.value].itemcode;
  431. this.setData({
  432. unit: unit,
  433. priceIndex: e.detail.value,
  434. });
  435. },
  436. heightChange(e) {
  437. let heightlimit = this.data.heightList[e.detail.value].itemcode;
  438. this.setData({
  439. heightlimit: heightlimit,
  440. heightIndex: e.detail.value,
  441. });
  442. },
  443. clientChange(e) {
  444. let clientId = this.data.clientList[e.detail.value].id;
  445. this.setData({
  446. clientId: clientId,
  447. clientIndex: e.detail.value,
  448. });
  449. },
  450. areaChange(e) {
  451. this.data.multiIndex[0] = e.detail.value[0];
  452. this.data.multiIndex[1] = e.detail.value[1];
  453. this.data.multiIndex[2] = e.detail.value[2];
  454. let province = CityArray0[e.detail.value[0]].id;
  455. let city = CityArray1[e.detail.value[1]].id;
  456. let area = CityArray2[e.detail.value[2]].id;
  457. this.setData({
  458. multiIndex: this.data.multiIndex,
  459. province: province,
  460. city: city,
  461. area: area,
  462. });
  463. },
  464. MultiPickerAreaChange(e) {
  465. if (e.detail.column == 0) {
  466. let pid = CityArray0[e.detail.value].id;
  467. this.data.multiIndex[0] = e.detail.value;
  468. this.getCity(pid);
  469. } else if (e.detail.column == 1) {
  470. let pid = CityArray1[e.detail.value].id;
  471. this.data.multiIndex[1] = e.detail.value;
  472. this.getArea(pid);
  473. } else {
  474. this.data.multiIndex[2] = e.detail.value;
  475. }
  476. this.setData({
  477. multiIndex: this.data.multiIndex,
  478. });
  479. },
  480. // 工作日期
  481. workStartTimeBindDateChange(e) {
  482. this.setData({
  483. workdateStart: e.detail.value,
  484. });
  485. },
  486. workStartTimeBindTimeChange(e) {
  487. this.setData({
  488. worktimeStart: e.detail.value,
  489. });
  490. },
  491. workEndTimeBindDateChange(e) {
  492. this.setData({
  493. workdateEnd: e.detail.value,
  494. });
  495. },
  496. workEndTimeBindTimeChange(e) {
  497. this.setData({
  498. worktimeEnd: e.detail.value,
  499. });
  500. },
  501. // 报名截止
  502. registrationBindDateChange(e) {
  503. this.setData({
  504. registrationDate: e.detail.value,
  505. });
  506. },
  507. registrationBindTimeChange(e) {
  508. this.setData({
  509. registrationHS: e.detail.value,
  510. });
  511. },
  512. // 集合时间
  513. meetingBindDateChange(e) {
  514. this.setData({
  515. meetingTimeDate: e.detail.value,
  516. });
  517. },
  518. meetingBindTimeChange(e) {
  519. this.setData({
  520. meetingTimeHS: e.detail.value,
  521. });
  522. },
  523. // 面试时间
  524. interviewTimeDateChange(e) {
  525. this.setData({
  526. interviewTime: e.detail.value,
  527. });
  528. },
  529. interviewTimeChange(e) {
  530. this.setData({
  531. interviewTimeHS: e.detail.value,
  532. });
  533. },
  534. // 培训时间
  535. trainingTimeDateChange(e) {
  536. this.setData({
  537. trainingTime: e.detail.value,
  538. });
  539. },
  540. trainingTimeChange(e) {
  541. this.setData({
  542. trainingTimeHS: e.detail.value,
  543. });
  544. },
  545. // 是否需要会员
  546. freeRadioChange(e) {
  547. this.setData({
  548. isNeedVip: e.detail.value,
  549. });
  550. },
  551. // 推荐首页
  552. recommendRadioChange(e) {
  553. this.setData({
  554. isTop: e.detail.value,
  555. });
  556. },
  557. // 性别要求
  558. sexRadioChange(e) {
  559. this.setData({
  560. sexlimit: e.detail.value,
  561. });
  562. },
  563. changeAddress() {
  564. wx.chooseLocation({
  565. success: (res) => {
  566. console.log(res, 1111);
  567. wx.showLoading({
  568. title: "获取位置中...",
  569. });
  570. App._get(
  571. "store/getDetailsAddress",
  572. {
  573. lon: res.longitude,
  574. lat: res.latitude,
  575. },
  576. (result) => {
  577. if (result.code === 0) {
  578. wx.hideLoading();
  579. this.setData({
  580. address: result.data.street_number,
  581. coordinate: res.longitude + "," + res.latitude,
  582. });
  583. }
  584. }
  585. );
  586. },
  587. });
  588. // wx.navigateTo({
  589. // url: `/activity/map/map?lng=${this.data.lng}&lat=${this.data.lat}`,
  590. // })
  591. },
  592. uploadHandle(e) {
  593. let currentIndex = e.currentTarget.dataset.index;
  594. // if (this.data.list.length == 3) {
  595. // return false
  596. // }
  597. let _this = this;
  598. var tempFile;
  599. wx.showActionSheet({
  600. itemList: ["拍照上传", "从相册中选择"],
  601. success(res) {
  602. if (res.tapIndex === 0) {
  603. wx.chooseImage({
  604. count: 1,
  605. sizeType: ["original", "compressed"],
  606. sourceType: ["camera"],
  607. success(res) {
  608. wx.showLoading({
  609. title: "上传中...",
  610. });
  611. const tempFilePaths = res.tempFilePaths;
  612. wx.uploadFile({
  613. url: App.apiRoot + "file/upload",
  614. filePath: tempFilePaths[0],
  615. name: "file",
  616. success: function (res) {
  617. if (res.errMsg === "uploadFile:ok") {
  618. wx.hideLoading();
  619. wx.showToast({
  620. title: "上传成功",
  621. image: "",
  622. duration: 1500,
  623. mask: false,
  624. });
  625. let data = JSON.parse(res.data);
  626. if (currentIndex == 1) {
  627. _this.data.indexImg = data.data;
  628. _this.setData({
  629. indexImg: _this.data.indexImg,
  630. });
  631. } else {
  632. _this.data.qrCodePicture = data.data;
  633. _this.setData({
  634. qrCodePicture: _this.data.qrCodePicture,
  635. });
  636. }
  637. }
  638. },
  639. function() {
  640. wx.hideLoading();
  641. wx.showToast({
  642. title: "上传失败",
  643. icon: "none",
  644. image: "",
  645. duration: 1500,
  646. mask: false,
  647. });
  648. },
  649. });
  650. },
  651. });
  652. } else if (res.tapIndex === 1) {
  653. wx.chooseImage({
  654. count: 1,
  655. sizeType: ["original", "compressed"],
  656. sourceType: ["album"],
  657. success(res) {
  658. wx.showLoading({
  659. title: "上传中...",
  660. });
  661. const tempFilePaths = res.tempFilePaths;
  662. wx.uploadFile({
  663. url: App.apiRoot + "file/upload",
  664. filePath: tempFilePaths[0],
  665. name: "file",
  666. success: function (res) {
  667. if (res.errMsg === "uploadFile:ok") {
  668. wx.hideLoading();
  669. wx.showToast({
  670. title: "上传成功",
  671. image: "",
  672. duration: 1500,
  673. mask: false,
  674. });
  675. let data = JSON.parse(res.data);
  676. if (currentIndex == 1) {
  677. _this.data.indexImg = data.data;
  678. _this.setData({
  679. indexImg: _this.data.indexImg,
  680. });
  681. } else {
  682. _this.data.qrCodePicture = data.data;
  683. _this.setData({
  684. qrCodePicture: _this.data.qrCodePicture,
  685. });
  686. }
  687. }
  688. },
  689. function() {
  690. wx.hideLoading();
  691. wx.showToast({
  692. title: "上传失败",
  693. icon: "none",
  694. image: "",
  695. duration: 1500,
  696. mask: false,
  697. success: (result) => {},
  698. fail: () => {},
  699. complete: () => {},
  700. });
  701. },
  702. });
  703. },
  704. });
  705. }
  706. },
  707. fail(res) {},
  708. });
  709. },
  710. submit() {
  711. if (!this.data.clientId) {
  712. return util.alert("请先选择所属客户");
  713. }
  714. if (!this.data.title) {
  715. return util.alert("请先填写兼职标题");
  716. }
  717. if (!this.data.category) {
  718. return util.alert("请先选择兼职分类");
  719. }
  720. if (!this.data.type) {
  721. return util.alert("请先选择兼职类型");
  722. }
  723. if (!this.data.city || !this.data.area) {
  724. return util.alert("请先选择所属区域");
  725. }
  726. if (!this.data.address) {
  727. return util.alert("请先选择兼职地址");
  728. }
  729. if (!this.data.workdateStart || !this.data.workdateEnd) {
  730. return util.alert("请先选择工作日期");
  731. }
  732. if (!this.data.worktimeStart || !this.data.worktimeEnd) {
  733. return util.alert("请先选择工作时间");
  734. }
  735. if (!this.data.registrationDate || !this.data.registrationHS) {
  736. return util.alert("请先选择报名截止时间");
  737. }
  738. // if (this.data.registrationDate && this.data.workdateStart) {
  739. // let endTime = new Date(
  740. // this.data.registrationDate + " " + this.data.registrationHS
  741. // ).getTime();
  742. // let workTime = new Date(
  743. // this.data.workdateStart + " " + this.data.worktimeStart
  744. // ).getTime();
  745. // if (endTime >= workTime) {
  746. // return util.alert("报名截止时间不得大于工作时间");
  747. // }
  748. // }
  749. if (!this.data.meetingTimeDate || !this.data.meetingTimeHS) {
  750. return util.alert("请先选择集合时间");
  751. }
  752. if (!this.data.price) {
  753. return util.alert("请先填写工资价格");
  754. }
  755. if (!this.data.unit) {
  756. return util.alert("请先选择工资单位");
  757. }
  758. if (!this.data.heightlimit) {
  759. return util.alert("请先选择身高要求");
  760. }
  761. if (!this.data.willnum) {
  762. return util.alert("请先填写报名人数限制");
  763. }
  764. if (!this.data.indexImg) {
  765. return util.alert("请先上传兼职详情banner图");
  766. }
  767. if (!this.data.activityjs) {
  768. return util.alert("请先填写兼职介绍");
  769. }
  770. if (!this.data.activityyq) {
  771. return util.alert("请先填写兼职要求");
  772. }
  773. if (!this.data.activitysx) {
  774. return util.alert("请先填写注意事项");
  775. }
  776. if (!this.data.attention) {
  777. return util.alert("请先填写注意事项");
  778. }
  779. if (!this.data.qrCodePicture) {
  780. return util.alert("请先上传联系二维码图");
  781. }
  782. if (!this.data.contactInstructions) {
  783. return util.alert("请先填写联系说明");
  784. }
  785. wx.showLoading({
  786. title: "提交中,请稍后",
  787. });
  788. let list = [
  789. this.data.activityjs,
  790. this.data.activityyq,
  791. this.data.activitysx,
  792. ];
  793. let obj = {
  794. category: this.data.category,
  795. type: this.data.type,
  796. address: this.data.address,
  797. area: this.data.area,
  798. indexImg: this.data.indexImg,
  799. city: this.data.city,
  800. workAppletsDetailsList: list,
  801. coordinate: this.data.coordinate,
  802. workdateEnd: this.data.workdateEnd,
  803. worktimeEnd: this.data.worktimeEnd,
  804. isNeedVip: this.data.isNeedVip == 1 ? true : false,
  805. isTop: this.data.isTop,
  806. meetingTime: this.data.meetingTimeDate + " " + this.data.meetingTimeHS,
  807. price: this.data.price,
  808. unit: this.data.unit,
  809. cashMethod: this.data.cashMethod,
  810. sexlimit: this.data.sexlimit,
  811. province: this.data.province,
  812. registrationTime:
  813. this.data.registrationDate + " " + this.data.registrationHS,
  814. clientId: this.data.clientId,
  815. heightlimit: this.data.heightlimit,
  816. interviewTime: this.data.interviewTime + " " + this.data.interviewTimeHS,
  817. trainingTime: this.data.trainingTime + " " + this.data.trainingTimeHS,
  818. workdateStart: this.data.workdateStart,
  819. worktimeStart: this.data.worktimeStart,
  820. qrCodePicture: this.data.qrCodePicture,
  821. contactInstructions: this.data.contactInstructions,
  822. title: this.data.title,
  823. willnum: this.data.willnum,
  824. principal: this.data.principal,
  825. attention: this.data.attention,
  826. memberId: this.data.user.id,
  827. // is_applets_release 是否是小程序发布 1是 0否
  828. isAppletsRelease: 1,
  829. };
  830. wx.setStorageSync("workDetail", obj);
  831. wx.navigateTo({
  832. url: "/job/postJob/detail",
  833. });
  834. return false;
  835. // App._post_form('work/saveWork', '', obj, res => {
  836. // if (res.code === 0) {
  837. // wx.showToast({
  838. // title: '添加成功',
  839. // })
  840. // wx.removeStorageSync('workDetail')
  841. // }
  842. // }, err => {}, complete => {
  843. // setTimeout(() => {
  844. // wx.hideLoading()
  845. // }, 300)
  846. // })
  847. },
  848. /**
  849. * 生命周期函数--监听页面隐藏
  850. */
  851. onHide() {},
  852. /**
  853. * 生命周期函数--监听页面卸载
  854. */
  855. onUnload() {},
  856. /**
  857. * 页面相关事件处理函数--监听用户下拉动作
  858. */
  859. onPullDownRefresh() {},
  860. /**
  861. * 页面上拉触底事件的处理函数
  862. */
  863. onReachBottom() {},
  864. /**
  865. * 用户点击右上角分享
  866. */
  867. onShareAppMessage() {},
  868. });