UNPKG

@wjya/ngx-webapp-icpc.group.pms

Version:

angular webapp : icpc.group.pms

82 lines 6.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = require("@angular/core"); var forms_1 = require("@angular/forms"); var data_source_helper_1 = require("../../service/data-source.helper"); var pay_setting_help_modal_1 = require("./pay-setting-help.modal"); var router_1 = require("@angular/router"); var PaySettingComponent = /** @class */ (function () { function PaySettingComponent(fb, dataSourceHelper, router) { this.fb = fb; this.dataSourceHelper = dataSourceHelper; this.router = router; this.next = new core_1.EventEmitter(); this.confirmApiKey = function (control) { if (control.value) { if (control.value.length !== 32) { return { length: true, error: true }; } } }; this.dataSource = this.dataSourceHelper.configWxpayMch; this.validateForm = this.fb.group({ mchId: [''], apiKey: ['', this.confirmApiKey], }); } PaySettingComponent.prototype.getFormControl = function (name) { return this.validateForm.controls[name]; }; PaySettingComponent.prototype.ngOnInit = function () { }; PaySettingComponent.prototype.genrate = function () { this.validateForm.patchValue({ apiKey: this.randomPassword(32) }); }; PaySettingComponent.prototype.nextStep = function (entity) { var _this = this; this.dataSource.create(null, { mchId: entity.mchId, apiKey: entity.apiKey }).subscribe(function (success) { _this.next.emit(); }); }; PaySettingComponent.prototype.randomPassword = function (size) { var seed = new Array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'm', 'n', 'p', 'Q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '2', '3', '4', '5', '6', '7', '8', '9'); var seedlength = seed.length; var createPassword = ''; for (var i = 0; i < size; i++) { var j = Math.floor(Math.random() * seedlength); createPassword += seed[j]; } return createPassword; }; PaySettingComponent.prototype.readHelp = function () { this.paySettingHelp.modalIsVisible = true; }; PaySettingComponent.prototype.back = function () { this.router.navigate(['/login']); }; PaySettingComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'zx-pay-setting', template: "<form nz-form [formGroup]=\"validateForm\"><div nz-form-item nz-row><div nz-form-label nz-col><label>\u5FAE\u4FE1\u5546\u6237\u53F7</label></div><div nz-col nz-form-control nzHasFeedback><nz-input formControlName=\"mchId\" [nzPlaceHolder]=\"'\u8BF7\u586B\u5199\u5FAE\u4FE1\u5546\u6237\u53F7'\" [nzSize]=\"'large'\"></nz-input><span class=\"tip\"><span>\u5546\u6237\u53F7\u53EF\u4EE5\u70B9\u51FB\u516C\u4F17\u53F7>\u5FAE\u4FE1\u652F\u4ED8\u83DC\u5355\u529F\u80FD\u680F\u67E5\u770B\u3002</span> <a (click)=\"readHelp()\">\u67E5\u770B\u5E2E\u52A9</a></span></div></div><div nz-form-item nz-row><div nz-form-label nz-col><label>\u5FAE\u4FE1\u5546\u6237API\u5BC6\u94A5</label></div><div nz-col nz-form-control><div style=\"width: calc(100% - 92px); display: inline-block; margin-right: 4px;\" nz-form-control nzHasFeedback><nz-input formControlName=\"apiKey\" [nzPlaceHolder]=\"'\u8BF7\u586B\u5199\u5FAE\u4FE1\u5546\u6237API\u5BC6\u94A5'\" [nzSize]=\"'large'\"></nz-input></div><button nz-button [nzType]=\"'default'\" [nzSize]=\"'large'\" style=\"vertical-align: bottom\" (click)=\"genrate()\"><span>\u751F\u6210\u5BC6\u94A5</span></button><div nz-form-explain *ngIf=\"getFormControl('apiKey').dirty&&getFormControl('apiKey').hasError('length')\">\u5FAE\u4FE1\u5546\u6237API\u5BC6\u94A5\u5E94\u4E3A32\u4F4D\u5B57\u7B26</div><div class=\"tip\"><span>\u8BF7\u5C06\u5FAE\u4FE1\u5546\u6237API\u5BC6\u94A5\u6309\u5FAE\u4FE1\u8981\u6C42\u914D\u7F6E\u4E0E\u5FAE\u4FE1\u5546\u6237\u4E2D\u3002</span> <a href=\"/docs/ddd.html\" target=\"_blank\">\u64CD\u4F5C\u6307\u5357</a></div><div class=\"tip\" style=\"width: 610px;\">\u5982\u60A8\u7684\u5FAE\u4FE1\u5546\u6237\u8D26\u6237\u5DF2\u7ECF\u8BBE\u7F6E\u8FC7\u5FAE\u4FE1\u5546\u6237API\u5BC6\u94A5\uFF0C\u5219\u5728\u4EE5\u4E0A\u8F93\u5165\u6846\u586B\u5199\u5DF2\u6709\u7684\u5FAE\u4FE1\u5546\u6237API\u5BC6\u94A5\u3002</div></div></div><div class=\"br\"></div><div nz-form-item nz-row><button nz-button class=\"login-form-button\" [nzType]=\"'primary'\" (click)=\"nextStep(validateForm.value)\" [disabled]=\"!validateForm.valid\">\u4E0B\u4E00\u6B65</button> <button nz-button class=\"login-form-button\" [nzType]=\"'default'\" (click)=\"back()\">\u8FD4 \u56DE</button></div></form><zx-pay-setting-help #paySettingHelp></zx-pay-setting-help>", styles: [ "\n :host .br {\n height: 1px;\n width: 100%;\n margin: 30px 0;\n border-top: 1px dashed #ddd;\n }\n :host ::ng-deep .ant-form-item-label{\n width:130px;\n float:left;\n }\n :host ::ng-deep .ant-form-item-control-wrapper{\n width:500px;\n float:left;\n }\n :host .title{\n font-size: 16px;\n font-weight: bold;\n margin-bottom: 12px;\n }\n :host .tip{\n color:#c0c0c0;\n }\n :host .tip > a{\n float:right;\n }\n " ] },] }, ]; /** @nocollapse */ PaySettingComponent.ctorParameters = function () { return [ { type: forms_1.FormBuilder, }, { type: data_source_helper_1.DataSourceHelper, }, { type: router_1.Router, }, ]; }; PaySettingComponent.propDecorators = { "paySettingHelp": [{ type: core_1.ViewChild, args: ['paySettingHelp',] },], "next": [{ type: core_1.Output },], }; return PaySettingComponent; }()); exports.PaySettingComponent = PaySettingComponent; //# sourceMappingURL=pay-setting.component.js.map