Skip to content
Snippets Groups Projects
Forked from Pleroma / admin-fe
1688 commits behind the upstream repository.
  • 花裤衩's avatar
    45fef9b4
    Feature/english (#381) · 45fef9b4
    花裤衩 authored
    * perf[navbar]: set langSelect to component && refine errorLog component
    
    * feat[login]:add 18n to login form
    
    * fix[pagination]: fixed when selected page-sizes
    
    * perf[i18n]:dashboard document svg permission
    
    * perf[charts]: perf effect
    
    * perf[i18n]:excel && zip
    
    * perf[i18n]: table && errorLog && theme
    
    * perf[i18n]: components
    
    * perf[i18n]: direct use $t
    
    * perf[i18n]: complex-table
    
    * update README.md
    
    * update README.md :blue_book:
    
    * perf[i18n]: refine code comments
    Feature/english (#381)
    花裤衩 authored
    * perf[navbar]: set langSelect to component && refine errorLog component
    
    * feat[login]:add 18n to login form
    
    * fix[pagination]: fixed when selected page-sizes
    
    * perf[i18n]:dashboard document svg permission
    
    * perf[charts]: perf effect
    
    * perf[i18n]:excel && zip
    
    * perf[i18n]: table && errorLog && theme
    
    * perf[i18n]: components
    
    * perf[i18n]: direct use $t
    
    * perf[i18n]: complex-table
    
    * update README.md
    
    * update README.md :blue_book:
    
    * perf[i18n]: refine code comments
article.js 2.18 KiB
import Mock from 'mockjs'
import { param2Obj } from '@/utils'

const List = []
const count = 100

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)',
    forecast: '@float(0, 100, 2, 2)',
    importance: '@integer(1, 3)',
    'type|1': ['CN', 'US', 'JP', 'EU'],
    'status|1': ['published', 'draft', 'deleted'],
    display_time: '@datetime',
    pageviews: '@integer(300, 5000)'
  }))
}

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: () => ({
    id: 120000000001,
    author: { key: 'mockPan' },
    source_name: '原创作者',
    category_item: [{ key: 'global', name: '全球' }],
    comment_disabled: true,
    content: '<p>我是测试数据我是测试数据</p><p><img class="wscnph" src="https://wpimg.wallstcn.com/4c69009c-0fd4-4153-b112-6cb53d1cf943" data-wscntype="image" data-wscnh="300" data-wscnw="400" data-mce-src="https://wpimg.wallstcn.com/4c69009c-0fd4-4153-b112-6cb53d1cf943"></p>"',
    content_short: '我是测试数据',
    display_time: +new Date(),
    image_uri: 'https://wpimg.wallstcn.com/e4558086-631c-425c-9430-56ffb46e70b3',
    platforms: ['a-platform'],
    source_uri: 'https://github.com/PanJiaChen/vue-element-admin',
    status: 'published',
    tags: [],
    title: 'vue-element-admin'
  }),
  createArticle: () => ({
    data: 'success'
  }),
  updateArticle: () => ({
    data: 'success'
  })
}