uni_modules-uni-upgrade-center-app-pages-upgrade-popup.f3a5aae1.js 9.6 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["uni_modules-uni-upgrade-center-app-pages-upgrade-popup"],{"113e":function(t,e,a){t.exports=a.p+"static/img/bg_top.125b3525.png"},"11eb":function(t,e,a){"use strict";(function(t){a("7a82");var n=a("4ea4").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(a("3835")),o=n(a("c7eb")),r=n(a("1da1"));a("a9e3"),a("c975"),a("caad"),a("2532");var s=null;var l={data:function(){return{installForBeforeFilePath:"",installed:!1,installing:!1,downloadSuccess:!1,downloading:!1,downLoadPercent:0,downloadedSize:0,packageFileSize:0,tempFilePath:"",title:"更新日志",contents:"",is_mandatory:!1,subTitle:"发现新版本",downLoadBtnTextiOS:"立即跳转更新",downLoadBtnText:"立即下载更新",downLoadingText:"安装包下载中,请稍后"}},onLoad:function(e){var a=e.local_storage_key;if(!a)return t.error("local_storage_key为空,请检查后重试"),void uni.navigateBack();var n=uni.getStorageSync(a);if(!n)return t.error("安装包信息为空,请检查后重试"),void uni.navigateBack();var i=["version","url","type"];for(var o in n)if(-1!==i.indexOf(o)&&!n[o])return t.error("参数 ".concat(o," 必填,请检查后重试")),void uni.navigateBack();Object.assign(this,n),this.checkLocalStoragePackage()},onBackPress:function(){if(this.is_mandatory)return!0;s&&s.abort()},computed:{isWGT:function(){return"wgt"===this.type},isiOS:function(){return!this.isWGT&&this.platform.includes("iOS")}},methods:{checkLocalStoragePackage:function(){var t=uni.getStorageSync("__localFilePath__");if(t){var e=t.version,a=t.savedFilePath,n=t.installed;n||0!==function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"0",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0";t=String(t).split("."),e=String(e).split(".");for(var a=Math.min(t.length,e.length),n=0,i=0;i<a;i++){var o=Number(t[i]),r=Number(e[i]);if(o>r){n=1;break}if(o<r){n=-1;break}}if(0===n&&t.length!==e.length)for(var s=t.length>e.length,l=s?t:e,c=a;c<l.length;c++){var d=Number(l[c]);if(d>0){n=s?1:-1;break}}return n}(e,this.version)?this.deleteSavedFile(a):(this.downloadSuccess=!0,this.installForBeforeFilePath=a,this.tempFilePath=a)}},closeUpdate:function(){var t=this;return(0,r.default)((0,o.default)().mark((function e(){return(0,o.default)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!t.downloading){e.next=5;break}if(!t.is_mandatory){e.next=3;break}return e.abrupt("return",uni.showToast({title:"下载中,请稍后……",icon:"none",duration:500}));case 3:return uni.showModal({title:"是否取消下载?",cancelText:"否",confirmText:"是",success:function(t){t.confirm&&(s&&s.abort(),uni.navigateBack())}}),e.abrupt("return");case 5:if(!t.downloadSuccess||!t.tempFilePath){e.next=10;break}return e.next=8,t.saveFile(t.tempFilePath,t.version);case 8:return uni.navigateBack(),e.abrupt("return");case 10:uni.navigateBack();case 11:case"end":return e.stop()}}),e)})))()},downloadPackage:function(){var t=this;this.downloading=!0,s=uni.downloadFile({url:this.url,success:function(e){200==e.statusCode&&(t.downloadSuccess=!0,t.tempFilePath=e.tempFilePath,t.is_mandatory&&t.installPackage())},complete:function(){t.downloading=!1,t.downLoadPercent=0,t.downloadedSize=0,t.packageFileSize=0,s=null}}),s.onProgressUpdate((function(e){t.downLoadPercent=e.progress,t.downloadedSize=(e.totalBytesWritten/Math.pow(1024,2)).toFixed(2),t.packageFileSize=(e.totalBytesExpectedToWrite/Math.pow(1024,2)).toFixed(2)}))},installPackage:function(){},restart:function(){this.installed=!1},saveFile:function(t,e){return(0,r.default)((0,o.default)().mark((function a(){var n,r,s,l;return(0,o.default)().wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.next=2,uni.saveFile({tempFilePath:t});case 2:if(n=a.sent,r=(0,i.default)(n,2),s=r[0],l=r[1],!s){a.next=8;break}return a.abrupt("return");case 8:uni.setStorageSync("__localFilePath__",{version:e,savedFilePath:l.savedFilePath});case 9:case"end":return a.stop()}}),a)})))()},deleteSavedFile:function(t){return uni.removeStorageSync("__localFilePath__"),uni.removeSavedFile({filePath:t})},jumpToAppStore:function(){plus.runtime.openURL(this.url)}}};e.default=l}).call(this,a("5a52")["default"])},"23cd":function(t,e,a){var n=a("24fb");e=n(!1),e.push([t.i,"uni-page-body[data-v-5d39b7ae]{background:transparent}body.?%PAGE?%[data-v-5d39b7ae]{background:transparent}.flex-center[data-v-5d39b7ae]{\ndisplay:flex;\njustify-content:center;align-items:center}.mask[data-v-5d39b7ae]{position:fixed;left:0;top:0;right:0;bottom:0;background-color:rgba(0,0,0,.65)}.botton-radius[data-v-5d39b7ae]{border-bottom-left-radius:%?30?%;border-bottom-right-radius:%?30?%}.content[data-v-5d39b7ae]{position:relative;top:0;width:%?600?%;background-color:#fff;box-sizing:border-box;padding:0 %?50?%;font-family:Source Han Sans CN}.text[data-v-5d39b7ae]{\ndisplay:block;\nline-height:200px;text-align:center;color:#fff}.content-top[data-v-5d39b7ae]{position:absolute;top:%?-195?%;left:0;width:%?600?%;height:%?270?%}.content-top-text[data-v-5d39b7ae]{font-size:%?45?%;font-weight:700;color:#f8f8fa;position:absolute;top:%?120?%;left:%?50?%;z-index:1}.content-header[data-v-5d39b7ae]{height:%?70?%}.title[data-v-5d39b7ae]{font-size:%?33?%;font-weight:700;color:#3da7ff;line-height:38px}.footer[data-v-5d39b7ae]{height:%?150?%;display:flex;align-items:center;justify-content:space-around}.box-des-scroll[data-v-5d39b7ae]{box-sizing:border-box;padding:0 %?40?%;height:%?200?%;text-align:left}.box-des[data-v-5d39b7ae]{font-size:%?26?%;color:#000;line-height:%?50?%}.progress-box[data-v-5d39b7ae]{width:100%}.progress[data-v-5d39b7ae]{width:90%;height:%?40?%;border-radius:35px}.close-img[data-v-5d39b7ae]{width:%?70?%;height:%?70?%;z-index:1000;position:absolute;bottom:%?-120?%;left:calc(50% - %?70?% / 2)}.content-button[data-v-5d39b7ae]{text-align:center;flex:1;font-size:%?30?%;font-weight:400;color:#fff;border-radius:%?40?%;margin:0 %?18?%;height:%?80?%;line-height:%?80?%;background:linear-gradient(90deg,#1785ff,#3da7ff)}.flex-column[data-v-5d39b7ae]{display:flex;flex-direction:column;align-items:center}",""]),t.exports=e},"64a7":function(t,e,a){"use strict";var n=a("9842"),i=a.n(n);i.a},"7c94":function(t,e,a){"use strict";a.d(e,"b",(function(){return n})),a.d(e,"c",(function(){return i})),a.d(e,"a",(function(){}));var n=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("v-uni-view",{staticClass:"mask flex-center"},[n("v-uni-view",{staticClass:"content botton-radius"},[n("v-uni-view",{staticClass:"content-top"},[n("v-uni-text",{staticClass:"content-top-text"},[t._v(t._s(t.title))]),n("v-uni-image",{staticClass:"content-top",staticStyle:{top:"0"},attrs:{width:"100%",height:"100%",src:a("113e")}})],1),n("v-uni-view",{staticClass:"content-header"}),n("v-uni-view",{staticClass:"content-body"},[n("v-uni-view",{staticClass:"title"},[n("v-uni-text",[t._v(t._s(t.subTitle))])],1),n("v-uni-view",{staticClass:"body"},[n("v-uni-scroll-view",{staticClass:"box-des-scroll",attrs:{"scroll-y":"true"}},[n("v-uni-text",{staticClass:"box-des"},[t._v(t._s(t.contents))])],1)],1),n("v-uni-view",{staticClass:"footer flex-center"},[t.isiOS?[n("v-uni-button",{staticClass:"content-button",staticStyle:{border:"none",color:"#fff"},attrs:{plain:!0},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.jumpToAppStore.apply(void 0,arguments)}}},[t._v(t._s(t.downLoadBtnTextiOS))])]:[t.downloadSuccess?t.downloadSuccess&&!t.installed?n("v-uni-button",{staticClass:"content-button",staticStyle:{border:"none",color:"#fff"},attrs:{plain:!0,loading:t.installing,disabled:t.installing},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.installPackage.apply(void 0,arguments)}}},[t._v(t._s(t.installing?"正在安装……":"下载完成,立即安装"))]):t._e():[t.downloading?n("v-uni-view",{staticClass:"progress-box flex-column"},[n("v-uni-progress",{staticClass:"progress",attrs:{"border-radius":"35",percent:t.downLoadPercent,activeColor:"#3DA7FF","show-info":!0,"stroke-width":"10"}}),n("v-uni-view",{staticStyle:{width:"100%","font-size":"28rpx",display:"flex","justify-content":"space-around"}},[n("v-uni-text",[t._v(t._s(t.downLoadingText))]),n("v-uni-text",[t._v("("+t._s(t.downloadedSize)+"/"+t._s(t.packageFileSize)+"M)")])],1)],1):n("v-uni-button",{staticClass:"content-button",staticStyle:{border:"none",color:"#fff"},attrs:{plain:!0},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.downloadPackage.apply(void 0,arguments)}}},[t._v(t._s(t.downLoadBtnText))])],t.installed&&t.isWGT?n("v-uni-button",{staticClass:"content-button",staticStyle:{border:"none",color:"#fff"},attrs:{plain:!0},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.restart.apply(void 0,arguments)}}},[t._v("安装完毕,点击重启")]):t._e()]],2)],1),t.is_mandatory?t._e():n("v-uni-image",{staticClass:"close-img",attrs:{src:a("9ac4")},on:{click:function(e){e.stopPropagation(),arguments[0]=e=t.$handleEvent(e),t.closeUpdate.apply(void 0,arguments)}}})],1)],1)},i=[]},9842:function(t,e,a){var n=a("23cd");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);var i=a("4f06").default;i("25674c6e",n,!0,{sourceMap:!1,shadowMode:!1})},"9ac4":function(t,e,a){t.exports=a.p+"static/img/app_update_close.901cf6af.png"},b577:function(t,e,a){"use strict";a.r(e);var n=a("11eb"),i=a.n(n);for(var o in n)["default"].indexOf(o)<0&&function(t){a.d(e,t,(function(){return n[t]}))}(o);e["default"]=i.a},cb37:function(t,e,a){"use strict";a.r(e);var n=a("7c94"),i=a("b577");for(var o in i)["default"].indexOf(o)<0&&function(t){a.d(e,t,(function(){return i[t]}))}(o);a("64a7");var r=a("f0c5"),s=Object(r["a"])(i["default"],n["b"],n["c"],!1,null,"5d39b7ae",null,!1,n["a"],void 0);e["default"]=s.exports}}]);