修复缺陷

This commit is contained in:
duxp 2023-10-09 16:44:50 +08:00
parent d3bf6e94cd
commit 85f5e5625c
3 changed files with 25 additions and 7 deletions

View File

@ -1,6 +1,6 @@
// pages/approvalWarning/approvalForm/approvalForm.js // pages/approvalWarning/approvalForm/approvalForm.js
import {base_url} from '../../../utils/http'; import {base_url} from '../../../utils/http';
import {API} from "../../../utils/api"; import {API as $api, API} from "../../../utils/api";
Page({ Page({
/** /**
@ -23,9 +23,8 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
if(options && JSON.parse(options.data)){ if(options && JSON.stringify(options) !== '{}'){
let _data = JSON.parse(options.data); let _fileData = options.files?options.files.split(","):[];
let _fileData = _data.files?_data.files.split(","):[];
let _newFileData = []; let _newFileData = [];
_fileData.forEach(item => { _fileData.forEach(item => {
let _lastNum = item.lastIndexOf('/')+1; let _lastNum = item.lastIndexOf('/')+1;
@ -34,8 +33,13 @@ Page({
url:base_url+item url:base_url+item
}) })
}) })
this.loadDetailData({
pageNum:1,
pageSize:10,
type:options.type,
id:options.id
})
this.setData({ this.setData({
fData:_data,
fileList:_newFileData fileList:_newFileData
}) })
} }
@ -165,6 +169,21 @@ Page({
} }
}) })
}, },
//加载详情数据
loadDetailData(param){
let _this = this;
$api.queryList(param).then(res => {
if(res.code === 0){
let _data = null;
if(res.rows.length>0){
_data = res.rows[0];
}
_this.setData({
fData:_data
})
}
})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成

View File

@ -37,7 +37,7 @@ Page({
handleSwitchItem(e){ handleSwitchItem(e){
let _data = e.currentTarget.dataset.item; let _data = e.currentTarget.dataset.item;
wx.navigateTo({ wx.navigateTo({
url:'./approvalForm/approvalForm?data='+JSON.stringify(_data) url:'./approvalForm/approvalForm?files='+_data.files+'&type='+_data.type+'&id='+_data.id
}) })
}, },

View File

@ -34,7 +34,6 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
console.log(options,'option');
if(options && JSON.stringify(options) !== '{}'){ if(options && JSON.stringify(options) !== '{}'){
this.setData({ this.setData({
"searchForm.type":options.type, "searchForm.type":options.type,