// pages/resumeDone/index.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { userDetails: {}, userEmergencyList: [], userExperienceList: [], userEducationList: [], }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getUserDetails(); this.getUserEmergencyList(); this.getUserEducationList(); this.getUserExperienceList(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, getUserDetails: function() { var that = this; wx.request({ url: app.globalData.ip + '/user/getUserDetails', data: {}, header: app.globalData.headers, method: "POST", success: function (res) { console.log(res); if (res.data.status == 200) { that.data.userDetails = res.data.data; that.setData({ userDetails: that.data.userDetails, lifePhotoUrl: that.data.userDetails.lifePhoto, lifePhotoUrlMini: that.data.userDetails.lifePhotoMini, }); } else if (res.data.status == 9999) { // app.dialogNotLogin(); } else { app.showTips(that, res.data.msg); } } }) }, getUserEmergencyList: function() { var that = this; wx.request({ url: app.globalData.ip + '/user/emergency/getUserEmergencyList', data: {}, header: app.globalData.headers, method: "POST", success: function (res) { console.log(res); if (res.data.status == 200) { that.setData({ userEmergencyList: res.data.data }); } else if (res.data.status == 9999) { // app.dialogNotLogin(); } else { app.showTips(that, res.data.msg); } } }) }, getUserEducationList: function() { var that = this; wx.request({ url: app.globalData.ip + '/user/education/getUserEducationList', data: {}, header: app.globalData.headers, method: "POST", success: function (res) { console.log(res); if (res.data.status == 200) { res.data.data.forEach(item => { if (app.isNotEmptyCheck(item.startDate) && app.isNotEmptyCheck(item.endDate)) { var str = ''; var startDate = new Date(item.startDate); var yearIndex = startDate.getFullYear(); var monthIndex = startDate.getMonth() + 1; str = yearIndex + "." + monthIndex; var endDate = new Date(item.endDate); yearIndex = endDate.getFullYear(); monthIndex = endDate.getMonth() + 1; str = str + '-' + yearIndex + "." + monthIndex; item['dateStr'] = str; } }); that.setData({ userEducationList: res.data.data }); } else if (res.data.status == 9999) { // app.dialogNotLogin(); } else { app.showTips(that, res.data.msg); } } }) }, getUserExperienceList: function() { var that = this; wx.request({ url: app.globalData.ip + '/user/experience/getUserExperienceList', data: {}, header: app.globalData.headers, method: "POST", success: function (res) { console.log(res); if (res.data.status == 200) { res.data.data.forEach(item => { if (app.isNotEmptyCheck(item.startDate) && app.isNotEmptyCheck(item.endDate)) { var str = ''; var startDate = new Date(item.startDate); var yearIndex = startDate.getFullYear(); var monthIndex = startDate.getMonth() + 1; str = yearIndex + "." + monthIndex; var endDate = new Date(item.endDate); yearIndex = endDate.getFullYear(); monthIndex = endDate.getMonth() + 1; str = str + '-' + yearIndex + "." + monthIndex; item['dateStr'] = str; } }); that.setData({ userExperienceList: res.data.data }); } else if (res.data.status == 9999) { // app.dialogNotLogin(); } else { app.showTips(that, res.data.msg); } } }) }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })