1 line
9.5 KiB
JavaScript
1 line
9.5 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["account"],{"5e46":function(t,s,e){},a3f2:function(t,s,e){"use strict";e.r(s);var n=function(){var t=this,s=t.$createElement,e=t._self._c||s;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(s){return t.back()}}},[e("md-icon",[t._v("arrow_back")])],1),e("h3",{staticClass:"md-title",staticStyle:{flex:"1"}},[t._v(t._s(t.lang.title))])],1)]),e("md-app-content",[e("v-touch",{attrs:{"swipe-options":{direction:"horizontal"}},on:{swiperight:function(s){return t.back()}}},[e("div",{ref:"list_placeholder",staticStyle:{height:"54px"}}),e("icon",{staticClass:"logo",attrs:{name:"canary"}}),"login"==t.page_type?[e("md-field",{class:t.cid_verify?"":"md-invalid"},[e("label",[t._v(t._s(t.lang.login.input_placeholder[0]))]),e("md-input",{attrs:{required:""},model:{value:t.cid,callback:function(s){t.cid=s},expression:"cid"}}),e("span",{staticClass:"md-error"},[t._v(t._s(t.cid_errmsg))])],1),e("md-field",{class:t.password_verify?"":"md-invalid"},[e("label",[t._v(t._s(t.lang.login.input_placeholder[1]))]),e("md-input",{attrs:{required:"",type:"password"},model:{value:t.password,callback:function(s){t.password=s},expression:"password"}}),e("span",{staticClass:"md-error"},[t._v(t._s(t.lang.login.password_errmsg))])],1),e("md-button",{staticClass:"md-raised md-primary expand",attrs:{disabled:t.login_loading},on:{click:function(s){return t.judgeLogin()}}},[t._v(" "+t._s(t.lang.login.submit)+" "),e("div",{staticClass:"loading-box"},[t.login_loading?e("md-progress-spinner",{attrs:{"md-diameter":22,"md-stroke":3,"md-mode":"indeterminate"}}):t._e()],1)])]:t._e(),"account"==t.page_type?[e("md-list",[e("md-list-item",[e("span",{staticClass:"md-list-item-text"},[t._v(t._s(t.user_infos.cid)+" | "+t._s(t.user_infos.user_name))])]),e("md-divider"),e("md-list-item",[e("span",{staticClass:"md-list-item-text"},[t._v(t._s(t.lang.account.label[0]))]),e("span",{staticClass:"time-content"},[t._v(t._s(t.update_time))])]),e("md-list-item",[e("span",{staticClass:"md-list-item-text"},[t._v(t._s(t.lang.account.label[1]))]),e("span",{staticClass:"time-content"},[t._v(t._s(t.user_infos.cloud_drivce))])]),e("md-list-item",[e("span",{staticClass:"md-list-item-text"},[t._v(t._s(t.lang.account.label[2]))]),t.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(s){return t.syncCloudStart()}}},[e("md-icon",[t._v("cloud_upload")])],1)],1),e("md-list-item",[e("span",{staticClass:"md-list-item-text"},[t._v(t._s(t.lang.account.label[3]))]),t.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(s){return t.syncLocalStart()}}},[e("md-icon",[t._v("cloud_download")])],1)],1),e("md-button",{staticClass:"md-raised md-primary expand",attrs:{disabled:t.sync_local_loading||t.sync_cloud_loading},on:{click:function(s){return t.startLogout()}}},[t._v(t._s(t.lang.account.logout))])],1)]:t._e(),e("md-snackbar",{attrs:{"md-position":"center","md-active":t.show_snackbar,"md-persistent":""},on:{"update:mdActive":function(s){t.show_snackbar=s},"update:md-active":function(s){t.show_snackbar=s}}},[e("span",[t._v(t._s(t.snakebar_msg))])])],2)],1)],1)],1)},a=[],i=(e("0bd5"),e("9b42"),e("0861"),e("d211")),o=e("cf6b"),c=e("c71e"),r=e("2503"),d=e("36f0"),l=e("e6a3"),_=e("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(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(i["a"])({},Object(o["b"])(["setRowData","setRowPwd","setSettings","setUserInfo"])),{},{changeFixed:function(t){this.$refs.list_placeholder.parentNode.parentNode.style.maxHeight=t+"px",this.$refs.list_placeholder.parentNode.style.minHeight=t-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(t){console.log(t),this.$router.replace("/")},judgeLogin:function(){var t=!0;(this.cid=this.cid.trim())||(t=!1,this.cid_verify=!1,this.cid_errmsg=this.lang.cid_errmsg[0]),(this.password=this.password.trim())||(t=!1,this.password_verify=!1),t&&this.startLogin()},startLogin:function(){var t=this;this.login_loading=!0;var s={cid:this.cid,pwd:this.password};Object(r["b"])(s).then((function(s){t.manageLoginRes(s.data)})).catch((function(s){console.log(s),t.login_loading=!1,s.response?512==s.response.status?t.snakebar_msg=t.lang.snakebar_msg[1]:510==s.response.status?t.snakebar_msg=t.lang.snakebar_msg[2]:t.snakebar_msg=t.lang.snakebar_msg[3]+s.response.status:t.snakebar_msg=t.lang.snakebar_msg[0],t.show_snackbar=!0}))},manageLoginRes:function(t){var s=Object(i["a"])(Object(i["a"])({},this.user_infos),{},{cid:this.cid,row_login_pwd:Object(c["d"])(this.password),user_name:t.username,update_time:t.modified,cloud_drivce:this.settings.is_chinese?"暂无":"unknown"});this.setUserInfo([s,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(t){var s=new Date(t),e=s.getFullYear(),n=s.getMonth()+1;n=n<10?"0"+n:n;var a=s.getDate();a=a<10?"0"+a:a;var i=s.getHours();i=i<10?"0"+i:i;var o=s.getMinutes(),c=s.getSeconds();return o=o<10?"0"+o:o,c=c<10?"0"+c:c,e+"-"+n+"-"+a+" "+i+":"+o},syncLocalStart:function(){var t=this;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((function(s){var e=s.data,n="";try{if(n=JSON.parse(e.content),"string"==typeof n)throw new Error;n&&n.codebook||(n={codebook:"",drivce:n.drivce?n.drivce:t.settings.is_chinese?"暂无":"unknown"}),n.drivce&&"暂无"!=n.drivce&&"unknown"!=n.drivce?n.drivce=decodeURIComponent(n.drivce):n.drivce=t.settings.is_chinese?"暂无":"unknown",t.setRowData([n.codebook,t]),console.log("数据获取成功,密码本覆写成功");var a=t.user_infos;a.update_time=e.modified-24e4,a.user_name=e.username,a.cloud_drivce=n.drivce,t.setUserInfo([a,t]),console.log("数据获取成功,用户信息覆写成功"),t.snakebar_msg=t.lang.snakebar_msg[6],t.show_snackbar=!0}catch(i){console.log(i),console.log("数据获取成功,内容有误"),t.snakebar_msg=t.lang.snakebar_msg[5],t.show_snackbar=!0}finally{setTimeout(function(){this.sync_local_loading=!1}.bind(t),1e3)}})).catch((function(s){console.log(s),t.sync_local_loading=!1,s.response?512==s.response.status?t.snakebar_msg=t.lang.snakebar_msg[1]:510==s.response.status?t.snakebar_msg=t.lang.snakebar_msg[2]:t.snakebar_msg=t.lang.snakebar_msg[3]+s.response.status:t.snakebar_msg=t.lang.snakebar_msg[0],t.show_snackbar=!0}))},syncCloudStart:function(){var t=this;this.sync_cloud_loading=!0;var s={codebook:this.row_data,drivce:encodeURIComponent(this.user_infos.drivce)},e={cid:this.user_infos.cid,pwd:Object(c["b"])(this.user_infos.row_login_pwd),content:JSON.stringify(s)};console.log(e),Object(r["a"])(e).then((function(s){var e=t.user_infos;e.update_time=(new Date).getTime(),e.cloud_drivce=e.drivce?e.drivce:t.settings.is_chinese?"暂无":"unknown",t.setUserInfo([e,t]),console.log("数据上传成功,用户信息覆写成功"),t.snakebar_msg=t.lang.snakebar_msg[7],t.show_snackbar=!0,setTimeout(function(){this.sync_cloud_loading=!1}.bind(t),1e3)})).catch((function(s){console.log(s),t.sync_cloud_loading=!1,s.response?512==s.response.status?t.snakebar_msg=t.lang.snakebar_msg[1]:510==s.response.status?t.snakebar_msg=t.lang.snakebar_msg[2]:t.snakebar_msg=t.lang.snakebar_msg[3]+s.response.status:t.snakebar_msg=t.lang.snakebar_msg[0],t.show_snackbar=!0}))},startLogout:function(){var t=Object(i["a"])(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([t,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=(e("fa97"),e("5d22")),p=Object(u["a"])(m,n,a,!1,null,"233a6982",null);s["default"]=p.exports},fa97:function(t,s,e){"use strict";e("5e46")}}]); |