index.js 7.0 KB

1
  1. require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/users/user_spread_code/index"],{"3bf1":function(e,t,n){"use strict";var a=n("e14e"),i=n.n(a);i.a},"54aa":function(e,t,n){"use strict";(function(e,t){var a=n("4ea4");n("4789");a(n("66fd"));var i=a(n("66b2"));e.__webpack_require_UNI_MP_PLUGIN__=n,t(i.default)}).call(this,n("bc2e")["default"],n("543d")["createPage"])},"5b46":function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return s})),n.d(t,"a",(function(){return a}));var a={zbCode:function(){return Promise.all([n.e("common/vendor"),n.e("components/zb-code/zb-code")]).then(n.bind(null,"92ed"))}},i=function(){var e=this.$createElement,t=(this._self._c,this.$t("保存海报"));this.$mp.data=Object.assign({},{$root:{m0:t}})},s=[]},"66b2":function(e,t,n){"use strict";n.r(t);var a=n("5b46"),i=n("fcf4");for(var s in i)["default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(s);n("3bf1");var r=n("f0c5"),o=Object(r["a"])(i["default"],a["b"],a["c"],!1,null,null,null,!1,a["a"],void 0);t["default"]=o.exports},bcee:function(e,t,n){"use strict";(function(e){var a=n("4ea4");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=a(n("2eee")),s=a(n("c973")),r=n("d1ea"),o=n("86eb"),u=n("26cb"),c=n("00a0"),d=a(n("19b6")),f={components:{authorize:function(){n.e("components/Authorize").then(function(){return resolve(n("ad23"))}.bind(null,n)).catch(n.oe)},home:function(){Promise.all([n.e("common/vendor"),n.e("components/home/index")]).then(function(){return resolve(n("3b71"))}.bind(null,n)).catch(n.oe)},zbCode:function(){Promise.all([n.e("common/vendor"),n.e("components/zb-code/zb-code")]).then(function(){return resolve(n("92ed"))}.bind(null,n)).catch(n.oe)}},mixins:[d.default],data:function(){return{imgUrls:[],indicatorDots:!1,posterImageStatus:!0,circular:!1,autoplay:!1,interval:3e3,duration:500,swiperIndex:0,spreadList:[],userInfo:{},poster:"",isAuto:!1,isShowAuth:!1,spreadData:[{}],nickName:"",siteName:"",mpUrl:"",canvasImageUrl:"",posterImage:[],codeShow:!1,cid:"1",ifShow:!0,val:"",size:200,unit:"upx",background:"#FFF",foreground:"#000",pdground:"#000",icon:"",iconsize:40,lv:3,onval:!0,loadMake:!0,src:"",codeSrc:"",wd:0,hg:0,qrcode:""}},computed:(0,u.mapGetters)({isLogin:"isLogin",userData:"userInfo",uid:"uid"}),watch:{isLogin:{handler:function(e,t){e&&this.userSpreadBannerList()},deep:!0},userData:{handler:function(e,t){e&&this.$set(this,"userInfo",e)},deep:!0}},onReady:function(){var t=this;return(0,s.default)(i.default.mark((function n(){return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(!t.isLogin){n.next=6;break}return t.val="".concat(c.HTTP_REQUEST_URL,"?spid=").concat(t.uid),n.next=4,t.getUser();case 4:n.next=7;break;case 6:(0,o.toLogin)();case 7:t.$nextTick((function(){var n=e.createSelectorQuery().select(".aaa");n.fields({size:!0},(function(e){t.wd=e.width,t.hg=e.height})).exec()}));case 8:case"end":return n.stop()}}),n)})))()},onShow:function(){},onHide:function(){e.hideLoading()},onShareAppMessage:function(){return{title:this.userInfo.nickname+"-"+this.$t("分销海报"),imageUrl:this.spreadList[0],path:"/pages/index/index?spread="+this.userInfo.uid}},methods:{getUser:function(){var e=this;(0,r.getUserInfo)().then((function(t){e.userInfo=t.data}))},onLoadFun:function(e){this.$set(this,"userInfo",e),this.userSpreadBannerList()},qrR:function(e){this.codeSrc=e,this.spreadMsgs()},spreadMsgs:function(){var t=this;return(0,s.default)(i.default.mark((function n(){var a,s,o,u;return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,(0,r.spreadMsg)();case 2:return a=n.sent,t.spreadData=a.data.spread,t.nickName=a.data.nickname,t.siteName=a.data.site_name,n.next=8,t.imgToBase(a.data.qrcode);case 8:return t.qrcode=n.sent,n.next=11,t.routineCode();case 11:return n.next=13,t.downloadFilestoreImage(t.mpUrl);case 13:s=n.sent,e.showLoading({title:t.$t("海报生成中"),mask:!0}),o=i.default.mark((function e(n){var r,o;return i.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return r=t,o=void 0,void 0,e.t0=s,e.next=5,t.downloadFilestoreImage(a.data.spread[n].pic);case 5:e.t1=e.sent,o=[e.t0,e.t1],r.$util.userPosterCanvas(o,a.data.nickname,a.data.site_name,n,t.wd,t.hg,(function(e){if(r.$set(r.posterImage,n,e),!r.posterImage.length)return r.$util.Tips({title:r.$t("小程序二维码需要发布正式版后才能获取到")})}));case 8:case"end":return e.stop()}}),e)})),u=0;case 17:if(!(u<a.data.spread.length)){n.next=22;break}return n.delegateYield(o(u),"t0",19);case 19:u++,n.next=17;break;case 22:e.hideLoading();case 23:case"end":return n.stop()}}),n)})))()},downloadImg:function(){e.saveImageToPhotosAlbum({filePath:this.posterImage[this.swiperIndex],success:function(){}})},routineCode:function(){var e=this;return(0,s.default)(i.default.mark((function t(){var n;return i.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,(0,r.routineCode)();case 2:n=t.sent,e.mpUrl=n.data.url;case 4:case"end":return t.stop()}}),t)})))()},imgToBase:function(e,t){return(0,s.default)(i.default.mark((function n(){var a;return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,(0,r.imgToBase)({image:e,code:t});case 2:return a=n.sent,n.abrupt("return",a.data);case 4:case"end":return n.stop()}}),n)})))()},codeImg:function(){},authColse:function(e){this.isShowAuth=e},bindchange:function(e){this.spreadList;this.swiperIndex=e.detail.current},savePosterPathMp:function(t){var n=this;e.getSetting({success:function(a){a.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success:function(e){n.$util.Tips({title:n.$t("保存成功"),icon:"success"})},fail:function(e){n.$util.Tips({title:n.$t("保存失败")})}}):e.authorize({scope:"scope.writePhotosAlbum",success:function(){e.saveImageToPhotosAlbum({filePath:t,success:function(e){n.$util.Tips({title:n.$t("保存成功"),icon:"success"})},fail:function(e){n.$util.Tips({title:n.$t("保存失败")})}})}})}})},downloadFilestoreImage:function(t){var n=this;return new Promise((function(a,i){var s=n;e.downloadFile({url:t,success:function(e){a(e.tempFilePath)},fail:function(){return s.$util.Tips({title:""})}})}))},setShareInfoStatus:function(){var e=this;this.$wechat.isWeixin()&&(this.isLogin?(0,r.getUserInfo)().then((function(t){var n={desc:e.$t("分销海报"),title:t.data.nickname+"-"+e.$t("分销海报"),link:"/pages/index/index?spread="+t.data.uid,imgUrl:e.spreadList[0]};e.$wechat.wechatEvevt(["updateAppMessageShareData","updateTimelineShareData"],n)})):(0,o.toLogin)())},userSpreadBannerList:function(){var t=this;e.showLoading({title:t.$t("获取中"),mask:!0}),(0,r.spreadBanner)().then((function(n){e.hideLoading(),t.$set(t,"spreadList",n.data),t.$set(t,"poster",n.data[0].poster)})).catch((function(t){e.hideLoading()}))}}};t.default=f}).call(this,n("543d")["default"])},e14e:function(e,t,n){},fcf4:function(e,t,n){"use strict";n.r(t);var a=n("bcee"),i=n.n(a);for(var s in a)["default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return a[e]}))}(s);t["default"]=i.a}},[["54aa","common/runtime","common/vendor"]]]);