|
@@ -0,0 +1,70 @@
|
|
|
|
|
+require.config({
|
|
|
|
|
+ urlArgs: 'v=' + requirejs.s.contexts._.config.config.site.version,
|
|
|
|
|
+ paths: {
|
|
|
|
|
+ 'lang': 'empty:',
|
|
|
|
|
+ 'form': 'require-form',
|
|
|
|
|
+ 'jquery': '../libs/jquery/dist/jquery.min',
|
|
|
|
|
+ 'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',
|
|
|
|
|
+ 'upload': 'require-upload',
|
|
|
|
|
+ 'validator': '../libs/nice-validator/dist/jquery.validator',
|
|
|
|
|
+ 'validator-lang': '../libs/nice-validator/dist/local/zh-CN',
|
|
|
|
|
+ 'toastr': '../libs/toastr/toastr',
|
|
|
|
|
+ 'layer': '../libs/fastadmin-layer/dist/layer'
|
|
|
|
|
+ },
|
|
|
|
|
+ shim: {
|
|
|
|
|
+ 'bootstrap': ['jquery'],
|
|
|
|
|
+ 'validator-lang': ['validator']
|
|
|
|
|
+ },
|
|
|
|
|
+ baseUrl: requirejs.s.contexts._.config.config.site.cdnurl + '/assets/js/',
|
|
|
|
|
+ waitSeconds: 60,
|
|
|
|
|
+ charset: 'utf-8'
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+require(['jquery', 'bootstrap'], function ($) {
|
|
|
|
|
+ var Config = requirejs.s.contexts._.config.config;
|
|
|
|
|
+ window.Config = Config;
|
|
|
|
|
+ require.config({
|
|
|
|
|
+ paths: {
|
|
|
|
|
+ 'lang': Config.moduleurl + '/ajax/lang?callback=define&controllername=index&lang=' + Config.language + '&v=' + Config.site.version
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ require(['fast', 'form', 'validator-lang'], function (Fast, Form) {
|
|
|
|
|
+ $(function () {
|
|
|
|
|
+ Fast.config.toastr.positionClass = 'toast-top-center';
|
|
|
|
|
+
|
|
|
|
|
+ var lastlogin = localStorage.getItem('lastlogin');
|
|
|
|
|
+ if (lastlogin) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ lastlogin = JSON.parse(lastlogin);
|
|
|
|
|
+ if (lastlogin && lastlogin.username) {
|
|
|
|
|
+ $('#pd-form-username').val(lastlogin.username);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $('#login-form').data('validator-options', {
|
|
|
|
|
+ invalid: function (form, errors) {
|
|
|
|
|
+ $.each(errors, function (i, j) {
|
|
|
|
|
+ Toastr.error(j);
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ target: '#errtips'
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ Form.api.bindevent($('#login-form'), function (data) {
|
|
|
|
|
+ localStorage.setItem('lastlogin', JSON.stringify({
|
|
|
|
|
+ id: data.id,
|
|
|
|
|
+ username: data.username,
|
|
|
|
|
+ avatar: data.avatar
|
|
|
|
|
+ }));
|
|
|
|
|
+ location.href = Fast.api.fixurl(data.url);
|
|
|
|
|
+ }, function () {
|
|
|
|
|
+ $('input[name=captcha]').next('.input-group-addon').find('img').trigger('click');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ $('#pd-form-username').trigger('focus');
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+});
|