activity.js 7.9 KB

12
  1. require('./common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_course/activity"],{978:function(n,e,o){"use strict";(function(n,e){var t=o(4);o(26);t(o(25));var i=t(o(979));n.__webpack_require_UNI_MP_PLUGIN__=o,e(i.default)}).call(this,o(1)["default"],o(2)["createPage"])},979:function(n,e,o){"use strict";o.r(e);var t=o(980),i=o(982);for(var r in i)["default"].indexOf(r)<0&&function(n){o.d(e,n,(function(){return i[n]}))}(r);o(984);var s,c=o(34),a=Object(c["default"])(i["default"],t["render"],t["staticRenderFns"],!1,null,"2fb2792c",null,!1,t["components"],s);a.options.__file="pages_course/activity.vue",e["default"]=a.exports},980:function(n,e,o){"use strict";o.r(e);var t=o(981);o.d(e,"render",(function(){return t["render"]})),o.d(e,"staticRenderFns",(function(){return t["staticRenderFns"]})),o.d(e,"recyclableRender",(function(){return t["recyclableRender"]})),o.d(e,"components",(function(){return t["components"]}))},981:function(n,e,o){"use strict";var t;o.r(e),o.d(e,"render",(function(){return i})),o.d(e,"staticRenderFns",(function(){return s})),o.d(e,"recyclableRender",(function(){return r})),o.d(e,"components",(function(){return t}));try{t={uPopup:function(){return Promise.all([o.e("common/vendor"),o.e("uni_modules/uview-ui/components/u-popup/u-popup")]).then(o.bind(null,1216))},uAvatar:function(){return Promise.all([o.e("common/vendor"),o.e("uni_modules/uview-ui/components/u-avatar/u-avatar")]).then(o.bind(null,1224))},uIcon:function(){return Promise.all([o.e("common/vendor"),o.e("uni_modules/uview-ui/components/u-icon/u-icon")]).then(o.bind(null,1232))}}}catch(c){if(-1===c.message.indexOf("Cannot find module")||-1===c.message.indexOf(".vue"))throw c;console.error(c.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var i=function(){var n=this,e=n.$createElement;n._self._c;n._isMounted||(n.e0=function(e){n.show=!1})},r=!1,s=[];i._withStripped=!0},982:function(n,e,o){"use strict";o.r(e);var t=o(983),i=o.n(t);for(var r in t)["default"].indexOf(r)<0&&function(n){o.d(e,n,(function(){return t[n]}))}(r);e["default"]=i.a},983:function(n,e,o){"use strict";(function(n){var t=o(4);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=t(o(59)),r=t(o(61)),s=t(o(11)),c=o(36),a=o(913);function u(n,e){var o=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.push.apply(o,t)}return o}function l(n){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?u(Object(o),!0).forEach((function(e){(0,s.default)(n,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):u(Object(o)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(o,e))}))}return n}var f={data:function(){return{statusBarHeight:n.getSystemInfoSync().statusBarHeight,show:!1,status:0,recordId:"",urlOption:{},sortLink:"",isLogin:!1,isLoginH5:0,collectType:0,isExpiry:!0,coinAmount:0,balance:0,chatId:"",userlogo:!1,imgname:"",userinfos:{nickname:"",avatar:""},btnLoading:!1}},computed:l(l({},(0,c.mapGetters)(["coureLogin"])),{},{nameuser:function(){return this.userinfos.nickname},avataruser:function(){return this.userinfos.avatar}}),watch:{coureLogin:{immediate:!0,handler:function(e){2==e&&this.isLogin&&(console.log("注册AppToken失效,请重新登录"),n.removeStorageSync("web_userInfo"),n.removeStorageSync("TOKEN_WEXIN"),this.isLogin=!1,0==this.isLoginH5?this.goWXLogin():this.goLogin())}}},onLoad:function(e){var o=this;this.urlOption=e.link?JSON.parse(decodeURIComponent(e.link)):{},this.sortLink=this.urlOption.link||"",this.chatId=this.urlOption.chatId||"",this.recordId=this.urlOption.businessId||"",console.log(this.sortLink),n.$on("usercode",(function(n){n&&o.goLogin(n)})),this.getLuckyBagInfo()},beforeDestroy:function(){n.$off("usercode")},onUnload:function(){n.$off("usercode")},methods:{editUserA:function(){var e=this;this.userinfos=n.getStorageSync("userinfos")?n.getStorageSync("userinfos"):this.userinfos;var o={nickName:this.userinfos.nickname};(0,a.editUser)(o).then((function(o){200==o.code?(e.isLogin=!0,n.showToast({icon:"none",title:"修改成功!"}),setTimeout((function(){e.receiveLuckyBag()}),100)):(n.removeStorageSync("userinfos"),n.showToast({icon:"none",title:o.msg+"请重新领取福袋"}))}))},shouquan:function(){""==this.userinfos.nickname&&n.showToast({icon:"none",title:"请先授权微信昵称"})},confimrname:function(){""!=this.userinfos.nickname?(n.setStorageSync("userinfos",this.userinfos),this.editUserA(),this.userlogo=!1):n.showToast({icon:"none",title:"请授权微信昵称"})},onNickNameInput:function(n){console.log(n),this.userinfos.nickname=n.detail.value},onChooseAvatar:function(e){var o=this;this.userinfos.avatar=e.detail.avatarUrl,n.uploadFile({url:"https://h5api.his.cdwjyyh.com/app/common/uploadOSS",filePath:e.detail.avatarUrl,name:"file",formData:{user:"test"},success:function(e){console.log(e);var t=JSON.parse(e.data);o.headImg=n.getStorageSync("requestPath")+t.fileName,o.userinfos.avatar=t.url}})},handleReceive:function(){var n=this;0==this.isLoginH5?this.utils.isLoginCourse().then((function(e){n.isLogin=e,console.log("==isLogin=",n.isLogin),n.isLogin?n.chatId?n.userlogo=!0:n.receiveLuckyBag():n.goLogin()}),(function(n){})):this.utils.isLoginResCourse().then((function(e){n.isLogin=e,n.isLogin?n.receiveLuckyBag():n.goLogin()}),(function(n){}))},receiveLuckyBag:function(){var e=this;if(!this.btnLoading){n.showToast({title:"领取中...",icon:"loading"}),this.btnLoading=!0;var o=l(l({},this.urlOption),{},{recordId:this.recordId});(0,a.receiveLuckyBag)(o).then((function(o){n.hideLoading(),e.btnLoading=!1,200==o.code?(e.coinAmount=o.data.coinAmount||0,e.balance=o.data.balance||0,e.collectType=1,e.show=!0):n.showModal({title:"领取失败",content:o.msg,showCancel:!1,success:function(n){n.confirm?console.log("用户点击确定"):n.cancel&&console.log("用户点击取消")}})})).catch((function(){e.btnLoading=!1}))}},navTo:function(){this.show=!1,n.navigateTo({url:"/pages_course/appDownload"})},getLuckyBagInfo:function(){var e=this;(0,a.getLuckyBagInfo)({recordId:this.recordId}).then((function(o){200==o.code?(e.collectType=o.data.collectType||0,e.isExpiry=o.data.isExpiry):n.showToast({title:o.msg,icon:"none"})}))},goLogin:function(n){0!=this.isLoginH5||this.goWXLogin(1)},goWXLogin:function(){var e=this;this.utils.getProvider().then((function(o){console.log("当前的环境商",o),o||reject(),n.login({provider:o,success:function(){var t=(0,r.default)(i.default.mark((function t(r){return i.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:console.log(r),n.getUserInfo({provider:o,success:function(o){n.showToast({title:"登录中...",icon:"loading"}),(0,a.loginByMp)({code:r.code,encryptedData:o.encryptedData,iv:o.iv,appId:getApp().globalData.appId}).then((function(o){n.hideLoading(),200==o.code?(e.$store.commit("setCoureLogin",1),n.setStorageSync("AppTokenmini_RTCourse",o.token),n.setStorageSync("auto_userInfo",JSON.stringify(o.user)),e.isLogin=!0,e.chatId?e.userlogo=!0:e.receiveLuckyBag()):n.showToast({title:o.msg,icon:"none"})})).catch((function(e){n.hideLoading(),n.showToast({icon:"none",title:"登录失败,请重新登录"})}))}});case 2:case"end":return t.stop()}}),t)})));function s(n){return t.apply(this,arguments)}return s}()})})).catch((function(n){}))}}};e.default=f}).call(this,o(2)["default"])},984:function(n,e,o){"use strict";o.r(e);var t=o(985),i=o.n(t);for(var r in t)["default"].indexOf(r)<0&&function(n){o.d(e,n,(function(){return t[n]}))}(r);e["default"]=i.a},985:function(n,e,o){}},[[978,"common/runtime","common/vendor"]]]);
  2. //# sourceMappingURL=../../.sourcemap/mp-weixin/pages_course/activity.js.map