2022-12-12 20:56:25 +08:00

1 line
3.0 KiB
JavaScript
Vendored

"use strict";(self.webpackChunkDooTask=self.webpackChunkDooTask||[]).push([[334],{62637:(t,a,e)=>{e.d(a,{Z:()=>n});var s=e(1519),o=e.n(s)()((function(t){return t[1]}));o.push([t.id,".input-box[data-v-176a1e1a]{align-items:center;display:flex}.input-box .input-box-push[data-v-176a1e1a]{opacity:.5;padding:0 12px 0 8px}.input-box .input-box-key[data-v-176a1e1a]{width:80px}",""]);const n=o},53334:(t,a,e)=>{e.r(a),e.d(a,{default:()=>c});const s={data:function(){return{loadIng:0,mateName:/macintosh|mac os x/i.test(navigator.userAgent)?"Command":"Ctrl",formData:{screenshot_mate:!0,screenshot_shift:!0,screenshot_key:""},ruleData:{}}},mounted:function(){this.initData()},computed:{screenshotDisabled:function(){return!this.formData.screenshot_mate&&!this.formData.screenshot_shift}},methods:{initData:function(){this.formData=Object.assign({screenshot_mate:!0,screenshot_shift:!0,screenshot_key:""},$A.jsonParse(window.localStorage.getItem("__keyboard:data__")||{})),this.formData_bak=$A.cloneJSON(this.formData)},onKeydown:function(t){var a=t.key;8!==t.keyCode&&(a=/^[A-Za-z0-9]?$/.test(a)?a:"")&&(this.formData.screenshot_key=a)},submitForm:function(){var t=this;this.$refs.formData.validate((function(a){a&&(window.localStorage.setItem("__keyboard:data__",$A.jsonStringify(t.formData)),$A.bindScreenshotKey(t.formData),$A.messageSuccess("保存成功"))}))},resetForm:function(){this.formData=$A.cloneJSON(this.formData_bak)}}};var o=e(93379),n=e.n(o),i=e(62637),r={insert:"head",singleton:!1};n()(i.Z,r);i.Z.locals;const c=(0,e(51900).Z)(s,(function(){var t=this,a=t._self._c;return a("div",{staticClass:"setting-item submit"},[a("Form",{ref:"formData",attrs:{model:t.formData,rules:t.ruleData,"label-width":"auto"},nativeOn:{submit:function(t){t.preventDefault()}}},[a("FormItem",{attrs:{label:t.$L("截图快捷键"),prop:"screenshot"}},[a("div",{staticClass:"input-box"},[a("Checkbox",{model:{value:t.formData.screenshot_mate,callback:function(a){t.$set(t.formData,"screenshot_mate",a)},expression:"formData.screenshot_mate"}},[t._v(t._s(t.mateName))]),t._v(" "),a("div",{staticClass:"input-box-push"},[t._v("+")]),t._v(" "),a("Checkbox",{model:{value:t.formData.screenshot_shift,callback:function(a){t.$set(t.formData,"screenshot_shift",a)},expression:"formData.screenshot_shift"}},[t._v("Shift")]),t._v(" "),a("div",{staticClass:"input-box-push"},[t._v("+")]),t._v(" "),a("Input",{staticClass:"input-box-key",attrs:{disabled:t.screenshotDisabled,value:t.formData.screenshot_key,maxlength:1},on:{"on-keydown":t.onKeydown}})],1),t._v(" "),t.screenshotDisabled?a("div",{staticClass:"form-tip red"},[t._v(t._s(t.$L("至少选择一个功能键!")))]):t._e()])],1),t._v(" "),a("div",{staticClass:"setting-footer"},[a("Button",{attrs:{loading:t.loadIng>0,disabled:t.screenshotDisabled,type:"primary"},on:{click:t.submitForm}},[t._v(t._s(t.$L("保存")))]),t._v(" "),a("Button",{staticStyle:{"margin-left":"8px"},attrs:{loading:t.loadIng>0},on:{click:t.resetForm}},[t._v(t._s(t.$L("重置")))])],1)],1)}),[],!1,null,"176a1e1a",null).exports}}]);