|
|
require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["package_sub/login/login"],{243:function(e,n,o){"use strict";(function(e,n){var t=o(4);o(26);t(o(25));var r=t(o(244));e.__webpack_require_UNI_MP_PLUGIN__=o,n(r.default)}).call(this,o(1)["default"],o(2)["createPage"])},244:function(e,n,o){"use strict";o.r(n);var t=o(245),r=o(247);for(var i in r)["default"].indexOf(i)<0&&function(e){o.d(n,e,(function(){return r[e]}))}(i);o(249);var a,s=o(35),c=Object(s["default"])(r["default"],t["render"],t["staticRenderFns"],!1,null,"6126915d",null,!1,t["components"],a);c.options.__file="package_sub/login/login.vue",n["default"]=c.exports},245:function(e,n,o){"use strict";o.r(n);var t=o(246);o.d(n,"render",(function(){return t["render"]})),o.d(n,"staticRenderFns",(function(){return t["staticRenderFns"]})),o.d(n,"recyclableRender",(function(){return t["recyclableRender"]})),o.d(n,"components",(function(){return t["components"]}))},246:function(e,n,o){"use strict";var t;o.r(n),o.d(n,"render",(function(){return r})),o.d(n,"staticRenderFns",(function(){return a})),o.d(n,"recyclableRender",(function(){return i})),o.d(n,"components",(function(){return t}));try{t={uInput:function(){return Promise.all([o.e("common/vendor"),o.e("uview-ui/components/u-input/u-input")]).then(o.bind(null,415))}}}catch(s){if(-1===s.message.indexOf("Cannot find module")||-1===s.message.indexOf(".vue"))throw s;console.error(s.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,n=e.$createElement;e._self._c;e._isMounted||(e.e0=function(n,o){var t=arguments[arguments.length-1].currentTarget.dataset,r=t.eventParams||t["event-params"];o=r.item;e.form.role=o.value},e.e1=function(n){e.isRemeber=!e.isRemeber})},i=!1,a=[];r._withStripped=!0},247:function(e,n,o){"use strict";o.r(n);var t=o(248),r=o.n(t);for(var i in t)["default"].indexOf(i)<0&&function(e){o.d(n,e,(function(){return t[e]}))}(i);n["default"]=r.a},248:function(e,n,o){"use strict";(function(e,o){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var t={data:function(){return{form:{username:"",password:"",role:""},roleList:[{value:"nurse",label:"护工"},{value:"staff",label:"工作人员"},{value:"operator",label:"运营人员"}],site_name:"",isRemeber:!0,showPrivacyTip:!1,privacyAuthorized:!1,needPrivacyAuth:!1}},onReady:function(){},onShareAppMessage:function(){return{title:"医康养服务",path:"/pages/index/index"}},onLoad:function(){this.showPrivacyTip=!0,this.needPrivacyAuth=!0,this.privacyAuthorized=!1,this.checkPrivacySetting()},mounted:function(){this.form=this.vuex_saved_username_psd||{username:"",password:"",role:"nurse"},console.log("form",this.form)},methods:{checkPrivacySetting:function(){var n=this;e.getPrivacySetting&&e.getPrivacySetting({success:function(e){console.log("隐私设置:",e),e.needAuthorization&&(n.needPrivacyAuth=!0,n.showPrivacyTip=!0)},fail:function(e){console.error("获取隐私设置失败:",e)}})},handlePrivacyConfirm:function(){var n=this;e.requirePrivacyAuthorize?e.requirePrivacyAuthorize({success:function(){console.log("隐私授权成功"),n.privacyAuthorized=!0,n.showPrivacyTip=!1,n.needPrivacyAuth=!1},fail:function(e){console.error("隐私授权失败:",e),o.showToast({title:"需要授权才能使用",icon:"none"})}}):(this.showPrivacyTip=!1,this.privacyAuthorized=!0)},handlePrivacyCancel:function(){this.showPrivacyTip=!1,o.showToast({title:"需要授权才能使用",icon:"none"})},openPrivacyContract:function(){e.openPrivacyContract?e.openPrivacyContract({success:function(e){console.log("打开隐私协议成功",e)},fail:function(e){console.error("打开隐私协议失败:",e),o.showToast({title:"无法打开隐私协议",icon:"none"})}}):o.showToast({title:"当前微信版本不支持查看隐私协议",icon:"none"})},login:function(){var n=this;if(!this.needPrivacyAuth||this.privacyAuthorized)if(this.form.username&&this.form.password)if(this.form.role){var t=this,r=null;switch(this.form.role){case"nurse":r=this.$u.api.login;break;case"staff":r=this.$u.api.staffLogin;break;case"operator":r=this.$u.api.operatorLogin;break;default:return void o.showToast({title:"无效的角色选择",icon:"none"})}r({username:this.form.username,password:this.form.password}).then((function(r){if(console.log("res1",r),40002!==r.errcode){o.setStorageSync("login_role",n.form.role);var i=o.getStorageSync("login_role");"staff"===i?t.$u.vuex("vuex_token",r.token):"operator"===i?t.$u.vuex("vuex_token",r.access_token):t.$u.vuex("vuex_token",r.token),n.isRemeber?n.$u.vuex("vuex_saved_username_psd",n.form):n.$u.vuex("vuex_saved_username_psd",{username:"",password:"",role:"nurse"}),t.base.toast("登录成功",1500,(function(){t.needPrivacyAuth&&!t.privacyAuthorized&&e.requirePrivacyAuthorize?e.requirePrivacyAuthorize({success:function(){t.privacyAuthorized=!0,t.doWeixinLogin(t)},fail:function(){o.showToast({title:"需要授权才能使用",icon:"none"})}}):t.doWeixinLogin(t)}))}else t.base.toast("账号密码不正确")})).catch((function(e){console.error("登录失败",e),t.base.toast("登录失败,请稍后重试")}))}else o.showToast({title:"请选择登录角色",icon:"none"});else o.showToast({title:"请输入用户名和密码",icon:"none"});else this.showPrivacyTip=!0},doWeixinLogin:function(e){o.login({provider:"weixin",success:function(n){var t=n.code;setTimeout((function(){var n=o.getStorageSync("login_role");"staff"===n?e.$u.api.appletLogin({code:t}).then((function(e){o.reLaunch({url:"/pages/index/staffIndex"})})).catch((function(e){console.error("静默登录失败",e)})):"operator"===n?o.reLaunch({url:"/pages/index/operatorIndex"}):e.$u.api.nurseAppletLogin({code:t}).then((function(e){o.switchTab({url:"/pages/index/index"})})).catch((function(e){console.error("静默登录失败",e)}))}),1500)},fail:function(e){console.error("获取微信code失败",e)}})}}};n.default=t}).call(this,o(1)["default"],o(2)["default"])},249:function(e,n,o){"use strict";o.r(n);var t=o(250),r=o.n(t);for(var i in t)["default"].indexOf(i)<0&&function(e){o.d(n,e,(function(){return t[e]}))}(i);n["default"]=r.a},250:function(e,n,o){}},[[243,"common/runtime","common/vendor"]]]);
|