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.
35 lines
653 B
35 lines
653 B
const app = getApp();
|
|
Component({
|
|
properties: {
|
|
data:Object
|
|
},
|
|
data: {
|
|
|
|
},
|
|
methods: {
|
|
preview(){
|
|
let url = global.config.eduUrl + this.data.data.url;
|
|
if (this.data.data.content_type.startsWith("image")) {
|
|
wx.previewImage({
|
|
urls: [url]
|
|
});
|
|
return;
|
|
}
|
|
wx.showLoading({
|
|
title: '下载中',
|
|
})
|
|
wx.downloadFile({
|
|
url,
|
|
success: (res) => {
|
|
wx.openDocument({
|
|
filePath: res.tempFilePath,
|
|
fail: app.showError
|
|
});
|
|
},
|
|
fail: app.showError,
|
|
complete: wx.hideLoading
|
|
})
|
|
}
|
|
}
|
|
})
|