2025-06-19 17:33:18 +08:00

106 lines
2.0 KiB
TypeScript

// pages/backlog/violation/violation.ts
import { getAction } from '../../../api/base';
Page({
/**
* 页面的初始数据
*/
data: {
tabActive: 0,
id: '',
item: {}
},
// 变更tab
changeTab(e: any) {
console.log(e.currentTarget.dataset.tab);
this.setData({
tabActive: e.currentTarget.dataset.tab
});
},
getDetailInf() {
let parms = {
id: this.data.id
};
getAction('api/vehicles/backlog/getViolationRecorddById', parms).then(
(res: any) => {
if (res.code == 200) {
console.log(res.result);
this.setData({
item: res.result
});
} else {
wx.showToast({
title: res.message,
icon: 'none'
});
}
}
);
},
toFeedback() {
let that = this;
// 违章信息
wx.setStorageSync('violation', '');
// 跳转到违章处理反馈
wx.navigateTo({
url: '../violationFeedback/violationFeedback',
success: function (res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('eventName', { ...that.data.item });
},
fail: e => {
console.log(e);
}
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {
const eventChannel = this.getOpenerEventChannel();
getApp().EventChannel = eventChannel;
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
let id = wx.getStorageSync('backlogInf').id;
this.setData({
id: id
});
this.getDetailInf();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
});