mirror of
https://github.com/zuiidea/antd-admin
synced 2026-11-17 21:25:06 +00:00
😪 js-standard
This commit is contained in:
+5
-5
@@ -1,8 +1,8 @@
|
||||
module.exports = {
|
||||
name: 'Ant Design Admin',
|
||||
prefix:'antdAdmin',
|
||||
prefix: 'antdAdmin',
|
||||
footerText: 'Ant Design Admin 版权所有 © 2016 由 zuiidea 支持',
|
||||
logoSrc:'https://t.alipayobjects.com/images/rmsweb/T1B9hfXcdvXXXXXXXX.svg',
|
||||
logoText:'Antd Admin',
|
||||
needLogin:true,
|
||||
};
|
||||
logoSrc: 'https://t.alipayobjects.com/images/rmsweb/T1B9hfXcdvXXXXXXXX.svg',
|
||||
logoText: 'Antd Admin',
|
||||
needLogin: true
|
||||
}
|
||||
|
||||
+15
-14
@@ -15,28 +15,29 @@ String.prototype.hyphenToHump = function () {
|
||||
|
||||
// 驼峰转连字符
|
||||
String.prototype.humpToHyphen = function () {
|
||||
return this.replace(/([A-Z])/g, "-$1").toLowerCase()
|
||||
return this.replace(/([A-Z])/g, '-$1').toLowerCase()
|
||||
}
|
||||
|
||||
// 日期格式化
|
||||
Date.prototype.format = function (format) {
|
||||
var o = {
|
||||
"M+": this.getMonth() + 1,
|
||||
"d+": this.getDate(),
|
||||
"h+": this.getHours(),
|
||||
'M+': this.getMonth() + 1,
|
||||
'd+': this.getDate(),
|
||||
'h+': this.getHours(),
|
||||
'H+': this.getHours(),
|
||||
"m+": this.getMinutes(),
|
||||
"s+": this.getSeconds(),
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3),
|
||||
"S": this.getMilliseconds()
|
||||
'm+': this.getMinutes(),
|
||||
's+': this.getSeconds(),
|
||||
'q+': Math.floor((this.getMonth() + 3) / 3),
|
||||
'S': this.getMilliseconds()
|
||||
}
|
||||
if (/(y+)/.test(format))
|
||||
format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length))
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(format))
|
||||
format = format.replace(RegExp.$1, RegExp.$1.length == 1
|
||||
if (/(y+)/.test(format)) { format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length)) }
|
||||
for (var k in o) {
|
||||
if (new RegExp('(' + k + ')').test(format)) {
|
||||
format = format.replace(RegExp.$1, RegExp.$1.length === 1
|
||||
? o[k]
|
||||
: ("00" + o[k]).substr(("" + o[k]).length))
|
||||
: ('00' + o[k]).substr(('' + o[k]).length))
|
||||
}
|
||||
}
|
||||
return format
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -7,18 +7,18 @@ module.exports = [
|
||||
{
|
||||
key: 'users',
|
||||
name: '用户管理',
|
||||
icon: 'user',
|
||||
icon: 'user'
|
||||
},
|
||||
{
|
||||
key: 'ui',
|
||||
name: 'UI组件',
|
||||
icon: 'camera-o',
|
||||
clickable:false,
|
||||
child:[
|
||||
clickable: false,
|
||||
child: [
|
||||
{
|
||||
key: 'ico',
|
||||
name: '业务图标',
|
||||
},
|
||||
name: '业务图标'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -28,7 +28,7 @@ module.exports = [
|
||||
child: [
|
||||
{
|
||||
key: 'navigation1',
|
||||
name: '二级导航1',
|
||||
name: '二级导航1'
|
||||
},
|
||||
{
|
||||
key: 'navigation2',
|
||||
@@ -36,14 +36,14 @@ module.exports = [
|
||||
child: [
|
||||
{
|
||||
key: 'navigation21',
|
||||
name: '三级导航1',
|
||||
name: '三级导航1'
|
||||
},
|
||||
{
|
||||
key: 'navigation22',
|
||||
name: '三级导航2',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
name: '三级导航2'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
+9
-9
@@ -1,22 +1,22 @@
|
||||
const Mock = require('mockjs')
|
||||
const mockData = [require("../../mock/users"), require("../../mock/app"), require("../../mock/dashboard")]
|
||||
const mockData = [require('../../mock/users'), require('../../mock/app'), require('../../mock/dashboard')]
|
||||
|
||||
function serialize(str) {
|
||||
let paramArray = str.split("&")
|
||||
function serialize (str) {
|
||||
let paramArray = str.split('&')
|
||||
let query = {}
|
||||
for (let i in paramArray) {
|
||||
query[paramArray[i].split("=")[0]] = paramArray[i].split("=")[1]
|
||||
query[paramArray[i].split('=')[0]] = paramArray[i].split('=')[1]
|
||||
}
|
||||
return query
|
||||
}
|
||||
|
||||
for (let i in mockData) {
|
||||
for (let key in mockData[i]) {
|
||||
Mock.mock(eval("/" + key.split(" ")[1].replace(/\//g, "\\\/") + "/"), key.split(" ")[0].toLowerCase(), function (options) {
|
||||
if (key.split(" ")[0].toLowerCase() == 'get') {
|
||||
options.query = !!options.url.split("?")[1]
|
||||
? serialize(options.url.split("?")[1])
|
||||
: (!!options.body
|
||||
Mock.mock(eval('/' + key.split(' ')[1].replace(/\//g, '\\\/') + '/'), key.split(' ')[0].toLowerCase(), function (options) {
|
||||
if (key.split(' ')[0].toLowerCase() == 'get') {
|
||||
options.query = options.url.split('?')[1]
|
||||
? serialize(options.url.split('?')[1])
|
||||
: (options.body
|
||||
? serialize(options.body)
|
||||
: {})
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
const Mock = require('mockjs')
|
||||
const Watch = require("watchjs")
|
||||
const Watch = require('watchjs')
|
||||
import config from './config'
|
||||
|
||||
export default function mockStorge(name, defaultValue) {
|
||||
export default function mockStorge (name, defaultValue) {
|
||||
let key = config.prefix + name
|
||||
global[key] = localStorage.getItem(key)
|
||||
? JSON.parse(localStorage.getItem(key))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const Ajax = require("robe-ajax")
|
||||
const Ajax = require('robe-ajax')
|
||||
|
||||
/**
|
||||
* Requests a URL, returning a promise.
|
||||
@@ -7,20 +7,18 @@ const Ajax = require("robe-ajax")
|
||||
* @param {object} [options] The options we want to pass to "fetch"
|
||||
* @return {object} An object containing either "data" or "err"
|
||||
*/
|
||||
export default function request(url, options) {
|
||||
export default function request (url, options) {
|
||||
if (options.cross) {
|
||||
return Ajax.getJSON("http://query.yahooapis.com/v1/public/yql", {
|
||||
q: "select * from json where url=\'"+url+"?"+Ajax.param(options.data)+"\'",
|
||||
format: "json"
|
||||
return Ajax.getJSON('http://query.yahooapis.com/v1/public/yql', {
|
||||
q: "select * from json where url='" + url + '?' + Ajax.param(options.data) + "'",
|
||||
format: 'json'
|
||||
})
|
||||
} else {
|
||||
return Ajax.ajax({
|
||||
url: url,
|
||||
method: options.method || 'get',
|
||||
data: options.data || {},
|
||||
processData: options.method == 'get'
|
||||
? true
|
||||
: false,
|
||||
processData: options.method === 'get',
|
||||
dataType: 'JSON'
|
||||
}).done((data) => {
|
||||
return data
|
||||
|
||||
+12
-12
@@ -1,14 +1,14 @@
|
||||
module.exports = {
|
||||
color:{
|
||||
green:'#64ea91',
|
||||
blue:'#8fc9fb',
|
||||
purple:'#d897eb',
|
||||
red:'#f69899',
|
||||
yellow:'#f8c82e',
|
||||
peach:'#f797d6',
|
||||
borderBase:'#e5e5e5',
|
||||
borderSplit:'#f4f4f4',
|
||||
grass:"#d6fbb5",
|
||||
sky:'#c1e0fc'
|
||||
color: {
|
||||
green: '#64ea91',
|
||||
blue: '#8fc9fb',
|
||||
purple: '#d897eb',
|
||||
red: '#f69899',
|
||||
yellow: '#f8c82e',
|
||||
peach: '#f797d6',
|
||||
borderBase: '#e5e5e5',
|
||||
borderSplit: '#f4f4f4',
|
||||
grass: '#d6fbb5',
|
||||
sky: '#c1e0fc'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user