Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
CS-Tao committed Nov 9, 2018
2 parents 07f0c11 + 099ec61 commit 9be7b58
Show file tree
Hide file tree
Showing 24 changed files with 3,428 additions and 1,980 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
dist/electron/*
dist/web/*
dist/docs/*
build/*
!build/icons
coverage
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
### 最新版本下载

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

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

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

### 安装软件

Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ footer: Copyright © 2018 CS-Tao

#### 使用演示

> 以桌面端(v1.2.0)为例,移动端相关操作与之一致
> 以桌面端为例,移动端相关操作与之一致
![软件演示](https://raw.githubusercontent.com/CS-Tao/github-content/master/contents/github/whu-library-seat/full.gif)

Expand Down
23 changes: 9 additions & 14 deletions docs/specification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,26 @@

#### 桌面端下载

- Windows
- 链接: [whu-library-seat-setup-1.6.0.exe](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.6.0/whu-library-seat-setup-1.6.0.exe)
安装包链接: [https://github.com/CS-Tao/whu-library-seat#最新版本下载](https://github.com/CS-Tao/whu-library-seat#最新版本下载)

- Mac OS
- 链接: [whu-library-seat-1.6.0.dmg](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.6.0/whu-library-seat-1.6.0.dmg)
#### 移动端(Android)下载

- Linux
- 链接: [whu-library-seat-1.6.0-x86_64.AppImage](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.6.0/whu-library-seat-1.6.0-x86_64.AppImage)
安装包链接: [https://github.com/CS-Tao/whu-library-seat-mobile#最新版本下载](https://github.com/CS-Tao/whu-library-seat-mobile#最新版本下载)

#### 移动端下载
二维码:

- 移动端(Android)

安装包链接: [https://github.com/CS-Tao/whu-library-seat-mobile#最新版本下载](https://github.com/CS-Tao/whu-library-seat-mobile#最新版本下载)

二维码:

![安卓版本二维码](https://raw.githubusercontent.com/CS-Tao/whu-library-seat/user-validation/last-android-qr.jpg)
![安卓版本二维码](https://raw.githubusercontent.com/CS-Tao/whu-library-seat/user-validation/last-android-qr.jpg)

### 安装软件

运行安装包即可

### 申请软件使用权

::: warning
不再对桌面版本低于 v1.5.0、安卓版本低于 v1.2.0 的软件提供用户认证支持
:::

在您登录之前,软件会检查您的学号是否被记录在[这个文件](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 protected])(请在邮件中注明学号、院系和姓名)

当然,因为本软件为开源软件,您可以在遵守本软件[版权声明](https://github.com/CS-Tao/whu-library-seat/blob/master/README.md#版权声明)的前提下,自己构建软件并删除其中的认证代码,具体请查看[面向开发者](https://github.com/CS-Tao/whu-library-seat/blob/master/README.md#面向开发者)
Expand Down
4 changes: 2 additions & 2 deletions docs/specification/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@

- 版本 vx.x.x

显示本软件的版本号,点击可以进入本版本的[更新日志和下载链接](https://github.com/CS-Tao/whu-library-seat/releases/tag/v1.4.0)
显示当前版本号

- 更新日志

查看[最新版本的更新日志](https://github.com/CS-Tao/whu-library-seat/releases)
显示本软件的版本号,点击可以进入本版本的[更新日志和下载链接](https://github.com/CS-Tao/whu-library-seat/releases/tag/v1.4.0)

- 检查更新

Expand Down
10 changes: 10 additions & 0 deletions docs/specification/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@

默认为 `22:45:00`

#### 检测系统是否开放

> 桌面端 v1.7.0(移动端 v1.4.0) 新增
如果勾选该项,当您预约明天的座位的时候,软件会提前 10 秒检查图书馆后台是否开放,每隔 1s 检查一次,最多检查 20 次。

这个功能可以在您的系统时间和网络时间有些许偏差的时候,防止提前抢座或滞后抢座。

默认``勾选该项

#### 退出到托盘

> 本条针对桌面端
Expand Down
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "whu-library-seat",
"version": "1.6.0",
"version": "1.7.0",
"author": "CS-Tao <[email protected]>",
"description": "武汉大学图书馆抢座软件",
"license": null,
Expand Down Expand Up @@ -32,6 +32,9 @@
"files": [
"dist/electron/**/*"
],
"extraResources": [
"static"
],
"dmg": {
"contents": [
{
Expand All @@ -51,12 +54,7 @@
"icon": "build/icons/icon.icns"
},
"win": {
"icon": "build/icons/icon.ico",
"target": "nsis"
},
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true
"icon": "build/icons/icon.ico"
},
"linux": {
"icon": "build/icons"
Expand Down
31 changes: 21 additions & 10 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ const template = [
submenu: [
{
label: '版本 v' + appVersion,
click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat/releases/tag/v' + appVersion) }
enabled: false
},
{
label: '更新日志',
click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat/releases') }
click () { require('electron').shell.openExternal('https://github.com/CS-Tao/whu-library-seat/releases/tag/v' + appVersion) }
},
{
label: '检查更新',
Expand Down Expand Up @@ -221,13 +221,16 @@ function createWindow () {
mainWindow.setPosition(position[0], position[1] === -1 ? mainWindow.getPosition()[1] : position[1])
}

const baseLibUrl = store.get('baseUrl', 'https://seat.lib.whu.edu.cn:8443')
session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
details.requestHeaders['User-Agent'] = null
details.requestHeaders['Accept'] = null
details.requestHeaders['Accept-Encoding'] = null
details.requestHeaders['Accept-Language'] = null
details.requestHeaders['Referer'] = null
details.requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
if (details.url && details.url.indexOf(baseLibUrl) !== -1) {
details.requestHeaders['User-Agent'] = null
details.requestHeaders['Accept'] = null
details.requestHeaders['Accept-Encoding'] = null
details.requestHeaders['Accept-Language'] = null
details.requestHeaders['Referer'] = null
details.requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'
}
callback({ cancel: false, requestHeaders: details.requestHeaders }) // eslint-disable-line
})

Expand Down Expand Up @@ -293,8 +296,12 @@ ipcMain.on('show-window-notify', (event, title, message) => {
title: title,
subTitle: title,
message: message,
icon: path.join(__static, '/toast.png'),
sound: true,
icon: process.env.NODE_ENV !== 'production'
? path.join(__static, 'toast.png')
: (process.platform === 'darwin'
? './Contents/Resources/static/toast.png'
: './resources/static/toast.png'),
sound: false,
wait: true
},
() => {}
Expand All @@ -310,12 +317,16 @@ ipcMain.on('show-window-notify', (event, title, message) => {

autoUpdater.autoDownload = false
autoUpdater.autoInstallOnAppQuit = true
autoUpdater.allowPrerelease = true
autoUpdater.allowDowngrade = true

ipcMain.on('check-updates', (event, arg) => {
// 检查更新
if (process.env.NODE_ENV === 'production') {
autoUpdater.checkForUpdates().then((info) => {
mainWindow.webContents.send('update-available', info)
}).catch((error) => {
mainWindow.webContents.send('check-update-error', error)
})
}
})
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/api/mock/library.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
Book: config => {
console.log('Mock: ' + config.url)
var num = Math.random()
if (num > 0.02) {
if (num > 0.05) {
return {'status': 'fail', 'data': null, 'message': '预约失败,请尽快选择其他时段或座位', 'code': '1'}
} else {
return {'status': 'success', 'data': {'id': 3442608, 'receipt': '0175-608-1', 'onDate': '2018 年 07 月 23 日', 'begin': '21 : 30', 'end': '22 : 30', 'location': '信息馆2层东区东自然科学区,座位号009', 'checkedIn': false}, 'message': '', 'code': '0'}
Expand Down
Binary file added src/renderer/assets/last-android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/renderer/components/Body/Announce/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export default {

<style lang="scss" scoped>
@import '@/styles/index.scss';
$warp-width: 280px;
$warp-height: 300px;
$warp-width: 296px;
$warp-height: 330px;
$warp-padding: 20px;
.warp {
width: $warp-width;
Expand Down
17 changes: 11 additions & 6 deletions src/renderer/components/Body/History/index.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<div class="flex-row">
<div class="warp">
<el-table class="table" height="320" :data="reservations" border>
<el-table-column label="场馆">
<div v-loading="loading" :fullscreen="false" class="warp">
<el-table class="table" height="350" :data="reservations" border>
<el-table-column label="位置和时间">
<template slot-scope="scope">
<span style="display:block;">{{ scope.row.loc }}</span>
<span style="font-size:10px;font-family:'Times New Roman'!important;">{{ scope.row.date }}&nbsp;&nbsp;&nbsp;&nbsp;{{ scope.row.begin }} 到 {{ scope.row.end }}</span>
Expand Down Expand Up @@ -37,6 +37,7 @@ const emptyMessage = '数据加载失败'
export default {
data () {
return {
loading: false,
reservations: []
}
},
Expand All @@ -51,6 +52,7 @@ export default {
},
methods: {
initList () {
this.loading = true
libraryRestApi.History(1, 50, this.userToken).then((response) => {
if (response.data.status === 'success') {
this.reservations = response.data.data.reservations
Expand All @@ -62,7 +64,10 @@ export default {
message: response.data.message ? response.data.message : emptyMessage
})
}
}).catch(() => {})
this.loading = false
}).catch(() => {
this.loading = false
})
},
cancelReserve (index) {
if (!this.reservations[index].id) {
Expand Down Expand Up @@ -119,8 +124,8 @@ export default {

<style lang="scss" scoped>
@import '@/styles/index.scss';
$warp-width: 300px;
$warp-height: 320px;
$warp-width: 316px;
$warp-height: 350px;
$warp-padding: 10px;
.warp {
cursor: default!important;
Expand Down
16 changes: 13 additions & 3 deletions src/renderer/components/Body/Timer/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
:disabled="!timerInfo.complete"
type="primary"
:class="timerInfo.complete?'save-button':'button-disabled'"
:icon="timerInfo.status === 'working'?'el-icon-loading':null"
:style="timerInfo.status === 'working'?'width: 100px;':'width: 80px;'"
:icon="(timerInfo.status === 'working' || timerInfo.status === 'checking')?'el-icon-loading':null"
:style="(timerInfo.status === 'working' || timerInfo.status === 'checking')?'width: 100px;':'width: 80px;'"
@click="okBtnClicked()">
{{timerInfo.message}}
</el-button>
Expand Down Expand Up @@ -71,6 +71,14 @@ export default {
loginAndBookFunc: {
type: Function,
require: true
},
checkOpenAndBookFunc: {
type: Function,
require: true
},
isToday: {
type: Boolean,
require: true
}
},
components: {
Expand Down Expand Up @@ -130,6 +138,8 @@ export default {
bookFunc: this.bookFunc,
loginFunc: this.loginFunc,
loginAndBookFunc: this.loginAndBookFunc,
checkOpenAndBookFunc: this.checkOpenAndBookFunc,
isToday: this.isToday,
time: this.result
})
this.$message({
Expand All @@ -146,7 +156,7 @@ export default {
this.$store.dispatch('updateTimer', 'unset')
this.$message({
type: 'info',
duration: 1000,
duration: 1500,
showClose: true,
message: '已取消定时器'
})
Expand Down
16 changes: 10 additions & 6 deletions src/renderer/components/Body/User/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="flex-row">
<div class="warp">
<div v-loading="loading" :fullscreen="false" class="warp">
<span class="title">用户信息</span>
<span class="info"><span class="info-key">Id</span><span class="info-value">{{ userInfo.id }}</span></span>
<span class="info"><span class="info-key">姓名</span><span class="info-value">{{ userInfo.name }}</span></span>
Expand All @@ -11,7 +11,6 @@
<span class="info"><span class="info-key">最近签到地点</span><span class="info-value">{{ userInfo.lastInBuildingName }}</span></span>
<span class="info"><span class="info-key">最近登录时间</span><span class="info-value">{{ formatDate(new Date(userInfo.lastLogin)) }}</span></span>
<span class="info"><span class="info-key">违约次数</span><span class="info-value">{{ userInfo.violationCount }}&nbsp;次</span></span>
<!-- <span><span class="info-key"></span><span class="info-value">{{ violationCount }}</span></span> -->
</div>
</div>
</template>
Expand All @@ -37,7 +36,8 @@ export default {
lastOut: '无数据',
lastInBuildingName: '无数据',
violationCount: '无数据'
}
},
loading: false
}
},
computed: {
Expand All @@ -46,6 +46,7 @@ export default {
])
},
mounted () {
this.loading = true
libraryRestApi.User(this.userToken).then((response) => {
if (response.data.status === 'success') {
this.userInfo = response.data.data
Expand All @@ -57,7 +58,10 @@ export default {
message: response.data.message ? response.data.message : emptyMessage
})
}
}).catch(() => {})
this.loading = false
}).catch(() => {
this.loading = false
})
},
methods: {
formatDate (time) {
Expand All @@ -75,7 +79,7 @@ export default {

<style lang="scss" scoped>
@import '@/styles/index.scss';
$warp-width: 280px;
$warp-width: 296px;
$warp-height: 300px;
$warp-padding: 20px;
.warp {
Expand All @@ -97,7 +101,7 @@ $warp-padding: 20px;
}
.info {
display: block;
margin: 10px 0;
margin: 8px 0;
.info-key {
left: 0;
color: $text-color;
Expand Down
Loading

0 comments on commit 9be7b58

Please sign in to comment.