1 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugins/step/dare/dare"],{"28e9":function(t,e,n){"use strict";n.r(e);var i=n("349a"),o=n.n(i);for(var a in i)"default"!==a&&function(t){n.d(e,t,(function(){return i[t]}))}(a);e["default"]=o.a},"349a":function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n("2f62");function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var s=function(){Promise.all([n.e("common/vendor"),n.e("components/basic-component/app-layout/app-layout")]).then(function(){return resolve(n("3dd6"))}.bind(null,n)).catch(n.oe)},u=function(){Promise.all([n.e("common/vendor"),n.e("components/basic-component/app-form-id/app-form-id")]).then(function(){return resolve(n("e583"))}.bind(null,n)).catch(n.oe)},r=function(){n.e("components/page-component/app-ad/app-ad").then(function(){return resolve(n("c4cc"))}.bind(null,n)).catch(n.oe)},l={data:function(){return{unit_id:"",list:[],ad:!1,space:!0,daily_real_num:0,page:2,join:!1,isSubmit:!1,activity_id:"",open_date:"",step_num:0,over:!1,authorize:!1,ad_data:{},setting:null,success:!1,adHeight:0,coupon_url:this.$api.step.receive}},components:{"app-layout":s,"app-form-id":u,appAd:r},computed:a({},(0,i.mapState)({theme:function(t){return t.mallConfig.theme},stepImg:function(t){return t.mallConfig.plugin.step},userInfo:function(t){return t.user.info}})),filters:{getObje:function(t,e){return{id:t.id}}},methods:{getHeight:function(){var e=this,n=this;setTimeout((function(){var i=t.createSelectorQuery().in(e);i.select("#ad").boundingClientRect((function(t){console.log(t),n.adHeight=t.height})).exec()}))},toSubmit:function(t,e){this.step_num=t,this.activity_id=e,this.isSubmit=!0},toLog:function(){t.navigateTo({url:"/plugins/step/log/log"})},toRules:function(){t.navigateTo({url:"/plugins/step/rules/rules?rule=2"})},toJoin:function(e){t.navigateTo({url:"/plugins/step/join/join?id="+e})},submit:function(){var e,n,i,o=this,a=o.daily_real_num,c=o.activity_id,s=o.step_num;o.isSubmit=!1,a<s?t.showToast({title:"成绩未达标",icon:"none",duration:1e3}):(t.showLoading({title:"提交成绩中..."}),t.login({success:function(s){e=s.code,t.getWeRunData({success:function(s){n=s.iv,i=s.encryptedData,o.$request({url:o.$api.step.activity_submit,method:"POST",data:{encrypted_data:i,iv:n,code:e,activity_id:c,num:a}}).then((function(e){t.hideLoading(),0==e.code?o.success=!0:t.showToast({title:e.msg,icon:"none",duration:1e3})})).catch((function(e){t.hideLoading(),t.showToast({title:e,icon:"none",duration:1e3})}))}})}}))},getSetting:function(){var e=this;e.$request({url:e.$api.step.setting}).then((function(n){0==n.code?e.setting=n.data:t.showToast({title:n.msg,icon:"none",duration:1e3})})).catch((function(t){e.$hideLoading()}))},auth:function(){var e=this;t.getSetting({success:function(n){1==n.authSetting["scope.werun"]?(e.page=1,e.getList()):t.authorize({scope:"scope.werun",success:function(t){"authorize:ok"==t.errMsg&&(e.page=1,e.getList())},fail:function(n){e.$hideLoading(),t.showModal({title:"提示",content:"获取步数信息失败,需要授权获取步数权限",showCancel:!1,confirmText:"打开授权",success:function(e){e.confirm&&t.openSetting({})}})}})},fail:function(t){e.authorize=!0,e.$hideLoading()}})},getList:function(){var e,n,i,o=this;t.login({success:function(a){e=a.code,t.getWeRunData({success:function(a){n=a.iv,i=a.encryptedData,o.$request({url:o.$api.step.activity,method:"POST",data:{encrypted_data:i,iv:n,code:e,page:o.page}}).then((function(e){if(o.$hideLoading(),0==e.code){o.ad_data=e.list.ad_data,o.getHeight(),o.daily_real_num=e.list.daily_real_num;var n=o.list,i=e.list.activity_data;if(o.page++,i.length>0){if(n.length>0)for(var a=0;a<n.length;a++)if(i[0].id==n[a].id)return;o.more=!1,3==i.length&&(o.more=!0),o.list=n.concat(i)}}else t.showToast({title:e.msg,icon:"none",duration:1e3})})).catch((function(e){t.showToast({title:e,icon:"none",duration:1e3})}))},fail:function(e){"getWeRunData:fail cancel"==e.errMsg?t.showModal({content:"读取失败,请稍后再试",showCancel:!1}):"getWeRunData: fail device not support"==e.errMsg?t.showModal({content:'请在微信中搜索"微信运动"公众号,并点击关注',showCancel:!1}):t.showModal({content:e.errMsg,showCancel:!1})}})},fail:function(e){t.showModal({content:e.errMsg,showCancel:!1})}})},closeTip:function(t){this.success=!1,this.join=!1,1==t&&(this.list=[],this.page=1,this.$showLoading({type:"global",text:"加载中..."}),this.getList())}},onReachBottom:function(){this.more&&this.getList()},onShareAppMessage:function(){return this.$shareAppMessage({title:"步数挑战",path:"/plugins/step/index/index",params:{user_id:this.userInfo.options.user_id}})},onLoad:function(t){var e=this;e.$store.dispatch("user/info"),1==t.submit?(e.activity_id=t.activity_id,e.step_num=t.step_num,e.isSubmit=!0):1==t.join&&(e.join=!0,e.open_date=t.date),e.$showLoading({type:"global",text:"加载中..."}),e.auth(),e.getSetting()}};e.default=l}).call(this,n("543d")["default"])},5157:function(t,e,n){"use strict";n.r(e);var i=n("d070"),o=n("28e9");for(var a in o)"default"!==a&&function(t){n.d(e,t,(function(){return o[t]}))}(a);n("7d87");var c,s=n("f0c5"),u=Object(s["a"])(o["default"],i["b"],i["c"],!1,null,"76a79798",null,!1,i["a"],c);e["default"]=u.exports},"6aa3":function(t,e,n){"use strict";(function(t){n("8748");i(n("66fd"));var e=i(n("5157"));function i(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("543d")["createPage"])},"7d87":function(t,e,n){"use strict";var i=n("969e"),o=n.n(i);o.a},"969e":function(t,e,n){},d070:function(t,e,n){"use strict";var i,o=function(){var t=this,e=t.$createElement,n=(t._self._c,t._f("getObje")(t.ad_data,t.ad_data));t.$mp.data=Object.assign({},{$root:{f0:n}})},a=[];n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return a})),n.d(e,"a",(function(){return i}))}},[["6aa3","common/runtime","common/vendor"]]]);
|