使用分组打包减少首屏时间, 升级脚手架

This commit is contained in:
zema1 2017-10-19 19:33:31 +08:00
parent 160a8d3073
commit 1782bc213c
26 changed files with 3574 additions and 3200 deletions

View File

@ -1,14 +1,26 @@
{
"presets": [
["env", { "modules": false }],
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-runtime"],
"plugins": [
"transform-runtime",
"syntax-dynamic-import"
],
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": [ "istanbul" ]
"presets": [
"env",
"stage-2"
],
"plugins": [
"istanbul"
]
}
},
"comments": false
}
}

View File

@ -1,16 +1,17 @@
'use strict'
require('./check-versions')()
process.env.NODE_ENV = 'production'
var ora = require('ora')
var rm = require('rimraf')
var path = require('path')
var chalk = require('chalk')
var webpack = require('webpack')
var config = require('../config')
var webpackConfig = require('./webpack.prod.conf')
const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
var spinner = ora('building for production...')
const spinner = ora('building for production...')
spinner.start()
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
@ -26,6 +27,11 @@ rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
chunkModules: false
}) + '\n\n')
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +

View File

@ -1,17 +1,18 @@
var chalk = require('chalk')
var semver = require('semver')
var packageConfig = require('../package.json')
var shell = require('shelljs')
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}
var versionRequirements = [
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
},
}
]
if (shell.which('npm')) {
@ -23,9 +24,9 @@ if (shell.which('npm')) {
}
module.exports = function () {
var warnings = []
for (var i = 0; i < versionRequirements.length; i++) {
var mod = versionRequirements[i]
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' +
@ -38,8 +39,8 @@ module.exports = function () {
console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()
for (var i = 0; i < warnings.length; i++) {
var warning = warnings[i]
for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i]
console.log(' ' + warning)
}
console.log()

View File

@ -1,4 +1,5 @@
/* eslint-disable */
'use strict'
require('eventsource-polyfill')
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')

View File

@ -1,47 +1,55 @@
'use strict'
require('./check-versions')()
var config = require('../config')
const config = require('../config')
if (!process.env.NODE_ENV) {
process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
}
var opn = require('opn')
var path = require('path')
var express = require('express')
var webpack = require('webpack')
var proxyMiddleware = require('http-proxy-middleware')
var webpackConfig = require('./webpack.dev.conf')
const opn = require('opn')
const path = require('path')
const express = require('express')
const webpack = require('webpack')
const proxyMiddleware = require('http-proxy-middleware')
const webpackConfig = require('./webpack.dev.conf')
// default port where dev server listens for incoming traffic
var port = process.env.PORT || config.dev.port
const port = process.env.PORT || config.dev.port
// automatically open browser, if not set will be false
var autoOpenBrowser = !!config.dev.autoOpenBrowser
const autoOpenBrowser = !!config.dev.autoOpenBrowser
// Define HTTP proxies to your custom API backend
// https://github.com/chimurai/http-proxy-middleware
var proxyTable = config.dev.proxyTable
const proxyTable = config.dev.proxyTable
var app = express()
var compiler = webpack(webpackConfig)
const app = express()
const compiler = webpack(webpackConfig)
var devMiddleware = require('webpack-dev-middleware')(compiler, {
const devMiddleware = require('webpack-dev-middleware')(compiler, {
publicPath: webpackConfig.output.publicPath,
quiet: true
})
var hotMiddleware = require('webpack-hot-middleware')(compiler, {
log: () => {}
const hotMiddleware = require('webpack-hot-middleware')(compiler, {
log: false,
heartbeat: 2000
})
// force page reload when html-webpack-plugin template changes
compiler.plugin('compilation', function (compilation) {
compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
hotMiddleware.publish({ action: 'reload' })
cb()
})
})
// currently disabled until this is resolved:
// https://github.com/jantimon/html-webpack-plugin/issues/680
// compiler.plugin('compilation', function (compilation) {
// compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
// hotMiddleware.publish({ action: 'reload' })
// cb()
// })
// })
// enable hot-reload and state-preserving
// compilation error display
app.use(hotMiddleware)
// proxy api requests
Object.keys(proxyTable).forEach(function (context) {
var options = proxyTable[context]
let options = proxyTable[context]
if (typeof options === 'string') {
options = { target: options }
}
@ -54,33 +62,41 @@ app.use(require('connect-history-api-fallback')())
// serve webpack bundle output
app.use(devMiddleware)
// enable hot-reload and state-preserving
// compilation error display
app.use(hotMiddleware)
// serve pure static assets
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
const staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
app.use(staticPath, express.static('./static'))
var uri = 'http://localhost:' + port
const uri = 'http://localhost:' + port
var _resolve
var readyPromise = new Promise(resolve => {
var _reject
var readyPromise = new Promise((resolve, reject) => {
_resolve = resolve
_reject = reject
})
var server
var portfinder = require('portfinder')
portfinder.basePort = port
console.log('> Starting dev server...')
devMiddleware.waitUntilValid(() => {
console.log('> Listening at ' + uri + '\n')
// when env is testing, don't need open it
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
opn(uri)
}
_resolve()
portfinder.getPort((err, port) => {
if (err) {
_reject(err)
}
process.env.PORT = port
var uri = 'http://localhost:' + port
console.log('> Listening at ' + uri + '\n')
// when env is testing, don't need open it
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
opn(uri)
}
server = app.listen(port)
_resolve()
})
})
var server = app.listen(port)
module.exports = {
ready: readyPromise,
close: () => {

View File

@ -1,9 +1,10 @@
var path = require('path')
var config = require('../config')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
'use strict'
const path = require('path')
const config = require('../config')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
exports.assetsPath = function (_path) {
var assetsSubDirectory = process.env.NODE_ENV === 'production'
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
return path.posix.join(assetsSubDirectory, _path)
@ -12,7 +13,7 @@ exports.assetsPath = function (_path) {
exports.cssLoaders = function (options) {
options = options || {}
var cssLoader = {
const cssLoader = {
loader: 'css-loader',
options: {
minimize: process.env.NODE_ENV === 'production',
@ -22,7 +23,7 @@ exports.cssLoaders = function (options) {
// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
var loaders = [cssLoader]
const loaders = [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
@ -58,10 +59,10 @@ exports.cssLoaders = function (options) {
// Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) {
var output = []
var loaders = exports.cssLoaders(options)
for (var extension in loaders) {
var loader = loaders[extension]
const output = []
const loaders = exports.cssLoaders(options)
for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader

View File

@ -1,6 +1,7 @@
var utils = require('./utils')
var config = require('../config')
var isProduction = process.env.NODE_ENV === 'production'
'use strict'
const utils = require('./utils')
const config = require('../config')
const isProduction = process.env.NODE_ENV === 'production'
module.exports = {
loaders: utils.cssLoaders({
@ -8,5 +9,11 @@ module.exports = {
? config.build.productionSourceMap
: config.dev.cssSourceMap,
extract: isProduction
})
}),
transformToRequire: {
video: 'src',
source: 'src',
img: 'src',
image: 'xlink:href'
}
}

View File

@ -1,8 +1,9 @@
var path = require('path')
var utils = require('./utils')
var webpack = require('webpack')
var config = require('../config')
var vueLoaderConfig = require('./vue-loader.conf')
'use strict'
const path = require('path')
const webpack = require('webpack')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) {
return path.join(__dirname, '..', dir)
@ -35,7 +36,6 @@ module.exports = {
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test')],
// include: [resolve('src'), resolve('test'), resolve('node_modules/vue-echarts')],
options: {
formatter: require('eslint-friendly-formatter')
}
@ -59,6 +59,14 @@ module.exports = {
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',

View File

@ -1,10 +1,11 @@
var utils = require('./utils')
var webpack = require('webpack')
var config = require('../config')
var merge = require('webpack-merge')
var baseWebpackConfig = require('./webpack.base.conf')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
'use strict'
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
// add hot-reload related code to entry chunks
Object.keys(baseWebpackConfig.entry).forEach(function (name) {

View File

@ -1,17 +1,18 @@
var path = require('path')
var utils = require('./utils')
var webpack = require('webpack')
var config = require('../config')
var merge = require('webpack-merge')
var baseWebpackConfig = require('./webpack.base.conf')
var CopyWebpackPlugin = require('copy-webpack-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
'use strict'
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
var env = config.build.env
const env = config.build.env
var webpackConfig = merge(baseWebpackConfig, {
const webpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
@ -29,6 +30,7 @@ var webpackConfig = merge(baseWebpackConfig, {
new webpack.DefinePlugin({
'process.env': env
}),
// UglifyJs do not support ES6+, you can also use babel-minify for better treeshaking: https://github.com/babel/minify
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
@ -63,10 +65,12 @@ var webpackConfig = merge(baseWebpackConfig, {
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
// keep module.id stable when vender modules does not change
new webpack.HashedModuleIdsPlugin(),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: function (module, count) {
minChunks: function (module) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
@ -95,7 +99,7 @@ var webpackConfig = merge(baseWebpackConfig, {
})
if (config.build.productionGzip) {
var CompressionWebpackPlugin = require('compression-webpack-plugin')
const CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
@ -113,7 +117,7 @@ if (config.build.productionGzip) {
}
if (config.build.bundleAnalyzerReport) {
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}

View File

@ -1,5 +1,9 @@
'use strict'
// Template version: 1.1.1
// see http://vuejs-templates.github.io/webpack for documentation.
var path = require('path')
const path = require('path')
module.exports = {
build: {
@ -8,7 +12,7 @@ module.exports = {
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
productionSourceMap: true,
productionSourceMap: false,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
@ -23,7 +27,7 @@ module.exports = {
},
dev: {
env: require('./dev.env'),
port: 8080,
port: process.env.PORT || 8080,
autoOpenBrowser: true,
assetsSubDirectory: 'static',
assetsPublicPath: '/',

6297
oj/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,71 +1,74 @@
{
"name": "onlinejudge",
"version": "2.0.0",
"description": "A Vue.js project",
"description": "onlinejudge front end",
"author": "zemal <rawidn@163.com>",
"private": true,
"scripts": {
"dev": "node build/dev-server.js",
"start": "npm run dev",
"build": "node build/build.js",
"analyz": "NODE_ENV=production npm_config_report=true node build/build.js",
"lint": "eslint --ext .js,.vue src"
},
"dependencies": {
"axios": "^0.16.2",
"browser-detect": "^0.2.18",
"echarts": "^3.6.2",
"echarts": "^3.7.2",
"highlight.js": "^9.12.0",
"i": "^0.3.5",
"iview": "^2.3.2",
"moment": "^2.18.1",
"vue": "^2.4.4",
"iview": "^2.5.0-beta.1",
"moment": "^2.19.1",
"vue": "^2.5.2",
"vue-codemirror-lite": "^1.0.2",
"vue-cropper": "^0.2.1",
"vue-cropper": "^0.2.3",
"vue-echarts": "^2.4.1",
"vue-router": "^2.7.0",
"vuex": "^2.4.0",
"vue-router": "^3.0.1",
"vuex": "^2.5.0",
"vuex-router-sync": "^4.3.2"
},
"devDependencies": {
"autoprefixer": "^6.7.2",
"babel-core": "^6.26.0",
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.2.10",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.6.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.26.0",
"chalk": "^1.1.3",
"babel-register": "^6.22.0",
"chalk": "^2.0.1",
"connect-history-api-fallback": "^1.3.0",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.7",
"css-loader": "^0.28.0",
"eslint": "^3.19.0",
"eslint-config-standard": "^6.2.1",
"eslint-friendly-formatter": "^2.0.7",
"eslint-loader": "^1.9.0",
"eslint-plugin-html": "^2.0.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-html": "^3.0.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"eslint-plugin-standard": "^3.0.1",
"eventsource-polyfill": "^0.9.6",
"express": "^4.15.4",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.2",
"friendly-errors-webpack-plugin": "^1.1.3",
"express": "^4.14.1",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"http-proxy-middleware": "^0.17.3",
"less": "^2.7.2",
"less": "^3.0.0-alpha.3",
"less-loader": "^4.0.5",
"opn": "^4.0.2",
"optimize-css-assets-webpack-plugin": "^1.3.0",
"opn": "^5.1.0",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"rimraf": "^2.6.0",
"semver": "^5.4.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"url-loader": "^0.5.9",
"vue-loader": "^12.2.2",
"vue-style-loader": "^3.0.3",
"vue-template-compiler": "^2.4.4",
"webpack": "^2.7.0",
"url-loader": "^0.5.8",
"vue-loader": "^13.0.4",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.4.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-middleware": "^1.12.0",
"webpack-hot-middleware": "^2.18.2",

View File

@ -266,4 +266,3 @@ function ajax (url, method, options) {
})
})
}

View File

@ -69,7 +69,7 @@
// codemirror options
tabSize: 4,
mode: 'text/x-c++src',
theme: 'monokai',
theme: 'solarized',
lineNumbers: true,
line: true,
//

View File

@ -10,6 +10,7 @@ import 'iview/dist/styles/iview.css'
import Panel from '~/Panel.vue'
import VerticalMenu from '~/verticalMenu/verticalMenu.vue'
import VerticalMenuItem from '~/verticalMenu/verticalMenu-item.vue'
import './styles/index.less'
import filters from './utils/filters.js'
@ -29,7 +30,6 @@ import cpp from 'highlight.js/lib/languages/cpp'
import python from 'highlight.js/lib/languages/python'
import java from 'highlight.js/lib/languages/java'
import 'highlight.js/styles/atom-one-light.css'
import './styles/index.less'
hljs.registerLanguage('cpp', cpp)
hljs.registerLanguage('java', java)
@ -95,4 +95,3 @@ Vue.prototype.$info = Vue.prototype.$Message.info
Vue.prototype.$success = Vue.prototype.$Message.success
new Vue(Vue.util.extend({router, store}, App)).$mount('#app')

View File

@ -44,4 +44,3 @@ router.afterEach((to, from, next) => {
sync(store, router)
export default router

View File

@ -1,23 +1,15 @@
// all routes here.
import Test from '../views/test'
import {
AccountSetting,
Home, Logout,
ProblemList, Problem,
SubmissionList, SubmissionDetails,
ACMRank, OIRank,
ApplyResetPassword,
ContestAnnouncement,
ContestDetails,
ContestList,
ContestProblemList,
ContestRank,
Home,
Logout,
ProblemList,
ProfileSetting,
ResetPassword,
SecuritySetting,
Settings
ApplyResetPassword, ResetPassword
} from '../views'
import * as Contest from '@/views/contest'
import * as Setting from '@/views/setting'
export default [
{
name: 'logout',
@ -42,52 +34,52 @@ export default [
{
name: 'problem-details',
path: '/problem/:problemID',
component: () => import('@/views/problem/Problem.vue')
component: Problem
},
{
name: 'submission-list',
path: '/status',
component: () => import('@/views/submission/SubmissionList.vue')
component: SubmissionList
},
{
name: 'submission-details',
path: '/status/:id/',
component: () => import('@/views/submission/SubmissionDetails.vue')
component: SubmissionDetails
},
{
name: 'contest-list',
path: '/contests',
component: ContestList
component: Contest.ContestList
},
{
name: 'contest-details',
path: '/contest/:contestID/',
component: ContestDetails,
component: Contest.ContestDetails,
children: [
{
name: 'contest-submission-list',
path: 'submissions',
component: () => import('@/views/submission/SubmissionList.vue')
component: SubmissionList
},
{
name: 'contest-problem-list',
path: 'problems',
component: ContestProblemList
component: Contest.ContestProblemList
},
{
name: 'contest-problem-details',
path: 'problem/:problemID/',
component: () => import('@/views/problem/Problem.vue')
component: () => Problem
},
{
name: 'contest-announcement-list',
path: 'announcements',
component: ContestAnnouncement
component: Contest.ContestAnnouncement
},
{
name: 'contest-rank',
path: 'rank',
component: ContestRank
component: Contest.ContestRank
}
]
},
@ -109,35 +101,30 @@ export default [
},
{
path: '/setting',
component: Settings,
component: Setting.Settings,
meta: {requiresAuth: true},
children: [
{
name: 'default-setting',
path: '',
component: ProfileSetting
component: Setting.ProfileSetting
},
{
name: 'profile-setting',
path: 'profile',
component: ProfileSetting
component: Setting.ProfileSetting
},
{
name: 'account-setting',
path: 'account',
component: AccountSetting
component: Setting.AccountSetting
},
{
name: 'security-setting',
path: 'security',
component: SecuritySetting
component: Setting.SecuritySetting
}
]
},
{
name: 'test',
path: '/test',
component: Test
}
// {
// path: '*', redirect: '/problems'

View File

@ -43,4 +43,3 @@ export default {
actions,
mutations
}

View File

@ -90,6 +90,11 @@ export const CONTEST_STATUS = {
}
}
export const CONTEST_TYPE = {
ACM: 'ACM',
OI: 'OI'
}
export const USER_TYPE = {
REGULAR_USER: 'Regular User',
ADMIN: 'Admin',
@ -99,4 +104,3 @@ export const USER_TYPE = {
export const STORAGE_KEY = {
AUTHED: 'authed'
}

View File

@ -31,4 +31,3 @@ export default {
getACRate: getACRate,
filterEmptyValue: filterEmptyValue
}

View File

@ -1,7 +1,7 @@
import ContestList from './ContestList.vue'
import ContestDetails from './ContestDetail.vue'
import ContestProblemList from './children/ContestProblemList.vue'
import ContestAnnouncement from './children/ContestAnnouncement.vue'
import ContestRank from './children/ContestRank.vue'
const ContestList = () => import(/* webpackChunkName: "contest" */ './ContestList.vue')
const ContestDetails = () => import(/* webpackChunkName: "contest" */ './ContestDetail.vue')
const ContestProblemList = () => import(/* webpackChunkName: "contest" */ './children/ContestProblemList.vue')
const ContestAnnouncement = () => import(/* webpackChunkName: "contest" */ './children/ContestAnnouncement.vue')
const ContestRank = () => import(/* webpackChunkName: "contest" */ './children/ContestRank.vue')
export {ContestAnnouncement, ContestDetails, ContestList, ContestProblemList, ContestRank}

View File

@ -1,17 +1,26 @@
import ProblemList from './problem/ProblemList.vue'
import ACMRank from './rank/ACMRank.vue'
import OIRank from './rank/OIRank.vue'
import Logout from './user/Logout.vue'
import ApplyResetPassword from './user/ApplyResetPassword.vue'
import ResetPassword from './user/ResetPassword.vue'
import Home from './user/Home.vue'
// Grouping Components in the Same Chunk
const SubmissionList = () => import(/* webpackChunkName: "submission" */ '@/views/submission/SubmissionList.vue')
const SubmissionDetails = () => import(/* webpackChunkName: "submission" */ '@/views/submission/SubmissionDetails.vue')
const ACMRank = () => import(/* webpackChunkName: "userRank" */ '@/views/rank/ACMRank.vue')
const OIRank = () => import(/* webpackChunkName: "userRank" */ '@/views/rank/OIRank.vue')
const ApplyResetPassword = () => import(/* webpackChunkName: "password" */ '@/views/user/ApplyResetPassword.vue')
const ResetPassword = () => import(/* webpackChunkName: "password" */ '@/views/user/ResetPassword.vue')
const Problem = () => import(/* webpackChunkName: "Problem" */ '@/views/problem/Problem.vue')
export {
Logout, ResetPassword, ApplyResetPassword, Home,
ProblemList, ACMRank, OIRank
Logout, Home,
ProblemList, Problem,
ACMRank, OIRank,
SubmissionList, SubmissionDetails,
ApplyResetPassword, ResetPassword
}
export * from './contest'
export * from './setting'
/* , Login, Logout,
* 在对应的route内加载
* 见https://router.vuejs.org/en/advanced/lazy-loading.html

View File

@ -14,13 +14,10 @@
</template>
<script>
// import 'echarts/lib/component/axisPointer'
// import 'echarts/lib/component/title'
import api from '@/api'
import Pagination from '~/Pagination'
import utils from '@/utils/utils'
import {CONTEST_TYPE} from '@/utils/consts'
const limit = 10
@ -149,7 +146,7 @@
let offset = (page - 1) * this.limit
let bar = this.$refs.chart
bar.showLoading({maskColor: 'rgba(250, 250, 250, 0.8)'})
api.getUserRank(offset, this.limit, 'acm').then(res => {
api.getUserRank(offset, this.limit, CONTEST_TYPE.ACM).then(res => {
this.initData(res)
bar.hideLoading()
})

View File

@ -14,13 +14,10 @@
</template>
<script>
// import 'echarts/lib/component/axisPointer'
// import 'echarts/lib/component/title'
import api from '@/api'
import Pagination from '~/Pagination'
import utils from '@/utils/utils'
import {CONTEST_TYPE} from '@/utils/consts'
const limit = 10
@ -144,7 +141,7 @@
let offset = (page - 1) * this.limit
let bar = this.$refs.chart
bar.showLoading({maskColor: 'rgba(250, 250, 250, 0.8)'})
api.getUserRank(offset, this.limit, 'oi').then(res => {
api.getUserRank(offset, this.limit, CONTEST_TYPE.OI).then(res => {
this.initData(res)
bar.hideLoading()
})

View File

@ -1,6 +1,6 @@
import Settings from './Settings.vue'
import ProfileSetting from './children/ProfileSetting.vue'
import SecuritySetting from './children/SecuritySetting.vue'
import AccountSetting from './children/AccountSetting.vue'
const Settings = () => import(/* webpackChunkName: "setting" */ './Settings.vue')
const ProfileSetting = () => import(/* webpackChunkName: "setting" */ './children/ProfileSetting.vue')
const SecuritySetting = () => import(/* webpackChunkName: "setting" */ './children/SecuritySetting.vue')
const AccountSetting = () => import(/* webpackChunkName: "setting" */ './children/AccountSetting.vue')
export {Settings, ProfileSetting, SecuritySetting, AccountSetting}