Browse Source

支持自定义颜色和背景图片

master
qcc 5 years ago
parent
commit
cb57b0d06e
  1. 8
      src/main/java/com/fr/plugin/login/theme/fresh/FreshTheme.java
  2. 21
      src/main/resources/com/fr/plugin/login/theme/fresh/web/js/login.js
  3. 20
      src/main/resources/com/fr/plugin/login/theme/fresh/web/js/login.model.js
  4. BIN
      src/main/resources/com/fr/plugin/login/theme/fresh/web/login_style.png
  5. 44
      src/main/resources/com/fr/plugin/login/theme/fresh/web/theme.js

8
src/main/java/com/fr/plugin/login/theme/fresh/FreshTheme.java

@ -38,12 +38,12 @@ public class FreshTheme extends AbstractLoginPageProvider {
}
@Override
public int imgHeight() {
return 1080;
public int imgWidth() {
return 1920;
}
@Override
public int imgWidth() {
return 1920;
public int imgHeight() {
return 1080;
}
}

21
src/main/resources/com/fr/plugin/login/theme/fresh/web/js/login.js

@ -6,7 +6,7 @@
},
_store: function () {
return BI.Models.getModel("dec.model.login");
return BI.Models.getModel("dec.model.login.fresh");
},
watch: {
@ -14,6 +14,10 @@
render: function () {
var self = this, loginConfig = this.model.loginConfig;
// 调用自定义主题色,可以自行配置
BI.Services.getService("dec.service.login").initStyles();
return {
type: "bi.htape",
cls: "dec-login-fresh",
@ -68,9 +72,20 @@
}, top: 0, right: 89, bottom: 0, left: 89
}]
}]
}]
}],
ref: function (_ref) {
self.loginBg = _ref;
}
};
},
mounted: function () {
var loginConfig = this.model.loginConfig;
// 使用用户自定义登录背景
if (loginConfig.loginImg) {
this.loginBg.element.css("backgroundImage", "url(" + Dec.fineServletURL + "/login/image/" + loginConfig.loginImgId + ")");
}
}
});
BI.shortcut("dec.login.custom", Login);
BI.shortcut("dec.login.fresh", Login);
})();

20
src/main/resources/com/fr/plugin/login/theme/fresh/web/js/login.model.js

@ -0,0 +1,20 @@
!(function () {
var Model = BI.inherit(Fix.Model, {
_init: function () {
this.loginConfigInfo = Dec.loginConfig || {};
},
state: function () {
return {};
},
computed: {
loginConfig: function () {
return this.loginConfigInfo;
}
},
actions: {}
});
BI.model("dec.model.login.fresh", Model);
})();

BIN
src/main/resources/com/fr/plugin/login/theme/fresh/web/login_style.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 212 KiB

44
src/main/resources/com/fr/plugin/login/theme/fresh/web/theme.js

@ -6,7 +6,7 @@
},
_store: function () {
return BI.Models.getModel("dec.model.login");
return BI.Models.getModel("dec.model.login.fresh");
},
watch: {
@ -14,6 +14,10 @@
render: function () {
var self = this, loginConfig = this.model.loginConfig;
// 调用自定义主题色,可以自行配置
BI.Services.getService("dec.service.login").initStyles();
return {
type: "bi.htape",
cls: "dec-login-fresh",
@ -68,13 +72,45 @@
}, top: 0, right: 89, bottom: 0, left: 89
}]
}]
}]
}],
ref: function (_ref) {
self.loginBg = _ref;
}
};
},
mounted: function () {
var loginConfig = this.model.loginConfig;
// 使用用户自定义登录背景
if (loginConfig.loginImg) {
this.loginBg.element.css("backgroundImage", "url(" + Dec.fineServletURL + "/login/image/" + loginConfig.loginImgId + ")");
}
}
});
BI.shortcut("dec.login.custom", Login);
BI.shortcut("dec.login.fresh", Login);
})();
!(function () {
var Model = BI.inherit(Fix.Model, {
_init: function () {
this.loginConfigInfo = Dec.loginConfig || {};
},
state: function () {
return {};
},
computed: {
loginConfig: function () {
return this.loginConfigInfo;
}
},
actions: {}
});
BI.model("dec.model.login.fresh", Model);
})();
!(function () {
BI.config("dec.login", function (ob) {
return BI.extend(ob, {type: "dec.login.custom"});
return BI.extend(ob, {type: "dec.login.fresh"});
});
})();
Loading…
Cancel
Save