| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- import {
- imgServerUrl,
- imgServerUrl_new
- } from '../../config/config.js'
- import {
- resumeBase,
- eduList,
- groupApply,
- positionApply
- } from '../../services/index.js'
- import {
- uploadImg
- } from '../../services/uploadFile.js'
- import {
- showToast
- } from '../../utils/tips.js'
- import {
- argusToTimestamp
- } from '../../utils/util.js'
- import {
- updataStorageData
- } from '../../utils/storage.js'
- const app = getApp();
- Page({
- data: {
- imgServerUrl: imgServerUrl,
- imgServerUrl_new: imgServerUrl_new,
- sex: ["男", "女"],
- sex_index: 0,
- eduList: ["请选择", "小学", "中学", "高中", "大专", "本科", "研究生", "博士", "博士后"],
- eduIndex: 1,
- avatar: '',
- headImg: '',
- name: '',
- year: '',
- iphone: '',
- hpUserResumeId: null
- },
- onLoad: function(options) {
- let {
- hpUserResumeId = null, progress = 0
- } = options
- this.setData({
- hpUserResumeId
- })
- this.setData({
- avatar: (app.globalData.userInfo && app.globalData.userInfo.avatarUrl) ? app.globalData.userInfo.avatarUrl : `${imgServerUrl}/images/avatar/man.png`,
- endDate: new Date().getFullYear(),
- year: '1993'
- })
- let phone = updataStorageData('phone')
- if (phone) {
- this.setData({
- iphone: phone
- })
- }
- if (hpUserResumeId) {
- let userResume = wx.getStorageSync('userResume')
- if (userResume.id) {
- this.setData({
- hpUserResumeId: userResume.id,
- avatar: userResume.headImg,
- name: userResume.realName,
- sex_index: userResume.gender == 1 ? 0 : 1,
- year: userResume.birthYear,
- iphone: userResume.phone,
- eduIndex: userResume.highestQualification ? Number(userResume.highestQualification) : 0
- })
- }
- }
- },
- //改变学历
- bindPickerChange(e) {
- console.log(e)
- let {
- value
- } = e.detail
- this.setData({
- eduIndex: value
- })
- },
- //改变性别
- bindSexChange(e) {
- console.log(e)
- let {
- value
- } = e.detail
- this.setData({
- sex_index: value
- })
- },
- //姓名改变
- changeName(e) {
- console.log(e)
- let {
- value
- } = e.detail
- this.setData({
- name: value.excludeSpecial().excludeSpace()
- })
- },
- //改变出生年月
- changeYear(e) {
- console.log(e)
- let {
- value
- } = e.detail
- this.setData({
- year: value
- })
- },
- //手机号改变
- changeIphone(e) {
- console.log(e)
- let {
- value
- } = e.detail
- this.setData({
- iphone: value.excludeSpecial().excludeSpace()
- })
- },
- //上传图片
- changeImg() {
- var up_type = '0';
- uploadImg(up_type).then(res => {
- let image = res.data.imgUrl
- this.setData({
- avatar: `${imgServerUrl_new}` + image,
- headImg: image
- })
- })
- },
- //验证
- check() {
- let {
- avatar,
- name,
- year,
- iphone
- } = this.data
- if (avatar == (imgServerUrl + "/images/avatar/man.png")) {
- showToast('请上传头像');
- return false;
- }
- if (name == "") {
- showToast('请输入用户名');
- return false;
- }
- if (this.data.iphone == "" || this.data.iphone.length != 11) {
- showToast('请输入11位手机号');
- return false;
- }
- return true
- },
- //保存
- submit() {
- let flag = this.check()
- if (!flag) {
- return
- }
- let {
- sex_index,
- eduIndex,
- avatar,
- headImg,
- name,
- year,
- iphone,
- hpUserResumeId
- } = this.data
- let paramsObj = {
- highestQualification: eduIndex,
- birthYear: year,
- gender: sex_index == 0 ? 1 : 2,
- realName: name,
- phone: iphone,
- avatar: headImg,
- user_id: app.globalData.userId,
- user_token: app.globalData.userToken
- }
- Object.assign(paramsObj);
- resumeBase(paramsObj).then(data => {
- showToast('保存成功', 'success');
- wx.setStorageSync("userResume", data.data.userResume);
- wx.navigateBack();
- })
- },
- onError(err) {
- app.aldstat.sendEvent('报错', {
- 'err': err
- });
- },
- })
|