|
|
@@ -508,6 +508,7 @@ Page({
|
|
|
_request.$get(url, params, success)
|
|
|
},
|
|
|
projectImageLoading () {
|
|
|
+ console.log('do projectImageLoading');
|
|
|
var that = this
|
|
|
wx.getImageInfo({
|
|
|
src: 'https://cfohow.hiwavo.com/xcx/poster6.jpg',
|
|
|
@@ -536,82 +537,113 @@ Page({
|
|
|
type: 'project'
|
|
|
}
|
|
|
var success = function (res) {
|
|
|
- wx.getImageInfo({
|
|
|
- src: res.data.qrcode_url,
|
|
|
- success: function (res) {
|
|
|
- that.posterImage.qcode = res
|
|
|
- that.posterLoading++
|
|
|
- if (that.posterLoading === 4) {
|
|
|
- that.createCtx()
|
|
|
- }
|
|
|
- },
|
|
|
- fail: function (res) {
|
|
|
- var url = 'v1/update/poster/' + that.data.productId
|
|
|
- var params = {
|
|
|
- type: 'project'
|
|
|
- }
|
|
|
- var success = function (res2) {
|
|
|
- wx.getImageInfo({
|
|
|
- src: res2.data.qrcode_url,
|
|
|
- success: function (res2) {
|
|
|
- that.posterImage.qcode = res2
|
|
|
- that.posterLoading++
|
|
|
- if (that.posterLoading === 4) {
|
|
|
- that.createCtx()
|
|
|
- }
|
|
|
- },
|
|
|
- fail: function (res2) {
|
|
|
- that.qcodeError = true
|
|
|
- if (that.data.posterPopup) {
|
|
|
- that.setData({
|
|
|
- posterPopup: false
|
|
|
- })
|
|
|
- wx.showToast({
|
|
|
- title: '海报生成失败,请稍后重试',
|
|
|
- icon: 'none',
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- wx.hideLoading()
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- wx.getImageInfo({
|
|
|
- src: res2.data.wx_head,
|
|
|
- success: function (res2) {
|
|
|
- that.posterImage.head = res2
|
|
|
- that.posterLoading++
|
|
|
- if (that.posterLoading === 4) {
|
|
|
- that.createCtx()
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- _request.$put(url, params, success)
|
|
|
-
|
|
|
-// that.qcodeError = true
|
|
|
-// if (that.data.posterPopup) {
|
|
|
-// that.setData({
|
|
|
-// posterPopup: false
|
|
|
-// })
|
|
|
-// wx.showToast({
|
|
|
-// title: '海报生成失败,请稍后重试',
|
|
|
-// icon: 'none',
|
|
|
-// duration: 2000
|
|
|
-// })
|
|
|
-// wx.hideLoading()
|
|
|
-// }
|
|
|
- }
|
|
|
- })
|
|
|
- wx.getImageInfo({
|
|
|
- src: res.data.wx_head,
|
|
|
- success: function (res) {
|
|
|
- that.posterImage.head = res
|
|
|
- that.posterLoading++
|
|
|
- if (that.posterLoading === 4) {
|
|
|
- that.createCtx()
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ var wxhead = res.data.wx_head;
|
|
|
+ if(!wxhead){
|
|
|
+ wx.getUserProfile({
|
|
|
+ desc: '用户头像无法获取,请从新授权', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
|
|
+ success: function(res3) {
|
|
|
+ var url = 'xcx/save_wx_user/info'
|
|
|
+ console.log(JSON.stringify(res3.userInfo));
|
|
|
+ var params = {
|
|
|
+ userinfo: JSON.stringify(res3.userInfo)
|
|
|
+ }
|
|
|
+ var success = function (res4) {
|
|
|
+ console.log('authorize',res4)
|
|
|
+ wxhead = res4.data.head;
|
|
|
+ console.log(wxhead);
|
|
|
+ that.posterLoading = 0;
|
|
|
+ that.projectImageLoading();
|
|
|
+ }
|
|
|
+ _request.$post(url, params, success)
|
|
|
+ },
|
|
|
+ fail: function(err){
|
|
|
+ wx.showToast({
|
|
|
+ title: '用户头像获取失败,生成海报失败',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ wx.hideLoading();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ wx.getImageInfo({
|
|
|
+ src: res.data.qrcode_url,
|
|
|
+ success: function (res) {
|
|
|
+ that.posterImage.qcode = res
|
|
|
+ that.posterLoading++
|
|
|
+ if (that.posterLoading === 4) {
|
|
|
+ that.createCtx()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ var url = 'v1/update/poster/' + that.data.productId
|
|
|
+ var params = {
|
|
|
+ type: 'project'
|
|
|
+ }
|
|
|
+ var success = function (res2) {
|
|
|
+ wx.getImageInfo({
|
|
|
+ src: res2.data.qrcode_url,
|
|
|
+ success: function (res2) {
|
|
|
+ that.posterImage.qcode = res2
|
|
|
+ that.posterLoading++
|
|
|
+ if (that.posterLoading === 4) {
|
|
|
+ that.createCtx()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: function (res2) {
|
|
|
+ that.qcodeError = true
|
|
|
+ if (that.data.posterPopup) {
|
|
|
+ that.setData({
|
|
|
+ posterPopup: false
|
|
|
+ })
|
|
|
+ wx.showToast({
|
|
|
+ title: '海报生成失败,请稍后重试',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ wx.hideLoading()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ wx.getImageInfo({
|
|
|
+ src: res2.data.wx_head,
|
|
|
+ success: function (res2) {
|
|
|
+ that.posterImage.head = res2
|
|
|
+ that.posterLoading++
|
|
|
+ if (that.posterLoading === 4) {
|
|
|
+ that.createCtx()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ _request.$put(url, params, success)
|
|
|
+
|
|
|
+ // that.qcodeError = true
|
|
|
+ // if (that.data.posterPopup) {
|
|
|
+ // that.setData({
|
|
|
+ // posterPopup: false
|
|
|
+ // })
|
|
|
+ // wx.showToast({
|
|
|
+ // title: '海报生成失败,请稍后重试',
|
|
|
+ // icon: 'none',
|
|
|
+ // duration: 2000
|
|
|
+ // })
|
|
|
+ // wx.hideLoading()
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ wx.getImageInfo({
|
|
|
+ src: res.data.wx_head,
|
|
|
+ success: function (res) {
|
|
|
+ that.posterImage.head = res
|
|
|
+ that.posterLoading++
|
|
|
+ if (that.posterLoading === 4) {
|
|
|
+ that.createCtx()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
_request.$get(url, params, success)
|
|
|
},
|