pages-index-wechat.b22a8163.js 4.5 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-index-wechat"],{"3fd7":function(e,t,n){"use strict";var a=n("804c"),r=n.n(a);r.a},"65b1":function(e,t,n){"use strict";n.r(t);var a=n("6684"),r=n.n(a);for(var o in a)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return a[e]}))}(o);t["default"]=r.a},6684:function(e,t,n){"use strict";(function(e){n("7a82"),Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,n("ac1f"),n("5319"),n("4d63"),n("c607"),n("2c3e"),n("25f0"),n("466d");var a=getApp(),r={data:function(){return{state:0}},onLoad:function(e){this.state=this.getUrlCode("state");var t=this.getUrlCode("code");t?this.getOpenidAndUserinfo(t):this.getCode()},methods:{getCode:function(){if(this.isWechat()){var e=this.getUrlCode("code");null!==e&&""!==e||(window.location.href="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+a.globalData.appId+"&redirect_uri="+encodeURIComponent(a.globalData.redirectUri)+"&response_type=code&scope=snsapi_userinfo&state="+this.state+"#wechat_redirect")}},getUrlCode:function(e){return decodeURIComponent((new RegExp("[?|&]"+e+"=([^&;]+?)(&|#|;|$)").exec(location.href)||[,""])[1].replace(/\+/g,"%20"))||null},isWechat:function(){return"micromessenger"===String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i))},getOpenidAndUserinfo:function(t){var n=this;uni.request({url:a.globalData.serverUrl+"Oauth/checkCode",data:{code:t},method:"GET",header:{"content-type":"application/x-www-form-urlencoded"},success:function(t){if(e.log("通过code获取openid和accessToken",t),0==t.data.code){var a=getApp();if(uni.setStorageSync(a.globalData.storagePre+"token",t.data.data.token),uni.setStorageSync(a.globalData.storagePre+"userId",t.data.data.userId),a.globalData.userinfo.token=t.data.data.token,a.globalData.userinfo.userId=t.data.data.userId,n.state){var r=n.state.split("_"),o=r[0],i=r.length>1?r[1]:0;window.location.href=a.globalData.host+"#/pages/index/add?orgId="+o+"&type="+i}else window.location.href=a.globalData.host}else n.msg=t.data.message},fail:function(t){e.log(t),n.msg="登录失败"}})},goBack:function(){uni.reLaunch({url:"/pages/index/wechat"})}}};t.default=r}).call(this,n("5a52")["default"])},"804c":function(e,t,n){var a=n("be3a");a.__esModule&&(a=a.default),"string"===typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);var r=n("4f06").default;r("2895ad2b",a,!0,{sourceMap:!1,shadowMode:!1})},be3a:function(e,t,n){var a=n("24fb");t=a(!1),t.push([e.i,'@charset "UTF-8";\r\n/**\r\n * 这里是uni-app内置的常用样式变量\r\n *\r\n * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量\r\n * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App\r\n *\r\n */\r\n/**\r\n * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能\r\n *\r\n * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件\r\n */\r\n/* 颜色变量 */\r\n/* 行为相关颜色 */\r\n/* 文字基本颜色 */\r\n/* 背景颜色 */\r\n/* 边框颜色 */\r\n/* 尺寸变量 */\r\n/* 文字尺寸 */\r\n/* 图片尺寸 */\r\n/* Border Radius */\r\n/* 水平间距 */\r\n/* 垂直间距 */\r\n/* 透明度 */\r\n/* 文章场景相关 */.error-box[data-v-7bc2670d]{font-size:%?40?%;color:#333;text-align:center;margin-top:%?180?%;margin-bottom:%?80?%}.order-btn[data-v-7bc2670d]{width:%?673?%;height:%?72?%;border-radius:%?10?%;color:#fff;background-color:#023894;line-height:%?72?%;font-size:%?38?%;text-align:center;margin:0 auto;margin-top:%?40?%}',""]),e.exports=t},d214:function(e,t,n){"use strict";n.r(t);var a=n("d607"),r=n("65b1");for(var o in r)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(o);n("3fd7");var i=n("f0c5"),s=Object(i["a"])(r["default"],a["b"],a["c"],!1,null,"7bc2670d",null,!1,a["a"],void 0);t["default"]=s.exports},d607:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){}));var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-uni-view",[e.msg?n("v-uni-view",{staticClass:"error-box"},[e._v(e._s(e.msg))]):e._e(),e.msg?n("v-uni-view",{staticClass:"order-btn",on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.goBack.apply(void 0,arguments)}}},[e._v("返回")]):e._e()],1)},r=[]}}]);