111 lines
2.1 KiB
TypeScript
111 lines
2.1 KiB
TypeScript
// pages/dataRecords/dataRecords.ts
|
|
import { dataRecord } from "../../apis/information";
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
id: undefined,
|
|
current: {},
|
|
records: [],
|
|
formName: ''
|
|
},
|
|
|
|
handleEdit() {
|
|
// console.log(e);
|
|
const { records } = this.data
|
|
// const { value } = e.currentTarget.dataset
|
|
let value = records[0]
|
|
const { formName } = this.data
|
|
// let formName = wx.getStorageSync("informationName")
|
|
wx.setStorageSync('informationEditInfo', value)
|
|
|
|
wx.setStorageSync('informationEditDataName', formName === '职业经历' ? (value.dataName === '内容' ? '岗位描述' : value.dataName) : (value.dataName === '内容' ? '事件描述' : value.dataName))
|
|
wx.navigateTo({
|
|
url: `/pages/informationEdit/informationEdit?type=edit`
|
|
})
|
|
},
|
|
handleCorrigendum() {
|
|
const { current, id } = this.data
|
|
wx.setStorageSync('corrigendumInfo', current)
|
|
wx.navigateTo({
|
|
url: `/pages/corrigendum/corrigendum?id=${id}`
|
|
})
|
|
},
|
|
|
|
getDataRecord(id: string | undefined) {
|
|
dataRecord(id).then((res: any) => {
|
|
console.log(res);
|
|
if (res.c === 200) {
|
|
this.setData({
|
|
records: res.d,
|
|
current: res.d[0]
|
|
})
|
|
}
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
let { id } = options
|
|
this.setData({
|
|
id: options.id,
|
|
formName: wx.getStorageSync('informationName')
|
|
})
|
|
// this.getDataRecord(id)
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
// console.log('onShow');
|
|
|
|
this.getDataRecord(this.data.id)
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
}) |