Retired/unpackage/dist/dev/mp-weixin/components/popup-share/popup-share.js

12 lines
7.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/popup-share/popup-share"],{456:function(e,n,t){"use strict";t.r(n);var r=t(457),o=t(459);for(var s in o)["default"].indexOf(s)<0&&function(e){t.d(n,e,(function(){return o[e]}))}(s);t(461);var a,i=t(32),c=Object(i["default"])(o["default"],r["render"],r["staticRenderFns"],!1,null,"70be22fc",null,!1,r["components"],a);c.options.__file="components/popup-share/popup-share.vue",n["default"]=c.exports},457:function(e,n,t){"use strict";t.r(n);var r=t(458);t.d(n,"render",(function(){return r["render"]})),t.d(n,"staticRenderFns",(function(){return r["staticRenderFns"]})),t.d(n,"recyclableRender",(function(){return r["recyclableRender"]})),t.d(n,"components",(function(){return r["components"]}))},458:function(e,n,t){"use strict";var r;t.r(n),t.d(n,"render",(function(){return o})),t.d(n,"staticRenderFns",(function(){return a})),t.d(n,"recyclableRender",(function(){return s})),t.d(n,"components",(function(){return r}));try{r={uPopup:function(){return Promise.all([t.e("common/vendor"),t.e("uni_modules/uview-ui/components/u-popup/u-popup")]).then(t.bind(null,432))}}}catch(i){if(-1===i.message.indexOf("Cannot find module")||-1===i.message.indexOf(".vue"))throw i;console.error(i.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范文档https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var o=function(){var e=this,n=e.$createElement;e._self._c;e._isMounted||(e.e0=function(n){e.showShare=!1},e.e1=function(n){e.showShare=!0},e.e2=function(n){e.showShare=!1})},s=!1,a=[];o._withStripped=!0},459:function(e,n,t){"use strict";t.r(n);var r=t(460),o=t.n(r);for(var s in r)["default"].indexOf(s)<0&&function(e){t.d(n,e,(function(){return r[e]}))}(s);n["default"]=o.a},460:function(e,n,t){"use strict";(function(e){var r=t(4);Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var o=r(t(55)),s=r(t(57)),a={props:{show:{type:Boolean,default:!1}},watch:{show:function(e){this.showShare=e},showShare:function(e){this.$emit("update:show",e)}},data:function(){return{showShare:!1,providerList:[],shareType:1,title:"share",shareText:"uni-app可以同时发布成原生App、小程序、H5邀请你一起体验",href:"https://uniapp.dcloud.io",image:""}},computed:{isShow:function(){return function(e){return(0!==this.shareType||"qq"!==e.id)&&(5!==this.shareType||"微信好友"===e.name)}}},onShareAppMessage:function(){return{title:this.shareText?this.shareText:"欢迎体验uni-app",path:"/pages/tabBar/component/component",imageUrl:this.image?this.image:"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b6304f00-5168-11eb-bd01-97bc1429a9ff.png"}},beforeDestroy:function(){this.shareText="uni-app可以同时发布成原生App、小程序、H5邀请你一起体验",this.href="https://uniapp.dcloud.io",this.image=""},mounted:function(){var n=this;e.getProvider({service:"share",success:function(e){console.log("success",e);for(var t=[],r=0;r<e.provider.length;r++)switch(e.provider[r]){case"weixin":t.push({img:"/static/img/share/wx.svg",name:"微信好友",id:"weixin",sort:0}),t.push({img:"/static/img/share/pyq.svg",name:"朋友圈",id:"weixin",type:"WXSenceTimeline",sort:1});break;case"sinaweibo":t.push({img:"/static/img/share/wb.svg",name:"新浪微博",id:"sinaweibo",sort:2});break;case"qq":t.push({img:"/static/img/share/qq.svg",name:"QQ好友",id:"qq",sort:3});break;default:break}n.providerList=t.sort((function(e,n){return e.sort-n.sort})),console.log("providerList",n.providerList)},fail:function(n){console.log("获取分享通道失败",n),e.showModal({content:"获取分享通道失败",showCancel:!1})}})},methods:{share:function(n){var t=this;return(0,s.default)(o.default.mark((function r(){var s;return o.default.wrap((function(r){while(1)switch(r.prev=r.next){case 0:if(console.log("分享通道:"+n.id+" 分享类型:"+t.shareType),t.shareText||1!==t.shareType&&0!==t.shareType){r.next=4;break}return e.showModal({content:"分享内容不能为空",showCancel:!1}),r.abrupt("return");case 4:if(t.image||2!==t.shareType&&0!==t.shareType){r.next=7;break}return e.showModal({content:"分享图片不能为空",showCancel:!1}),r.abrupt("return");case 7:s={provider:n.id,scene:n.type&&"WXSenceTimeline"===n.type?"WXSenceTimeline":"WXSceneSession",type:t.shareType,success:function(n){console.log("success",n),e.showModal({content:"已分享",showCancel:!1})},fail:function(n){console.log("fail",n),e.showModal({content:n.errMsg,showCancel:!1})},complete:function(){console.log("分享操作结束!")}},r.t0=t.shareType,r.next=0===r.t0?11:1===r.t0?16:2===r.t0?18:5===r.t0?20:24;break;case 11:return s.summary=t.shareText,s.imageUrl=t.image,s.title="欢迎体验uniapp",s.href="https://uniapp.dcloud.io",r.abrupt("break",25);case 16:return s.summary=t.shareText,r.abrupt("break",25);case 18:return s.imageUrl=t.image,r.abrupt("break",25);case 20:return s.imageUrl=t.image?t.image:"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b6304f00-5168-11eb-bd01-97bc1429a9ff.png",s.title="欢迎体验uniapp",s.miniProgram={id:"gh_33446d7f7a26",path:"/pages/tabBar/component/component",webUrl:"https://uniapp.dcloud.io",type:0},r.abrupt("break",25);case 24:return r.abrupt("break",25);case 25:if(0!==s.type||"iOS"!==plus.os.name){r.next=29;break}return r.next=28,t.compress();case 28:s.imageUrl=r.sent;case 29:1===s.type&&"qq"===s.provider&&(s.href="https://uniapp.dcloud.io",s.title="欢迎体验uniapp"),e.share(s);case 31:case"end":return r.stop()}}),r)})))()},compress:function(){console.log("开始压缩");var n=this.image;return new Promise((function(t){var r=plus.io.convertAbsoluteFileSystem(n.replace("file://",""));console.log("after"+r),plus.io.resolveLocalFileSystemURL(r,(function(r){r.file((function(r){console.log("getFile:"+JSON.stringify(r)),r.size>20480&&plus.zip.compressImage({src:n,dst:n.replace(".jpg","2222.jpg").replace(".JPG","2222.JPG"),width:"10%",height:"10%",quality:1,overwrite:!0},(function(e){console.log("success zip****"+e.size);var r=n.replace(".jpg","2222.jpg").replace(".JPG","2222.JPG");t(r)}),(function(n){e.showModal({content:"分享图片太大,需要请重新选择图片!",showCancel:!1})}))}))}),(function(n){console.log("Resolve file URL failed: "+n.message),e.showModal({content:"分享图片太大,需要请重新选择图片!",showCancel:!1})}))}))}}};n.default=a}).call(this,t(2)["default"])},461:function(e,n,t){"use strict";t.r(n);var r=t(462),o=t.n(r);for(var s in r)["default"].indexOf(s)<0&&function(e){t.d(n,e,(function(){return r[e]}))}(s);n["default"]=o.a},462:function(e,n,t){}}]);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/popup-share/popup-share.js.map
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
'components/popup-share/popup-share-create-component',
{
'components/popup-share/popup-share-create-component':(function(module, exports, __webpack_require__){
__webpack_require__('2')['createComponent'](__webpack_require__(456))
})
},
[['components/popup-share/popup-share-create-component']]
]);