| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- import {
- resumeIntent
- } from '../../services/index.js'
- import {
- imgServerUrl
- } from '../../config/config.js'
- import {
- showToast
- } from '../../utils/tips.js'
- let app = getApp()
- Page({
- data: {
- imgServerUrl: imgServerUrl,
- salaryList: [{
- "expectationSalary": null,
- "hightNum": '请选择'
- },
- {
- "expectationSalary": -1,
- "hightNum": '不限'
- },
- {
- "expectationSalary": 0,
- "hightNum": '1000~2000'
- },
- {
- "expectationSalary": 1,
- "hightNum": '2000~3000'
- },
- {
- "expectationSalary": 2,
- "hightNum": '3000~4000'
- },
- {
- "expectationSalary": 3,
- "hightNum": '4000~5000'
- },
- {
- "expectationSalary": 4,
- "hightNum": '5000~6000'
- },
- {
- "expectationSalary": 5,
- "hightNum": '6000~7000'
- },
- {
- "expectationSalary": 6,
- "hightNum": '7000~8000'
- },
- {
- "expectationSalary": 7,
- "hightNum": '8000~9000'
- },
- {
- "expectationSalary": 8,
- "hightNum": '9000~10000'
- }, {
- "expectationSalary": 9,
- "hightNum": '10000以上'
- }
- ],
- expectationPosition: [{ name: "普工" }, { name: "客服" }, { name: "销售" }, { name: "服务员" }, { name: "物流仓储" }, { name: "司机" }, { name: "才艺技能" }, { name: "文员助理" }, { name: "快递配送" }, { name: "促销导购" }, { name: "展会演出" }, { name: "家教培训" }, { name: "模特" }, { name: "贸易采购" }, { name: "厨师" }, { name: "编辑" }, { name: "线上推广" }, { name: "设计" }, { name: "技工" }, { name: "保洁" }, { name: "其它" }],
- region: {
- code: [],
- value: []
- }, //省市区
- name: '',
- expectationPositionIndex: [],
- salaryIndex: 0,
- hpUserIntentionId: '',
- hpUserResumeId: '',
- disabled: false,
- cover: true,
- position: true,
- address: true,
- salary: true
- },
- onLoad: function (options) {
- let {
- hpUserResumeId
- } = options
- this.setData({
- hpUserResumeId: hpUserResumeId
- })
- if (hpUserResumeId) {
- let userResume = wx.getStorageSync('userResume')
- let region = {
- code: [],
- value: []
- };
- let salaryIndex = 0;
- let expectationArray = [];
- const expectationPosition = this.data.expectationPosition;
- if (userResume && userResume.id) {
- if (userResume.expectationAddress) {
- region.code.push(userResume.expectationProvinceId);
- region.code.push(userResume.expectationCityId);
- region.code.push(userResume.expectationCountryId);
- let arr = userResume.expectationAddress.split("-");
- for (let i = 0; i < arr.length; i++) {
- region.value.push(arr[i]);
- }
- }
- if (userResume.expectationPosition) {
- expectationArray = userResume.expectationPosition.split(',');
- let lengthSalary = this.data.salaryList.length;
- for (let i = 0; i < lengthSalary; i++) {
- if (userResume.expectationSalary == this.data.salaryList[i].hightNum) {
- salaryIndex = i;
- }
- }
- expectationArray.forEach(value => {
- if(value){
- expectationPosition[value].active = true
- }
- })
- }
- this.setData({
- hpUserResumeId: userResume.id,
- expectationPositionIndex: expectationArray,
- salaryIndex: salaryIndex,
- region,
- expectationPosition
- }, _ => {
- this.check()
- })
- }
- }
- },
- changeSalary() {
- this.setData({
- cover: false,
- salary: false
- })
- },
- changeCover(e) {
- const { type } = e.currentTarget.dataset;
- if (type) {
- this.setData({
- [type]: !this.data[type]
- })
- } else {
- this.setData({
- position: true,
- address: true,
- salary: true
- })
- }
- this.setData({
- cover: !this.data.cover
- })
- },
- //改变薪资水平
- bindSalaryChange(e) {
- this.setData({
- salaryIndex: e.detail.value
- }, _ => {
- this.check()
- })
- },
- //改变期望岗位
- changeName(e) {
- const { index } = e.currentTarget.dataset;
- let expectationPositionIndex = this.data.expectationPositionIndex;
- const expectationPosition = this.data.expectationPosition;
- if (expectationPosition[index].active) {
- expectationPosition[index].active = false;
- const _index = expectationPositionIndex.findIndex(value => {
- return Number(value) === index;
- })
- expectationPositionIndex.splice(_index, 1)
- } else {
- expectationPosition[index].active = true;
- expectationPositionIndex.push(index)
- }
- expectationPositionIndex.forEach((value, index) => {
- if (!value && value !== 0) {
- expectationPositionIndex.splice(index, 1)
- }
- })
- this.setData({
- expectationPositionIndex: expectationPositionIndex,
- expectationPosition
- }, _ => {
- this.check()
- })
- },
- //改变期望地点
- bindRegionChange() {
- // console.log('picker发送选择改变,携带值为', e.detail)
- // this.data.region.code = e.detail.code;
- // this.data.region.value = e.detail.value;
- // this.setData({
- // region: this.data.region
- // }, _ => {
- // this.check()
- // })
- wx.navigateTo({
- url: `/pages/choose-city/index?title=期望地点&®ion=${JSON.stringify(this.data.region)}`,
- })
- },
- //提交
- submit() {
- let flag = this.check(true)
- if (!flag) {
- return
- }
- let {
- expectationPositionIndex,
- salaryIndex,
- region,
- salaryList
- } = this.data
- let paramsObj = {
- expectationPosition: expectationPositionIndex.join(','),
- expectationSalary: salaryList[salaryIndex].expectationSalary,
- expectationProvinceId: region.code[0],
- expectationCityId: region.code[1],
- expectationCountryId: region.code[2],
- expectationAddress: region.value[0] + '-' + region.value[1] + '-' + region.value[2],
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken,
- member_id: app.globalData.memberId
- }
- Object.assign(paramsObj);
- resumeIntent(paramsObj).then(data => {
- showToast('保存成功', 'success')
- wx.navigateBack()
- })
- },
- //验证
- check(status = false) {
- let {
- region,
- salaryList,
- salaryIndex
- } = this.data;
- this.setData({
- disabled: false
- })
- if (salaryList[salaryIndex].expectationSalary == null) {
- status && showToast('请选择期望薪资');
- return false
- }
- if (region.value.length == 0) {
- status && showToast('请选择期望地点');
- return false
- }
- this.setData({
- disabled: true
- })
- return true
- }
- })
|