@wjya/ngx-webapp-icpc.group.pms
Version:
angular webapp : icpc.group.pms
114 lines • 9.21 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var data_source_helper_1 = require("../../../../../service/data-source.helper");
var core_1 = require("@angular/core");
var ngx_webapp_fx_1 = require("@wjya/ngx-webapp-fx");
var router_1 = require("@angular/router");
var MyMiniProgramManageComponent = /** @class */ (function () {
function MyMiniProgramManageComponent(appSettingService, config, authServerProvider, dataSourceHelper, activateRoute, router) {
var _this = this;
this.appSettingService = appSettingService;
this.config = config;
this.authServerProvider = authServerProvider;
this.dataSourceHelper = dataSourceHelper;
this.activateRoute = activateRoute;
this.router = router;
this.previewImage = '';
this.previewVisible = false;
this.fileList = [];
this.data = { headImageInfo: {}, signatureInfo: {} };
this.nameRepeat = false;
this.handlePreview = function (file) {
_this.previewImage = file.url || file.thumbUrl;
_this.previewVisible = true;
};
this.dataSource = this.dataSourceHelper.modifyTinyApp;
this.checkNameDataSource = this.dataSourceHelper.checkName;
this.modifyTinyAppDialogDataSource = this.dataSourceHelper.modifyTinyAppDialog;
this.photoBaseUrl = this.appSettingService.photoBaseUrl;
}
MyMiniProgramManageComponent.prototype.ngOnInit = function () {
this.id = this.activateRoute.snapshot.queryParams['id'];
this.officalId = this.activateRoute.snapshot.queryParams['officalId'];
this.loadAll();
};
MyMiniProgramManageComponent.prototype.loadAll = function () {
var _this = this;
this.dataSource.findOne(this.id).subscribe(function (res) {
_this.data = res.body;
if (_this.data.logo) {
_this.fileList[0] = {
uid: -1,
name: 'xxx.png',
status: 'done',
url: _this.data.logo,
};
}
});
};
MyMiniProgramManageComponent.prototype.onSave = function () {
var _this = this;
if (this.fileList[0].response) {
this.data.logo = this.fileList[0].response.info.md5;
}
this.modifyTinyAppDialogDataSource.create(this.data).subscribe(function (success) {
_this.router.navigate(['../wechat-public-account/my-mini-program/' + _this.officalId], { relativeTo: _this.activateRoute });
});
};
Object.defineProperty(MyMiniProgramManageComponent.prototype, "uploadUrl", {
get: function () {
return this.config.apiUrls.uploadPic;
},
enumerable: true,
configurable: true
});
MyMiniProgramManageComponent.prototype.getAuthToken = function () {
return this.authServerProvider.getToken();
};
Object.defineProperty(MyMiniProgramManageComponent.prototype, "isDisabled", {
get: function () {
if (!this.data.name || !this.data.signature || this.fileList.length === 0 || this.nameRepeat === true) {
return true;
}
return false;
},
enumerable: true,
configurable: true
});
MyMiniProgramManageComponent.prototype.nameCheck = function () {
var _this = this;
this.checkNameDataSource.createOne(this.id, null, {
name: this.data.name
}).subscribe(function (res) {
if (res.body.success) {
_this.nameRepeat = true;
_this.message = res.body.message;
}
else {
_this.nameRepeat = true;
_this.message = res.body.message;
}
});
};
MyMiniProgramManageComponent.decorators = [
{ type: core_1.Component, args: [{
selector: 'zx-my-mini-program-manage',
template: "<zx-header-block [title]=\"'\u7BA1\u7406\u5C0F\u7A0B\u5E8F'\" [showBottomLine]=\"false\" [showBreadcrumb]=\"true\" [breadcrumbAppendings]=\"['\u7BA1\u7406\u5C0F\u7A0B\u5E8F']\"><p>\u7BA1\u7406\u6211\u7684\u5C0F\u7A0B\u5E8F\u4FE1\u606F</p></zx-header-block><zx-content-block><ng-template #content><div nz-row class=\"row\"><div nz-col><div>\u5C0F\u7A0B\u5E8F\u540D\u79F0\uFF1A</div><div><div><nz-input [(ngModel)]=\"data.name\" [nzSize]=\"'large'\" [nzPlaceHolder]=\"'\u8BF7\u8F93\u5165\u5C0F\u7A0B\u5E8F\u540D\u79F0'\" style=\"width: calc(100% - 64px);vertical-align: top;\"></nz-input><button nz-button [nzType]=\"'default'\" (click)=\"nameCheck()\" [disabled]=\"!data.name\"><span>\u68C0\u6D4B</span></button></div><p style=\"color: red\" *ngIf=\"nameRepeat\">{{message}}</p><p style=\"color: #999\">\u5E10\u53F7\u540D\u79F0\u957F\u5EA6\u4E3A4-30\u4E2A\u5B57\u7B26\uFF0C\u4E00\u4E2A\u4E2D\u6587\u5B57\u7B49\u4E8E2\u4E2A\u5B57\u7B26\u3002\u63D0\u4EA4\u540D\u79F0\u524D\u8BF7\u68C0\u6D4B\u540D\u79F0\u662F\u5426\u53EF\u7528\u3002\u70B9\u51FB\u4E86\u89E3\u66F4\u591A <a href=\"http://kf.qq.com/faq/170109umMvm6170109MZNnYV.html\" target=\"_blank\">\u540D\u79F0\u89C4\u5219</a></p><p style=\"color: #999\">\u5C0F\u7A0B\u5E8F\u53D1\u5E03\u524D\uFF0C\u53EF\u4FEE\u65393\u6B21\u540D\u79F0</p></div></div></div><div nz-row class=\"row\"><div nz-col><div>\u5C0F\u7A0B\u5E8F\u5934\u50CF\uFF1A</div><div><p style=\"margin-top: 5px;\">\u65B0\u5934\u50CF\u4E0D\u5141\u8BB8\u6D89\u53CA\u653F\u6CBB\u654F\u611F\u4E0E\u8272\u60C5\uFF1B</p><p>\u56FE\u7247\u683C\u5F0F\u5FC5\u987B\u4E3A\uFF1Apng,bmp,jpeg,jpg,gif\uFF1B\u4E0D\u53EF\u5927\u4E8E2M\uFF1B</p><p>\u5EFA\u8BAE\u4F7F\u7528png\u683C\u5F0F\u56FE\u7247\uFF0C\u4EE5\u4FDD\u6301\u6700\u4F73\u6548\u679C\uFF1B\u5EFA\u8BAE\u56FE\u7247\u5C3A\u5BF8\u4E3A144px*144px</p><p>\u4E00\u4E2A\u6708\u5185\u53EF\u7533\u8BF7\u4FEE\u6539{{data.headImageInfo.modify_quota}}\u6B21\uFF0C\u672C\u6708\u8FD8\u53EF\u4FEE\u6539{{data.headImageInfo.modify_quota - data.headImageInfo.modify_used_count}}\u6B21</p><p><nz-upload [nzAction]=\"uploadUrl\" [nzHeaders]=\"{ 'Authorization':'Bearer '+getAuthToken() }\" nzListType=\"picture-card\" [(nzFileList)]=\"fileList\" [nzShowButton]=\"fileList.length < 1\" [nzPreview]=\"handlePreview\"><i class=\"anticon anticon-plus\"></i><div class=\"ant-upload-text\">\u4E0A\u4F20\u56FE\u7247</div></nz-upload><nz-modal [nzVisible]=\"previewVisible\" [nzContent]=\"modalContent\" [nzFooter]=\"null\" (nzOnCancel)=\"previewVisible=false\"><ng-template #modalContent><img [src]=\"previewImage\" [ngStyle]=\"{ 'width': '100%' }\"/></ng-template></nz-modal></p></div></div></div><div nz-row class=\"row\"><div nz-col><div>\u5C0F\u7A0B\u5E8F\u4ECB\u7ECD\uFF1A</div><div style=\"width: 705px\"><nz-input [(ngModel)]=\"data.signature\" [nzType]=\"'textarea'\" [nzRows]=\"'6'\" [nzPlaceHolder]=\"'\u8BF7\u8F93\u5165\u5C0F\u7A0B\u5E8F\u4ECB\u7ECD'\" style=\"width: 100%\"></nz-input><p style=\"color: #999\">\u8BF7\u786E\u8BA4\u4ECB\u7ECD\u5185\u5BB9\u4E0D\u542B\u56FD\u5BB6\u76F8\u5173\u6CD5\u5F8B\u6CD5\u89C4\u7981\u6B62\u5185\u5BB9\uFF0C\u4ECB\u7ECD\u5B57\u6570\u4E3A4~120\u4E2A\u5B57</p><p style=\"color: #999\">\u4E00\u4E2A\u6708\u5185\u53EF\u7533\u8BF7{{data.signatureInfo.modify_quota}}\u6B21\u4FEE\u6539\uFF0C\u672C\u6708\u8FD8\u53EF\u4FEE\u6539{{data.signatureInfo.modify_quota - data.signatureInfo.modify_used_count}}\u6B21</p></div></div></div><div nz-row class=\"row\"><div nz-col style=\"padding-left: 92px\"><button nz-button [nzType]=\"'primary'\" (click)=\"onSave()\" [disabled]=\"isDisabled\"><span>\u4FDD\u5B58\u4FEE\u6539</span></button></div></div></ng-template></zx-content-block>",
styles: [
"\n :host .row > div > div:nth-child(1){\n width: 90px;\n display: inline-block;\n vertical-align: top;\n text-align: right;\n line-height: 32px;\n }\n :host .row > div > div:nth-child(1)::before{\n content: '*';\n color:red;\n }\n :host .row > div > div:nth-child(2){\n display: inline-block;\n }\n :host .row > div > div:nth-child(2) > p{\n margin:8px 0;\n }\n :host ::ng-deep .anticon-plus {\n font-size: 32px;\n color: #999;\n }\n :host ::ng-deep .ant-upload-text {\n margin-top: 8px;\n color: #666;\n }\n "
]
},] },
];
/** @nocollapse */
MyMiniProgramManageComponent.ctorParameters = function () { return [
{ type: ngx_webapp_fx_1.AppSettingService, },
{ type: ngx_webapp_fx_1.CoreConfigService, },
{ type: ngx_webapp_fx_1.AuthServerProvider, },
{ type: data_source_helper_1.DataSourceHelper, },
{ type: router_1.ActivatedRoute, },
{ type: router_1.Router, },
]; };
return MyMiniProgramManageComponent;
}());
exports.MyMiniProgramManageComponent = MyMiniProgramManageComponent;
//# sourceMappingURL=my-mini-program-manage.component.js.map