You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1 lines
7.9 KiB

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-cc42e648"],{"0394":function(e,t,n){},2017:function(e,t,n){"use strict";var a=n("ffa6"),o=n.n(a);o.a},6923:function(e,t,n){"use strict";var a=n("0394"),o=n.n(a);o.a},9256:function(e,t,n){"use strict";n("99af"),n("4160"),n("caad"),n("4fad"),n("d3b7"),n("159b");var a=n("5530"),o=n("bc3a"),r=n.n(o),i=n("5c96"),s=n("5657");n("27ae");function c(e,t){"ECONNABORTED"===e.code?Object(i["Message"])({message:"请求超时"}):e.response&&e.response.data?Object(i["Message"])({message:e.response.data}):e.message&&Object(i["Message"])({message:e.message}),t(e)}function u(e,t){e.data.isError&&(4e4===e.data.code||40001===e.data.code||40002===e.data.code||40003===e.data.code||40005===e.data.code||40006===e.data.code||40008===e.data.code?i["MessageBox"].alert(e.data.msg,"提醒",{confirmButtonText:"确定",callback:function(){window.location.hash="/login"}}):i["Message"].error(e.data.msg)),t(e)}r.a.interceptors.request.use((function(e){var t=!1!==e.headers["X-isToken"]||e.headers["X-isToken"],n=s["a"].get("TOKEN","");n&&t&&(e.headers.token="Bearer "+n);var a="ceres_admin_web",o="ceres_admin_web";return e.headers["Authorization"]="Basic ".concat("".concat(a,":").concat(o)),e}),(function(e){return Promise.reject(e)})),r.a.interceptors.response.use((function(e){return e}),(function(e){return Promise.reject(e)}));var d=function(e){console.log(e,"opts");var t={ts:Date.now()},n=e.method.toUpperCase(),o={method:n,url:"".concat("https://pos.admin.api.lotus-wallet.com").concat(e.url),responseType:e.responseType||"",timeout:2e4},i=["PUT","POST","PATCH"];i.includes(n)?o.data=e.data||{}:o.params=Object(a["a"])(Object(a["a"])({},t),e.data||{}),e.formData&&(o.transformRequest=[function(e){var t=new FormData;return e&&Object.entries(e).forEach((function(e){t.append(e[0],e[1])})),t}]);var s=new Promise((function(e,t){r()(o).then((function(t){u(t,e)})).catch((function(e){c(e,t)}))}));return s};t["a"]=d},"9ed6":function(e,t,n){"use strict";n.r(t);var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"login-container"},[n("el-form",{ref:"loginForm",staticClass:"login-form",attrs:{model:e.loginForm,rules:e.rules,autocomplete:"off","label-position":"left"}},[n("div",{staticClass:"title-container"},[n("h3",{staticClass:"title"},[e._v("平台登录")])]),"up"===e.login.type?n("span",[n("el-form-item",{attrs:{prop:"account"}},[n("el-input",{ref:"account",attrs:{placeholder:e.$t("login.username"),autocomplete:"off",name:"account","prefix-icon":"el-icon-user",type:"text"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleLogin(t)}},model:{value:e.loginForm.account,callback:function(t){e.$set(e.loginForm,"account",t)},expression:"loginForm.account"}})],1),n("el-form-item",{attrs:{prop:"password"}},[n("el-input",{ref:"password",attrs:{placeholder:e.$t("login.password"),"show-password":!0,autocomplete:"off",name:"password","prefix-icon":"el-icon-key",type:"password"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleLogin(t)}},model:{value:e.loginForm.password,callback:function(t){e.$set(e.loginForm,"password",t)},expression:"loginForm.password"}})],1),n("el-form-item",{staticClass:"code-input",attrs:{prop:"code"}},[n("el-input",{ref:"code",staticStyle:{width:"70%"},attrs:{placeholder:e.$t("login.code"),autocomplete:"off",name:"code","prefix-icon":"el-icon-lock",type:"text"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleLogin(t)}},model:{value:e.loginForm.code,callback:function(t){e.$set(e.loginForm,"code",t)},expression:"loginForm.code"}})],1),n("img",{staticClass:"code-image",attrs:{src:e.imageCode,alt:"codeImage"},on:{click:e.getCodeImage}}),n("el-button",{staticStyle:{width:"100%","margin-bottom":"14px"},attrs:{loading:e.loading,type:"primary"},nativeOn:{click:function(t){return t.preventDefault(),e.handleLogin(t)}}},[e._v(e._s(e.$t("login.logIn")))])],1):e._e()]),n("span",{staticClass:"login-footer"},[e._v(" © 2020 回乡POS平台端 ")])],1)},o=[],r=(n("c975"),n("13d5"),n("ace4"),n("b0c0"),n("d3b7"),n("25f0"),n("5cc6"),n("9a8c"),n("a975"),n("735e"),n("c1ac"),n("d139"),n("3a7b"),n("d5d6"),n("82f8"),n("e91f"),n("60bd"),n("5f96"),n("3280"),n("3fcc"),n("ca91"),n("25a1"),n("cd26"),n("3c5d"),n("2954"),n("649e"),n("219c"),n("170b"),n("b39a"),n("72f7"),n("5657")),i=n("ed08"),s=n("9256"),c={captcha:"/anno/captcha",login:"/anno/admin/login",router:"/menu/admin/router"},u={getCaptcha:function(e){return Object(s["a"])({method:"GET",url:c.captcha+"?key=".concat(e),responseType:"arraybuffer",meta:{"X-isToken":!1}})},login:function(e){return Object(s["a"])({method:"POST",url:c.login,data:e})},getRouter:function(e){return Object(s["a"])({method:"GET",url:c.router,data:e||{}})}},d={name:"Login",data:function(){return{login:{type:"up"},logo:[{img:"gitee.png",name:"gitee",radius:!0},{img:"github.png",name:"github",radius:!0},{img:"tencent_cloud.png",name:"tencent_cloud",radius:!0},{img:"qq.png",name:"qq",radius:!1},{img:"dingtalk.png",name:"dingtalk",radius:!0},{img:"microsoft.png",name:"microsoft",radius:!1}],loginForm:{account:"",password:"",key:"",code:"",grantType:"captcha",bindAccount:"",bindPassword:"",signAccount:"",signPassword:""},rules:{account:{required:!0,message:this.$t("rules.require"),trigger:"blur"},password:{required:!0,message:this.$t("rules.require"),trigger:"blur"},code:{required:!0,message:this.$t("rules.require"),trigger:"blur"},bindAccount:{required:!0,message:this.$t("rules.require"),trigger:"blur"},bindPassword:{required:!0,message:this.$t("rules.require"),trigger:"blur"},signAccount:[{required:!0,message:this.$t("rules.require"),trigger:"blur"},{min:4,max:10,message:this.$t("rules.range4to10"),trigger:"blur"}],signPassword:[{required:!0,message:this.$t("rules.require"),trigger:"blur"},{min:6,max:20,message:this.$t("rules.range6to20"),trigger:"blur"}]},authUser:null,loading:!1,showDialog:!1,redirect:void 0,otherQuery:{},randomId:Object(i["d"])(24,16),imageCode:"",page:{width:.5*window.screen.width,height:.5*window.screen.height}}},created:function(){},mounted:function(){r["a"].clear(),this.getCodeImage()},destroyed:function(){window.removeEventListener("message",this.resolveSocialLogin)},methods:{getCodeImage:function(){var e=this;u.getCaptcha(this.randomId).then((function(t){var n=t.data;return n.byteLength<=100&&e.$message({message:e.$t("tips.systemError"),type:"error"}),"data:image/png;base64,"+btoa(new Uint8Array(n).reduce((function(e,t){return e+String.fromCharCode(t)}),""))})).then((function(t){console.log(t),e.imageCode=t})).catch((function(t){-1!==t.toString().indexOf("429")?e.$message({message:e.$t("tips.tooManyRequest"),type:"error"}):e.$message({message:e.$t("tips.getCodeImageFailed"),type:"error"})}))},handleLogin:function(){var e=this,t=!1,n=!1,a=!1;if(this.$refs.loginForm.validateField("account",(function(e){e||(t=!0)})),this.$refs.loginForm.validateField("password",(function(e){e||(n=!0)})),this.$refs.loginForm.validateField("code",(function(e){e||(a=!0)})),t&&n&&a){this.loading=!0;var o=this;o.loginForm["key"]=o.randomId,u.login(this.loginForm).then((function(t){var n=t.data;n.isSuccess?(o.saveLoginData(n.data["token"],n.data["refreshToken"],n.data["expiration"]),o.saveUserInfo(n.data),o.$message({message:e.$t("tips.loginSuccess"),type:"success"}),o.$router.push("/")):(o.loading=!1,o.getCodeImage())})).finally((function(){return o.loading=!1,!0}))}},saveLoginData:function(e,t,n){this.$store.commit("account/setToken",e),this.$store.commit("account/setRefreshToken",t),this.$store.commit("account/setExpireTime",n)},saveUserInfo:function(e){this.$store.commit("account/setUser",{id:e.userId,account:e.account,name:e.name,avatar:e.avatar,workDescribe:e.workDescribe})},loginSuccessCallback:function(e){}}},l=d,g=(n("2017"),n("6923"),n("2877")),m=Object(g["a"])(l,a,o,!1,null,"e2978f12",null);t["default"]=m.exports},ffa6:function(e,t,n){}}]);