Commit b225c178 authored by Facius's avatar Facius

分享文件加文件名

parent 782470a1
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
this.loadFileLabel('2', label.id) // 获取新合作商对应品牌 this.loadFileLabel('2', label.id) // 获取新合作商对应品牌
} else {// 品牌 } else {// 品牌
this.loadFileList(this.selected['1'].id, this.selected['2'].id) // 获取文件列表 this.loadFileList(this.selected['1'].id, this.selected['2'].id) // 获取文件列表
} }
}, },
// 跳转到所有标签 // 跳转到所有标签
handleMore(key) { handleMore(key) {
...@@ -164,17 +164,11 @@ ...@@ -164,17 +164,11 @@
id: this.vuex_user.id, id: this.vuex_user.id,
url: item.url url: item.url
}); });
let block = (filePath) => {
wx.shareFileMessage({
filePath: filePath,
success() {},
fail: console.error,
})
}
let filePath = this.fileList[(item.url || '').split('/').pop()] let filePath = this.fileList[(item.url || '').split('/').pop()]
if (filePath) { // 有下载记录 if (filePath) { // 有下载记录
wx.shareFileMessage({ // 如果用checkFile检查文件是否存在后再分享,shareFileMess报错:shareFileMessage:fail can only be invoked by user TAP gesture. wx.shareFileMessage({ // 如果用checkFile检查文件是否存在后再分享,shareFileMess报错:shareFileMessage:fail can only be invoked by user TAP gesture.
filePath: filePath, filePath: filePath,
fileName: item.name,
success() {}, success() {},
fail: (error) => { fail: (error) => {
console.log(error) console.log(error)
...@@ -182,6 +176,7 @@ ...@@ -182,6 +176,7 @@
this.downloadFile(item.url, (result)=> { this.downloadFile(item.url, (result)=> {
wx.shareFileMessage({ wx.shareFileMessage({
filePath: result.tempFilePath, filePath: result.tempFilePath,
fileName: item.name,
success() {}, success() {},
fail: console.error, fail: console.error,
}) })
...@@ -193,6 +188,7 @@ ...@@ -193,6 +188,7 @@
this.downloadFile(item.url, (res)=> { // 下载 this.downloadFile(item.url, (res)=> { // 下载
wx.shareFileMessage({ wx.shareFileMessage({
filePath: res.tempFilePath, filePath: res.tempFilePath,
fileName: item.name,
success() {}, success() {},
fail: console.error, fail: console.error,
}) })
...@@ -260,14 +256,6 @@ ...@@ -260,14 +256,6 @@
}); });
} }
}, },
// 分享文件
shareFile(filePath) {
wx.shareFileMessage({
filePath: filePath,
success() {},
fail: console.error,
})
},
// 获取合作商或品牌列表 // 获取合作商或品牌列表
async loadFileLabel(type, partnerCompanyId) { async loadFileLabel(type, partnerCompanyId) {
let param = { let param = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment