100 lines
2.0 KiB
JavaScript
100 lines
2.0 KiB
JavaScript
// pages/candidate/index.js
|
|
const api = require("../../utils/request.js");
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
search:null,
|
|
candidates:[],
|
|
query: {
|
|
page: 1,
|
|
limit: 10
|
|
}
|
|
},
|
|
onLoad: function () {
|
|
},
|
|
onShow: function () {
|
|
this.getList();
|
|
},
|
|
getList: function() {
|
|
wx.showLoading({
|
|
title: '正在加载...',
|
|
})
|
|
api.request('/crm/candidate/my/', 'GET').then(res=>{
|
|
wx.hideLoading()
|
|
this.setData({
|
|
candidates:res.data,
|
|
})
|
|
}).catch(
|
|
wx.hideLoading()
|
|
)
|
|
},
|
|
bindinput: function(e){
|
|
this.setData({
|
|
search:e.detail.value
|
|
})
|
|
},
|
|
copyUrl: function(e){
|
|
wx.setClipboardData({
|
|
data: e.currentTarget.dataset.url,
|
|
success: function (res) {
|
|
wx.showToast({
|
|
title: '复制成功,可前往自带浏览器粘贴访问',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
})
|
|
},
|
|
search: function() {
|
|
// debugger;
|
|
if(this.data.search!==null&&this.data.search!==''){
|
|
var data = {search:this.data.search};
|
|
wx.showLoading({
|
|
title: '查询中..',
|
|
mask:true
|
|
})
|
|
api.request('/crm/candidate/', 'GET', data).then(res => {
|
|
this.setData({
|
|
candidates:res.data.results
|
|
})
|
|
wx.hideLoading()
|
|
}).catch(e=>{
|
|
wx.hideLoading()
|
|
})
|
|
// api.request('/crm/consumer/realinfo/', 'POST', data).then(res=>{
|
|
// })
|
|
}else{
|
|
wx.showToast({
|
|
title: '请填写正确的证书编号或身份证号',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
}
|
|
},
|
|
toDetail: function(e){
|
|
debugger;
|
|
var url = e.currentTarget.dataset.url;
|
|
var id = e.currentTarget.dataset.id;
|
|
console.log(id)
|
|
getApp().globalData.candidate_url = url
|
|
wx.navigateTo({
|
|
url: 'detail?id='+id,
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
|
|
}
|
|
}) |