Commit 6bc7d9dd by zhangxw

上传延保协议添加自定义loading

1 parent 3dd49c86
......@@ -14,7 +14,7 @@
left: 0;
bottom: 0;
right: 0;
background-color: rgba(0, 0, 0, .6);
background-color: rgba(0, 0, 0, .7);
}
.text-center {
......
......@@ -47,15 +47,19 @@ Component({
let [tempFiles] = res.tempFilePaths
let imgType = tempFiles.split('.')[1]
let type = imgType == 'unknown' ? 'jpg' : imgType
_this.setData({
loadingFlag: true
})
wx.getFileSystemManager().readFile({
filePath: tempFiles, //选择图片返回的相对路径
encoding: 'base64', //编码格式
success(_res) {
wx.$util.showLoading('上传中...')
api.uploadImg({
file: `${type}@${_res.data}`
}).then(img => {
wx.$util.hideLoading()
_this.setData({
loadingFlag: false
})
let { code, data, message } = img
if (code == 0) {
fileList.push({url: data})
......@@ -97,16 +101,20 @@ Component({
let fileType = fileName.split('.').pop() // 获取文件扩展名
// 读取文件
if (fileType != 'pdf') return wx.$util.showToast('只可上传pdf类型文件')
_this.setData({
loadingFlag: true
})
wx.getFileSystemManager().readFile({
filePath: tempFile.path, // 使用正确的路径
encoding: 'base64',
success(_res) {
wx.$util.showLoading('上传中...');
// 调用上传接口
api.uploadPdfAPI({
file: `${fileType}@${_res.data}` // 处理文件类型
}).then(img => {
wx.$util.hideLoading();
_this.setData({
loadingFlag: false
})
let { code, data, message } = img;
if (code == 0) {
......
{
"component": true,
"usingComponents": {
"popup": "../Popup/Popup"
"popup": "../Popup/Popup",
"van-loading": "@vant/weapp/loading/index"
}
}
\ No newline at end of file
......@@ -101,4 +101,10 @@
line-height: var(--fontSize112);
border-bottom: var(--fontSize1) solid #EBEDF0;
}
}
.loading-box{
background-color: rgba(0, 0, 0, 0.7);
.van-loading__text{
color: #FFFFFF !important;
}
}
\ No newline at end of file
<!--packageEquity/pages/carQuotation/components/zyPayPopup/zyPayPopup.wxml-->
<glsx-privacy appletName="生意助手员工版" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<block wx:if="{{!showChangeFileType}}">
<block wx:if="{{!showChangeFileType && !loadingFlag}}">
<popup
title="{{'上传延保协议'}}"
show="{{show}}"
......@@ -39,7 +39,7 @@
</view>
</popup>
</block>
<block wx:else>
<block wx:if="{{showChangeFileType && !loadingFlag}}">
<van-popup
class="file-type-popup"
show="{{show}}"
......@@ -54,4 +54,9 @@
</view>
</van-popup>
</block>
<block wx:if="{{loadingFlag}}">
<van-popup show="{{show}}" close-on-click-overlay="{{false}}" >
<van-loading custom-class="loading-box" color="#FFFFFF" type="spinner" size="45px" vertical>上传中</van-loading>
</van-popup>
</block>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!