Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
CS-Tao committed Oct 6, 2018
0 parents commit 2677604
Show file tree
Hide file tree
Showing 53 changed files with 12,804 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-runtime"]
}
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test/unit/coverage/**
test/unit/*.js
test/e2e/*.js
26 changes: 26 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
node: true
},
extends: 'standard',
globals: {
__static: true
},
plugins: [
'html'
],
'rules': {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
}
}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
dist/*
coverage
node_modules/
npm-debug.log
npm-debug.log.*
thumbs.db
!.gitkeep
41 changes: 41 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Commented sections below can be used to run tests on the CI server
# https://simulatedgreg.gitbooks.io/electron-vue/content/en/testing.html#on-the-subject-of-ci-testing
osx_image: xcode8.3
sudo: required
dist: trusty
language: c
matrix:
include:
- os: osx
- os: linux
env: CC=clang CXX=clang++ npm_config_clang=1
compiler: clang
cache:
directories:
- node_modules
before_install:
- mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v1.2.1/git-lfs-$([
"$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-1.2.1.tar.gz
| tar -xz -C /tmp/git-lfs --strip-components 1 && /tmp/git-lfs/git-lfs pull
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install --no-install-recommends -y icnsutils graphicsmagick xz-utils; fi
install:
#- export DISPLAY=':99.0'
#- Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- nvm install 8
- curl -o- -L https://yarnpkg.com/install.sh | bash
- source ~/.bashrc
- npm install -g vuepress
# - npm install -g xvfb-maybe
- yarn
script:
#- xvfb-maybe node_modules/.bin/karma start test/unit/karma.conf.js
#- yarn run pack && xvfb-maybe node_modules/.bin/mocha test/e2e
- yarn build:docs
- yarn build
deploy:
provider: pages
skip-cleanup: true
github-token: $GH_TOKEN
on:
branch: master
local-dir: dist/docs
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
[![Build status](https://ci.appveyor.com/api/projects/status/qq2adqaxv6vfj7di/branch/master?svg=true)](https://ci.appveyor.com/project/CS-Tao/whu-library-seat/branch/master)
[![Build Status](https://travis-ci.com/CS-Tao/whu-library-seat.svg?branch=master)](https://travis-ci.com/CS-Tao/whu-library-seat)
[![license](https://img.shields.io/badge/license-none-yellow.svg)](https://home.cs-tao.cc/whu-library-seat/copyright/)
[![feedback](https://img.shields.io/badge/feedback-issues-blue.svg)](https://github.com/CS-Tao/whu-library-seat/issues/new)

# whu-library-seat

>武汉大学图书馆抢座软件
## 使用说明

### 文档地址

[https://home.cs-tao.cc/whu-library-seat/](https://home.cs-tao.cc/whu-library-seat/)

### 软件演示

![软件演示](https://raw.githubusercontent.com/CS-Tao/github-content/master/contents/github/whu-library-seat/full.gif)

## 下载和安装

### 最新版本下载

最新版本(包括预览版): [https://github.com/CS-Tao/whu-library-seat/releases/latest](https://github.com/CS-Tao/whu-library-seat/releases/latest)

### 稳定版本下载

- Windows
- 链接: [whu-library-seat-setup-1.3.1.exe](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.3.1/whu-library-seat-setup-1.3.1.exe)

- Mac OS
- 链接: [whu-library-seat-1.3.1.dmg](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.3.1/whu-library-seat-1.3.1.dmg)

- Linux
- 链接: [whu-library-seat-1.3.1-x86_64.AppImage](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.3.1/whu-library-seat-1.3.1-x86_64.AppImage)

### 安装软件

运行安装包即可

### 申请软件使用权

在您登录之前,软件会检查您的学号是否被记录在[这个文件](https://github.com/CS-Tao/whu-library-seat/blob/user-validation/validation.json)中,只有被记录在这个文件中的学号才能使用本软件,如果您的学号没有被记录,您可以通过邮件[联系我](http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=whucstao@qq.com)(请在邮件中注明学号、院系和姓名)

当然,因为本软件为开源软件,您可以在遵守本软件[版权声明](#版权声明)的前提下,自己构建软件并删除其中的认证代码,具体请查看[面向开发者](#面向开发者)

### 软件更新

软件启动的时候会自动访问[GitHub Release](https://github.com/CS-Tao/whu-library-seat/releases/latest)检查更新,如果有更新,在软件的左下角会出现更新的按钮

# 面向开发者

您可以通过以下步骤自行构建本软件,但请您务必注意,本仓库并未提供任何源码`许可证`,您没有权利将源码更改后继续传播,更没有权利将本软件或源码用于商业活动

如果您是自行构建而不是通过[申请软件使用权](#申请软件使用权)使用本软件,重新构建的软件只能您自己使用

如果您希望在本软件的基础上继续添加新的功能,非常欢迎您向本仓库发送 Pull Request

``` bash
# 安装依赖
yarn

# 以开发模式运行
yarn dev

# 单元测试和端到端测试
yarn test

# 对 src 文件夹下的 Vue/Js 文件进行语法检查
yarn lint

# 生成应用程序
yarn build
```

## 版权声明

本软件开源,但没有向开发者提供任何源码`许可证`,作者本人保留源代码的所有权利,任何组织和个人不得将本软件或源码用于商业活动

Copyright © 2018 CS-Tao
32 changes: 32 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Commented sections below can be used to run tests on the CI server
# https://simulatedgreg.gitbooks.io/electron-vue/content/en/testing.html#on-the-subject-of-ci-testing
version: 0.1.{build}

branches:
only:
- master

image: Visual Studio 2017
platform:
- x64

cache:
- node_modules
- '%APPDATA%\npm-cache'
- '%USERPROFILE%\.electron'
- '%USERPROFILE%\AppData\Local\Yarn\cache'

init:
- git config --global core.autocrlf input

install:
- ps: Install-Product node 8 x64
- git reset --hard HEAD
- yarn
- node --version

build_script:
#- yarn test
- yarn build

test: off
30 changes: 30 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict'

process.env.NODE_ENV = 'production'

const chalk = require('chalk')
const del = require('del')
const webpack = require('webpack')
const webConfig = require('./webpack.config')
const doneLog = chalk.bgGreen.white(' DONE ') + ' '

if (process.env.BUILD_TARGET === 'clean') clean()
else web()

function clean () {
del.sync(['dist/*', '!.gitkeep'])
console.log(`\n${doneLog}\n`)
process.exit()
}

function web () {
del.sync(['dist/*', '!.gitkeep'])
webpack(webConfig, (err, stats) => {
if (err || stats.hasErrors()) console.log(err)
console.log(stats.toString({
chunks: false,
colors: true
}))
process.exit()
})
}
Empty file added dist/.gitkeep
Empty file.
11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>武汉大学图书馆抢座软件</title>
</head>
<body>
<div id="app"></div>
</body>
</html>
82 changes: 82 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"name": "whu-library-seat",
"version": "1.3.1",
"author": "CS-Tao <whucstao@qq.com>",
"description": "武汉大学图书馆抢座软件",
"license": null,
"main": "./dist/web.js",
"scripts": {
"build": "node build.js",
"build:clean": "cross-env BUILD_TARGET=clean node build.js",
"dev": "webpack-dev-server --progress --open --inline --hot --config webpack.config.js",
"lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src test",
"lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src test",
"postinstall": "npm run lint:fix"
},
"dependencies": {
"axios": "^0.16.1",
"element-ui": "^2.4.4",
"mint-ui": "^2.2.13",
"mockjs": "^1.0.1-beta3",
"nedb": "^1.8.0",
"vue": "^2.3.3",
"vue-router": "^2.5.3",
"vuex": "^2.3.1"
},
"devDependencies": {
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
"babel-loader": "^7.1.1",
"babel-plugin-istanbul": "^4.1.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.24.1",
"babili-webpack-plugin": "^0.1.2",
"cfonts": "^1.1.3",
"chai": "^4.0.0",
"chalk": "^2.1.0",
"copy-webpack-plugin": "^4.0.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.4",
"del": "^3.0.0",
"eslint": "^4.4.1",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.9.0",
"eslint-plugin-html": "^3.1.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.1.1",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^3.0.1",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"html-webpack-plugin": "^2.30.1",
"inject-loader": "^3.0.0",
"karma": "^1.3.0",
"karma-chai": "^0.1.0",
"karma-coverage": "^1.1.1",
"karma-electron": "^5.1.1",
"karma-mocha": "^1.2.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "^0.0.31",
"karma-webpack": "^2.0.1",
"mocha": "^3.0.2",
"multispinner": "^0.2.1",
"node-loader": "^0.6.0",
"node-sass": "^4.9.2",
"require-dir": "^0.3.0",
"sass-loader": "^7.0.3",
"spectron": "^3.7.1",
"style-loader": "^0.18.2",
"url-loader": "^0.5.9",
"vue-html-loader": "^1.2.4",
"vue-loader": "^13.0.5",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.4.2",
"webpack": "^3.5.2",
"webpack-dev-server": "^2.7.1",
"webpack-hot-middleware": "^2.18.2",
"webpack-merge": "^4.1.0"
}
}
15 changes: 15 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<div id="app">
<router-view></router-view>
</div>
</template>

<script>
export default {
name: 'whu-library-seat'
}
</script>

<style>
/* CSS */
</style>
37 changes: 37 additions & 0 deletions src/api/config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import axios from 'axios'
import store from '@/nedb'
import { Message } from 'element-ui'

// create an axios instance
const service = axios.create({
baseURL: store.get('baseUrl', 'https://seat.lib.whu.edu.cn:8443'),
timeout: 5000,
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
},
withCredentials: true
})

// request interceptor
service.interceptors.request.use(config => {
// Do something before request is sent
return config
}, error => {
// Do something with request error
Promise.reject(error)
})

// respone interceptor
service.interceptors.response.use(
response => response,
error => {
Message({
message: error.message,
type: 'error',
duration: 3000,
showClose: true
})
return Promise.reject(error)
})

export default service
Loading

0 comments on commit 2677604

Please sign in to comment.