12 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_course/becomeVIP"],{425:function(e,t,n){"use strict";(function(e,t){var o=n(4);n(26);o(n(25));var r=o(n(426));e.__webpack_require_UNI_MP_PLUGIN__=n,t(r.default)}).call(this,n(1)["default"],n(2)["createPage"])},426:function(e,t,n){"use strict";n.r(t);var o=n(427),r=n(429);for(var s in r)["default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(s);n(432);var i,a=n(34),c=Object(a["default"])(r["default"],o["render"],o["staticRenderFns"],!1,null,"cfe1f8ea",null,!1,o["components"],i);c.options.__file="pages_course/becomeVIP.vue",t["default"]=c.exports},427:function(e,t,n){"use strict";n.r(t);var o=n(428);n.d(t,"render",(function(){return o["render"]})),n.d(t,"staticRenderFns",(function(){return o["staticRenderFns"]})),n.d(t,"recyclableRender",(function(){return o["recyclableRender"]})),n.d(t,"components",(function(){return o["components"]}))},428:function(e,t,n){"use strict";var o;n.r(t),n.d(t,"render",(function(){return r})),n.d(t,"staticRenderFns",(function(){return i})),n.d(t,"recyclableRender",(function(){return s})),n.d(t,"components",(function(){return o}));try{o={uPopup:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-popup/u-popup")]).then(n.bind(null,561))},uAvatar:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-avatar/u-avatar")]).then(n.bind(null,514))}}}catch(a){if(-1===a.message.indexOf("Cannot find module")||-1===a.message.indexOf(".vue"))throw a;console.error(a.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var r=function(){var e=this,t=e.$createElement;e._self._c},s=!1,i=[];r._withStripped=!0},429:function(e,t,n){"use strict";n.r(t);var o=n(430),r=n.n(o);for(var s in o)["default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(s);t["default"]=r.a},430:function(e,t,n){"use strict";(function(e){var o=n(4);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=o(n(57)),s=o(n(59)),i=n(169),a=n(431),c={data:function(){return{isVip:0,isWechat:!1,isLogin:!1,companyid:"",companyUserId:"",userInfo:{},tagIds:[],isbecomevip:0,viptext:"申请成为会员",userlogo:!1,userinfos:{nickname:"",avatar:""},headImg:"",authType:0,userdisabled:!1,projectId:"",H5course:{}}},computed:{imgPath:function(){return this.$store.state.imgpath},imgname:function(){return this.$store.state.logoname},appid:function(){return this.$store.state.appid},nameuser:function(){return this.userinfos.nickname},avataruser:function(){return this.userinfos.avatar}},onLoad:function(t){var n=this;return(0,s.default)(r.default.mark((function o(){var s,i,a;return r.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(e.$on("usercode",(function(e){console.log("huoqu ",e),n.goLogin(e)})),e.$on("vipMsg",(function(e){console.log("vipMsg ",e),n.viptext=e})),s="https://userapp.whhm.ylrzcloud.com/prod-api",e.setStorageSync("requestPath",s),e.getStorageSync("userInfo")&&"{}"!=e.getStorageSync("userInfo")?n.userInfo=e.getStorageSync("userInfo"):n.userInfo={},i=e.getStorageSync("TOKEN_WEXIN"),n.isLogin=!!i,n.companyid=t.companyId||"",n.companyUserId=t.companyUserId||0,n.projectId=t.projectId,n.H5course.companyId=t.companyId,n.H5course.companyUserId=t.companyUserId,n.H5course.projectId=t.projectId,e.setStorageSync("H5course",n.H5course),e.getStorageSync("userinfos")||"乐氏本源"!=n.$store.state.logoname){o.next=19;break}return o.next=17,n.$store.dispatch("getWebviewUrl");case 17:return e.navigateTo({url:"/pages_course/webview"}),o.abrupt("return");case 19:"null"==t.tagids?n.tagIds=[]:(n.tagIds=t.tagids,a=n.tagIds.split(",").map((function(e){return parseInt(e.trim(),10)})).filter((function(e){return!isNaN(e)})),n.tagIds=a),n.isWechat="micromessenger"===String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)),n.code=t.code;case 22:case"end":return o.stop()}}),o)})))()},onShow:function(){e.getStorageSync("userInfo")&&"{}"!=e.getStorageSync("userInfo")?this.userInfo=e.getStorageSync("userInfo"):this.userInfo={},this.userinfos=e.getStorageSync("userinfos");var t=e.getStorageSync("TOKEN_WEXIN");console.log(e.getStorageSync("userinfos")),this.isLogin=!!t,this.isLogin&&1!=this.isVip&&this.registerCourse()},methods:{goLogin:function(t){var n=this;return(0,s.default)(r.default.mark((function o(){return r.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(console.log("huoqu111",t),!t){o.next=7;break}console.log("huoqu1222",t),e.showLoading({title:"加载中"}),e.login({provider:"weixin",success:function(){var o=(0,s.default)(r.default.mark((function o(s){var i;return r.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:console.log(s),i=s.code,(0,a.handleFsUserWx)({code:i,appId:n.appid,userId:t.userId}).then((function(t){200==t.code?(console.log(t),e.hideLoading(),e.showToast({icon:"none",title:"登录成功"}),n.userinfos=e.getStorageSync("userinfos"),e.getStorageSync("TOKEN_WEXIN"),n.userInfo=e.getStorageSync("userInfo"),n.isLogin=!0,setTimeout((function(){n.registerCourse()}),200)):406==t.code?(e.hideLoading(),e.showToast({icon:"none",title:"该用户已成为其他销售会员"})):(e.hideLoading(),e.showToast({icon:"none",title:t.msg}))}));case 3:case"end":return o.stop()}}),o)})));function i(e){return o.apply(this,arguments)}return i}()}),o.next=10;break;case 7:return o.next=9,n.$store.dispatch("getWebviewUrl");case 9:e.navigateTo({url:"/pages_course/webview?H5course="+e.getStorageSync("H5course")});case 10:case"end":return o.stop()}}),o)})))()},shouquan:function(){""==this.userinfos.nickname&&e.showToast({icon:"none",title:"请先授权微信昵称"})},confimrname:function(){""!=this.userinfos.nickname?""!=this.userinfos.avatar?(e.setStorageSync("userinfos",this.userinfos),this.editUserA(),this.userlogo=!1):e.showToast({icon:"none",title:"请授权微信头像"}):e.showToast({icon:"none",title:"请授权微信昵称"})},onChooseAvatar:function(t){var n=this;this.userinfos.avatar=t.detail.avatarUrl,console.log(t.detail.avatarUrl),e.uploadFile({url:e.getStorageSync("requestPath")+"/app/common/uploadOSS",filePath:t.detail.avatarUrl,name:"file",formData:{user:"test"},success:function(t){console.log(t);var o=JSON.parse(t.data);n.headImg=e.getStorageSync("requestPath")+o.fileName,n.userinfos.avatar=o.url}})},onNickNameInput:function(e){console.log(e),this.userinfos.nickname=e.detail.value},nato:function(){var t=this;return(0,s.default)(r.default.mark((function n(){return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,t.$store.dispatch("getWebviewUrl");case 2:e.navigateTo({url:"/pages_course/webview"});case 3:case"end":return n.stop()}}),n)})))()},handleAgree:function(){console.log(144443),1==this.isVip?e.showToast({title:"您已成为会员!",icon:"none",duration:2e3}):(this.goLogin(),e.showToast({title:this.viptext,icon:"none",duration:2e3}))},getWechatCode:function(){if(this.isWechat){var t="wx0d021524695f1943",n=this.getUrlCode().code,o=window.location.href;if(null==n||""===n){var r=o.split("/registerCourse");e.setStorageSync("beforLoginPage",r[1]),window.location.href="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+t+"&redirect_uri="+encodeURIComponent(o)+"&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"}else this.code=n,this.loginByMp()}else e.showToast({title:"请在微信浏览器中打开",icon:"error"})},getUrlCode:function(){var e=location.search,t=new Object;if(-1!=e.indexOf("?"))for(var n=e.substr(1),o=n.split("&"),r=0;r<o.length;r++)t[o[r].split("=")[0]]=o[r].split("=")[1];return t},loginByMp:function(){var t=this;null!=this.code&&(e.showLoading({title:"处理中..."}),(0,i.loginByMp)({code:this.code}).then((function(n){if(e.hideLoading(),200==n.code){e.setStorageSync("TOKEN_KEY",n.token),e.setStorageSync("userInfo",JSON.stringify(n.user)),t.userInfo=n.user;e.getStorageSync("beforLoginPage");t.isLogin=!0,t.registerCourse()}else e.showToast({title:n.msg,icon:"none"})}),(function(e){})))},registerCourse:function(){var t=this;console.log(123333),this.isVip=0,null==this.tagIds&&(this.tagIds="");var n={userId:this.userInfo.userId,companyUserId:this.companyUserId,companyId:this.companyid,tagIds:this.tagIds,projectId:this.projectId};this.isLogin&&(0,a.registerCourses)(n).then((function(n){200==n.code?(t.isVip=1,t.isbecomevip=1,t.viptext="您已成为会员",e.showToast({title:"注册成功",icon:"none"})):(t.isbecomevip=1,t.viptext=n.msg,e.showToast({icon:"none",title:n.msg}))}))}}};t.default=c}).call(this,n(2)["default"])},432:function(e,t,n){"use strict";n.r(t);var o=n(433),r=n.n(o);for(var s in o)["default"].indexOf(s)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(s);t["default"]=r.a},433:function(e,t,n){}},[[425,"common/runtime","common/vendor"]]]);
- //# sourceMappingURL=../../.sourcemap/mp-weixin/pages_course/becomeVIP.js.map
|