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