Quellcode durchsuchen

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

xing.li vor 4 Jahren
Ursprung
Commit
46ed89b3df

+ 38 - 1
api/recruit.js

@@ -2,6 +2,7 @@ import request from '../utils/request.js'
 
 class recruit extends request {
 
+  //获取职位列表
   static async getRecruitList(name = '', type = 1, page = 1, pageSize = 10) {
     var data = {
       page: page,
@@ -13,6 +14,7 @@ class recruit extends request {
 
     return res.data
   }
+  //获取职位信息
   static async getRecruitInfo(id) {
     var data = {
       id: id
@@ -20,6 +22,7 @@ class recruit extends request {
     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,
@@ -29,7 +32,7 @@ class recruit extends request {
     return res.data;
   }
   
-
+  //收藏职位
   static async collectionRecruit(openId,recruitsId) {
     var data = {
       openid: openId,
@@ -38,15 +41,49 @@ class recruit extends request {
     const res = await this.postRequest(`${this.BASE_URL}open/recruit/collection-recruit`, data)
     return res.data;
   }
+  //投递职位
+  static async deliveryRecruit(openId,recruitsId) {
+    var data = {
+      openid: openId,
+      recruitsId: recruitsId
+    }
+    const res = await this.postRequest(`${this.BASE_URL}open/recruit/delivery-recruit`, data)
+    return res.data;
+  }
+   //获取我的投递列表
+   static async getDelivery(openId,page = 1, pageSize = 10) {
+    var data = {
+      page: page,
+      pageSize: pageSize,
+      openid: openId,
+    }
+    const res = await this.postRequest(`${this.BASE_URL}open/recruit/list-delivery`, data)
+
+    return res.data
+  }
+   //获取我的收藏列表
+   static async getCollection(openId,page = 1, pageSize = 10) {
+    var data = {
+      page: page,
+      pageSize: pageSize,
+      openid: openId,
+    }
+    const res = await this.postRequest(`${this.BASE_URL}open/recruit/list-collection`, 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;

+ 2 - 6
app.js

@@ -11,14 +11,10 @@ App({
     userInfo: null
   },
   getWxUserInfo: async function(){
-    if (!this.globalData.openId){
-      try {
-        let userInfo = wx.getStorageSync({key: 'userInfo'})
-        return userInfo.data
-      } catch (error) {
+    if (!wx.getStorageSync('openId')){
         console.log('缓存中没有用户信息')
         return null
-      }
+      
     }else {
       return this.globalData.userInfo
     }

+ 23 - 3
pages/collection/collection.js

@@ -1,4 +1,5 @@
-// pages/collection/collection.js
+import recruitApi from '../../api/recruit'
+const app = getApp()
 Page({
 
   /**
@@ -26,7 +27,11 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    var openId = wx.getStorageSync('openId');
+    this.setData({
+      openId:openId
+    })
+    this.getList(openId);
   },
 
   /**
@@ -62,5 +67,20 @@ Page({
    */
   onShareAppMessage: function () {
 
-  }
+  },
+  getList: async function(openId) {
+    var result = await recruitApi.getCollection(openId,1,100);
+    this.setData({
+      list:result.list,
+      count:result.count,
+      page:result.page
+    })
+  },
+
+  goToInfo:function(e){
+    var id = e.currentTarget.dataset.id;
+    wx.navigateTo({
+      url: '../recruitInfo/recruitInfo?id='+id
+    })
+  },
 })

+ 18 - 35
pages/collection/collection.wxml

@@ -2,40 +2,23 @@
 
 <view class="content" >
  
-    <view class="info" bindtap="goToInfo">
-      <view class="info_top">
-        <view class="info_top_left">拓展顾问</view>
-        <view class="info_top_right">6001-8000</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>
-    </view>
-    <view class="info">
-      <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>
+  <view class="info" bindtap="goToInfo" wx:for="{{list}}" data-id="{{item.recruitInfo.id}}">
+   <view class="info_top">
+     <view class="info_top_left">{{item.recruitInfo.name}}</view>
+     <view class="info_top_right">{{item.recruitInfo.salary}}</view>
+   </view>
+   <view class="info_mid">
+     <view class="info_mid_left">
+       <view>{{item.recruitInfo.workArea}}|</view>
+       <view>{{item.recruitInfo.workingHours}}|</view>
+       <view>{{item.recruitInfo.education}}</view>
+     </view>
+     <view class="info_mid_right">{{item.recruitInfo.releaseTime}}</view>
+   </view>
+   <view class="info_bottom">
+     <image src="/images/icons/depart.png" class="info_bottom_img"></image>
+     <view class="info_bottom_2">{{item.recruitInfo.demandDepartment}}</view>
+   </view>
     </view>
+   
 </view>

+ 8 - 7
pages/person/person.js

@@ -14,13 +14,14 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: async function (options) {
-    // let userInfo = await app.getWxUserInfo()
-    // if (userInfo) {
-    //   this.setData({
-    //     userInfo: userInfo,
-    //     hasUserInfo: true,
-    //   })
-    // }
+    let userInfo = await app.getWxUserInfo()
+    console.log(userInfo)
+    if (userInfo) {
+      this.setData({
+        userInfo: userInfo,
+        hasUserInfo: true,
+      })
+    }
   },
   /**
    * 生命周期函数--监听页面初次渲染完成

+ 21 - 6
pages/record/record.js

@@ -1,11 +1,12 @@
-// pages/record/record.js
+import recruitApi from '../../api/recruit'
+const app = getApp()
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-
+    list:[]
   },
 
   /**
@@ -26,7 +27,11 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    var openId = wx.getStorageSync('openId');
+   this.setData({
+     openId:openId
+   })
+   this.getList(openId);
   },
 
   /**
@@ -63,9 +68,19 @@ Page({
   onShareAppMessage: function () {
 
   },
-  goToInfo:function(){
+  getList: async function(openId) {
+    var result = await recruitApi.getDelivery(openId,1,100);
+    this.setData({
+      list:result.list,
+      count:result.count,
+      page:result.page
+    })
+  },
+
+  goToInfo:function(e){
+    var id = e.currentTarget.dataset.id;
     wx.navigateTo({
-      url: '../recruitInfo/recruitInfo'
+      url: '../recruitInfo/recruitInfo?id='+id
     })
-  }
+  },
 })

+ 10 - 32
pages/record/record.wxml

@@ -2,50 +2,28 @@
 
 <view class="content" >
  
- <view class="info" bindtap="goToInfo">
+ <view class="info" bindtap="goToInfo" wx:for="{{list}}" data-id="{{item.recruitInfo.id}}">
    <view class="info_top">
-     <view class="info_top_left">拓展顾问</view>
-     <view class="info_top_right">6001-8000</view>
+     <view class="info_top_left">{{item.recruitInfo.name}}</view>
+     <view class="info_top_right">{{item.recruitInfo.salary}}</view>
    </view>
    <view class="info_mid">
      <view class="info_mid_left">
-       <view>萧山区|</view>
-       <view>2年|</view>
-       <view>大专</view>
+       <view>{{item.recruitInfo.workArea}}|</view>
+       <view>{{item.recruitInfo.workingHours}}|</view>
+       <view>{{item.recruitInfo.education}}</view>
      </view>
-     <view class="info_mid_right">2020-12-01</view>
+     <view class="info_mid_right">{{item.recruitInfo.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 class="info_bottom_2">{{item.recruitInfo.demandDepartment}}</view>
    </view>
    <view class="info_bottom_date">
     <view>投递时间:</view>
-    <view>2021-05-11 12:30:30</view>
-    <!-- <view>已查阅</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>
-   <view class="info_bottom_date">
-    <view>投递时间:</view>
-    <view>2021-05-11 12:30:30</view>
+    <view>{{item.addTs}}</view>
     <!-- <view>已查阅</view> -->
    </view>
  </view>
+
 </view>

+ 2 - 1
pages/recruitInfo/recruitInfo.js

@@ -106,6 +106,7 @@ Page({
   },
   //投递简历
   saveResume:function(){
+    var self= this
     wx.showModal({
       title: '提示',
       // content: '您可申请2个社招职位,还剩2个,是否继续投递',
@@ -115,7 +116,7 @@ Page({
       success (res) {
         if (res.confirm) {
           wx.navigateTo({
-            url: '../resume/resume?type=2',
+            url: '../resume/resume?type=2&id='+self.data.id,
           })
           console.log('用户点击确定')
         } else if (res.cancel) {

+ 47 - 14
pages/resume/resume.js

@@ -27,7 +27,7 @@ Page({
     emali:'',
     mobile:'',
     birthday:'1990-01-01',
-    sex:0,
+    gender:0,
     nowAddress:'',
     registeredAddress:'',
     highestEducation:0,
@@ -63,6 +63,7 @@ Page({
     this.setData({
       endDate:endDate,
       type:options.type,
+      recruitsId:options.id,
     })
   },
 
@@ -86,6 +87,9 @@ Page({
     }
     
     var openId = wx.getStorageSync("openId")
+    this.setData({
+      openId:openId
+    })
     await this.getUserInfo(openId);
   },
 
@@ -131,7 +135,7 @@ Page({
   changeSex: function (e) {
     
     this.setData({
-      sex: e.detail.value
+      gender: e.detail.value
     })
   },
   changeEducation: function (e) {
@@ -169,8 +173,9 @@ Page({
       success (res) {
         // tempFilePath可以作为img标签的src属性显示图片
         console.log(res.tempFiles);
+        var path = res.tempFiles[0].path
         self.setData({
-          resumeFile:res.tempFiles[0].path,
+          resumeFile:path,
           resumeFileName:res.tempFiles[0].name
         })
         }
@@ -182,12 +187,7 @@ Page({
     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;
@@ -195,10 +195,11 @@ Page({
     var learningModality = info.learningModality?info.learningModality:0;
     var birthday = info.birthday?info.birthday:'1990-01-01';
     this.setData({
+      userId:info.userId,
       name:info.name,
       email:info.email,
       mobile:info.mobile,
-      sex:info.sex,
+      gender:info.gender,
       birthday:birthday,
       nowAddress:info.nowAddress,
       registeredAddress:info.registeredAddress,
@@ -212,7 +213,7 @@ Page({
       resumeFile:info.resumeFile,
     })
   },
-  saveResume: function(){
+  saveResume: async function(){
     if(!this.data.name){
       wx.showToast({
         title: '请输入姓名',
@@ -241,11 +242,12 @@ Page({
     }
    
     var params = {
+      userId:this.data.userId,
       name:this.data.name,
       email:this.data.email,
       mobile:this.data.mobile,
       birthday:this.data.birthday,
-      sex:this.data.sex,
+      gender:this.data.gender,
       nowAddress:this.data.nowAddress,
       registeredAddress:this.data.registeredAddress,
       highestEducation:this.data.highestEducation,
@@ -257,8 +259,39 @@ Page({
       hopeSalary:this.data.hopeSalary,
       resumeFile:this.data.resumeFile,
     };
-    var res = recruitApi.saveUser(params);
-    console.log(res);
+     await recruitApi.saveUser(params);
+
+     if(this.data.type ==2){
+      await recruitApi.deliveryRecruit(this.data.openId,this.data.recruitsId);
+      wx.showToast({
+        title: '投递成功',
+        icon: 'success',
+        success:function(){
+          setTimeout(() => {
+            wx.navigateBack({
+              delta: 2
+            })
+          }, 1000);
+        }
+      })
+     }else{
+      wx.showToast({
+        title: '保存成功',
+        icon: 'success',
+        success:function(){
+          setTimeout(() => {
+            wx.navigateBack({
+              delta: 2
+            })
+          }, 1000);
+        }
+      })
+     }
+    
+
+  
+    
+   
   }
   
 })

+ 2 - 2
pages/resume/resume.wxml

@@ -42,8 +42,8 @@
       <view class="info_left_1">*</view>
       <view class="info_left_2">性别</view>
     </view>
-    <picker class="info_right_picker" value="{{sex}}" range="{{array}}" bindchange="changeSex">
-               {{array[sex]}}
+    <picker class="info_right_picker" value="{{gender}}" range="{{array}}" bindchange="changeSex">
+               {{array[gender]}}
         </picker>
         <image class="next-gray" src="../../images/icons/next-gray.png">
         </image>

+ 6 - 1
pages/resume/resume.wxss

@@ -36,10 +36,15 @@ Page {
 }
 .info_left_1{
   color: red;
-  margin-right:10rpx 
+  margin-right:10rpx;
+  height: 60rpx;
+  line-height: 60rpx;
 }
 .info_left_2{
   font-size: 28rpx;
+  height: 60rpx;
+  line-height: 60rpx;
+
 }
 .info_right{
    width: 470rpx;

+ 40 - 5
pages/school/school.js

@@ -1,18 +1,21 @@
-// pages/school/school.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,2,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)
   }
+
 })

+ 14 - 12
pages/school/school.wxml

@@ -3,7 +3,7 @@
 <view class="content" >
     <view class="header">
       <view class="top">
-        <image class="c_img" src="https://www.hsayi.com/uploads/allimg/20210217/1-21021H0402UC.png"></image>
+        <image class="c_img" src="/images/icons/hsay.png"></image>
         <view class="top_right">
           <view class="c_name">沪上阿姨</view>
           <view class="desc">茶饮连锁品牌</view>
@@ -13,29 +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" disabled/>
-          <!-- <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 class="info_bottom_2">{{item.demandDepartment}}</view>
       </view>
     </view>
-   
+    
 </view>