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 Oct 28, 2018
2 parents b0e6ae6 + fff3fb6 commit 07f0c11
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 50 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@
### 最新版本下载

- Windows
- 链接: [whu-library-seat-setup-1.5.0.exe](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.5.0/whu-library-seat-setup-1.5.0.exe)
- 链接: [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)

- Mac OS
- 链接: [whu-library-seat-1.5.0.dmg](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.5.0/whu-library-seat-1.5.0.dmg)
- 链接: [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)

- Linux
- 链接: [whu-library-seat-1.5.0-x86_64.AppImage](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.5.0/whu-library-seat-1.5.0-x86_64.AppImage)
- 链接: [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)

### 安装软件

运行安装包即可

### 申请软件使用权

> 不再对桌面版本低于 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])(请在邮件中注明学号、院系和姓名)

当然,因为本软件为开源软件,您可以在遵守本软件[版权声明](#版权声明)的前提下,自己构建软件并删除其中的认证代码,具体请查看[面向开发者](#面向开发者)
Expand Down
6 changes: 3 additions & 3 deletions docs/specification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
#### 桌面端下载

- Windows
- 链接: [whu-library-seat-setup-1.5.0.exe](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.5.0/whu-library-seat-setup-1.5.0.exe)
- 链接: [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)

- Mac OS
- 链接: [whu-library-seat-1.5.0.dmg](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.5.0/whu-library-seat-1.5.0.dmg)
- 链接: [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)

- Linux
- 链接: [whu-library-seat-1.5.0-x86_64.AppImage](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.5.0/whu-library-seat-1.5.0-x86_64.AppImage)
- 链接: [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)

#### 移动端下载

Expand Down
4 changes: 1 addition & 3 deletions docs/specification/reservation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

### 选择座位

在主界面中选择日期、时间、场馆、房间、位置等参数,选中电源图标或太阳图标可以对座位进行预筛选(当您选择的座位已经被别人预约时,经过预筛选的座位会被优先选择)

您选择的除了日期之外的所有参数都会被保存到配置文件中,以便下次读取
在主界面中选择日期、时间、场馆、房间、位置等参数,选中电源图标或太阳图标可以对座位进行预筛选(当您选择的座位已经被别人预约时,经过预筛选的座位会被优先选择),在座位号的下拉列表中,座位号为红色表示当前座位处于不可用的状态

### 定时抢座

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "whu-library-seat",
"version": "1.5.0",
"version": "1.6.0",
"author": "CS-Tao <[email protected]>",
"description": "武汉大学图书馆抢座软件",
"license": null,
Expand Down
12 changes: 11 additions & 1 deletion src/main/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

import { autoUpdater } from 'electron-updater'
import { app, BrowserWindow, Menu, Tray, ipcMain, screen } from 'electron'
import { app, BrowserWindow, Menu, Tray, ipcMain, screen, session } from 'electron'
import path from 'path'
import Store from 'electron-store'
import notifier from 'node-notifier'
Expand Down Expand Up @@ -221,6 +221,16 @@ function createWindow () {
mainWindow.setPosition(position[0], position[1] === -1 ? mainWindow.getPosition()[1] : position[1])
}

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'
callback({ cancel: false, requestHeaders: details.requestHeaders }) // eslint-disable-line
})

mainWindow.loadURL(winURL)

mainWindow.onbeforeunload = (e) => {
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/api/library.api.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import request from './config'
import urls from './urls'
import Mock from 'mockjs'

export default {
// 登录
Login: (account, passwd) => {
return request({
url: urls.library.Login.url(),
method: urls.library.Login.method,
headers: {
token: Mock.mock(/[A-Z\d]{18}/)
},
params: {
username: account,
password: passwd
Expand Down
83 changes: 69 additions & 14 deletions src/renderer/components/Body/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
<el-form v-show="showMode==='normal'" :model="form" ref="seatForm" label-width="50px" class="flex-row form">
<div style="margin:auto;text-align:center;">
<el-form-item label="日期">
<el-select v-model="form.date" placeholder="请选择日期" class="input">
<el-select v-model="form.date" placeholder="请选择日期" class="input" @change="updateSeatsStatus()">
<el-option key="0" label="今天" :value="freeDates[0]"><span>今天&nbsp;&nbsp;{{freeDates[0]}}</span></el-option>
<el-option key="1" label="明天" :value="freeDates[1]"><span>明天&nbsp;&nbsp;{{freeDates[1]}}</span></el-option>
</el-select>
</el-form-item>
<el-form-item label="时间">
<el-select v-model="form.beginTime" placeholder="开始时间" class="time-input">
<el-select v-model="form.beginTime" placeholder="开始时间" class="time-input" @change="updateSeatsStatus()">
<el-option v-for="time in freeBeginTime" :key="time.time" :label="time.label" :value="time.time"></el-option>
</el-select>
<el-select v-model="form.endTime" placeholder="结束时间" class="time-input">
<el-select v-model="form.endTime" placeholder="结束时间" class="time-input" @change="updateSeatsStatus()">
<el-option v-for="time in freeEndTime" :key="time.time" :label="time.label" :value="time.time"></el-option>
</el-select>
</el-form-item>
Expand All @@ -26,15 +26,16 @@
<el-option v-for="room in singleLibRooms" :key="room[0]" :label="room[1]" :value="room[0]">
<span class="room-option-name">{{ room[1] }}</span>
<span class="room-option-floor">{{ room[3] }} F</span>
<span v-if="getRoomDetail(room[0])" :class=" getRoomDetail(room[0]).free > 0 ? 'room-option-free-green' : 'room-option-free'">{{ getRoomDetail(room[0]).free }}&nbsp;座可用</span>
<span v-if="getRoomDetail(room[0])" :class=" getRoomDetail(room[0]).free > 0 ? 'room-option-free-green' : 'room-option-free'">{{ getRoomDetail(room[0]).free }}&nbsp;座空闲</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="位置" :inline="true" style="flex-col">
<el-select v-model="form.seatNum" placeholder="座位号" class="num">
<el-option v-for="n in seatsForSelect.length" :key="n-1" :label="seatsForSelect[n-1].name" :value="seatsForSelect[n-1].id">
<span class="seat-option-left">{{ seatsForSelect[n-1].name }}</span>
<span class="seat-option-left" :style="{color: getSeatColor(seatsForSelect[n-1].id)}">{{ seatsForSelect[n-1].name }}</span>
<span class="seat-option-right">
<svg class="seat-flag" :class="{'seat-flag-computer':seatsForSelect[n-1].computer}" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M750.81728 870.23616 273.18272 870.23616c-18.80064 0-34.11968 34.11968-34.11968 34.11968l0 34.11968 545.87392 0 0-34.11968C784.93696 885.5552 769.61792 870.23616 750.81728 870.23616z"></path><path d="M853.17632 85.52448 170.82368 85.52448c-56.50432 0-102.35904 45.85472-102.35904 102.35904l0 477.65504c0 56.50432 45.85472 102.35904 102.35904 102.35904l238.81728 0 0 34.11968c0 18.80064 15.31904 34.11968 34.11968 34.11968l136.47872 0c18.80064 0 34.11968-17.59232 34.11968-34.11968 0-7.12704 0-20.84864 0-34.11968l238.81728 0c56.50432 0 102.35904-45.83424 102.35904-102.35904L955.53536 187.88352C955.53536 131.3792 909.68064 85.52448 853.17632 85.52448zM170.82368 631.41888c-18.80064 0-34.11968-15.31904-34.11968-34.11968L136.704 187.88352c0-18.80064 15.31904-34.11968 34.11968-34.11968l682.35264 0c18.80064 0 34.11968 15.31904 34.11968 34.11968l0 409.41568c0 18.80064-15.31904 34.11968-34.11968 34.11968L170.82368 631.41888zM853.13536 735.0272c-19.49696 0-35.30752-15.83104-35.30752-35.38944 0-19.51744 15.83104-35.38944 35.30752-35.38944 19.5584 0 35.38944 15.85152 35.38944 35.38944C888.5248 719.19616 872.69376 735.0272 853.13536 735.0272z"></path></svg>
<svg class="seat-flag" :class="{'seat-flag-power':seatsForSelect[n-1].power}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 313.585 313.585" style="enable-background:new 0 0 313.585 313.585;" xml:space="preserve"><g><path d="M260.287,69.487c3.541,0,6.427,2.879,6.427,6.427v26.511v12.854h12.854h14.737c3.541,0,6.427,2.879,6.427,6.427v70.168 c0,3.541-2.886,6.427-6.427,6.427h-14.737h-12.854v12.854v26.511c0,3.541-2.886,6.427-6.427,6.427H19.281 c-3.554,0-6.427-2.886-6.427-6.427V75.914c0-3.548,2.873-6.427,6.427-6.427H260.287 M260.287,56.633H19.281 C8.631,56.633,0,65.271,0,75.914v161.757c0,10.636,8.631,19.281,19.281,19.281h241.006c10.636,0,19.281-8.644,19.281-19.281V211.16 h14.737c10.636,0,19.28-8.644,19.28-19.281v-70.175c0-10.643-8.644-19.281-19.28-19.281h-14.737V75.914 C279.567,65.271,270.93,56.633,260.287,56.633L260.287,56.633z M44.454,99.475H78.69v114.616H44.454 C44.454,214.091,44.454,99.475,44.454,99.475z M96.422,99.475h34.236v114.616H96.422V99.475z M148.376,99.475h34.236v114.629 h-34.236V99.475z"/></g></svg>
<svg class="seat-flag" :class="{'seat-flag-window':seatsForSelect[n-1].window}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 511.34 511.34" style="enable-background:new 0 0 511.34 511.34;" xml:space="preserve"><g><path d="M497.78,326.334l-51.395-70.808l51.395-70.804c1.711-2.475,2.088-5.232,1.14-8.276c-0.767-2.859-2.669-4.762-5.712-5.712 l-83.363-27.408V55.959c0-3.044-1.242-5.519-3.721-7.421c-2.85-1.902-5.615-2.284-8.274-1.143l-83.367,26.836L263.092,3.427 C261.378,1.143,258.905,0,255.667,0c-3.234,0-5.708,1.146-7.422,3.427l-51.394,70.805l-83.368-26.836 c-2.662-1.142-5.424-0.76-8.28,1.143c-2.474,1.903-3.711,4.377-3.711,7.421v87.366l-83.367,27.408 c-3.044,0.953-4.947,2.856-5.708,5.712c-0.95,3.044-0.571,5.802,1.143,8.276l51.391,70.804L13.56,326.334 c-1.714,2.282-2.093,5.041-1.143,8.278c0.76,2.847,2.664,4.753,5.708,5.712l83.367,27.407v87.364c0,3.043,1.237,5.521,3.711,7.423 c2.856,1.903,5.618,2.283,8.28,1.144l83.368-26.837l51.394,70.805c1.902,2.471,4.377,3.71,7.422,3.71s5.522-1.239,7.424-3.71 l51.391-70.805l83.371,26.837c2.659,1.143,5.421,0.76,8.271-1.144c2.479-1.902,3.721-4.38,3.721-7.423v-87.364l83.363-27.407 c3.043-0.955,4.945-2.861,5.712-5.712C499.875,331.375,499.491,328.616,497.78,326.334z M407.134,319.339 c-8.661,20.27-20.365,37.78-35.114,52.534c-14.753,14.749-32.261,26.456-52.534,35.118c-20.266,8.657-41.541,12.99-63.811,12.99 c-22.27,0-43.537-4.333-63.81-12.99c-20.27-8.665-37.782-20.369-52.532-35.118c-14.75-14.754-26.455-32.265-35.117-52.534 c-8.66-20.272-12.99-41.541-12.99-63.813c0-22.27,4.331-43.537,12.99-63.81c8.658-20.27,20.367-37.781,35.117-52.534 c14.753-14.749,32.262-26.457,52.532-35.115c20.27-8.663,41.54-12.99,63.81-12.99c22.266,0,43.545,4.327,63.811,12.99 c20.273,8.658,37.781,20.366,52.534,35.115c14.749,14.753,26.453,32.264,35.114,52.534c8.658,20.273,12.991,41.543,12.991,63.81 C420.125,277.798,415.789,299.066,407.134,319.339z"/></g></svg>
</span>
Expand Down Expand Up @@ -97,6 +98,7 @@ export default {
singleLibRooms: [],
seats: [],
seatsForSelect: [],
seatsForSelectIsAvailable: null,
seatsSearched: null,
reserveTime: null,
checkReserveTime: false,
Expand Down Expand Up @@ -134,6 +136,11 @@ export default {
return this.userAccount === 2015302590039 || this.userAccount === 2017302590175
}
},
watch: {
seats () {
this.updateSeatsStatus()
}
},
mounted () {
this.form = {...this.seatInfo}
this.form.date = this.freeDates.length > 0 ? this.freeDates[0] : null
Expand All @@ -159,19 +166,19 @@ export default {
this.singleLibRooms.sort((x, y) => {
return parseInt(x[3]) - parseInt(y[3])
})
libraryRestApi.RoomStats(this.form.library, this.userToken).then((reponse) => {
if (reponse.data.status === 'success') {
this.roomsDetial = reponse.data.data
libraryRestApi.RoomStats(this.form.library, this.userToken).then((response) => {
if (response.data.status === 'success') {
this.roomsDetial = response.data.data
}
}).catch(() => {})
this.form.room = null
this.form.seatNum = null
},
roomChanged () {
if (this.form.room === null || this.form.date === null) { return }
this.seats = []
libraryRestApi.LayoutByDate(this.form.room, this.form.date, this.userToken).then((response) => {
if (response.data.status === 'success') {
this.seats = []
for (var key in response.data.data.layout) {
this.seats.push(response.data.data.layout[key])
}
Expand Down Expand Up @@ -389,7 +396,7 @@ export default {
} else {
if (response.data.code === 1 || response.data.code === '1') {
// 位置不可用,如果未达抢座上限则继续抢
usageApi.grabState(this.userAccount, false, 12, `位置不可用,如果未达抢座上限则继续抢(${this.grabCount}/${maxGrabCount}):${response.data.message}`)
usageApi.grabState(this.userAccount, false, 12, `位置不可用,如果未达抢座上限则继续抢(${seatNum}:${this.grabCount}/${maxGrabCount}):${response.data.message}`)
this.grabCount += 1
var cancelCurrentBool = response.data.message === '已有1个有效预约,请在使用结束后再次进行选择' && this.grabCount < 2
var newSeatId = -1
Expand Down Expand Up @@ -434,7 +441,9 @@ export default {
// 结束打印
// 开始下一次抢座
if (!this.isVip) {
this.sleep(100)
this.sleep(200)
} else {
this.sleep(120)
}
if (this.grabCount === arbitraryGrabCount) {
this.searchSeatsByTime(this.form.library, this.form.room, date, beginTime, endTime, userToken)
Expand Down Expand Up @@ -468,6 +477,7 @@ export default {
}
}
}).catch((error) => {
this.$store.dispatch('updateTimer', 'fail')
usageApi.grabState(this.userAccount, false, 20, `预约出现异常:${error.message}`)
})
},
Expand Down Expand Up @@ -546,6 +556,48 @@ export default {
}).catch(() => {
this.seatsSearched = null
})
},
updateSeatsStatus () {
this.seatsForSelectIsAvailable = null
if (this.form.library === null ||
this.form.room === null ||
this.form.date === null ||
this.form.beginTime === null ||
this.form.endTime === null) {
return
}
libraryRestApi.SearchSeat(
this.form.library,
this.form.room,
this.form.date,
this.form.beginTime,
this.form.endTime,
this.userToken).then((response) => {
if (response.data.status) {
this.seatsForSelectIsAvailable = []
if (response.data.data.seats) {
for (var key in response.data.data.seats) {
if (response.data.data.seats[key].status === 'FREE') {
this.seatsForSelectIsAvailable.push(response.data.data.seats[key].id)
}
}
}
} else {
this.seatsForSelectIsAvailable = null
}
}).catch(() => {
this.seatsForSelectIsAvailable = null
})
},
getSeatColor (seatId) {
if (this.seatsForSelectIsAvailable === null) {
// 数据未获取
return null
} else if (this.seatsForSelectIsAvailable.length === 0 || !this.seatsForSelectIsAvailable.includes(seatId)) {
return 'red'
} else {
return 'rgb(0, 204, 0)'
}
}
}
}
Expand All @@ -564,7 +616,7 @@ export default {
margin: 0 3px;
}
.num {
width: 120px;
width: 130px;
flex: 1;
float: left;
margin: 0 5px;
Expand Down Expand Up @@ -647,16 +699,19 @@ export default {
.seat-option-right {
float: right;
.seat-flag {
cursor: default;
cursor: pointer;
margin: 0 0 0 5px;
fill: $text-color-lowlight;
width: $text-size-small;
width: $text-size-small + 1;
}
.seat-flag-power {
fill: $button-green;
}
.seat-flag-window {
fill: $button-yellow;
}
.seat-flag-computer {
fill: $button-blue;
}
}
</style>
25 changes: 0 additions & 25 deletions src/renderer/store/modules/Counter.js

This file was deleted.

0 comments on commit 07f0c11

Please sign in to comment.