新增dataBrage用法;

This commit is contained in:
augushong
2022-01-07 10:44:21 +08:00
parent 7d0391145e
commit fc055fcaa6
5 changed files with 70 additions and 17 deletions

View File

@@ -12,6 +12,14 @@ define(["jquery", "easy-admin"], function ($, ea) {
password_url: 'system.admin/password',
};
var authList = ea.getDataBrage('auth_list',[]);
var count = ea.getDataBrage('count',0);
var tips = ea.getDataBrage('tips','');
console.log(authList);
console.log(count);
console.log(tips);
var Controller = {
index: function () {

View File

@@ -464,7 +464,7 @@ define(["jquery", "tableSelect", "ckeditor"], function ($, tableSelect, undefine
} else {
for (k in item) {
var v = item[k];
if(v.auth == undefined){
if (v.auth == undefined) {
v.auth = 'add'
}
if (admin.checkAuth(v.auth, elem)) {
@@ -1587,7 +1587,7 @@ define(["jquery", "tableSelect", "ckeditor"], function ($, tableSelect, undefine
if (typeof defaultValue == 'undefined') {
defaultValue = undefined;
}
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
@@ -1595,8 +1595,25 @@ define(["jquery", "tableSelect", "ckeditor"], function ($, tableSelect, undefine
if (pair[0] == variable) { return decodeURIComponent(pair[1]); }
}
return defaultValue;
},
dataBrage: null,
getDataBrage(name, defaultValue) {
if (this.dataBrage == null) {
this.dataBrage = JSON.parse($('#data-brage').text());
}
if (typeof defaultValue == 'undefined') {
defaultValue = undefined;
}
if (typeof this.dataBrage[name] == 'undefined') {
return defaultValue;
}
return this.dataBrage[name];
}
};
return admin;
});