Selaa lähdekoodia

feat(招聘小程序) 接口对接

xing.li 4 vuotta sitten
vanhempi
commit
d94f47a1d2

+ 57 - 0
api/recruit.js

@@ -0,0 +1,57 @@
+import request from '../utils/request.js'
+
+class recruit extends request {
+
+  static async getRecruitList(name = '', type = 1, page = 1, pageSize = 10) {
+    var data = {
+      page: page,
+      pageSize: pageSize,
+      name: name,
+      type: type,
+    }
+    const res = await this.postRequest(`${this.BASE_URL}open/recruit/list-recruit`, data)
+
+    return res.data
+  }
+  static async getRecruitInfo(id) {
+    var data = {
+      id: id
+    }
+    const res = await this.postRequest(`${this.BASE_URL}open/recruit/info-recruit`, data)
+    return res.data;
+  }
+  static async getRecruitLikeInfo(id,openid) {
+    var data = {
+      recruitsId: id,
+      openid: openid,
+    }
+    const res = await this.postRequest(`${this.BASE_URL}open/recruit/info-like-recruit`, data)
+    return res.data;
+  }
+  
+
+  static async collectionRecruit(openId,recruitsId) {
+    var data = {
+      openid: openId,
+      recruitsId: recruitsId
+    }
+    const res = await this.postRequest(`${this.BASE_URL}open/recruit/collection-recruit`, data)
+    return res.data;
+  }
+  static async saveUser(data) {
+    const res = await this.postRequest(`${this.BASE_URL}open/recruit/save-user`, data)
+    return res.data;
+  }
+  static async loginUser(data) {
+    const res = await this.postRequest(`${this.BASE_URL}open/recruit/login-user`, data)
+    return res.data;
+  }
+
+  static async infoUser(data) {
+    const res = await this.postRequest(`${this.BASE_URL}open/recruit/info-user`, data)
+    return res.data;
+  }
+
+}
+
+export default recruit

+ 61 - 13
app.js

@@ -1,19 +1,67 @@
 // app.js
+import { default as recruitApi } from "./api/recruit"
 App({
-  onLaunch() {
-    // 展示本地存储能力
-    const logs = wx.getStorageSync('logs') || []
-    logs.unshift(Date.now())
-    wx.setStorageSync('logs', logs)
-
-    // 登录
-    wx.login({
-      success: res => {
-        // 发送 res.code 到后台换取 openId, sessionKey, unionId
-      }
-    })
+  onLaunch:async function() {
+    var openId = wx.getStorageSync('openId')
+    if(openId){
+        await this.setUserInfo(openId)
+    }
   },
   globalData: {
     userInfo: null
-  }
+  },
+  getWxUserInfo: async function(){
+    if (!this.globalData.openId){
+      try {
+        let userInfo = wx.getStorageSync({key: 'userInfo'})
+        return userInfo.data
+      } catch (error) {
+        console.log('缓存中没有用户信息')
+        return null
+      }
+    }else {
+      return this.globalData.userInfo
+    }
+  },
+  isAuth: async function(){
+    if (!wx.getStorageSync('openId')){
+      console.log('您还没有授权');
+      return false;
+    }
+    return true;
+  },
+  wxLogin:async function(data){
+   
+    if (!data){
+      console.log('你还没有授权')
+      return
+    }
+    let res = await wx.login()
+
+    if (!res.code){
+      return
+    }
+    var params = {}
+    params['code'] = res.code
+    params['nickName'] = data.nickName
+    params['headerImg'] = data.avatarUrl
+    let openId =  await recruitApi.loginUser(params)
+    wx.setStorageSync('openId', openId);
+    var params = {}
+    params['openid'] = openId;
+    var info =  await recruitApi.infoUser(params);
+    this.globalData.userInfo = info 
+    return info
+
+  },
+    setUserInfo: async function(openId){
+      if(openId){
+        var params = {}
+        params['openid'] = openId;
+        var info =  await recruitApi.infoUser(params);
+        this.globalData.userInfo = info 
+        console.log(this.globalData.userInfo);
+      }
+     
+  },
 })

+ 27 - 24
pages/person/person.js

@@ -1,5 +1,5 @@
-// pages/person/person.js
-// const app = getApp()
+
+const app = getApp()
 Page({
 
   /**
@@ -19,7 +19,6 @@ Page({
     //   this.setData({
     //     userInfo: userInfo,
     //     hasUserInfo: true,
-    //     hasMobile: userInfo.mobile ? true : false
     //   })
     // }
   },
@@ -34,14 +33,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: async function () {
-    // let userInfo = await app.getWxUserInfo()
-    // if (userInfo) {
-    //   this.setData({
-    //     userInfo: userInfo,
-    //     hasUserInfo: true,
-    //     hasMobile: userInfo.mobile ? true : false
-    //   })
-    // }
+   
   },
 
   /**
@@ -79,19 +71,30 @@ Page({
 
   },
   getInfo: async function (e) {
-    const _self = this
-    let userInfo = e.detail.userInfo
-    userInfo['encryptedData'] = e.detail.encryptedData
-    userInfo['iv'] = e.detail.iv
-    let info = await app.wxLogin(userInfo);
-    let hasMobile = false;
-    if (info.mobile) {
-      hasMobile = true
-    }
-    _self.setData({
-      hasUserInfo: true,
-      userInfo: info,
-      hasMobile: hasMobile,
+    // const _self = this
+    // let userInfo = e.detail.userInfo
+    // console.log(userInfo);
+    // userInfo['encryptedData'] = e.detail.encryptedData
+    // userInfo['iv'] = e.detail.iv
+    // let info = await app.wxLogin(userInfo);
+    // _self.setData({
+    //   hasUserInfo: true,
+    //   userInfo: info,
+    // })
+  },
+  getUserProfile: function(e){
+    wx.getUserProfile({
+      desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+      success: (res) => {
+        console.log(res);
+        // res.userInfo['encryptedData'] = res.encryptedData
+        // res.userInfo['iv'] = res.iv
+        let info = app.wxLogin(res.userInfo);
+        this.setData({
+          userInfo: res.userInfo,
+          hasUserInfo: true
+        })
+      }
     })
   },
   gotoCollection: async function (e) {

+ 6 - 6
pages/person/person.wxml

@@ -3,22 +3,22 @@
 <view class="container">
     <view class="person card" wx:if="{{hasUserInfo}}" bindtap = "gotoPersonInfo">
         <view class="person-info">
-            <view class="user-name f18 c-202020" bindtap = "gotoPersonInfo">{{userInfo.name}}
-                <image class="next" src="../../images/icons/next.png" >
-                </image>
+            <view class="user-name f18 c-202020" bindtap = "gotoPersonInfo">{{userInfo.nickName}}
+                <!-- <image class="next" src="../../images/icons/next.png" >
+                </image> -->
             </view>
             <view class="tel c-707070 fw300">{{userInfo.mobile}}</view>
-            <button open-type="getPhoneNumber" catchgetphonenumber="getMobile" class="login-btn" wx:if="{{!userInfo.mobile}}" >获取手机号</button>
+            <!-- <button open-type="getPhoneNumber" catchgetphonenumber="getMobile" class="login-btn" wx:if="{{!userInfo.mobile}}" >获取手机号</button> -->
         </view>
         <view class="head-img">
-            <image class="" src="{{userInfo.avatar}}">
+            <image class="" src="{{userInfo.avatarUrl}}">
             </image>
         </view>
     </view>
     <view wx:else class="user-login">
         <view class="person-info">
             <view class="user-name f18 c-202020">
-                <button open-type="getUserInfo" bindgetuserinfo="getInfo" class="login-btn"
+                <button bindtap="getUserProfile" class="login-btn"
             style="height: 100px;width: 200px;">请点击登录</button>
                 <image class="next" src="../../images/icons/next.png">
                 </image>

+ 10 - 44
pages/prompt/prompt.js

@@ -15,27 +15,15 @@ Page({
   onLoad: async function (options) {
     console.log(options)
     let page = options.page
-    if (options.page === 'pages/appointment/appointment') {
-      page = `${page}?shopId=${options.shopId}&productId=${options.productId}`
-    }
-    if(options.storeId && options.tableId){
-      this.setData({
-        storeId: options.storeId,
-        tableId: options.tableId,
-      })
+    if (options.page == 'pages/recruitInfo/recruitInfo') {
+      page = `${page}?id=${options.id}`
     }
+
+   
     this.setData({
       fromPage: page
     })
-    let userInfo = await app.getWxUserInfo()
-    console.log(userInfo);
-    if (userInfo){
-      this.setData({
-        userInfo: userInfo,
-        hasUserInfo: true,
-        hasMobile: userInfo.mobile ? true : false
-      })
-    }
+   
   },
 
   /**
@@ -92,44 +80,22 @@ Page({
     userInfo['encryptedData'] = e.detail.encryptedData
     userInfo['iv'] = e.detail.iv
     let info = await app.wxLogin(userInfo);
-    let hasMobile = false;
-    if (info.mobile){
-      hasMobile = true
-    }
+   
     _self.setData({
       hasUserInfo: true,
       userInfo: info,
-      hasMobile: hasMobile,
     })
 
-    if(_self.data.fromPage=="pages/personorder/personorder"){
+    if(_self.data.fromPage=="pages/sociology/sociology" || _self.data.fromPage=="pages/school/school"){
       wx.switchTab({
         url: '/'+_self.data.fromPage,
       })
-      return;
-    }/* else{
+    }else{
       wx.redirectTo({
         url: '/'+_self.data.fromPage,
       })
-    } */
-    if(_self.data.fromPage=="pages/comments/comments"){
-      wx.redirectTo({
-        url: '../comments/comments?title=我的评论&commentstype=my',
-      })
-      return;
-    }
-
-    if(_self.data.fromPage=="pages/food/food"){
-      wx.redirectTo({
-        url: '/'+_self.data.fromPage+"?tableId="+this.data.tableId+"&storeId="+this.data.storeId,
-      })
-      return;
-    }
-
-    wx.redirectTo({
-      url: '/'+_self.data.fromPage,
-    })
-
+    } 
+  
     console.log(_self.data.fromPage)
    
   }

+ 3 - 1
pages/prompt/prompt.json

@@ -1,3 +1,5 @@
 {
-  "usingComponents": {}
+  "usingComponents": {},
+  "navigationBarTitleText": "首页"
+  
 }

+ 1 - 0
pages/prompt/prompt.wxss

@@ -59,4 +59,5 @@
 .container .confirm > button {
   width: 100%;
   font-weight: 400;
+  background-color: #1296db;
 }

+ 46 - 10
pages/recruitInfo/recruitInfo.js

@@ -1,18 +1,26 @@
-// pages/recruitInfo/recruitInfo.js
+import recruitApi from '../../api/recruit'
+const app = getApp()
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-    imgUrl:'/images/icons/like_no.png'
+    imgUrl:'/images/icons/like_no.png',
+    recruitInfo:[],
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
-  onLoad: function (options) {
-
+  onLoad: async function (options) {
+    console.log(options)
+    this.setData({
+      id:options.id
+    })
+    await this.getRecruitInfo(options.id)
+   
+     
   },
 
   /**
@@ -26,7 +34,10 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    var openid = wx.getStorageSync('openId');
+    if(openid){
+      this.getRecruitLikeInfo(openid);
+    }
   },
 
   /**
@@ -69,17 +80,25 @@ Page({
 
 
   },
-  saveLike:function(){
+  saveLike: async function(){
+    const isAuth = await app.isAuth()
+    if (!isAuth) {
+      wx.redirectTo({
+        url: '/pages/prompt/prompt?page=' + this.route+"&id="+this.data.id,
+      })
+      return
+    }
+    var id  = this.data.id;
+    var openid = wx.getStorageSync('openId');
+    var result = await recruitApi.collectionRecruit(openid,id);
     var imgUrl =  '/images/icons/like_no.png';
-    if(this.data.imgUrl =='/images/icons/like_no.png'){
+    if(result.isDelete !=1){
       imgUrl = '/images/icons/like_yes.png';
-   
       wx.showToast({
         title: '已收藏',
         image:imgUrl,
         duration: 2000
       })
-    
     }
     this.setData({
       imgUrl:imgUrl
@@ -104,6 +123,23 @@ Page({
         }
       }
     })
+  },
+  getRecruitInfo: async function(id) {
+    var result = await recruitApi.getRecruitInfo(id);
+    this.setData({
+      recruitInfo:result
+    })
+  },
+  getRecruitLikeInfo: async function(openid) {
+    var id =  this.data.id;
+    var result = await recruitApi.getRecruitLikeInfo(id,openid);
+    var imgUrl =  '/images/icons/like_no.png';
+    if(result){
+       imgUrl =  '/images/icons/like_yes.png';
+    }
+    this.setData({
+      imgUrl:imgUrl
+    })
   }
-
+  
 })

+ 11 - 15
pages/recruitInfo/recruitInfo.wxml

@@ -3,28 +3,28 @@
 <view class="content" >
   <view class="info">
       <view class="info_top">
-        <view class="info_top_left">拓展顾问</view>
-        <view class="info_top_right">6001-8000</view>
+        <view class="info_top_left">{{recruitInfo.name}}</view>
+        <view class="info_top_right">{{recruitInfo.salary}}</view>
       </view>
       <view class="info_mid">
         <view class="info_mid_left">
-          <view>萧山区|</view>
-          <view>2年|</view>
-          <view>大专</view>
+          <view>{{recruitInfo.workArea}}|</view>
+          <view>{{recruitInfo.workingHours}}|</view>
+          <view>{{recruitInfo.education}}</view>
         </view>
-        <view class="info_mid_right">2020-12-01</view>
+        <view class="info_mid_right">{{recruitInfo.releaseTime}}</view>
       </view>
       <view class="info_bottom">
         <view class="info_bottom_1">需求部门:</view>
-        <view class="info_bottom_2">拓展部</view>
+        <view class="info_bottom_2">{{recruitInfo.demandDepartment}}</view>
       </view>
       <view class="info_bottom">
         <view class="info_bottom_1">截至时间:</view>
-        <view class="info_bottom_2">2021-05-09</view>
+        <view class="info_bottom_2">{{recruitInfo.deadline}}</view>
       </view>
       <view class="info_bottom">
         <view class="info_bottom_1">招聘人数:</view>
-        <view class="info_bottom_2">13</view>
+        <view class="info_bottom_2">{{recruitInfo.recruitsNumber}}</view>
       </view>
     </view>
   <view class="duty">
@@ -33,10 +33,7 @@
       <view class="duty_top_r">工作职责</view>
     </view>
     <view class="duty_desc">
-      1.负责品牌在大众点评美团口碑等团购平台的运营推广工作;
-      2.负责平台内容运营,提升品牌线上形象塑造及产品管理与爆款打造能力;
-      3.协助上级通过日常活动策划,客户维护互动等,提高粉丝活跃度和粘性,提高好评数与好评率并评估转化效果;
-      4.及时关注评价,定期做数据报表。
+      {{recruitInfo.duty}}
     </view>
   </view>
 
@@ -46,8 +43,7 @@
       <view class="duty_top_r">任职资格</view>
     </view>
     <view class="duty_desc">
-      1、大专及以上学历,工商管理、市场营销等商科专业优先; 2、2-5年工作经验,熟悉连锁餐饮、茶饮、零售、生鲜拓展模式优先;3、具有良好的系统思维、学习创新能力、市场洞察能力、语言表达能力、分析判断和决策能力;
-      4、具有C1驾照,身体状况良好,适应长期出差。
+    {{recruitInfo.qualifications}}
     </view>
   </view>
 

+ 1 - 1
pages/recruitInfo/recruitInfo.wxss

@@ -58,7 +58,7 @@ Page {
   color: #b0b4ca;
 }
 .info_bottom_2{
-  font-size: 28rpx;
+  font-size: 12px;
   margin-left: 10rpx;
 }
 

+ 154 - 25
pages/resume/resume.js

@@ -1,4 +1,5 @@
-// pages/resume/resume.js
+import recruitApi from '../../api/recruit'
+const app = getApp()
 Page({
 
   /**
@@ -6,21 +7,38 @@ Page({
    */
   data: {
     endDate:'',
-    birth:'1990-01-01',
-    date:'',
-    sex: 0,
+    // birth:'1990-01-01',
+    // date:'1990-01-01',
+    // sex: 0,
     array: ["保密", "男", "女"],
-    educationArray: ["小学", "初中", "高中","中技(中专、技校、职高)","大专","本科","硕士研究生","MBA","博士研究生"],
-    educationIndex: 0,
-    schoolTypeArray: ["","全国普通高等院校非全日制","全国普通高等院校全日制", "成人高等教育", "统招专升本","自学考试","非统招专升本","海外留学生"],
-    schoolTypeIndex: 0,
+    educationArray: ["小学", "初中", "高中","中技(中专、技校、职高)","大专","本科","硕士研究生","MBA","博士研究生","保密"],
+    // highestEducation: 0,
+    schoolTypeArray: ["","全国普通高等院校非全日制","全国普通高等院校全日制", "成人高等教育", "统招专升本","其他","自学考试","非统招专升本","海外留学生"],
+    // learningModality: 0,
     statusArray: ["","正在主动找工作","可以考虑工作机会", "目前不想找工作"],
-    statusIndex: 0,
-    moneyArray: ["","1000以下","1000-2000", "2001-4000", "4001-6000","6001-8000","8001-10000","10001-15000","15001-25000","25001-30000","30001-50000","50001-70000","70001-100000","100001以上","面议"],
-    nowMoneyIndex:0,
-    expectMoneyIndex:0,
+    // jobStatus: 0,
+    moneyArray: ["","1000以下","1000-2000", "2001-4000", "4001-6000","6001-8000","8001-10000","10001-15000","15001-25000","25001-30000","30001-50000","50001以上","面议"],
+    // nowMoneyIndex:0,
+    // expectMoneyIndex:0,
     type:1,//1保存简历  2保存简历+投递简历)
-    saveTitle:'保存'
+    saveTitle:'保存',
+    
+    name:'',
+    emali:'',
+    mobile:'',
+    birthday:'1990-01-01',
+    sex:0,
+    nowAddress:'',
+    registeredAddress:'',
+    highestEducation:0,
+    learningModality:0,
+    takeProfessionally:'',
+    jobStatus:0,
+    hopeProfessionally:'',
+    nowSalary:0,
+    hopeSalary:0,
+    resumeFile:'',
+    resumeFileName:'在微信聊天中选择附件',
   },
 
   /**
@@ -43,7 +61,8 @@ Page({
     var d = new Date();
     var endDate = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
     this.setData({
-      endDate
+      endDate:endDate,
+      type:options.type,
     })
   },
 
@@ -57,9 +76,17 @@ Page({
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function () {
- 
-
+  onShow: async function () {
+    const isAuth = await app.isAuth()
+    if (!isAuth) {
+      wx.redirectTo({
+        url: '/pages/prompt/prompt?page=' + this.route+"?type="+this.data.type,
+      })
+      return
+    }
+    
+    var openId = wx.getStorageSync("openId")
+    await this.getUserInfo(openId);
   },
 
   /**
@@ -98,38 +125,140 @@ Page({
   },
   changeBirth: function (e) {
     this.setData({
-      birth: e.detail.value
+      birthday: e.detail.value
     })
   },
   changeSex: function (e) {
-    console.log(e.detail)
+    
     this.setData({
       sex: e.detail.value
     })
   },
   changeEducation: function (e) {
-    console.log(e.detail)
     this.setData({
-      educationIndex: e.detail.value
+      highestEducation: e.detail.value
     })
   },
 
   changeSchoolType: function (e) {
    
     this.setData({
-     schoolTypeIndex: e.detail.value
+      learningModality: e.detail.value
+    })
+  },
+  changeStatus:function(e){
+    this.setData({
+      jobStatus: e.detail.value
+    })
+  },
+  changeNowMoney:function(e){
+    this.setData({
+      nowSalary: e.detail.value
+    })
+  },
+  changeExpectMoney:function(e){
+    this.setData({
+      hopeSalary: e.detail.value
     })
   },
-
   chooseEnclosure:function(){
+    var self =this;
     wx.chooseMessageFile({
-      count: 10,
+      count: 1,
       type: 'file',
       success (res) {
         // tempFilePath可以作为img标签的src属性显示图片
-        const tempFilePaths = res.tempFiles  
+        console.log(res.tempFiles);
+        self.setData({
+          resumeFile:res.tempFiles[0].path,
+          resumeFileName:res.tempFiles[0].name
+        })
         }
     })
+  },
+  getUserInfo: async function(openId) {
+   
+    var params = {}
+    params['openid'] = openId;
+    var info =   await recruitApi.infoUser(params);
+    console.log(info);
+    if(info.birthday){
+        this.setData({
+          birthday:info.birthday,
+        })
+    }
+
+    var highestEducation = info.highestEducation?info.highestEducation:0;
+    var jobStatus = info.jobStatus?info.jobStatus:0;
+    var nowSalary = info.nowSalary?info.nowSalary:0;
+    var hopeSalary = info.hopeSalary?info.hopeSalary:0;
+    var learningModality = info.learningModality?info.learningModality:0;
+    var birthday = info.birthday?info.birthday:'1990-01-01';
+    this.setData({
+      name:info.name,
+      email:info.email,
+      mobile:info.mobile,
+      sex:info.sex,
+      birthday:birthday,
+      nowAddress:info.nowAddress,
+      registeredAddress:info.registeredAddress,
+      highestEducation:highestEducation,
+      learningModality:learningModality,
+      takeProfessionally:info.takeProfessionally,
+      jobStatus:jobStatus,
+      hopeProfessionally:info.hopeProfessionally,
+      nowSalary:nowSalary,
+      hopeSalary:hopeSalary,
+      resumeFile:info.resumeFile,
+    })
+  },
+  saveResume: function(){
+    if(!this.data.name){
+      wx.showToast({
+        title: '请输入姓名',
+        icon: 'none',
+        duration: 1000
+      })
+      return;
+    }
+
+    if(!this.data.email){
+      wx.showToast({
+        title: '请输入邮箱',
+        icon: 'none',
+        duration: 1000
+      })
+      return;
+    }
+
+    if(!this.data.resumeFile){
+      wx.showToast({
+        title: '请上传附件',
+        icon: 'none',
+        duration: 1000
+      })
+      return;
+    }
+   
+    var params = {
+      name:this.data.name,
+      email:this.data.email,
+      mobile:this.data.mobile,
+      birthday:this.data.birthday,
+      sex:this.data.sex,
+      nowAddress:this.data.nowAddress,
+      registeredAddress:this.data.registeredAddress,
+      highestEducation:this.data.highestEducation,
+      learningModality:this.data.learningModality,
+      takeProfessionally:this.data.takeProfessionally,
+      jobStatus:this.data.jobStatus,
+      hopeProfessionally:this.data.hopeProfessionally,
+      nowSalary:this.data.nowSalary,
+      hopeSalary:this.data.hopeSalary,
+      resumeFile:this.data.resumeFile,
+    };
+    var res = recruitApi.saveUser(params);
+    console.log(res);
   }
   
 })

+ 23 - 23
pages/resume/resume.wxml

@@ -6,7 +6,7 @@
       <view class="info_left_1">*</view>
       <view class="info_left_2">姓名</view>
     </view>
-    <input type="text" class="info_right" maxlength="50" placeholder="请输入姓名" placeholder-class="placeholder"/>
+    <input type="text" class="info_right" maxlength="50" placeholder="请输入姓名" placeholder-class="placeholder" value="{{name}}"/>
   </view>
 
   <view class="info">
@@ -14,7 +14,7 @@
       <view class="info_left_1">*</view>
       <view class="info_left_2">邮箱</view>
     </view>
-    <input type="text" class="info_right" maxlength="50" placeholder="请输入邮箱" placeholder-class="placeholder"/>
+    <input type="text" class="info_right" maxlength="50" placeholder="请输入邮箱" placeholder-class="placeholder" value="{{email}}"/>
   </view>
 
   <view class="info">
@@ -22,7 +22,7 @@
       <view class="info_left_1">*</view>
       <view class="info_left_2">手机号</view>
     </view>
-    <input type="number" class="info_right" maxlength="50" placeholder="请输入手机号" placeholder-class="placeholder"/>
+    <input type="number" class="info_right" maxlength="50" placeholder="请输入手机号" placeholder-class="placeholder" value="{{mobile}}"/>
   </view>
 
   <view class="info">
@@ -30,8 +30,8 @@
       <view class="info_left_1">*</view>
       <view class="info_left_2">出生日期</view>
     </view>
-    <picker mode="date"  class="info_right_picker" value="{{date}}" start="1970-01-01" end="{{endDate}}" bindchange="changeBirth">
-                {{birth}}
+    <picker mode="date"  class="info_right_picker" value="{{birthday}}" start="1970-01-01" end="{{endDate}}" bindchange="changeBirth">
+                {{birthday}}
     </picker>
     <image class="next-gray" src="../../images/icons/next-gray.png">
         </image>
@@ -54,7 +54,7 @@
       <view class="info_left_1"></view>
       <view class="info_left_2">居住地</view>
     </view>
-    <input  class="info_right"   placeholder="例:浙江省杭州市萧山区" maxlength="250" placeholder-class="placeholder" />
+    <input  class="info_right"   placeholder="例:浙江省杭州市萧山区" maxlength="250" placeholder-class="placeholder" value="{{nowAddress}}"/>
   </view>
 
   <view class="info" >
@@ -62,7 +62,7 @@
       <view class="info_left_1"></view>
       <view class="info_left_2">户口所在地</view>
     </view>
-    <input  class="info_right"   placeholder="例:安徽省合肥市蜀山区" maxlength="250" placeholder-class="placeholder" />
+    <input  class="info_right"   placeholder="例:安徽省合肥市蜀山区" maxlength="250" placeholder-class="placeholder" value="{{registeredAddress}}"/>
   </view>
 
   <view class="info">
@@ -70,8 +70,8 @@
       <view class="info_left_1">*</view>
       <view class="info_left_2">最高学历</view>
     </view>
-    <picker class="info_right_picker" value="{{educationIndex}}" range="{{educationArray}}" bindchange="changeEducation">
-                {{educationArray[educationIndex]}}
+    <picker class="info_right_picker" value="{{highestEducation}}"  range="{{educationArray}}" bindchange="changeEducation">
+                {{educationArray[highestEducation]}}
         </picker>
         <image class="next-gray" src="../../images/icons/next-gray.png">
         </image>
@@ -82,27 +82,27 @@
       <view class="info_left_1"></view>
       <view class="info_left_2">学习形式</view>
     </view>
-    <picker class="info_right_picker" value="{{schoolTypeIndex}}" range="{{schoolTypeArray}}" bindchange="changeSchoolType">
-      <view class="info_right_picker_v">{{schoolTypeArray[schoolTypeIndex]}}</view>
+    <picker class="info_right_picker" value="{{learningModality}}" range="{{schoolTypeArray}}" bindchange="changeSchoolType">
+      <view class="info_right_picker_v">{{schoolTypeArray[learningModality]}}</view>
         </picker>
         <image class="next-gray" src="../../images/icons/next-gray.png">
         </image>
   </view>
 
-  <view class="info" >
+  <!-- <view class="info" >
     <view class="info_left">
       <view class="info_left_1"></view>
       <view class="info_left_2">民族</view>
     </view>
     <input  class="info_right"   placeholder="请输入民族" placeholder-class="placeholder" maxlength="50"/>
-  </view>
+  </view> -->
 
   <view class="info" >
     <view class="info_left">
       <view class="info_left_1"></view>
       <view class="info_left_2">当前职业</view>
     </view>
-    <input  class="info_right"   placeholder="请输入当前职业" placeholder-class="placeholder" maxlength="50" />
+    <input  class="info_right"   placeholder="请输入当前职业" placeholder-class="placeholder" maxlength="50" value="{{takeProfessionally}}"/>
   </view>
 
   <view class="info">
@@ -110,9 +110,9 @@
       <view class="info_left_1"></view>
       <view class="info_left_2">求职状态</view>
     </view>
-    <picker class="info_right_picker" value="{{statusIndex}}" range="{{statusArray}}" bindchange="changeStatus">
+    <picker class="info_right_picker" value="{{jobStatus}}" range="{{statusArray}}" bindchange="changeStatus">
                
-                <view class="info_right_picker_v">  {{statusArray[statusIndex]}}</view>
+                <view class="info_right_picker_v">  {{statusArray[jobStatus]}}</view>
         </picker>
         <image class="next-gray" src="../../images/icons/next-gray.png">
         </image>
@@ -123,7 +123,7 @@
       <view class="info_left_1"></view>
       <view class="info_left_2">期望从事职业</view>
     </view>
-    <input  class="info_right"   placeholder="请输入期望从事职业" placeholder-class="placeholder" maxlength="50"/>
+    <input  class="info_right"   placeholder="请输入期望从事职业" placeholder-class="placeholder" maxlength="50" value="{{hopeProfessionally}}"/>
   </view>
 
   <view class="info">
@@ -131,9 +131,9 @@
       <view class="info_left_1"></view>
       <view class="info_left_2">现在税前月薪</view>
     </view>
-    <picker class="info_right_picker" value="{{nowMoneyIndex}}" range="{{moneyArray}}" bindchange="changeNowMoney">
+    <picker class="info_right_picker" value="{{nowSalary}}" range="{{moneyArray}}" bindchange="changeNowMoney">
                
-                <view class="info_right_picker_v"> {{moneyArray[nowMoneyIndex]}}</view>
+                <view class="info_right_picker_v"> {{moneyArray[nowSalary]}}</view>
         </picker>
         <image class="next-gray" src="../../images/icons/next-gray.png">
         </image>
@@ -144,9 +144,9 @@
       <view class="info_left_1"></view>
       <view class="info_left_2">期望税前月薪</view>
     </view>
-    <picker class="info_right_picker" value="{{expectMoneyIndex}}" range="{{moneyArray}}" bindchange="changeExpectMoney">
+    <picker class="info_right_picker" value="{{hopeSalary}}" range="{{moneyArray}}" bindchange="changeExpectMoney">
                
-                <view class="info_right_picker_v"> {{moneyArray[expectMoneyIndex]}}</view>
+                <view class="info_right_picker_v"> {{moneyArray[hopeSalary]}}</view>
         </picker>
         <image class="next-gray" src="../../images/icons/next-gray.png">
         </image>
@@ -157,11 +157,11 @@
       <view class="info_left_1">*</view>
       <view class="info_left_2">简历附件</view>
     </view>
-    <view  class="info_right placeholder"   bindtap="chooseEnclosure" >在微信聊天中选择附件</view>
+    <view  class="info_right placeholder"   bindtap="chooseEnclosure" >{{resumeFileName}}</view>
   </view>
 
   <view class="bottom">
-    <view class="save">{{saveTitle}}</view>
+    <view class="save" bindtap="saveResume">{{saveTitle}}</view>
     
   </view>
 </view>

+ 40 - 5
pages/sociology/sociology.js

@@ -1,18 +1,21 @@
-// pages/sociology/sociology.js
+
+import recruitApi from '../../api/recruit'
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-
+    recruitList:[],
+    showClear:false,
+    searchinput:''
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+        this.getRecruitList();
   },
 
   /**
@@ -63,9 +66,41 @@ Page({
   onShareAppMessage: function () {
 
   },
-  goToInfo:function(){
+  goToInfo:function(e){
+    var id = e.currentTarget.dataset.id;
     wx.navigateTo({
-      url: '../recruitInfo/recruitInfo'
+      url: '../recruitInfo/recruitInfo?id='+id
+    })
+  },
+  getRecruitList: async function(name='') {
+    var result = await recruitApi.getRecruitList(name,1,1,100);
+    this.setData({
+      recruitList:result.list,
+      count:result.count,
+      page:result.page
     })
+  },
+  inputFocus:function(e) {
+    var recruit = e.detail.value
+    if(recruit){
+      this.setData({
+        showClear:true
+      })
+    }else{
+      this.setData({
+        showClear:false
+      })
+    }
+  },
+  clearInput:function() {
+    this.setData({
+      showClear:false,
+      searchinput:''  
+    })
+  },
+  searchContents:function(e) {
+    var recruit = e.detail.value
+    this.getRecruitList(recruit)
   }
+
 })

+ 13 - 28
pages/sociology/sociology.wxml

@@ -13,46 +13,31 @@
       <view class="bottom">
         <view class="search_group">
           <icon type="search" class="icon_search" color="#c2c6da"></icon>
-          <input type="text" placeholder="请输入职位" placeholder-class="input_text" class="search_input" />
-          <icon type="clear" class="icon_clear" color="#c2c6da"></icon>
+          <input type="text" placeholder="请输入职位" confirm-type="search"
+          bindconfirm="searchContents"
+          placeholder-class="input_text" bindinput="inputFocus" class="search_input" maxlength="30" value="{{searchinput}}"/>
+          <icon type="clear" class="icon_clear" color="#c2c6da" wx:if="{{showClear}}" bindtap="clearInput"></icon>
         </view>
        
       </view>
     </view>
-    <view class="info" bindtap="goToInfo">
+    <view class="info" bindtap="goToInfo" data-id="{{item.id}}" wx:for="{{recruitList}}">
       <view class="info_top">
-        <view class="info_top_left">拓展顾问</view>
-        <view class="info_top_right">6001-8000</view>
+        <view class="info_top_left">{{item.name}}</view>
+        <view class="info_top_right">{{item.salary}}</view>
       </view>
       <view class="info_mid">
         <view class="info_mid_left">
-          <view>萧山区|</view>
-          <view>2年|</view>
-          <view>大专</view>
+          <view>{{item.workArea}}|</view>
+          <view>{{item.workingHours}}|</view>
+          <view>{{item.education}}</view>
         </view>
-        <view class="info_mid_right">2020-12-01</view>
+        <view class="info_mid_right">{{item.releaseTime}}</view>
       </view>
       <view class="info_bottom">
         <image src="/images/icons/depart.png" class="info_bottom_img"></image>
-        <view class="info_bottom_2">拓展部</view>
-      </view>
-    </view>
-    <view class="info" bindtap="goToInfo">
-      <view class="info_top">
-        <view class="info_top_left">招聘顾问</view>
-        <view class="info_top_right">9001-10000</view>
-      </view>
-      <view class="info_mid">
-        <view class="info_mid_left">
-          <view>金山区|</view>
-          <view>2年|</view>
-          <view>大专</view>
-        </view>
-        <view class="info_mid_right">2020-12-01</view>
-      </view>
-      <view class="info_bottom">
-        <image src="/images/icons/depart.png" class="info_bottom_img"></image>
-        <view class="info_bottom_2">招聘部</view>
+        <view class="info_bottom_2">{{item.demandDepartment}}</view>
       </view>
     </view>
+    
 </view>

+ 4 - 3
project.config.json

@@ -4,7 +4,7 @@
     "ignore": []
   },
   "setting": {
-    "urlCheck": true,
+    "urlCheck": false,
     "es6": true,
     "enhance": true,
     "postcss": false,
@@ -22,13 +22,14 @@
     "uploadWithSourceMap": true,
     "compileHotReLoad": false,
     "useMultiFrameRuntime": true,
-    "useApiHook": false,
-    "useApiHostProcess": false,
+    "useApiHook": true,
+    "useApiHostProcess": true,
     "babelSetting": {
       "ignore": [],
       "disablePlugins": [],
       "outputPath": ""
     },
+    "bundle": false,
     "useIsolateContext": true,
     "useCompilerModule": true,
     "userConfirmedUseCompilerModuleSwitch": false,

+ 133 - 0
utils/request.js

@@ -0,0 +1,133 @@
+
+class request {
+
+  static BASE_URL = 'http://oapi.shpr.top:81/'
+  static HEAD = {
+      "Content-Type": "application/json",
+      "token":'',
+  }
+  static constructor() {
+
+  }
+
+  /**
+   * 设置统一的异常处理
+   */
+  static setErrorHandler(handler) {
+      this._errorHandler = handler
+  }
+
+  /**
+   * GET类型的网络请求
+   */
+  static getRequest(url, data, header = this.HEAD ) {
+
+      const token = wx.getStorageSync('token')
+      if (token) {
+          header.token = token
+      }
+      return this.requestAll(url, data, header, 'GET')
+  }
+
+  
+
+  /**
+   * POST类型的网络请求
+   */
+  static postRequest(url, data, header = this.HEAD) {
+      const token = wx.getStorageSync('token')
+      if (token) {
+          header.token = token
+      }
+      return this.requestAll(url, data, header, 'POST')
+  }
+
+  static upload(url, name, path, ortherData, header = this.HEAD){
+      const token = wx.getStorageSync('token')
+      if (token) {
+          header.token = token
+      }
+      return new Promise((resolve, reject) => {
+          wx.uploadFile({
+              url: url,
+              header: header,
+              filePath: path,
+              name: name,
+              formData: ortherData,
+              success: (res => {
+                  res.data = JSON.parse(res.data);
+                  if (res.data.code === 200) {
+                      //200: 服务端业务处理正常结束
+                      resolve(res.data)
+                  } else {
+                        wx.showToast({
+                            title: res.data.message,
+                        })
+                      //其它错误,提示用户错误信息
+                      if (this._errorHandler != null) {
+                          //如果有统一的异常处理,就先调用统一异常处理函数对异常进行处理
+                          this._errorHandler(res)
+                      }
+                      reject(res)
+                  }
+              }),
+              fail: (res => {
+                  if (this._errorHandler != null) {
+                      this._errorHandler(res)
+                  }
+                  wx.showToast({
+                    title: '网络异常请,稍后再试~',
+                  })
+                  reject(res)
+              })
+          })
+      })
+  }
+
+  /**
+   * 网络请求
+   */
+  static requestAll(url, data, header, method) {
+      const _self = this
+      wx.showLoading()
+      return new Promise((resolve, reject) => {
+          wx.request({
+              url: url,
+              data: data,
+              header: header,
+              method: method,
+              success: (res => {
+                  wx.hideLoading()
+                  if (res.data.code === 200) {
+                      //200: 服务端业务处理正常结束
+                      resolve(res.data)
+                  } else {
+                      
+                          wx.showToast({
+                              title: res.data.message,
+                          })
+                     
+                    
+                      //其它错误,提示用户错误信息
+                      if (this._errorHandler != null) {
+                          //如果有统一的异常处理,就先调用统一异常处理函数对异常进行处理
+                          this._errorHandler(res)
+                      }
+                      reject(res)
+                  }
+              }),
+              fail: (res => {
+                  if (this._errorHandler != null) {
+                      this._errorHandler(res)
+                  }
+                  wx.showToast({
+                    title: '网络异常请,稍后再试~',
+                  })
+                  reject(res)
+              })
+          })
+      })
+  }
+}
+
+export default request