build
This commit is contained in:
parent
97aaefe7d5
commit
a64e1f431d
|
|
@ -527,11 +527,12 @@ exports.default = OakComponent({
|
|||
},
|
||||
onDownloadByMp: function (event) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var value, fileUrl, name;
|
||||
var value, fileUrl, name, that;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
value = event.currentTarget.dataset.value;
|
||||
fileUrl = this.features.extraFile.getUrl(value);
|
||||
name = this.features.extraFile.getFileName(value);
|
||||
that = this;
|
||||
wx.showLoading({
|
||||
title: '下载请求中,请耐心等待..',
|
||||
});
|
||||
|
|
@ -539,13 +540,45 @@ exports.default = OakComponent({
|
|||
url: fileUrl,
|
||||
success: function (res) {
|
||||
var filePath = res.tempFilePath || res.filePath;
|
||||
wx.hideLoading();
|
||||
var fs = wx.getFileSystemManager();
|
||||
var writeFilePath = "".concat(wx.env.USER_DATA_PATH, "/").concat(name);
|
||||
var res2 = fs.saveFileSync(filePath, writeFilePath);
|
||||
fs.saveFile({
|
||||
tempFilePath: filePath,
|
||||
success: function (res) {
|
||||
console.log(res, '下载成功');
|
||||
wx.hideLoading();
|
||||
var savedFilePath = res.savedFilePath;
|
||||
// 打开文件
|
||||
wx.openDocument({
|
||||
filePath: savedFilePath,
|
||||
success: function (res) {
|
||||
console.log('打开文档成功');
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log(res, 'openDocument');
|
||||
that.setMessage({
|
||||
type: 'error',
|
||||
content: '打开文档失败',
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log(res, 'saveFile');
|
||||
wx.hideLoading();
|
||||
that.setMessage({
|
||||
type: 'error',
|
||||
content: '保存文件失败',
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log(res);
|
||||
wx.hideLoading();
|
||||
that.setMessage({
|
||||
type: 'error',
|
||||
content: '下载文件失败'
|
||||
});
|
||||
},
|
||||
complete: function (res) { },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@
|
|||
</view>
|
||||
<view class="file-list-flow__item--btns">
|
||||
<view wx:if="{{!disableDownload}}" mut-bind:tap="onDownloadByMp" class="file-list-flow__download" data-value="{{item}}">
|
||||
<l-icon name="download" size="24" />
|
||||
<l-icon name="download" size="36" />
|
||||
</view>
|
||||
<view wx:if="{{!disableDelete}}" mut-bind:tap="onDeleteByMp" class="file-list-flow__remove" data-value="{{item}}">
|
||||
<l-icon name="delete" size="24" />
|
||||
<l-icon name="delete" size="36" />
|
||||
</view>
|
||||
<view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
<block wx:elif="{{!oakLoading && !expired && (hasConfirmed || !!(granteeId && userId === granteeId) )}}">
|
||||
<l-button l-class="btn" type="success" style="margin: 16rpx" size="large" bind:lintap="redirectPage" disabled="{{!redirectTo}}">
|
||||
领领成功{{redirectTo ? '(' + redirectCounter + 's)' : '' }}
|
||||
领取成功{{redirectTo ? '(' + redirectCounter + 's)' : '' }}
|
||||
</l-button>
|
||||
</block>
|
||||
</view>
|
||||
Loading…
Reference in New Issue