| 1 |
- require('./common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages_course/webview"],{"199a":function(e,n,t){"use strict";t.r(n);var o=t("5b9d"),i=t.n(o);for(var c in o)["default"].indexOf(c)<0&&function(e){t.d(n,e,(function(){return o[e]}))}(c);n["default"]=i.a},"44df":function(e,n,t){},"4f9d":function(e,n,t){"use strict";var o=t("44df"),i=t.n(o);i.a},"58d2":function(e,n,t){"use strict";(function(e,n){var o=t("47a9");t("584a");o(t("3240"));var i=o(t("cca4"));e.__webpack_require_UNI_MP_PLUGIN__=t,n(i.default)}).call(this,t("3223")["default"],t("df3c")["createPage"])},"5b9d":function(e,n,t){"use strict";(function(e){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var t={data:function(){return{loading:!0,webviewUrl:"https://h5.fbylive.com/weixinOauth",userInfo:null}},onLoad:function(n){console.log("webview",n),e.setStorageSync("webview","webview"),n.code&&this.loginweixin(n.code)},methods:{loginweixin:function(n){var t=this,o={code:n};loginByMp(o).then((function(n){t.res=n,e.hideLoading(),200==n.code?(console.log(n),e.hideLoading(),e.showToast({icon:"none",title:"成功获取用户信息"}),e.setStorageSync("userInfos",JSON.stringify(n.user)),t.userInfo=n.user,setTimeout((function(){e.navigateBack({delta:1})}),200)):(e.hideLoading(),e.showToast({title:n.msg||"获取用户信息失败",icon:"none"}))}),(function(e){})).catch((function(n){e.hideLoading(),e.showToast({icon:"none",title:"授权登录失败,请重新登录"})}))},generateAuthUrl:function(){var n=e.getLaunchOptionsSync().scene,t={scene:n,appid:"wx961fadab9bcb792b",redirect_uri:encodeURIComponent("https://h5.fbylive.com/weixinOauth"),scope:"snsapi_userinfo",state:"wechat_redirect"};return"https://open.weixin.qq.com/connect/oauth2/authorize?appid=".concat(t.appid,"&redirect_uri=").concat(t.redirect_uri,"&response_type=code&scope=").concat(t.scope,"&state=").concat(t.state,"#wechat_redirect")},handleMessage:function(n){console.log("收到web-view消息:",n.detail),console.log("收到web-view消息:",n),n.detail&&"user_info"===n.detail.type&&(this.userInfo=n.detail.data,this.token=n.detail.token,e.setStorageSync("userInfo",this.userInfo),e.setStorageSync("TOKEN_WEXIN",this.userInfo),e.showToast({title:"登录成功",icon:"success"}),setTimeout((function(){e.navigateBack()}),1500))},onLoads:function(){this.loading=!1,console.log("web-view加载完成")},onError:function(n){this.loading=!1,console.error("web-view加载失败:",n),e.showToast({title:"页面加载失败",icon:"none"})}}};n.default=t}).call(this,t("df3c")["default"])},"79a9":function(e,n,t){"use strict";t.d(n,"b",(function(){return o})),t.d(n,"c",(function(){return i})),t.d(n,"a",(function(){}));var o=function(){var e=this.$createElement;this._self._c},i=[]},cca4:function(e,n,t){"use strict";t.r(n);var o=t("79a9"),i=t("199a");for(var c in i)["default"].indexOf(c)<0&&function(e){t.d(n,e,(function(){return i[e]}))}(c);t("4f9d");var a=t("828b"),s=Object(a["a"])(i["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],void 0);n["default"]=s.exports}},[["58d2","common/runtime","common/vendor"]]]);
|