canary_fe/dist/js/add.345ecf51.js
2020-12-28 20:41:41 +08:00

1 line
10 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["add"],{"03fa":function(e,t,s){var a=s("3193"),i=s("2d82"),r="["+i+"]",n=RegExp("^"+r+r+"*"),o=RegExp(r+r+"*$"),d=function(e){return function(t){var s=String(a(t));return 1&e&&(s=s.replace(n,"")),2&e&&(s=s.replace(o,"")),s}};e.exports={start:d(1),end:d(2),trim:d(3)}},"2d82":function(e,t){e.exports="\t\n\v\f\r    \u2028\u2029\ufeff"},"8c18":function(e,t,s){},"94ec":function(e,t,s){"use strict";var a=s("91fe"),i=s("03fa").trim,r=s("b680");a({target:"String",proto:!0,forced:r("trim")},{trim:function(){return i(this)}})},b680:function(e,t,s){var a=s("f30e"),i=s("2d82"),r="…";e.exports=function(e){return a((function(){return!!i[e]()||r[e]()!=r||i[e].name!==e}))}},c0b7:function(e,t,s){"use strict";s.d(t,"a",(function(){return d}));s("c1f4");var a={lower:i,upper:r,number:n,symbol:o};function i(){return String.fromCharCode(Math.floor(26*Math.random())+97)}function r(){return String.fromCharCode(Math.floor(26*Math.random())+65)}function n(){return String.fromCharCode(Math.floor(10*Math.random())+48)}function o(){var e='~!@#$%^&*()_+{}":?><;.,';return e[Math.floor(Math.random()*e.length)]}function d(e,t,s,i,r){var n="",o=t+s+i+r,d=[{lower:t},{upper:s},{number:i},{symbol:r}].filter(e=>Object.values(e)[0]);if(0===o)return"";for(var l=0;l<e;l++)d.forEach(e=>{var t=Object.keys(e)[0];n+=a[t]()});return n.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=[],r=(s("7267"),s("d780"),s("94ec"),s("b54b")),n=s("08c1"),o=s("c71e"),d=s("36f0"),l=s("e6a3"),c=s("c0b7"),m=s("bfd3"),h={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(r["a"])({},Object(n["c"])(["row_data","row_pwd","settings","user_infos"])),methods:Object(r["a"])({},Object(n["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(m["a"].call(this),0!=Object.keys(this.row_pwd).length){var e=(new Date).getTime();if(e-this.row_pwd.create_time<this.settings.expired_time){if(this.initLanguage(),this.$route.params.modify_content){var t=this.$route.params.modify_content;this.title=t.title,this.user_name=t.user_name,this.password=t.password,this.node=t.node,this.web_address=t.web_address,this.id_cache=t.id,this.open_count_cache=t.open_count}return}this.turnToHome("密码超时")}else this.turnToHome("无密码")},initLanguage(){this.settings.is_chinese?this.lang=Object(d["a"])().add.CHS:this.lang=Object(d["a"])().add.EN,console.log("语言配置完成")},judgeContent(){var 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();var 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(o["b"])(this.row_pwd.main_code);if(this.row_data){var a=Object(o["a"])(s,this.row_data);e=JSON.parse(a),e.push(t)}else e=[t];var i=Object(o["c"])(s,e);this.setRowData([i,this]),console.log("新加密信息保存成功,返回Home"),this.back()},reWrite(){var 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(o["b"])(this.row_pwd.main_code),a=Object(o["a"])(s,this.row_data);for(var i in e=JSON.parse(a),e)e[i].id==t.id&&(e[i]=t);var r=Object(o["c"])(s,e);this.setRowData([r,this]),console.log("新加密信息覆写成功,返回详情"),this.back()},back(){this.$router.go(-1)},turnToHome(e){console.log(e),this.$router.replace("/")},createId(){var e=(new Date).getTime(),t=Math.floor(100*Math.random());t=t<10?"0"+t.toString():t.toString();var s=e.toString()+t;return s},generateStart(){this.password=Object(c["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(d["a"])().add.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)}},beforeDestroy(){},components:{}},_=h,u=(s("e2ca"),s("623f")),p=Object(u["a"])(_,a,i,!1,null,"5b047d15",null);t["default"]=p.exports},e2ca:function(e,t,s){"use strict";var a=s("8c18"),i=s.n(a);i.a}}]);