1 line
9.4 KiB
JavaScript
1 line
9.4 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["add"],{"9c60":function(e,t,s){},c0b7:function(e,t,s){"use strict";s.d(t,"a",(function(){return l}));const a={lower:i,upper:o,number:r,symbol:n};function i(){return String.fromCharCode(Math.floor(26*Math.random())+97)}function o(){return String.fromCharCode(Math.floor(26*Math.random())+65)}function r(){return String.fromCharCode(Math.floor(10*Math.random())+48)}function n(){const e='~!@#$%^&*()_+{}":?><;.,';return e[Math.floor(Math.random()*e.length)]}function l(e,t,s,i,o){let r="";const n=t+s+i+o,l=[{lower:t},{upper:s},{number:i},{symbol:o}].filter(e=>Object.values(e)[0]);if(0===n)return"";for(let d=0;d<e;d++)l.forEach(e=>{const t=Object.keys(e)[0];r+=a[t]()});return r.slice(0,e)}},df8f:function(e,t,s){"use strict";s.r(t);var a=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"add"},[s("md-app",{attrs:{"md-waterfall":"","md-mode":"fixed"}},[s("md-app-toolbar",{staticClass:"md-primary toolbar"},[s("div",{staticClass:"md-toolbar-section-start"},[s("md-button",{staticClass:"md-icon-button",on:{click:function(t){return e.back()}}},[s("md-icon",[e._v("arrow_back")])],1),s("h3",{staticClass:"md-title",staticStyle:{flex:"1"}},[e._v(e._s(e.id_cache?e.lang.title[1]:e.lang.title[0]))])],1)]),s("md-app-content",[s("v-touch",{attrs:{"swipe-options":{direction:"horizontal"}},on:{swiperight:function(t){return e.back()}}},[s("div",{ref:"list_placeholder",staticStyle:{height:"54px"}}),s("md-field",{class:e.title_verify?"":"md-invalid"},[s("label",[e._v(e._s(e.lang.subheader[0]))]),s("md-input",{attrs:{required:""},model:{value:e.title,callback:function(t){e.title=t},expression:"title"}}),s("span",{staticClass:"md-error"},[e._v(e._s(e.lang.empty_error[0]))])],1),s("md-field",{class:e.user_name_verify?"":"md-invalid"},[s("label",[e._v(e._s(e.lang.subheader[1]))]),s("md-input",{attrs:{required:""},model:{value:e.user_name,callback:function(t){e.user_name=t},expression:"user_name"}}),s("span",{staticClass:"md-error"},[e._v(e._s(e.lang.empty_error[1]))])],1),s("md-field",{class:e.password_verify?"":"md-invalid"},[s("label",[e._v(e._s(e.lang.subheader[2]))]),s("md-input",{attrs:{required:""},model:{value:e.password,callback:function(t){e.password=t},expression:"password"}}),s("span",{staticClass:"md-error"},[e._v(e._s(e.lang.empty_error[2]))]),s("span",{staticClass:"md-caption",staticStyle:{color:"#448AFF"},on:{click:function(t){e.show_dialog=!0}}},[e._v("生成密码")])],1),s("md-field",[s("label",[e._v(e._s(e.lang.subheader[3]))]),s("md-input",{model:{value:e.web_address,callback:function(t){e.web_address=t},expression:"web_address"}})],1),s("md-field",[s("label",[e._v(e._s(e.lang.subheader[4]))]),s("md-textarea",{model:{value:e.node,callback:function(t){e.node=t},expression:"node"}})],1),s("md-button",{staticClass:"md-raised md-primary expand",on:{click:function(t){return e.judgeContent()}}},[e._v(e._s(e.lang.enter))]),s("md-dialog",{staticStyle:{"min-width":"50%"},attrs:{"md-active":e.show_dialog},on:{"update:mdActive":function(t){e.show_dialog=t},"update:md-active":function(t){e.show_dialog=t}}},[s("md-dialog-title",[e._v("生成密码"+e._s(e.copy_state))]),s("md-list",[s("md-subheader",{staticClass:"md-primary"},[e._v(e._s(e.lang.generator.subheader[0]))]),s("md-list-item",[s("p",[e._v(e._s(e.password?e.password:e.lang.generator.code_res_empty))])]),s("md-subheader",{staticClass:"md-primary"},[e._v(e._s(e.lang.generator.subheader[1]))]),s("md-list-item",[s("md-field",[s("label",{attrs:{for:"expired_time"}},[e._v(e._s(e.lang.generator.length_setter.label))]),s("md-select",{attrs:{name:"code_length",id:"code_length"},model:{value:e.code_length,callback:function(t){e.code_length=t},expression:"code_length"}},[s("md-option",{attrs:{value:"6"}},[e._v(e._s(e.lang.generator.length_setter.options[0]))]),s("md-option",{attrs:{value:"12"}},[e._v(e._s(e.lang.generator.length_setter.options[1]))]),s("md-option",{attrs:{value:"18"}},[e._v(e._s(e.lang.generator.length_setter.options[2]))]),s("md-option",{attrs:{value:"24"}},[e._v(e._s(e.lang.generator.length_setter.options[3]))]),s("md-option",{attrs:{value:"32"}},[e._v(e._s(e.lang.generator.length_setter.options[4]))])],1)],1)],1),s("md-list-item",[s("span",{staticClass:"md-list-item-text"},[e._v(e._s(e.lang.generator.settings[0]))]),s("md-switch",{staticClass:"md-primary",model:{value:e.have_upper,callback:function(t){e.have_upper=t},expression:"have_upper"}})],1),s("md-list-item",[s("span",{staticClass:"md-list-item-text"},[e._v(e._s(e.lang.generator.settings[1]))]),s("md-switch",{staticClass:"md-primary",model:{value:e.have_lower,callback:function(t){e.have_lower=t},expression:"have_lower"}})],1),s("md-list-item",[s("span",{staticClass:"md-list-item-text"},[e._v(e._s(e.lang.generator.settings[2]))]),s("md-switch",{staticClass:"md-primary",model:{value:e.have_num,callback:function(t){e.have_num=t},expression:"have_num"}})],1),s("md-list-item",[s("span",{staticClass:"md-list-item-text"},[e._v(e._s(e.lang.generator.settings[3]))]),s("md-switch",{staticClass:"md-primary",model:{value:e.have_symbol,callback:function(t){e.have_symbol=t},expression:"have_symbol"}})],1)],1),s("md-dialog-actions",[s("md-button",{staticClass:"md-primary",on:{click:function(t){return e.generateStart()}}},[e._v(e._s(e.lang.generator.actions[0]))]),s("md-button",{directives:[{name:"clipboard",rawName:"v-clipboard:copy",value:e.password,expression:"password",arg:"copy"},{name:"clipboard",rawName:"v-clipboard:success",value:e.onCopyCode,expression:"onCopyCode",arg:"success"},{name:"clipboard",rawName:"v-clipboard:error",value:e.onErrorCode,expression:"onErrorCode",arg:"error"}],staticClass:"md-primary"},[e._v(e._s(e.lang.generator.actions[1]))]),s("md-button",{staticClass:"md-primary",on:{click:function(t){e.show_dialog=!1}}},[e._v(e._s(e.lang.generator.actions[2]))])],1)],1)],1)],1)],1)],1)},i=[],o=(s("9b42"),s("cf6b")),r=s("c71e"),n=s("36f0"),l=s("e6a3"),d=s("c0b7"),c=s("bfd3"),m={name:"Add",data(){return{clientHeight:"",title:"",user_name:"",password:"",node:"",web_address:"",id_cache:"",open_count_cache:"",title_verify:!0,user_name_verify:!0,password_verify:!0,lang:"",show_dialog:!1,have_upper:!0,have_lower:!0,have_num:!0,have_symbol:!1,code_length:12,copy_state:""}},computed:{...Object(o["c"])(["row_data","row_pwd","settings","user_infos"])},methods:{...Object(o["b"])(["setRowData","setRowPwd","setSettings","setUserInfo"]),changeFixed(e){this.$refs.list_placeholder.parentNode.parentNode.style.maxHeight=e+"px",this.$refs.list_placeholder.parentNode.style.minHeight=e-32+"px",window.document.documentElement.setAttribute("data-theme",this.settings.is_dark_mode?"dark":"light")},init(){if(c["a"].call(this),0!=Object.keys(this.row_pwd).length){let e=(new Date).getTime();if(e-this.row_pwd.create_time<this.settings.expired_time){if(this.initLanguage(),this.$route.params.modify_content){let e=this.$route.params.modify_content;this.title=e.title,this.user_name=e.user_name,this.password=e.password,this.node=e.node,this.web_address=e.web_address,this.id_cache=e.id,this.open_count_cache=e.open_count}return}this.turnToHome("密码超时")}else this.turnToHome("无密码")},initLanguage(){this.settings.is_chinese?this.lang=Object(n["a"])().add.CHS:this.lang=Object(n["a"])().add.EN,console.log("语言配置完成")},judgeContent(){let e=!0;(this.title=this.title.trim())||(e=!1,this.title_verify=!1),(this.user_name=this.user_name.trim())||(e=!1,this.user_name_verify=!1),(this.password=this.password.trim())||(e=!1,this.password_verify=!1),e&&this.submit()},submit(){if(this.id_cache)return console.log("覆写拦截器生效"),void this.reWrite();let e,t={id:this.createId(),open_count:0,title:this.title,user_name:this.user_name,password:this.password,node:this.node,web_address:this.web_address},s=Object(r["b"])(this.row_pwd.main_code);if(this.row_data){let a=Object(r["a"])(s,this.row_data);e=JSON.parse(a),e.push(t)}else e=[t];let a=Object(r["c"])(s,e);this.setRowData([a,this]),console.log("新加密信息保存成功,返回Home"),this.back()},reWrite(){let e,t={id:this.id_cache,open_count:this.open_count_cache,title:this.title,user_name:this.user_name,password:this.password,node:this.node,web_address:this.web_address},s=Object(r["b"])(this.row_pwd.main_code),a=Object(r["a"])(s,this.row_data);e=JSON.parse(a);for(let o in e)e[o].id==t.id&&(e[o]=t);let i=Object(r["c"])(s,e);this.setRowData([i,this]),console.log("新加密信息覆写成功,返回详情"),this.back()},back(){this.$router.go(-1)},turnToHome(e){console.log(e),this.$router.replace("/")},createId(){let e=(new Date).getTime(),t=Math.floor(100*Math.random());t=t<10?"0"+t.toString():t.toString();let s=e.toString()+t;return s},generateStart(){this.password=Object(d["a"])(this.code_length,this.have_lower,this.have_upper,this.have_num,this.have_symbol)},onCopyCode(){this.copy_state=this.lang.generator.copy_successful,setTimeout(()=>{this.copy_state=""},2e3)},onErrorCode(){this.copy_state=this.lang.generator.copy_failed,setTimeout(()=>{this.copy_state=""},2e3)}},created(){this.lang=Object(n["a"])().add.CHS,console.log("临时语言系统加载完成"),this.init()},mounted(){this.clientHeight=""+document.documentElement.clientHeight,window.onresize=function(){this.clientHeight=""+document.documentElement.clientHeight,Object(l["a"])()}.bind(this)},watch:{clientHeight:function(){this.changeFixed(this.clientHeight)}},beforeDestroy(){},components:{}},h=m,_=(s("fc60"),s("5d22")),u=Object(_["a"])(h,a,i,!1,null,"5317d644",null);t["default"]=u.exports},fc60:function(e,t,s){"use strict";s("9c60")}}]); |