forked from AkkomaGang/admin-fe
Merge branch 'chore/env-assets-path' into 'master'
Load fonts from a file instead of inline Closes #16 See merge request pleroma/admin-fe!15
This commit is contained in:
commit
d61dbb5e16
9 changed files with 6 additions and 206 deletions
|
@ -83,9 +83,8 @@ module.exports = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
||||||
loader: 'url-loader',
|
loader: 'file-loader',
|
||||||
options: {
|
options: {
|
||||||
limit: 10000,
|
|
||||||
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
"jszip": "3.1.5",
|
"jszip": "3.1.5",
|
||||||
"lodash": "^4.17.11",
|
"lodash": "^4.17.11",
|
||||||
"lodash.debounce": "^4.0.8",
|
"lodash.debounce": "^4.0.8",
|
||||||
"mockjs": "1.0.1-beta3",
|
|
||||||
"normalize.css": "7.0.0",
|
"normalize.css": "7.0.0",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"screenfull": "4.0.0",
|
"screenfull": "4.0.0",
|
||||||
|
|
|
@ -17,7 +17,6 @@ import i18n from './lang' // Internationalization
|
||||||
import './icons' // icon
|
import './icons' // icon
|
||||||
import './errorLog' // error log
|
import './errorLog' // error log
|
||||||
import './permission' // permission control
|
import './permission' // permission control
|
||||||
import './mock' // simulation data
|
|
||||||
|
|
||||||
import * as filters from './filters' // global filters
|
import * as filters from './filters' // global filters
|
||||||
|
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
import Mock from 'mockjs'
|
|
||||||
import { param2Obj } from '@/utils'
|
|
||||||
|
|
||||||
const List = []
|
|
||||||
const count = 100
|
|
||||||
|
|
||||||
const baseContent = '<p>我是测试数据我是测试数据</p><p><img src="https://wpimg.wallstcn.com/4c69009c-0fd4-4153-b112-6cb53d1cf943"></p>'
|
|
||||||
const image_uri = 'https://wpimg.wallstcn.com/e4558086-631c-425c-9430-56ffb46e70b3'
|
|
||||||
|
|
||||||
for (let i = 0; i < count; i++) {
|
|
||||||
List.push(Mock.mock({
|
|
||||||
id: '@increment',
|
|
||||||
timestamp: +Mock.Random.date('T'),
|
|
||||||
author: '@first',
|
|
||||||
reviewer: '@first',
|
|
||||||
title: '@title(5, 10)',
|
|
||||||
content_short: '我是测试数据',
|
|
||||||
content: baseContent,
|
|
||||||
forecast: '@float(0, 100, 2, 2)',
|
|
||||||
importance: '@integer(1, 3)',
|
|
||||||
'type|1': ['CN', 'US', 'JP', 'EU'],
|
|
||||||
'status|1': ['published', 'draft', 'deleted'],
|
|
||||||
display_time: '@datetime',
|
|
||||||
comment_disabled: true,
|
|
||||||
pageviews: '@integer(300, 5000)',
|
|
||||||
image_uri,
|
|
||||||
platforms: ['a-platform']
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
getList: config => {
|
|
||||||
const { importance, type, title, page = 1, limit = 20, sort } = param2Obj(config.url)
|
|
||||||
|
|
||||||
let mockList = List.filter(item => {
|
|
||||||
if (importance && item.importance !== +importance) return false
|
|
||||||
if (type && item.type !== type) return false
|
|
||||||
if (title && item.title.indexOf(title) < 0) return false
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
|
|
||||||
if (sort === '-id') {
|
|
||||||
mockList = mockList.reverse()
|
|
||||||
}
|
|
||||||
|
|
||||||
const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1))
|
|
||||||
|
|
||||||
return {
|
|
||||||
total: mockList.length,
|
|
||||||
items: pageList
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getPv: () => ({
|
|
||||||
pvData: [{ key: 'PC', pv: 1024 }, { key: 'mobile', pv: 1024 }, { key: 'ios', pv: 1024 }, { key: 'android', pv: 1024 }]
|
|
||||||
}),
|
|
||||||
getArticle: (config) => {
|
|
||||||
const { id } = param2Obj(config.url)
|
|
||||||
for (const article of List) {
|
|
||||||
if (article.id === +id) {
|
|
||||||
return article
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
createArticle: () => ({
|
|
||||||
data: 'success'
|
|
||||||
}),
|
|
||||||
updateArticle: () => ({
|
|
||||||
data: 'success'
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
import Mock from 'mockjs'
|
|
||||||
import loginAPI from './login'
|
|
||||||
import articleAPI from './article'
|
|
||||||
import remoteSearchAPI from './remoteSearch'
|
|
||||||
import transactionAPI from './transaction'
|
|
||||||
|
|
||||||
// 修复在使用 MockJS 情况下,设置 withCredentials = true,且未被拦截的跨域请求丢失 Cookies 的问题
|
|
||||||
// https://github.com/nuysoft/Mock/issues/300
|
|
||||||
Mock.XHR.prototype.proxy_send = Mock.XHR.prototype.send
|
|
||||||
Mock.XHR.prototype.send = function() {
|
|
||||||
if (this.custom.xhr) {
|
|
||||||
this.custom.xhr.withCredentials = this.withCredentials || false
|
|
||||||
}
|
|
||||||
this.proxy_send(...arguments)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mock.setup({
|
|
||||||
// timeout: '350-600'
|
|
||||||
// })
|
|
||||||
|
|
||||||
// 登录相关
|
|
||||||
Mock.mock(/\/login\/login/, 'post', loginAPI.loginByUsername)
|
|
||||||
Mock.mock(/\/login\/logout/, 'post', loginAPI.logout)
|
|
||||||
Mock.mock(/\/user\/info\.*/, 'get', loginAPI.getUserInfo)
|
|
||||||
|
|
||||||
// 文章相关
|
|
||||||
Mock.mock(/\/article\/list/, 'get', articleAPI.getList)
|
|
||||||
Mock.mock(/\/article\/detail/, 'get', articleAPI.getArticle)
|
|
||||||
Mock.mock(/\/article\/pv/, 'get', articleAPI.getPv)
|
|
||||||
Mock.mock(/\/article\/create/, 'post', articleAPI.createArticle)
|
|
||||||
Mock.mock(/\/article\/update/, 'post', articleAPI.updateArticle)
|
|
||||||
|
|
||||||
// 搜索相关
|
|
||||||
Mock.mock(/\/search\/user/, 'get', remoteSearchAPI.searchUser)
|
|
||||||
|
|
||||||
// 账单相关
|
|
||||||
Mock.mock(/\/transaction\/list/, 'get', transactionAPI.getList)
|
|
||||||
|
|
||||||
export default Mock
|
|
|
@ -1,34 +0,0 @@
|
||||||
import { param2Obj } from '@/utils'
|
|
||||||
|
|
||||||
const userMap = {
|
|
||||||
admin: {
|
|
||||||
roles: ['admin'],
|
|
||||||
token: 'admin',
|
|
||||||
introduction: '我是超级管理员',
|
|
||||||
avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
|
|
||||||
name: 'Super Admin'
|
|
||||||
},
|
|
||||||
editor: {
|
|
||||||
roles: ['editor'],
|
|
||||||
token: 'editor',
|
|
||||||
introduction: '我是编辑',
|
|
||||||
avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
|
|
||||||
name: 'Normal Editor'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
loginByUsername: config => {
|
|
||||||
const { username } = JSON.parse(config.body)
|
|
||||||
return userMap[username]
|
|
||||||
},
|
|
||||||
getUserInfo: config => {
|
|
||||||
const { token } = param2Obj(config.url)
|
|
||||||
if (userMap[token]) {
|
|
||||||
return userMap[token]
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
logout: () => 'success'
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
import Mock from 'mockjs'
|
|
||||||
import { param2Obj } from '@/utils'
|
|
||||||
|
|
||||||
const NameList = []
|
|
||||||
const count = 100
|
|
||||||
|
|
||||||
for (let i = 0; i < count; i++) {
|
|
||||||
NameList.push(Mock.mock({
|
|
||||||
name: '@first'
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
NameList.push({ name: 'mockPan' })
|
|
||||||
|
|
||||||
export default {
|
|
||||||
searchUser: config => {
|
|
||||||
const { name } = param2Obj(config.url)
|
|
||||||
const mockNameList = NameList.filter(item => {
|
|
||||||
const lowerCaseName = item.name.toLowerCase()
|
|
||||||
if (name && lowerCaseName.indexOf(name.toLowerCase()) < 0) return false
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
return { items: mockNameList }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
import Mock from 'mockjs'
|
|
||||||
|
|
||||||
const List = []
|
|
||||||
const count = 20
|
|
||||||
|
|
||||||
for (let i = 0; i < count; i++) {
|
|
||||||
List.push(Mock.mock({
|
|
||||||
order_no: '@guid()',
|
|
||||||
timestamp: +Mock.Random.date('T'),
|
|
||||||
username: '@name()',
|
|
||||||
price: '@float(1000, 15000, 0, 2)',
|
|
||||||
'status|1': ['success', 'pending']
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
getList: () => {
|
|
||||||
return {
|
|
||||||
total: List.length,
|
|
||||||
items: List
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
17
yarn.lock
17
yarn.lock
|
@ -2486,16 +2486,16 @@ combined-stream@^1.0.6, combined-stream@~1.0.6:
|
||||||
dependencies:
|
dependencies:
|
||||||
delayed-stream "~1.0.0"
|
delayed-stream "~1.0.0"
|
||||||
|
|
||||||
commander@*, commander@^2.13.0, commander@^2.14.1, commander@^2.9.0:
|
|
||||||
version "2.19.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
|
|
||||||
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
|
|
||||||
|
|
||||||
commander@2.17.x, commander@~2.17.1:
|
commander@2.17.x, commander@~2.17.1:
|
||||||
version "2.17.1"
|
version "2.17.1"
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
|
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
|
||||||
integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
|
integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
|
||||||
|
|
||||||
|
commander@^2.13.0, commander@^2.14.1, commander@^2.9.0:
|
||||||
|
version "2.19.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
|
||||||
|
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
|
||||||
|
|
||||||
commander@~2.13.0:
|
commander@~2.13.0:
|
||||||
version "2.13.0"
|
version "2.13.0"
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
|
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
|
||||||
|
@ -6645,13 +6645,6 @@ mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@0.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@
|
||||||
dependencies:
|
dependencies:
|
||||||
minimist "0.0.8"
|
minimist "0.0.8"
|
||||||
|
|
||||||
mockjs@1.0.1-beta3:
|
|
||||||
version "1.0.1-beta3"
|
|
||||||
resolved "https://registry.yarnpkg.com/mockjs/-/mockjs-1.0.1-beta3.tgz#d234f3c27256397564f2c955142e891909537209"
|
|
||||||
integrity sha1-0jTzwnJWOXVk8slVFC6JGQlTcgk=
|
|
||||||
dependencies:
|
|
||||||
commander "*"
|
|
||||||
|
|
||||||
move-concurrently@^1.0.1:
|
move-concurrently@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
|
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
|
||||||
|
|
Loading…
Reference in a new issue