修改作品分享事件

master
chen 2022-01-04 12:45:30 +08:00
parent 8a48573ec6
commit 1f86962abd
5 changed files with 80 additions and 42 deletions

View File

@ -643,45 +643,83 @@ Page({
}) })
if(newIndex==0){ if(newIndex==0){
wx.showToast({title:'正在调起分享',duration:50000}) wx.showToast({title:'正在调起分享',duration:50000})
} wx.showShareImageMenu({
wx.uploadFile({ path: this.data.canvasTemImg,
url: urlPath.composeBottle, success:(res)=>{
filePath: this.data.canvasTemImg, wx.hideToast();
name: 'image', this.setData({times:0})
formData: { },
'name': this.data.titleVal fail:(error)=>{
}, wx.hideToast();
header: { this.setData({times:0})
"Content-Type": "multipart/form-data",
'Content-Type': 'application/json',
'token': wx.getStorageSync('token')
},
success: (res)=> {
let newRes = JSON.parse(res.data);
if(newRes.code==0){
if(newIndex==0){
wx.downloadFile({
url: urlPath.host + newRes.data.src,
success: (res) => {
wx.hideToast();
this.setData({
times:0
})
wx.showShareImageMenu({
path: res.tempFilePath,
success:(res)=>{}
})
}
})
} else {
this.shareEv(newRes.data.id);
}
} }
}, })
fail: function(data) { } else {
console.log(data); wx.showToast({title:'正在发布...',duration:50000})
} wx.uploadFile({
}) url: urlPath.composeBottle,
filePath: this.data.canvasTemImg,
name: 'image',
formData: {
'name': this.data.titleVal
},
header: {
"Content-Type": "multipart/form-data",
'Content-Type': 'application/json',
'token': wx.getStorageSync('token')
},
success: (res)=> {
let newRes = JSON.parse(res.data);
console.log(newRes);
if(newRes.code==0){
this.shareEv(newRes.data.id);
} else {
wx.showToast({title:'发布失败'})
}
},
fail: function(data) {
console.log(data);
}
})
}
// wx.uploadFile({
// url: urlPath.composeBottle,
// filePath: this.data.canvasTemImg,
// name: 'image',
// formData: {
// 'name': this.data.titleVal
// },
// header: {
// "Content-Type": "multipart/form-data",
// 'Content-Type': 'application/json',
// 'token': wx.getStorageSync('token')
// },
// success: (res)=> {
// let newRes = JSON.parse(res.data);
// if(newRes.code==0){
// if(newIndex==0){
// wx.downloadFile({
// url: urlPath.host + newRes.data.src,
// success: (res) => {
// wx.hideToast();
// this.setData({
// times:0
// })
// wx.showShareImageMenu({
// path: this.data.canvasTemImg,
// success:(res)=>{}
// })
// }
// })
// } else {
// this.shareEv(newRes.data.id);
// }
// }
// },
// fail: function(data) {
// console.log(data);
// }
// })
} }
}, },
// 分享事件 // 分享事件

View File

@ -52,7 +52,7 @@ Page({
}); });
}, },
sign() { sign() {
wx.navigateTo({ url: '/pagesA/pages/sign/sign' }); // wx.navigateTo({ url: '/pagesA/pages/sign/sign' });
}, },
/** /**
* 页面的初始数据 * 页面的初始数据

View File

@ -6,7 +6,7 @@ Page({
wx.navigateTo({ url: '/pagesA/pages/picture/picture' }); wx.navigateTo({ url: '/pagesA/pages/picture/picture' });
}, },
again() { again() {
wx.navigateTo({ url: '/pagesA/pages/sign/sign' }); // wx.navigateTo({ url: '/pagesA/pages/sign/sign' });
}, },
/** /**
* 页面的初始数据 * 页面的初始数据

View File

@ -6,7 +6,7 @@ Page({
wx.navigateTo({ url: '/pagesA/pages/personal/personal' }); wx.navigateTo({ url: '/pagesA/pages/personal/personal' });
}, },
sign() { sign() {
wx.navigateTo({ url: '/pagesA/pages/sign/sign' }); // wx.navigateTo({ url: '/pagesA/pages/sign/sign' });
}, },
/** /**
* 页面的初始数据 * 页面的初始数据

View File

@ -2,7 +2,7 @@
Page({ Page({
sign() { sign() {
wx.navigateTo({ url: '/pagesA/pages/sign/sign' }); // wx.navigateTo({ url: '/pagesA/pages/sign/sign' });
}, },
/** /**
* 页面的初始数据 * 页面的初始数据