12345678910111213141516171819202122232425262728 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var const_1 = require("./const");
- var config_1 = require("./config");
- exports.default = {
- isLogin: function () {
- return !!this.user.token;
- },
- eqMobile: function (mobile) {
- return this.user.mobile === mobile;
- },
- getRole: function (key) {
- var value = this.user[config_1.default.jurisdictionKey] || const_1.default.identity.NO_LOGIN;
- switch (key) {
- default: return !!(this.jurisdiction[key] && this.jurisdiction[key][value]);
- }
- },
- setRole: function () {
- this.user.role = this.user.role || {};
- this.user.isLogin = this.isLogin();
- for (var key in this.const.jurisdiction) {
- if (this.const.jurisdiction.hasOwnProperty(key)) {
- this.user.role[key] = this.getRole(this.const.jurisdiction[key]);
- }
- }
- }
- };
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGFuZGxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaGFuZGxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsaUNBQTJCO0FBQzNCLG1DQUE4QjtBQUU5QixrQkFBOEI7SUFHN0IsT0FBTyxFQUFDO1FBQ1AsT0FBTyxDQUFDLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUM7SUFDMUIsQ0FBQztJQUdELFFBQVEsRUFBQyxVQUFVLE1BQWE7UUFDL0IsT0FBTyxJQUFJLENBQUMsSUFBSSxDQUFDLE1BQU0sS0FBSyxNQUFNLENBQUM7SUFDcEMsQ0FBQztJQUdELE9BQU8sRUFBQyxVQUFVLEdBQUc7UUFFcEIsSUFBSSxLQUFLLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQyxnQkFBTSxDQUFDLGVBQWUsQ0FBQyxJQUFJLGVBQUksQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDO1FBRXhFLFFBQVEsR0FBRyxFQUFFO1lBQ1osT0FBTyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0F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