mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-16 12:08:12 +00:00
1 line
12 KiB
JavaScript
Vendored
1 line
12 KiB
JavaScript
Vendored
"use strict";(self.webpackChunkDooTask=self.webpackChunkDooTask||[]).push([[205],{60205:(e,t,i)=>{i.r(t),i.d(t,{default:()=>l});var n=i(20629),o=i(80641);function r(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function s(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?r(Object(i),!0).forEach((function(t){a(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function a(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const c={data:function(){return{loadIng:0,codeNeed:!1,codeUrl:$A.apiUrl("users/login/codeimg?_="+Math.random()),loginType:"login",loginJump:!1,email:$A.getStorageString("cacheLoginEmail")||"",password:"",password2:"",code:"",invite:"",needStartHome:!1,needInvite:!1,subscribe:null,privacyShow:!!this.$isEEUiApp}},mounted:function(){var e=this;this.getDemoAccount(),this.getNeedStartHome(),this.isSoftware?this.chackServerUrl().catch((function(e){})):this.clearServerUrl(),this.subscribe=o.Store.subscribe("useSSOLogin",(function(){e.inputServerUrl()}))},beforeDestroy:function(){this.subscribe&&(this.subscribe.unsubscribe(),this.subscribe=null)},activated:function(){this.loginType="login",this.$Electron&&this.$Electron.sendMessage("subWindowDestroyAll")},deactivated:function(){this.loginJump=!1,this.password="",this.password2="",this.code="",this.invite=""},computed:s(s({},(0,n.rn)(["cacheServerUrl","themeMode","themeList"])),{},{isSoftware:function(){return this.$Electron||this.$isEEUiApp},currentLanguage:function(){return this.languageList[this.languageType]||"Language"},welcomeTitle:function(){return"Welcome "+(window.systemInfo.title||"DooTask")},loginText:function(){var e="login"==this.loginType?"登录":"注册";return this.loginJump&&(e+="成功..."),e}}),watch:{$route:function(e){var t=this;"reg"==e.query.type&&this.$nextTick((function(){t.loginType="reg"}))},loginType:function(e){"reg"==e&&this.getNeedInvite()}},methods:{goHome:function(){this.needStartHome&&this.goForward({name:"index",query:{action:"index"}})},setTheme:function(e){this.$store.dispatch("setTheme",e)},getDemoAccount:function(){var e=this;this.isNotServer()||this.$store.dispatch("call",{url:"system/demo"}).then((function(t){var i=t.data;i.account&&(e.email=i.account,e.password=i.password)})).catch((function(e){}))},getNeedStartHome:function(){var e=this;this.isNotServer()||this.$store.dispatch("call",{url:"system/get/starthome"}).then((function(t){var i=t.data;e.needStartHome=!!i.need_start})).catch((function(t){e.needStartHome=!1}))},getNeedInvite:function(){var e=this;this.$store.dispatch("call",{url:"users/reg/needinvite"}).then((function(t){var i=t.data;e.needInvite=!!i.need})).catch((function(t){e.needInvite=!1}))},forgotPassword:function(){$A.modalWarning("请联系管理员!")},reCode:function(){this.codeUrl=$A.apiUrl("users/login/codeimg?_="+Math.random())},inputServerUrl:function(){var e=this,t=$A.rightDelete(this.cacheServerUrl,"/api/");t=$A.leftDelete(t,"http://"),$A.modalInput({title:"使用 SSO 登录",value:t,placeholder:"请输入服务器地址",onOk:function(t){return t?e.inputServerChack($A.trim(t)):"请输入服务器地址"}})},inputServerChack:function(e){var t=this;return new Promise((function(i,n){var o=e;/\/api\/$/.test(o)||(o+=$A.rightExists(o,"/")?"api/":"/api/"),/^https*:\/\//i.test(o)||(o="https://".concat(o)),t.$store.dispatch("call",{url:"".concat(o,"system/setting"),checkNetwork:!1}).then((function(){t.setServerUrl(o),i()})).catch((function(o){var r=o.ret,s=o.msg;if(-1001===r){if(!/^https*:\/\//i.test(e))return void t.inputServerChack("http://".concat(e)).then(i).catch(n);s="服务器地址无效"}n(s)}))}))},chackServerUrl:function(e){var t=this;return new Promise((function(i,n){t.isNotServer()?(!0===e&&$A.messageWarning("请设置服务器"),t.inputServerUrl(),n()):i()}))},setServerUrl:function(e){e!=this.cacheServerUrl&&($A.setStorage("cacheServerUrl",e),$A.reloadUrl())},clearServerUrl:function(){this.setServerUrl("")},isNotServer:function(){var e=$A.getDomain(window.systemInfo.apiUrl);return this.isSoftware&&(""==e||"public"==e)},onBlur:function(){var e=this;"login"==this.loginType&&this.email?(this.loadIng++,this.$store.dispatch("call",{url:"users/login/needcode",data:{email:this.email}}).then((function(){e.reCode(),e.codeNeed=!0})).catch((function(t){e.codeNeed=!1})).finally((function(t){e.loadIng--}))):this.codeNeed=!1},onPrivacy:function(e){e||$A.eeuiAppGoDesktop()},onLogin:function(){var e=this;this.chackServerUrl(!0).then((function(){return e.email=$A.trim(e.email),e.password=$A.trim(e.password),e.password2=$A.trim(e.password2),e.code=$A.trim(e.code),e.invite=$A.trim(e.invite),$A.isEmail(e.email)?e.password?"reg"==e.loginType&&e.password!=e.password2?($A.messageWarning("确认密码输入不一致"),void e.$refs.password2.focus()):(e.loadIng++,void e.$store.dispatch("call",{url:"users/login",data:{type:e.loginType,email:e.email,password:e.password,code:e.code,invite:e.invite}}).then((function(t){var i=t.data;e.codeNeed=!1,$A.setStorage("cacheLoginEmail",e.email),e.$store.dispatch("handleClearCache",i).then((function(){e.goNext()})).catch((function(t){e.goNext()}))})).catch((function(t){var i=t.data,n=t.msg;"email"===i.code?$A.modalWarning(n):$A.modalError(n),"need"===i.code&&(e.reCode(),e.codeNeed=!0,e.$refs.code.focus())})).finally((function(t){e.loadIng--}))):($A.messageWarning("请输入密码"),void e.$refs.password.focus()):($A.messageWarning("请输入正确的邮箱地址"),void e.$refs.email.focus())}))},goNext:function(){this.loginJump=!0;var e=decodeURIComponent($A.getObject(this.$route.query,"from"));e?window.location.replace(e):this.goForward({name:"manage-dashboard"},!0)}}};const l=(0,i(51900).Z)(c,(function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"page-login"},[i("PageTitle",{attrs:{title:e.$L("登录")}}),e._v(" "),i("div",{staticClass:"login-body"},[i("div",{staticClass:"login-logo no-dark-content",class:{"can-click":e.needStartHome},on:{click:e.goHome}}),e._v(" "),i("div",{staticClass:"login-box"},[i("div",{staticClass:"login-title"},[e._v(e._s(e.welcomeTitle))]),e._v(" "),"reg"==e.loginType?i("div",{staticClass:"login-subtitle"},[e._v(e._s(e.$L("输入您的信息以创建帐户。")))]):i("div",{staticClass:"login-subtitle"},[e._v(e._s(e.$L("输入您的凭证以访问您的帐户。")))]),e._v(" "),i("div",{staticClass:"login-input"},[e.isSoftware&&e.cacheServerUrl?i("Input",{attrs:{value:e.$A.getDomain(e.cacheServerUrl),prefix:"ios-globe-outline",size:"large",readonly:"",clearable:""},on:{"on-clear":e.clearServerUrl}}):e._e(),e._v(" "),i("Input",{ref:"email",attrs:{prefix:"ios-mail-outline",placeholder:e.$L("输入您的电子邮件"),type:"email",size:"large",clearable:""},on:{"on-enter":e.onLogin,"on-blur":e.onBlur},model:{value:e.email,callback:function(t){e.email=t},expression:"email"}}),e._v(" "),i("Input",{ref:"password",attrs:{prefix:"ios-lock-outline",placeholder:e.$L("输入您的密码"),type:"password",size:"large",clearable:""},on:{"on-enter":e.onLogin},model:{value:e.password,callback:function(t){e.password=t},expression:"password"}}),e._v(" "),"reg"==e.loginType?i("Input",{ref:"password2",attrs:{prefix:"ios-lock-outline",placeholder:e.$L("输入确认密码"),type:"password",size:"large",clearable:""},on:{"on-enter":e.onLogin},model:{value:e.password2,callback:function(t){e.password2=t},expression:"password2"}}):e._e(),e._v(" "),"reg"==e.loginType&&e.needInvite?i("Input",{ref:"invite",staticClass:"login-code",attrs:{placeholder:e.$L("请输入注册邀请码"),type:"text",size:"large",clearable:""},on:{"on-enter":e.onLogin},model:{value:e.invite,callback:function(t){e.invite=t},expression:"invite"}},[i("span",{attrs:{slot:"prepend"},slot:"prepend"},[e._v(" "+e._s(e.$L("邀请码"))+" ")])]):e._e(),e._v(" "),"login"==e.loginType&&e.codeNeed?i("Input",{ref:"code",staticClass:"login-code",attrs:{placeholder:e.$L("输入图形验证码"),type:"text",size:"large",clearable:""},on:{"on-enter":e.onLogin},model:{value:e.code,callback:function(t){e.code=t},expression:"code"}},[i("Icon",{staticClass:"login-icon",attrs:{slot:"prepend",type:"ios-checkmark-circle-outline"},slot:"prepend"}),e._v(" "),i("div",{staticClass:"login-code-end",attrs:{slot:"append"},on:{click:e.reCode},slot:"append"},[i("img",{attrs:{src:e.codeUrl}})])],1):e._e(),e._v(" "),i("Button",{attrs:{type:"primary",loading:e.loadIng>0||e.loginJump,size:"large",long:""},on:{click:e.onLogin}},[e._v(e._s(e.$L(e.loginText)))]),e._v(" "),"reg"==e.loginType?i("div",{staticClass:"login-switch"},[e._v(e._s(e.$L("已经有帐号?"))),i("a",{attrs:{href:"javascript:void(0)"},on:{click:function(t){e.loginType="login"}}},[e._v(e._s(e.$L("登录帐号")))])]):i("div",{staticClass:"login-switch"},[e._v(e._s(e.$L("还没有帐号?"))),i("a",{attrs:{href:"javascript:void(0)"},on:{click:function(t){e.loginType="reg"}}},[e._v(e._s(e.$L("注册帐号")))])])],1)]),e._v(" "),i("div",{staticClass:"login-bottom"},[i("Dropdown",{attrs:{trigger:"click",placement:"bottom-start"}},[i("div",{staticClass:"login-setting"},[e._v("\n "+e._s(e.$L("设置"))+"\n "),i("i",{staticClass:"taskfont"},[e._v("")])]),e._v(" "),i("DropdownMenu",{staticClass:"login-setting-menu",attrs:{slot:"list"},slot:"list"},[i("Dropdown",{attrs:{placement:"right-start",transfer:""},on:{"on-click":e.setTheme}},[i("DropdownItem",[i("div",{staticClass:"login-setting-item"},[e._v("\n "+e._s(e.$L("主题皮肤"))+"\n "),i("Icon",{attrs:{type:"ios-arrow-forward"}})],1)]),e._v(" "),i("DropdownMenu",{attrs:{slot:"list"},slot:"list"},e._l(e.themeList,(function(t,n){return i("DropdownItem",{key:n,attrs:{name:t.value,selected:e.themeMode===t.value}},[e._v(e._s(e.$L(t.name)))])})),1)],1),e._v(" "),i("Dropdown",{attrs:{placement:"right-start",transfer:""},on:{"on-click":e.setLanguage}},[i("DropdownItem",{attrs:{divided:""}},[i("div",{staticClass:"login-setting-item"},[e._v("\n "+e._s(e.currentLanguage)+"\n "),i("Icon",{attrs:{type:"ios-arrow-forward"}})],1)]),e._v(" "),i("DropdownMenu",{attrs:{slot:"list"},slot:"list"},e._l(e.languageList,(function(t,n){return i("DropdownItem",{key:n,attrs:{name:n,selected:e.getLanguage()===n}},[e._v(e._s(t))])})),1)],1)],1)],1),e._v(" "),i("div",{staticClass:"login-forgot"},[e._v(e._s(e.$L("忘记密码了?"))),i("a",{attrs:{href:"javascript:void(0)"},on:{click:e.forgotPassword}},[e._v(e._s(e.$L("重置密码")))])])],1)]),e._v(" "),i("Modal",{attrs:{title:e.$L("隐私协议"),"mask-closable":!1},model:{value:e.privacyShow,callback:function(t){e.privacyShow=t},expression:"privacyShow"}},[i("div",{staticClass:"privacy-content"},[i("div",[e._v("欢迎使用本软件!")]),e._v(" "),i("p",[e._v("在您使用本软件前,请您认真阅读并了解相应的"),i("a",{attrs:{target:"_blank",href:e.$A.apiUrl("../privacy.html")}},[e._v("《"+e._s(e.$L("隐私政策"))+"》")]),e._v(",以了解我们的服务内容和您相关个人信息的处理规则。我们将严格的按照隐私服务协议为您提供服务,保护您的个人信息。")])]),e._v(" "),i("div",{staticClass:"adaption",attrs:{slot:"footer"},slot:"footer"},[i("Button",{attrs:{type:"default"},on:{click:function(t){return e.onPrivacy(!1)}}},[e._v(e._s(e.$L("不同意")))]),e._v(" "),i("Button",{attrs:{type:"primary"},on:{click:function(t){return e.onPrivacy(!0)}}},[e._v(e._s(e.$L("同意")))])],1)])],1)}),[],!1,null,null,null).exports}}]); |