You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
const _app = getApp<IAppOption>();
|
|
|
|
|
|
|
|
Page({
|
|
|
|
data: {
|
|
|
|
doc: '1',
|
|
|
|
|
|
|
|
fileIcon: {
|
|
|
|
pdf: 'file-icon1',
|
|
|
|
doc: 'file-icon2',
|
|
|
|
docx: 'file-icon3',
|
|
|
|
pptx: 'file-icon4',
|
|
|
|
xls: 'file-icon5',
|
|
|
|
xlsx: 'file-icon6',
|
|
|
|
ppt: 'file-icon7',
|
|
|
|
none: 'file-icon8',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onLoad() {},
|
|
|
|
|
|
|
|
handleDownload() {
|
|
|
|
wx.downloadFile({
|
|
|
|
url: '',
|
|
|
|
success: (res) => {
|
|
|
|
if (res.statusCode === 200) {
|
|
|
|
wx.openDocument({
|
|
|
|
filePath: res.tempFilePath,
|
|
|
|
success: () => {
|
|
|
|
console.log('打开文档成功');
|
|
|
|
},
|
|
|
|
fail: (err) => {
|
|
|
|
console.error('打开文档失败', err);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
console.error('下载文件失败', res);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export {};
|