From 1f86962abd31e19da4886394f4e98b6ae0139054 Mon Sep 17 00:00:00 2001 From: chen <2659004835@qq.com> Date: Tue, 4 Jan 2022 12:45:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E5=93=81=E5=88=86?= =?UTF-8?q?=E4=BA=AB=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/canvasposter/canvasposter.js | 114 +++++++++++++++++++---------- pages/index/index.js | 2 +- pages/user/user.js | 2 +- pagesA/pages/picture/picture.js | 2 +- pagesA/pages/rule/rule.js | 2 +- 5 files changed, 80 insertions(+), 42 deletions(-) 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' }); }, /** * 页面的初始数据