diff --git a/pages/canvasposter/canvasposter.js b/pages/canvasposter/canvasposter.js index c44d970..303d653 100644 --- a/pages/canvasposter/canvasposter.js +++ b/pages/canvasposter/canvasposter.js @@ -643,45 +643,83 @@ Page({ }) if(newIndex==0){ 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); - 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); - } + wx.showShareImageMenu({ + path: this.data.canvasTemImg, + success:(res)=>{ + wx.hideToast(); + this.setData({times:0}) + }, + fail:(error)=>{ + wx.hideToast(); + this.setData({times:0}) } - }, - fail: function(data) { - console.log(data); - } - }) + }) + } else { + 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); + // } + // }) } }, // 分享事件 diff --git a/pages/index/index.js b/pages/index/index.js index 3b1fc21..88aa61e 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -52,7 +52,7 @@ Page({ }); }, sign() { - wx.navigateTo({ url: '/pagesA/pages/sign/sign' }); + // wx.navigateTo({ url: '/pagesA/pages/sign/sign' }); }, /** * 页面的初始数据 diff --git a/pages/user/user.js b/pages/user/user.js index 69b4f02..64de8c5 100644 --- a/pages/user/user.js +++ b/pages/user/user.js @@ -6,7 +6,7 @@ Page({ wx.navigateTo({ url: '/pagesA/pages/picture/picture' }); }, again() { - wx.navigateTo({ url: '/pagesA/pages/sign/sign' }); + // wx.navigateTo({ url: '/pagesA/pages/sign/sign' }); }, /** * 页面的初始数据 diff --git a/pagesA/pages/picture/picture.js b/pagesA/pages/picture/picture.js index 5caf4ec..4c5d5a4 100644 --- a/pagesA/pages/picture/picture.js +++ b/pagesA/pages/picture/picture.js @@ -6,7 +6,7 @@ Page({ wx.navigateTo({ url: '/pagesA/pages/personal/personal' }); }, sign() { - wx.navigateTo({ url: '/pagesA/pages/sign/sign' }); + // wx.navigateTo({ url: '/pagesA/pages/sign/sign' }); }, /** * 页面的初始数据 diff --git a/pagesA/pages/rule/rule.js b/pagesA/pages/rule/rule.js index 643f55c..3f75df5 100644 --- a/pagesA/pages/rule/rule.js +++ b/pagesA/pages/rule/rule.js @@ -2,7 +2,7 @@ Page({ sign() { - wx.navigateTo({ url: '/pagesA/pages/sign/sign' }); + // wx.navigateTo({ url: '/pagesA/pages/sign/sign' }); }, /** * 页面的初始数据