mirror of
https://github.com/zuiidea/antd-admin
synced 2026-11-17 21:25:06 +00:00
update theme
This commit is contained in:
@@ -3,7 +3,6 @@ import menu from './menu'
|
||||
import request from './request'
|
||||
import classnames from 'classnames'
|
||||
import { color } from './theme'
|
||||
// require('./mock.js')
|
||||
|
||||
// 连字符转驼峰
|
||||
String.prototype.hyphenToHump = function () {
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
const Mock = require('mockjs')
|
||||
const users = require('../../mock/users')
|
||||
const app = require('../../mock/app')
|
||||
const dashboard = require('../../mock/dashboard')
|
||||
const mockData = [users, app, dashboard]
|
||||
|
||||
function serialize (str) {
|
||||
let paramArray = str.split('&')
|
||||
let query = {}
|
||||
for (let i in paramArray) {
|
||||
if (Object.prototype.hasOwnProperty.call(paramArray, i)) {
|
||||
query[paramArray[i].split('=')[0]] = paramArray[i].split('=')[1]
|
||||
}
|
||||
}
|
||||
return query
|
||||
}
|
||||
|
||||
for (let i in mockData) {
|
||||
if (Object.prototype.hasOwnProperty.call(mockData, i)) {
|
||||
for (let key in mockData[i]) {
|
||||
if (Object.prototype.hasOwnProperty.call(mockData[i], key)) {
|
||||
Mock.mock(eval(`/${key.split(' ')[1].replace(/\//g, '\\/')}/`), key.split(' ')[0].toLowerCase(), (options) => {
|
||||
if (key.split(' ')[0].toLowerCase() === 'get') {
|
||||
if (options.url.split('?')[1]) {
|
||||
options.query = serialize(options.url.split('?')[1])
|
||||
} else {
|
||||
options.query = options.body ? JSON.parse(options.body) : {}
|
||||
}
|
||||
}
|
||||
let res = {}
|
||||
let result = {}
|
||||
res.json = function (data) {
|
||||
result = data
|
||||
}
|
||||
mockData[i][key](options, res)
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Mock.setup({ timeout: '200-600' })
|
||||
@@ -1,14 +0,0 @@
|
||||
const Watch = require('watchjs')
|
||||
const config = require('./config')
|
||||
|
||||
export default function mockStorge (name, defaultValue) {
|
||||
let key = config.prefix + name
|
||||
global[key] = localStorage.getItem(key)
|
||||
? JSON.parse(localStorage.getItem(key))
|
||||
: defaultValue
|
||||
!localStorage.getItem(key) && localStorage.setItem(key, JSON.stringify(global[key]))
|
||||
Watch.watch(global[key], () => {
|
||||
localStorage.setItem(key, JSON.stringify(global[key]))
|
||||
})
|
||||
return key
|
||||
}
|
||||
Reference in New Issue
Block a user