1 line
9.4 KiB
JavaScript
1 line
9.4 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["account"],{"42b4":function(s,t,e){"use strict";var i=e("ddf3"),n=e.n(i);n.a},a3f2:function(s,t,e){"use strict";e.r(t);var i=function(){var s=this,t=s.$createElement,e=s._self._c||t;return e("div",{staticClass:"account"},[e("md-app",{attrs:{"md-waterfall":"","md-mode":"fixed"}},[e("md-app-toolbar",{staticClass:"md-primary toolbar"},[e("div",{staticClass:"md-toolbar-section-start"},[e("md-button",{staticClass:"md-icon-button",on:{click:function(t){return s.back()}}},[e("md-icon",[s._v("arrow_back")])],1),e("h3",{staticClass:"md-title",staticStyle:{flex:"1"}},[s._v(s._s(s.lang.title))])],1)]),e("md-app-content",[e("v-touch",{attrs:{"swipe-options":{direction:"horizontal"}},on:{swiperight:function(t){return s.back()}}},[e("div",{ref:"list_placeholder",staticStyle:{height:"54px"}}),e("icon",{staticClass:"logo",attrs:{name:"canary"}}),"login"==s.page_type?[e("md-field",{class:s.cid_verify?"":"md-invalid"},[e("label",[s._v(s._s(s.lang.login.input_placeholder[0]))]),e("md-input",{attrs:{required:""},model:{value:s.cid,callback:function(t){s.cid=t},expression:"cid"}}),e("span",{staticClass:"md-error"},[s._v(s._s(s.cid_errmsg))])],1),e("md-field",{class:s.password_verify?"":"md-invalid"},[e("label",[s._v(s._s(s.lang.login.input_placeholder[1]))]),e("md-input",{attrs:{required:"",type:"password"},model:{value:s.password,callback:function(t){s.password=t},expression:"password"}}),e("span",{staticClass:"md-error"},[s._v(s._s(s.lang.login.password_errmsg))])],1),e("md-button",{staticClass:"md-raised md-primary expand",attrs:{disabled:s.login_loading},on:{click:function(t){return s.judgeLogin()}}},[s._v(" "+s._s(s.lang.login.submit)+" "),e("div",{staticClass:"loading-box"},[s.login_loading?e("md-progress-spinner",{attrs:{"md-diameter":22,"md-stroke":3,"md-mode":"indeterminate"}}):s._e()],1)])]:s._e(),"account"==s.page_type?[e("md-list",[e("md-list-item",[e("span",{staticClass:"md-list-item-text"},[s._v(s._s(s.user_infos.cid)+" | "+s._s(s.user_infos.user_name))])]),e("md-divider"),e("md-list-item",[e("span",{staticClass:"md-list-item-text"},[s._v(s._s(s.lang.account.label[0]))]),e("span",{staticClass:"time-content"},[s._v(s._s(s.update_time))])]),e("md-list-item",[e("span",{staticClass:"md-list-item-text"},[s._v(s._s(s.lang.account.label[1]))]),e("span",{staticClass:"time-content"},[s._v(s._s(s.user_infos.cloud_drivce))])]),e("md-list-item",[e("span",{staticClass:"md-list-item-text"},[s._v(s._s(s.lang.account.label[2]))]),s.sync_cloud_loading?e("md-progress-spinner",{attrs:{"md-diameter":22,"md-stroke":3,"md-mode":"indeterminate"}}):e("md-button",{staticClass:"md-icon-button md-list-action",on:{click:function(t){return s.syncCloudStart()}}},[e("md-icon",[s._v("cloud_upload")])],1)],1),e("md-list-item",[e("span",{staticClass:"md-list-item-text"},[s._v(s._s(s.lang.account.label[3]))]),s.sync_local_loading?e("md-progress-spinner",{attrs:{"md-diameter":22,"md-stroke":3,"md-mode":"indeterminate"}}):e("md-button",{staticClass:"md-icon-button md-list-action",on:{click:function(t){return s.syncLocalStart()}}},[e("md-icon",[s._v("cloud_download")])],1)],1),e("md-button",{staticClass:"md-raised md-primary expand",attrs:{disabled:s.sync_local_loading||s.sync_cloud_loading},on:{click:function(t){return s.startLogout()}}},[s._v(s._s(s.lang.account.logout))])],1)]:s._e(),e("md-snackbar",{attrs:{"md-position":"center","md-active":s.show_snackbar,"md-persistent":""},on:{"update:mdActive":function(t){s.show_snackbar=t},"update:md-active":function(t){s.show_snackbar=t}}},[e("span",[s._v(s._s(s.snakebar_msg))])])],2)],1)],1)],1)},n=[],a=(e("d780"),e("94ec"),e("b54b")),o=e("08c1"),c=e("c71e"),r=e("2503"),d=e("36f0"),l=e("e6a3"),_=e("bfd3"),g={name:"Add",data(){return{page_type:"login",cid:"",cid_verify:!0,cid_errmsg:"",password:"",password_verify:!0,sync_local_loading:!1,sync_cloud_loading:!1,login_loading:!1,show_snackbar:!1,snakebar_msg:"",lang:"",clientHeight:""}},computed:Object(a["a"])({},Object(o["c"])(["user_infos","row_data","row_pwd","settings"]),{update_time:function(){return this.formatDateTime(new Date(parseInt(this.user_infos.update_time)))}}),methods:Object(a["a"])({},Object(o["b"])(["setRowData","setRowPwd","setSettings","setUserInfo"]),{changeFixed(s){this.$refs.list_placeholder.parentNode.parentNode.style.maxHeight=s+"px",this.$refs.list_placeholder.parentNode.style.minHeight=s-32+"px",window.document.documentElement.setAttribute("data-theme",this.settings.is_dark_mode?"dark":"light")},init(){_["a"].call(this),this.initLanguage(),this.user_infos&&this.user_infos.cid&&this.user_infos.row_login_pwd?this.page_type="account":this.page_type="login",console.log("当前用户状态为"+this.page_type)},initLanguage(){this.settings.is_chinese?this.lang=Object(d["a"])().account.CHS:this.lang=Object(d["a"])().account.EN,console.log("语言配置完成")},back(){this.$router.go(-1)},turnToHome(s){console.log(s),this.$router.replace("/")},judgeLogin(){var s=!0;(this.cid=this.cid.trim())||(s=!1,this.cid_verify=!1,this.cid_errmsg=this.lang.cid_errmsg[0]),(this.password=this.password.trim())||(s=!1,this.password_verify=!1),s&&this.startLogin()},startLogin(){this.login_loading=!0;var s={cid:this.cid,pwd:this.password};Object(r["b"])(s).then(s=>{this.manageLoginRes(s.data)}).catch(s=>{console.log(s),this.login_loading=!1,s.response?512==s.response.status?this.snakebar_msg=this.lang.snakebar_msg[1]:510==s.response.status?this.snakebar_msg=this.lang.snakebar_msg[2]:this.snakebar_msg=this.lang.snakebar_msg[3]+s.response.status:this.snakebar_msg=this.lang.snakebar_msg[0],this.show_snackbar=!0})},manageLoginRes(s){var t=Object(a["a"])({},this.user_infos,{cid:this.cid,row_login_pwd:Object(c["d"])(this.password),user_name:s.username,update_time:s.modified,cloud_drivce:this.settings.is_chinese?"暂无":"unknown"});this.setUserInfo([t,this]),console.log("正常用户登录,用户信息覆写完成"),this.snakebar_msg=this.lang.snakebar_msg[4],this.show_snackbar=!0,this.page_type="account",this.login_loading=!1},formatDateTime(s){var t=new Date(s),e=t.getFullYear(),i=t.getMonth()+1;i=i<10?"0"+i:i;var n=t.getDate();n=n<10?"0"+n:n;var a=t.getHours();a=a<10?"0"+a:a;var o=t.getMinutes(),c=t.getSeconds();return o=o<10?"0"+o:o,c=c<10?"0"+c:c,e+"-"+i+"-"+n+" "+a+":"+o},syncLocalStart(){this.sync_local_loading=!0;var s={cid:this.user_infos.cid,pwd:Object(c["b"])(this.user_infos.row_login_pwd)};Object(r["b"])(s).then(s=>{var t=s.data,e="";try{if(e=JSON.parse(t.content),"string"==typeof e)throw new Error;e&&e.codebook||(e={codebook:"",drivce:e.drivce?e.drivce:this.settings.is_chinese?"暂无":"unknown"}),e.drivce&&"暂无"!=e.drivce&&"unknown"!=e.drivce?e.drivce=decodeURIComponent(e.drivce):e.drivce=this.settings.is_chinese?"暂无":"unknown",this.setRowData([e.codebook,this]),console.log("数据获取成功,密码本覆写成功");var i=this.user_infos;i.update_time=t.modified-24e4,i.user_name=t.username,i.cloud_drivce=e.drivce,this.setUserInfo([i,this]),console.log("数据获取成功,用户信息覆写成功"),this.snakebar_msg=this.lang.snakebar_msg[6],this.show_snackbar=!0}catch(n){console.log(n),console.log("数据获取成功,内容有误"),this.snakebar_msg=this.lang.snakebar_msg[5],this.show_snackbar=!0}finally{setTimeout(function(){this.sync_local_loading=!1}.bind(this),1e3)}}).catch(s=>{console.log(s),this.sync_local_loading=!1,s.response?512==s.response.status?this.snakebar_msg=this.lang.snakebar_msg[1]:510==s.response.status?this.snakebar_msg=this.lang.snakebar_msg[2]:this.snakebar_msg=this.lang.snakebar_msg[3]+s.response.status:this.snakebar_msg=this.lang.snakebar_msg[0],this.show_snackbar=!0})},syncCloudStart(){this.sync_cloud_loading=!0;var s={codebook:this.row_data,drivce:encodeURIComponent(this.user_infos.drivce)},t={cid:this.user_infos.cid,pwd:Object(c["b"])(this.user_infos.row_login_pwd),content:JSON.stringify(s)};console.log(t),Object(r["a"])(t).then(s=>{var t=this.user_infos;t.update_time=(new Date).getTime(),t.cloud_drivce=t.drivce?t.drivce:this.settings.is_chinese?"暂无":"unknown",this.setUserInfo([t,this]),console.log("数据上传成功,用户信息覆写成功"),this.snakebar_msg=this.lang.snakebar_msg[7],this.show_snackbar=!0,setTimeout(function(){this.sync_cloud_loading=!1}.bind(this),1e3)}).catch(s=>{console.log(s),this.sync_cloud_loading=!1,s.response?512==s.response.status?this.snakebar_msg=this.lang.snakebar_msg[1]:510==s.response.status?this.snakebar_msg=this.lang.snakebar_msg[2]:this.snakebar_msg=this.lang.snakebar_msg[3]+s.response.status:this.snakebar_msg=this.lang.snakebar_msg[0],this.show_snackbar=!0})},startLogout(){var s=Object(a["a"])({},this.user_infos,{user_name:"A Little Canary",cid:"Codebook",row_login_pwd:"",cloud_drivce:this.settings.is_chinese?"暂无":"unknown",update_time:(new Date).getTime()});this.setUserInfo([s,this]),console.log("用户信息覆写完成"),this.back()}}),created(){this.lang=Object(d["a"])().account.CHS,console.log("临时语言系统加载完成"),this.init()},mounted(){this.clientHeight="".concat(document.documentElement.clientHeight),window.onresize=function(){this.clientHeight="".concat(document.documentElement.clientHeight),Object(l["a"])()}.bind(this)},watch:{clientHeight:function(){this.changeFixed(this.clientHeight)},cid:function(){this.cid_verify=!0},password:function(){this.password_verify=!0},activation_code:function(){this.activation_code_verify=!0}},beforeDestroy(){},components:{}},m=g,h=(e("42b4"),e("623f")),u=Object(h["a"])(m,i,n,!1,null,"a52b4772",null);t["default"]=u.exports},ddf3:function(s,t,e){}}]); |