Pārlūkot izejas kodu

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

xing.li 4 gadi atpakaļ
vecāks
revīzija
ef5ac46bea

+ 26 - 5
pages/collection/collection.js

@@ -6,7 +6,10 @@ Page({
    * 页面的初始数据
    */
   data: {
-
+    list:[],
+    page:1,
+    pageNum:10,
+    count:0
   },
 
   /**
@@ -26,7 +29,14 @@ 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');
     this.setData({
       openId:openId
@@ -59,7 +69,16 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-
+    var totalPage = Math.ceil(this.data.count/this.data.pageNum)
+    console.log('到底了')
+    var page = this.data.page
+    page++;
+    this.setData({
+      page:page
+    })
+    if(page<=totalPage){
+      this.getList();
+    }
   },
 
   /**
@@ -69,12 +88,14 @@ Page({
 
   },
   getList: async function(openId) {
-    var result = await recruitApi.getCollection(openId,1,100);
+    var result = await recruitApi.getCollection(openId,this.data.page,this.data.pageNum);
+    var nowList = this.data.list.concat(result.list)
     this.setData({
-      list:result.list,
+      list:nowList,
       count:result.count,
       page:result.page
     })
+    
   },
 
   goToInfo:function(e){

+ 5 - 2
pages/collection/collection.wxml

@@ -2,7 +2,7 @@
 
 <view class="content" >
  
-  <view class="info" bindtap="goToInfo" wx:for="{{list}}" data-id="{{item.recruitInfo.id}}">
+  <view class="info" bindtap="goToInfo" wx:for="{{list}}" data-id="{{item.recruitInfo.id}}" wx:if="{{list.length>0}}">
    <view class="info_top">
      <view class="info_top_left">{{item.recruitInfo.name}}</view>
      <view class="info_top_right">{{item.recruitInfo.salary}}</view>
@@ -20,5 +20,8 @@
      <view class="info_bottom_2">{{item.recruitInfo.demandDepartment}}</view>
    </view>
     </view>
-   
+    <view class="no_data_par" wx:if="{{list.length==0}}">
+      <image src="/images/icons/no_data.png" class="no_data_img"></image>
+      <view class="no_data_text">暂无数据</view>
+    </view>
 </view>

+ 10 - 0
pages/collection/collection.wxss

@@ -70,3 +70,13 @@ Page {
 .icon_clear{
   margin-right: 20rpx;
 }
+.no_data_par{
+  display: flex;
+  flex-flow: column nowrap;
+  align-items: center;
+  margin-top: 200rpx;
+}
+.no_data_img{
+  height: 320rpx;
+  width: 320rpx;
+}

+ 2 - 20
pages/person/person.js

@@ -71,18 +71,7 @@ Page({
   onShareAppMessage: function () {
 
   },
-  getInfo: async function (e) {
-    // 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: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
@@ -90,7 +79,7 @@ Page({
         console.log(res);
         // res.userInfo['encryptedData'] = res.encryptedData
         // res.userInfo['iv'] = res.iv
-        let info = app.wxLogin(res.userInfo);
+        app.wxLogin(res.userInfo);
         this.setData({
           userInfo: res.userInfo,
           hasUserInfo: true
@@ -100,13 +89,6 @@ Page({
   },
   gotoCollection: async function (e) {
    
-    // const isAuth = await app.isAuth()
-    // if (!isAuth) {
-    //   wx.redirectTo({
-    //     url: '/pages/prompt/prompt?page=pages/collection/collection',
-    //   })
-    //   return
-    // }
     wx.navigateTo({
       url: '../collection/collection',
     })

+ 53 - 22
pages/prompt/prompt.js

@@ -19,6 +19,9 @@ Page({
       page = `${page}?id=${options.id}`
     }
 
+    if (options.page == 'pages/resume/resume') {
+      page = `${page}?type=${options.type}`
+    }
    
     this.setData({
       fromPage: page
@@ -74,29 +77,57 @@ Page({
   onShareAppMessage: function () {
 
   },
-  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);
-   
-    _self.setData({
-      hasUserInfo: true,
-      userInfo: info,
-    })
 
-    if(_self.data.fromPage=="pages/sociology/sociology" || _self.data.fromPage=="pages/school/school"){
-      wx.switchTab({
-        url: '/'+_self.data.fromPage,
-      })
-    }else{
-      wx.redirectTo({
-        url: '/'+_self.data.fromPage,
-      })
-    } 
+  getUserProfile: function(e){
+    var _self=this;
+    wx.getUserProfile({
+      desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+      success: (res) => {
+        console.log(res);
+        // res.userInfo['encryptedData'] = res.encryptedData
+        // res.userInfo['iv'] = res.iv
+        app.wxLogin(res.userInfo).then(function(){
+         
+          if(_self.data.fromPage=="pages/sociology/sociology" || _self.data.fromPage=="pages/school/school"){
+            wx.switchTab({
+              url: '/'+_self.data.fromPage,
+            })
+          }else{
+            wx.redirectTo({
+              url: '/'+_self.data.fromPage,
+            })
+          } 
+        }
+
+
+        )
+       
+      }
+    })
+  },
+  // 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);
+   
+  //   _self.setData({
+  //     hasUserInfo: true,
+  //     userInfo: info,
+  //   })
+
+  //   if(_self.data.fromPage=="pages/sociology/sociology" || _self.data.fromPage=="pages/school/school"){
+  //     wx.switchTab({
+  //       url: '/'+_self.data.fromPage,
+  //     })
+  //   }else{
+  //     wx.redirectTo({
+  //       url: '/'+_self.data.fromPage,
+  //     })
+  //   } 
   
-    console.log(_self.data.fromPage)
+  //   console.log(_self.data.fromPage)
    
-  }
+  // }
 })

+ 1 - 1
pages/prompt/prompt.wxml

@@ -13,6 +13,6 @@
             你的公开信息(昵称,头像等)</view>
     </view>
     <view class="confirm">
-        <button open-type="getUserInfo" bindgetuserinfo="getInfo" type="primary">确认</button>
+        <button bindtap="getUserProfile" type="primary">确认</button>
     </view>
 </view>

+ 25 - 5
pages/record/record.js

@@ -6,7 +6,10 @@ Page({
    * 页面的初始数据
    */
   data: {
-    list:[]
+    list:[],
+    page:1,
+    pageNum:10,
+    count:0
   },
 
   /**
@@ -26,7 +29,14 @@ 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');
    this.setData({
      openId:openId
@@ -59,7 +69,16 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-
+    var totalPage = Math.ceil(this.data.count/this.data.pageNum)
+    console.log('到底了')
+    var page = this.data.page
+    page++;
+    this.setData({
+      page:page
+    })
+    if(page<=totalPage){
+      this.getList();
+    }
   },
 
   /**
@@ -69,9 +88,10 @@ Page({
 
   },
   getList: async function(openId) {
-    var result = await recruitApi.getDelivery(openId,1,100);
+    var result = await recruitApi.getDelivery(openId,this.data.page,this.data.pageNum);
+    var nowList = this.data.list.concat(result.list)
     this.setData({
-      list:result.list,
+      list:nowList,
       count:result.count,
       page:result.page
     })

+ 5 - 1
pages/record/record.wxml

@@ -2,7 +2,7 @@
 
 <view class="content" >
  
- <view class="info" bindtap="goToInfo" wx:for="{{list}}" data-id="{{item.recruitInfo.id}}">
+ <view class="info" bindtap="goToInfo" wx:for="{{list}}" data-id="{{item.recruitInfo.id}}" wx:if="{{list.length>0}}">
    <view class="info_top">
      <view class="info_top_left">{{item.recruitInfo.name}}</view>
      <view class="info_top_right">{{item.recruitInfo.salary}}</view>
@@ -26,4 +26,8 @@
    </view>
  </view>
 
+ <view class="no_data_par" wx:if="{{list.length==0}}">
+      <image src="/images/icons/no_data.png" class="no_data_img"></image>
+      <view class="no_data_text">暂无数据</view>
+    </view>
 </view>

+ 10 - 0
pages/record/record.wxss

@@ -79,3 +79,13 @@ Page {
 .icon_clear{
   margin-right: 20rpx;
 }
+.no_data_par{
+  display: flex;
+  flex-flow: column nowrap;
+  align-items: center;
+  margin-top: 200rpx;
+}
+.no_data_img{
+  height: 320rpx;
+  width: 320rpx;
+}

+ 12 - 3
pages/recruitInfo/recruitInfo.js

@@ -18,7 +18,7 @@ Page({
     this.setData({
       id:options.id
     })
-    await this.getRecruitInfo(options.id)
+   
    
      
   },
@@ -33,10 +33,19 @@ Page({
   /**
    * 生命周期函数--监听页面显示
    */
-  onShow: function () {
+  onShow: async function () {
+    const isAuth = await app.isAuth()
+    if (!isAuth) {
+      wx.redirectTo({
+        url: '/pages/prompt/prompt?page=' + this.route+"&id="+this.data.id,
+      })
+      return
+    }
+    
+    await this.getRecruitInfo(this.data.id)
     var openid = wx.getStorageSync('openId');
     if(openid){
-      this.getRecruitLikeInfo(openid);
+      await this.getRecruitLikeInfo(openid);
     }
   },
 

+ 25 - 3
pages/resume/resume.js

@@ -39,6 +39,7 @@ Page({
     hopeSalary:0,
     resumeFile:'',
     resumeFileName:'在微信聊天中选择附件',
+    resumeFileNow:'',
   },
 
   /**
@@ -172,10 +173,10 @@ Page({
       type: 'file',
       success (res) {
         // tempFilePath可以作为img标签的src属性显示图片
-        console.log(res.tempFiles);
-        var path = res.tempFiles[0].path
+        console.log(res.tempFiles[0].path);
+
         self.setData({
-          resumeFile:path,
+          resumeFileNow: res.tempFiles[0].path,
           resumeFileName:res.tempFiles[0].name
         })
         }
@@ -213,7 +214,28 @@ Page({
       resumeFile:info.resumeFile,
     })
   },
+
+
   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: '请输入姓名',

+ 3 - 3
pages/resume/resume.wxml

@@ -139,7 +139,7 @@
         </image>
   </view>
 
-  <view class="info" >
+  <view class="info"  style="margin-bottom:100rpx">
     <view class="info_left">
       <view class="info_left_1"></view>
       <view class="info_left_2">期望税前月薪</view>
@@ -152,13 +152,13 @@
         </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> -->
 
   <view class="bottom">
     <view class="save" bindtap="saveResume">{{saveTitle}}</view>

+ 22 - 6
pages/school/school.js

@@ -6,16 +6,20 @@ Page({
    * 页面的初始数据
    */
   data: {
+    type:2,
     recruitList:[],
     showClear:false,
-    searchinput:''
+    searchinput:'',
+    page:1,
+    pageNum:10,
+    count:0
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-        this.getRecruitList();
+       
   },
 
   /**
@@ -29,7 +33,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    this.getRecruitList();
   },
 
   /**
@@ -57,7 +61,17 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-
+      var totalPage = Math.ceil(this.data.count/this.data.pageNum)
+      console.log('到底了')
+      var page = this.data.page
+      page++;
+      this.setData({
+        page:page
+      })
+      if(page<=totalPage){
+        this.getRecruitList();
+      }
+     
   },
 
   /**
@@ -73,9 +87,11 @@ Page({
     })
   },
   getRecruitList: async function(name='') {
-    var result = await recruitApi.getRecruitList(name,2,1,100);
+    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)
     this.setData({
-      recruitList:result.list,
+      recruitList:nowResult,
       count:result.count,
       page:result.page
     })

+ 5 - 1
pages/school/school.wxml

@@ -21,7 +21,7 @@
        
       </view>
     </view>
-    <view class="info" bindtap="goToInfo" data-id="{{item.id}}" wx:for="{{recruitList}}">
+    <view class="info" bindtap="goToInfo" data-id="{{item.id}}" wx:for="{{recruitList}}" wx:if="{{recruitList.length>0}}">
       <view class="info_top">
         <view class="info_top_left">{{item.name}}</view>
         <view class="info_top_right">{{item.salary}}</view>
@@ -40,4 +40,8 @@
       </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>
+    </view>
 </view>

+ 10 - 0
pages/school/school.wxss

@@ -121,3 +121,13 @@ Page {
 .icon_clear{
   margin-right: 20rpx;
 }
+.no_data_par{
+  display: flex;
+  flex-flow: column nowrap;
+  align-items: center;
+  margin-top: 200rpx;
+}
+.no_data_img{
+  height: 320rpx;
+  width: 320rpx;
+}

+ 22 - 6
pages/sociology/sociology.js

@@ -6,16 +6,20 @@ Page({
    * 页面的初始数据
    */
   data: {
+    type:1,//社招
     recruitList:[],
     showClear:false,
-    searchinput:''
+    searchinput:'',
+    page:1,
+    pageNum:10,
+    count:0
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-        this.getRecruitList();
+       
   },
 
   /**
@@ -29,7 +33,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    this.getRecruitList();
   },
 
   /**
@@ -57,7 +61,17 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function () {
-
+      var totalPage = Math.ceil(this.data.count/this.data.pageNum)
+      console.log('到底了')
+      var page = this.data.page
+      page++;
+      this.setData({
+        page:page
+      })
+      if(page<=totalPage){
+        this.getRecruitList();
+      }
+     
   },
 
   /**
@@ -73,9 +87,11 @@ Page({
     })
   },
   getRecruitList: async function(name='') {
-    var result = await recruitApi.getRecruitList(name,1,1,100);
+    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)
     this.setData({
-      recruitList:result.list,
+      recruitList:nowResult,
       count:result.count,
       page:result.page
     })

+ 5 - 2
pages/sociology/sociology.wxml

@@ -21,7 +21,7 @@
        
       </view>
     </view>
-    <view class="info" bindtap="goToInfo" data-id="{{item.id}}" wx:for="{{recruitList}}">
+    <view class="info" bindtap="goToInfo" data-id="{{item.id}}" wx:for="{{recruitList}}" wx:if="{{recruitList.length>0}}">
       <view class="info_top">
         <view class="info_top_left">{{item.name}}</view>
         <view class="info_top_right">{{item.salary}}</view>
@@ -39,5 +39,8 @@
         <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>
+    </view>
 </view>

+ 10 - 0
pages/sociology/sociology.wxss

@@ -121,3 +121,13 @@ Page {
 .icon_clear{
   margin-right: 20rpx;
 }
+.no_data_par{
+  display: flex;
+  flex-flow: column nowrap;
+  align-items: center;
+  margin-top: 200rpx;
+}
+.no_data_img{
+  height: 320rpx;
+  width: 320rpx;
+}