Prechádzať zdrojové kódy

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

xing.li 4 rokov pred
rodič
commit
345d86d294

+ 1 - 0
app.js

@@ -41,6 +41,7 @@ App({
     params['code'] = res.code
     params['nickName'] = data.nickName
     params['headerImg'] = data.avatarUrl
+    params['gender'] = data.gender
     let openId =  await recruitApi.loginUser(params)
     wx.setStorageSync('openId', openId);
     var params = {}

+ 10 - 9
pages/person/person.js

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

+ 1 - 1
pages/person/person.wxml

@@ -7,7 +7,7 @@
                 <!-- <image class="next" src="../../images/icons/next.png" >
                 </image> -->
             </view>
-            <view class="tel c-707070 fw300">{{userInfo.mobile}}</view>
+            <!-- <view class="tel c-707070 fw300">{{userInfo.mobile}}</view> -->
             <!-- <button open-type="getPhoneNumber" catchgetphonenumber="getMobile" class="login-btn" wx:if="{{!userInfo.mobile}}" >获取手机号</button> -->
         </view>
         <view class="head-img">

+ 101 - 35
pages/resume/resume.js

@@ -7,19 +7,14 @@ Page({
    */
   data: {
     endDate:'',
-    // birth:'1990-01-01',
-    // date:'1990-01-01',
-    // sex: 0,
+    fileColor:"",
     array: ["保密", "男", "女"],
     educationArray: ["小学", "初中", "高中","中技(中专、技校、职高)","大专","本科","硕士研究生","MBA","博士研究生","保密"],
-    // highestEducation: 0,
+    
     schoolTypeArray: ["","全国普通高等院校非全日制","全国普通高等院校全日制", "成人高等教育", "统招专升本","其他","自学考试","非统招专升本","海外留学生"],
-    // learningModality: 0,
     statusArray: ["","正在主动找工作","可以考虑工作机会", "目前不想找工作"],
-    // 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,
+    nowMoneyArray: ["","1000以下","1000-2000", "2001-4000", "4001-6000","6001-8000","8001-10000","10001-15000","15001-25000","25001-30000","30001-50000","50001以上"],
     type:1,//1保存简历  2保存简历+投递简历)
     saveTitle:'保存',
     
@@ -40,13 +35,15 @@ Page({
     resumeFile:'',
     resumeFileName:'在微信聊天中选择附件',
     resumeFileNow:'',
+   
+    isChooseFile:false,
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    console.log(options)
+   
     if(options.type ==2){
       this.setData({
        saveTitle:'确认投递'
@@ -91,7 +88,14 @@ Page({
     this.setData({
       openId:openId
     })
-    await this.getUserInfo(openId);
+    if(!this.data.isChooseFile){
+      await this.getUserInfo(openId);
+    }else{
+      this.setData({
+        isChooseFile:false
+      })
+    }
+    
   },
 
   /**
@@ -128,6 +132,32 @@ Page({
   onShareAppMessage: function () {
 
   },
+  
+  bindInputName: function (e) {
+    this.setData({
+      name: e.detail.value
+    })
+  },
+  bindInputEmail: function (e) {
+    this.setData({
+      email: e.detail.value
+    })
+  },
+  bindInputMobile: function (e) {
+    this.setData({
+      mobile: e.detail.value
+    })
+  },
+  bindInputNowAddress: function (e) {
+    this.setData({
+      nowAddress: e.detail.value
+    })
+  },
+  bindInputRegisteredAddress: function (e) {
+    this.setData({
+      registeredAddress: e.detail.value
+    })
+  },
   changeBirth: function (e) {
     this.setData({
       birthday: e.detail.value
@@ -156,6 +186,16 @@ Page({
       jobStatus: e.detail.value
     })
   },
+  bindInputTakeProfessionally:function(e){
+    this.setData({
+      takeProfessionally: e.detail.value
+    })
+  },
+  bindInputHopeProfessionally:function(e){
+    this.setData({
+      hopeProfessionally: e.detail.value
+    })
+  },
   changeNowMoney:function(e){
     this.setData({
       nowSalary: e.detail.value
@@ -167,21 +207,53 @@ Page({
     })
   },
   chooseEnclosure:function(){
+    this.setData({
+      isChooseFile:true
+    })
     var self =this;
     wx.chooseMessageFile({
       count: 1,
       type: 'file',
       success (res) {
         // tempFilePath可以作为img标签的src属性显示图片
-        console.log(res.tempFiles[0].path);
-
+        self.uploadFile(res.tempFiles[0].path)
         self.setData({
-          resumeFileNow: res.tempFiles[0].path,
           resumeFileName:res.tempFiles[0].name
         })
         }
     })
   },
+  uploadFile: function(temFile){
+    var self = this;
+    wx.uploadFile({
+      url: "https://oapi.shpr.top/open/upload/upload-pic",   //上传的路径
+      filePath:temFile, //刚刚在data保存的文件路径
+      name: 'file',   //后台获取的凭据
+      formData: {
+        'basePath': 'recruit'
+      },
+      success (res){
+        const result = JSON.parse(res.data)
+        self.setData({
+          resumeFileNow:result.data.destPath,
+          fileColor:"#000",
+        })
+        
+      }
+  })
+  },
+  // downloadFile:function(e){
+  //   var url = e.currentTarget.dataset.url;
+  //   wx.downloadFile({
+  //     url: url, //仅为示例,并非真实的资源
+  //     success (res) {
+  //       // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
+  //       if (res.statusCode === 200) {
+         
+  //       }
+  //     }
+  //   })
+  // },
   getUserInfo: async function(openId) {
    
     var params = {}
@@ -195,6 +267,8 @@ Page({
     var hopeSalary = info.hopeSalary?info.hopeSalary:0;
     var learningModality = info.learningModality?info.learningModality:0;
     var birthday = info.birthday?info.birthday:'1990-01-01';
+    var fileColor = info.resumeFileName?'#000':'#c2c6da';
+    var resumeFileName = info.resumeFileName?info.resumeFileName:'';
     this.setData({
       userId:info.userId,
       name:info.name,
@@ -212,30 +286,13 @@ Page({
       nowSalary:nowSalary,
       hopeSalary:hopeSalary,
       resumeFile:info.resumeFile,
+      resumeFileNow:info.resumeFile,
+      resumeFileName:resumeFileName,
+      fileColor:fileColor,
     })
   },
 
-
   saveResume: async function(){
-  
-// console.log(this.data.resumeFileNow);
-//   wx.uploadFile({
-//     url: "http://oapi.shpr.top:81/open/upload/upload-pic",   //上传的路径
-//     filePath:this.data.resumeFileNow, //刚刚在data保存的文件路径
-//     name: 'file',   //后台获取的凭据
-//     formData: {
-//       'basePath': 'recruit'
-//     },
-//     success (res){
-//       const data = res.data
-//       console.log(data);
-//       //do something
-//     }
-// })
-
-return;
-
-
     if(!this.data.name){
       wx.showToast({
         title: '请输入姓名',
@@ -254,7 +311,15 @@ return;
       return;
     }
 
-    if(!this.data.resumeFile){
+    if(!this.data.mobile){
+      wx.showToast({
+        title: '请输入手机号',
+        icon: 'none',
+        duration: 1000
+      })
+      return;
+    }
+    if(!this.data.resumeFileNow){
       wx.showToast({
         title: '请上传附件',
         icon: 'none',
@@ -279,7 +344,8 @@ return;
       hopeProfessionally:this.data.hopeProfessionally,
       nowSalary:this.data.nowSalary,
       hopeSalary:this.data.hopeSalary,
-      resumeFile:this.data.resumeFile,
+      resumeFile:this.data.resumeFileNow,
+      resumeFileName:this.data.resumeFileName,
     };
      await recruitApi.saveUser(params);
 

+ 14 - 13
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" value="{{name}}"/>
+    <input type="text" class="info_right" maxlength="50" placeholder="请输入姓名" placeholder-class="placeholder" value="{{name}}" bindinput="bindInputName"/>
   </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" value="{{email}}"/>
+    <input type="text" class="info_right" maxlength="50" placeholder="请输入邮箱" placeholder-class="placeholder" value="{{email}}"  bindinput="bindInputEmail"/>
   </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" value="{{mobile}}"/>
+    <input type="number" class="info_right" maxlength="50" placeholder="请输入手机号" placeholder-class="placeholder" value="{{mobile}}" bindinput="bindInputMobile"/>
   </view>
 
   <view class="info">
@@ -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" value="{{nowAddress}}"/>
+    <input  class="info_right"   placeholder="例:浙江省杭州市萧山区" maxlength="250" placeholder-class="placeholder" value="{{nowAddress}}" bindinput="bindInputNowAddress"/>
   </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" value="{{registeredAddress}}"/>
+    <input  class="info_right"   placeholder="例:安徽省合肥市蜀山区" maxlength="250" placeholder-class="placeholder" value="{{registeredAddress}}" bindinput="bindInputRegisteredAddress"/>
   </view>
 
   <view class="info">
@@ -102,7 +102,7 @@
       <view class="info_left_1"></view>
       <view class="info_left_2">当前职业</view>
     </view>
-    <input  class="info_right"   placeholder="请输入当前职业" placeholder-class="placeholder" maxlength="50" value="{{takeProfessionally}}"/>
+    <input  class="info_right"   placeholder="请输入当前职业" placeholder-class="placeholder" maxlength="50" value="{{takeProfessionally}}"  bindinput="bindInputTakeProfessionally"/>
   </view>
 
   <view class="info">
@@ -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" value="{{hopeProfessionally}}"/>
+    <input  class="info_right"   placeholder="请输入期望从事职业" placeholder-class="placeholder" maxlength="50" value="{{hopeProfessionally}}"  bindinput="bindInputHopeProfessionally"/>
   </view>
 
   <view class="info">
@@ -131,15 +131,15 @@
       <view class="info_left_1"></view>
       <view class="info_left_2">现在税前月薪</view>
     </view>
-    <picker class="info_right_picker" value="{{nowSalary}}" range="{{moneyArray}}" bindchange="changeNowMoney">
+    <picker class="info_right_picker" value="{{nowSalary}}" range="{{nowMoneyArray}}" bindchange="changeNowMoney">
                
-                <view class="info_right_picker_v"> {{moneyArray[nowSalary]}}</view>
+                <view class="info_right_picker_v"> {{nowMoneyArray[nowSalary]}}</view>
         </picker>
         <image class="next-gray" src="../../images/icons/next-gray.png">
         </image>
   </view>
 
-  <view class="info"  style="margin-bottom:100rpx">
+  <view class="info">
     <view class="info_left">
       <view class="info_left_1"></view>
       <view class="info_left_2">期望税前月薪</view>
@@ -152,13 +152,14 @@
         </image>
   </view>
   
-  <!-- <view class="info" style="margin-bottom:100rpx" >
+  <view class="info" style="margin-bottom:100rpx" >
     <view class="info_left">
       <view class="info_left_1">*</view>
       <view class="info_left_2">简历附件</view>
     </view>
-    <view  class="info_right placeholder"   bindtap="chooseEnclosure" >{{resumeFileName}}</view>
-  </view> -->
+    <view  class="info_right placeholder"  style="color:{{fileColor}};white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"  bindtap="chooseEnclosure" >{{resumeFileName}}</view>
+    <!-- <view bindtap="downloadFile"  style="width:60rpx;font-size: 24rpx;" data-url ="{{resumeFileNow}}" wx:if="{{resumeFileNow}}">下载</view> -->
+  </view>
 
   <view class="bottom">
     <view class="save" bindtap="saveResume">{{saveTitle}}</view>

+ 20 - 6
pages/school/school.js

@@ -6,7 +6,7 @@ Page({
    * 页面的初始数据
    */
   data: {
-    type:2,
+    type:2,//校招
     recruitList:[],
     showClear:false,
     searchinput:'',
@@ -33,6 +33,9 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
+    this.setData({
+      page:1
+    })
     this.getRecruitList();
   },
 
@@ -89,7 +92,12 @@ Page({
   getRecruitList: async function(name='') {
     var result = await recruitApi.getRecruitList(name,this.data.type,this.data.page,this.data.pageNum);
     console.log(result)
-    var nowResult = this.data.recruitList.concat(result.list)
+    if(this.data.page!=1){
+      var nowResult = this.data.recruitList.concat(result.list)
+    }else{
+      var nowResult = result.list
+    }
+    
     this.setData({
       recruitList:nowResult,
       count:result.count,
@@ -100,11 +108,13 @@ Page({
     var recruit = e.detail.value
     if(recruit){
       this.setData({
-        showClear:true
+        showClear:true,
+        searchinput:recruit
       })
     }else{
       this.setData({
-        showClear:false
+        showClear:false,
+        searchinput:''
       })
     }
   },
@@ -114,8 +124,12 @@ Page({
       searchinput:''  
     })
   },
-  searchContents:function(e) {
-    var recruit = e.detail.value
+  searchContents:function() {
+    var recruit = this.data.searchinput
+    console.log(recruit)
+    this.setData({
+      page:1
+    })
     this.getRecruitList(recruit)
   }
 

+ 2 - 3
pages/school/school.wxml

@@ -13,11 +13,11 @@
       <view class="bottom">
         <view class="search_group">
           <icon type="search" class="icon_search" color="#c2c6da"></icon>
-          <input type="text" placeholder="请输入职位" confirm-type="search"
-          bindconfirm="searchContents"
+          <input type="text" placeholder="请输入职位" 
           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 bindtap="searchContents" class="search_aa">搜索</view>
        
       </view>
     </view>
@@ -39,7 +39,6 @@
         <view class="info_bottom_2">{{item.demandDepartment}}</view>
       </view>
     </view>
-    
     <view class="no_data_par" wx:if="{{recruitList.length==0}}">
       <image src="/images/icons/no_data.png" class="no_data_img"></image>
       <view class="no_data_text">暂无数据</view>

+ 12 - 2
pages/school/school.wxss

@@ -49,7 +49,17 @@ Page {
   border-radius: 50rpx;
   height: 60rpx;
   align-items: center;
-  width: 660rpx;
+  width: 550rpx;
+}
+.search_aa{
+  width: 80rpx;
+  display: flex;
+  flex-flow: row nowrap;
+  justify-content: center;
+  align-items: center;
+  font-size:28rpx;
+  margin-left:20rpx;
+  color: #1296db;
 }
 .search_input{
   width: 600rpx;
@@ -130,4 +140,4 @@ Page {
 .no_data_img{
   height: 320rpx;
   width: 320rpx;
-}
+}

+ 19 - 5
pages/sociology/sociology.js

@@ -33,6 +33,9 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
+    this.setData({
+      page:1
+    })
     this.getRecruitList();
   },
 
@@ -89,7 +92,12 @@ Page({
   getRecruitList: async function(name='') {
     var result = await recruitApi.getRecruitList(name,this.data.type,this.data.page,this.data.pageNum);
     console.log(result)
-    var nowResult = this.data.recruitList.concat(result.list)
+    if(this.data.page!=1){
+      var nowResult = this.data.recruitList.concat(result.list)
+    }else{
+      var nowResult = result.list
+    }
+    
     this.setData({
       recruitList:nowResult,
       count:result.count,
@@ -100,11 +108,13 @@ Page({
     var recruit = e.detail.value
     if(recruit){
       this.setData({
-        showClear:true
+        showClear:true,
+        searchinput:recruit
       })
     }else{
       this.setData({
-        showClear:false
+        showClear:false,
+        searchinput:''
       })
     }
   },
@@ -114,8 +124,12 @@ Page({
       searchinput:''  
     })
   },
-  searchContents:function(e) {
-    var recruit = e.detail.value
+  searchContents:function() {
+    var recruit = this.data.searchinput
+    console.log(recruit)
+    this.setData({
+      page:1
+    })
     this.getRecruitList(recruit)
   }
 

+ 2 - 2
pages/sociology/sociology.wxml

@@ -13,11 +13,11 @@
       <view class="bottom">
         <view class="search_group">
           <icon type="search" class="icon_search" color="#c2c6da"></icon>
-          <input type="text" placeholder="请输入职位" confirm-type="search"
-          bindconfirm="searchContents"
+          <input type="text" placeholder="请输入职位" 
           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 bindtap="searchContents" class="search_aa">搜索</view>
        
       </view>
     </view>

+ 11 - 1
pages/sociology/sociology.wxss

@@ -49,7 +49,17 @@ Page {
   border-radius: 50rpx;
   height: 60rpx;
   align-items: center;
-  width: 660rpx;
+  width: 550rpx;
+}
+.search_aa{
+  width: 80rpx;
+  display: flex;
+  flex-flow: row nowrap;
+  justify-content: center;
+  align-items: center;
+  font-size:28rpx;
+  margin-left:20rpx;
+  color: #1296db;
 }
 .search_input{
   width: 600rpx;

+ 2 - 1
utils/request.js

@@ -1,7 +1,8 @@
 
 class request {
 
-  static BASE_URL = 'http://oapi.shpr.top:81/'
+//   static BASE_URL = 'http://oapi.shpr.top:81/'
+  static BASE_URL = 'https://oapi.shpr.top/'
   static HEAD = {
       "Content-Type": "application/json",
       "token":'',