浏览代码

优化

master
pangdongxu 3 年前
父节点
当前提交
0b3dccf7b9
共有 4 个文件被更改,包括 84 次插入2 次删除
  1. +65
    -0
      pages/apply/paymentTemplate/add/add.js
  2. +9
    -0
      pages/apply/paymentTemplate/add/add.wxml
  3. +1
    -1
      project.private.config.json
  4. +9
    -1
      utils/API.js

+ 65
- 0
pages/apply/paymentTemplate/add/add.js 查看文件

@@ -1690,6 +1690,71 @@ Page({
}
})
},
uploadFile(e){
var that = this;
wx.chooseMessageFile({
count: 1,
type: 'file',
success (res) {
console.log(res);
// tempFilePath可以作为 img 标签的 src 属性显示图片
const tempFilePaths = res.tempFiles
wx.uploadFile({
url: API.URL_GET_UPLOADFILE,
filePath: tempFilePaths[0].path,
name: 'file',
header: {
"Content-Type": "multipart/form-data",//记得设置
"chartset":"utf-8",
'Authorization':'Bearer '+getApp().globalData.userInfo.token
},
formData:{
bankType:'2',
accountType:'1',
isPeers:'Y'
},
success (response){
console.log(response);
let list = JSON.parse(response.data);
console.log(list);
that.setData({
['form.transfers[0].payeeList']:list.rows
})
},
fail(res){
}
})
}
})
},
downLoad(){
wx.downloadFile({
url: API.URL_GET_DOWNFILE, //仅为示例,并非真实的资源
success (res) {
console.log(res);
// 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
if (res.statusCode === 200) {
var fs = wx.getFileSystemManager();
fs.saveFile({
tempFilePath:res.tempFilePath,
success:function(response){
console.log(response);
}
})
// wx.saveFile({
// tempFilePath: res.tempFilePath,
// success:function(response){
// console.log(response);
// }
// })

// wx.playVoice({
// filePath: res.tempFilePath
// })
}
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/


+ 9
- 0
pages/apply/paymentTemplate/add/add.wxml 查看文件

@@ -221,7 +221,16 @@
</block>

</view>

<text class="title">收款方信息</text>
<view bindtap="uploadFile">
<image src="/image/apply/icon_exel.png" style="width: 25px;height: 25px;"></image>
<text>批量上传</text>
</view>
<view bindtap="downLoad">
<image src="/image/apply/icon_exel.png" style="width: 25px;height: 25px;"></image>
<text>模板下载</text>
</view>
<view class="center-box">
<block wx:if="{{form.transfers[index].transferType == 12}}">
<view class="main-box table-box" wx:for="{{form.transfers[index].payeeList}}" wx:for-index="childrenIndex" wx:key="payeeId">


+ 1
- 1
project.private.config.json 查看文件

@@ -149,5 +149,5 @@
},
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "WXMB",
"libVersion": "2.11.2"
"libVersion": "2.24.3"
}

+ 9
- 1
utils/API.js 查看文件

@@ -306,6 +306,12 @@ const URL_GET_PAYEEGET = `${URL_PREFIX}/yinnong/payee/get/`;
//收款人删除
const URL_GET_PAYEEREMOVE = `${URL_PREFIX}/yinnong/payee/remove/`;

//上传收款人
const URL_GET_UPLOADFILE = `${URL_PREFIX}/yinnong/transfer/importData`;

//下载收款人模板
const URL_GET_DOWNFILE = `${URL_PREFIX}/yinnong/transfer/importTemplate`;



/****************接口地址end****************/
@@ -423,5 +429,7 @@ export {
URL_GET_ASSETREMOVE,
URL_GET_PAYEEEDIT,
URL_GET_PAYEEGET,
URL_GET_PAYEEREMOVE
URL_GET_PAYEEREMOVE,
URL_GET_UPLOADFILE,
URL_GET_DOWNFILE
}

正在加载...
取消
保存