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 Sep 10, 2018
2 parents 9b212e8 + d6f41b9 commit 3fdac58
Show file tree
Hide file tree
Showing 18 changed files with 254 additions and 81 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

- Windows
- 安装包: `whu-library-seat-setup-<version>.exe`
- 链接: [v1.1.2](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.1.2/whu-library-seat-setup-1.1.2.exe)
- 链接: [v1.2.0](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.2.0/whu-library-seat-setup-1.2.0.exe)

- Mac OS
- 安装包: `whu-library-seat-<version>.dmg`
- 链接: [v1.1.2](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.1.2/whu-library-seat-1.1.2.dmg)
- 链接: [v1.2.0](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.2.0/whu-library-seat-1.2.0.dmg)

- Linux
- 安装包: `whu-library-seat-<version>-x86_64.AppImage`
- 链接: [v1.1.2](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.1.2/whu-library-seat-1.1.2-x86_64.AppImage)
- 链接: [v1.2.0](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.2.0/whu-library-seat-1.2.0-x86_64.AppImage)

### 安装软件

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

- Windows
- 安装包: `whu-library-seat-setup-<version>.exe`
- 链接: [v1.1.2](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.1.2/whu-library-seat-setup-1.1.2.exe)
- 链接: [v1.2.0](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.2.0/whu-library-seat-setup-1.2.0.exe)

- Mac OS
- 安装包: `whu-library-seat-<version>.dmg`
- 链接: [v1.1.2](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.1.2/whu-library-seat-1.1.2.dmg)
- 链接: [v1.2.0](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.2.0/whu-library-seat-1.2.0.dmg)

- Linux
- 安装包: `whu-library-seat-<version>-x86_64.AppImage`
- 链接: [v1.1.2](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.1.2/whu-library-seat-1.1.2-x86_64.AppImage)
- 链接: [v1.2.0](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.2.0/whu-library-seat-1.2.0-x86_64.AppImage)

### 安装软件

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.1.2",
"version": "1.2.0",
"author": "CS-Tao <[email protected]>",
"description": "武汉大学图书馆抢座软件",
"license": null,
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions src/renderer/api/gitcontents.api.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import axios from 'axios'
import { Message } from 'element-ui'
import urls from './urls'

var service = axios.create({
baseURL: 'https://raw.githubusercontent.com/CS-Tao/whu-library-seat',
timeout: 5000,
timeout: 8000,
withCredentials: true
})

Expand Down Expand Up @@ -33,7 +34,7 @@ export default {
// 用户验证
validateUser: () => {
return service({
url: '/user-validation/validation.json',
url: urls.gitcontents.validateUser.url(),
method: 'get',
params: {
time: new Date()
Expand Down
32 changes: 23 additions & 9 deletions src/renderer/api/library.api.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import request from './config'
import urls from './urls'

export default {
// 登录
Login: (account, passwd) => {
return request({
url: '/rest/auth',
url: urls.library.Login.url(),
method: 'get',
params: {
username: account,
Expand All @@ -15,7 +16,7 @@ export default {
// 得到可以使用的房间信息
FreeFilters: (token) => {
return request({
url: '/rest/v2/free/filters',
url: urls.library.FreeFilters.url(),
method: 'get',
headers: {
token
Expand All @@ -25,7 +26,7 @@ export default {
// 得到房间详细信息
RoomStats: (libraryId, token) => {
return request({
url: '/rest/v2/room/stats2/' + libraryId,
url: urls.library.RoomStats.url(libraryId),
method: 'get',
headers: {
token
Expand All @@ -35,7 +36,7 @@ export default {
// 验证 token 是否可用
ValidateToken: (token) => {
return request({
url: '/rest/v2/violations',
url: urls.library.ValidateToken.url(),
method: 'get',
headers: {
token
Expand All @@ -45,18 +46,31 @@ export default {
// 得到位置详细信息
LayoutByDate: (roomId, dateStr, token) => {
return request({
url: '/rest/v2/room/layoutByDate/' + roomId + '/' + dateStr,
url: urls.library.LayoutByDate.url(roomId, dateStr),
method: 'get',
headers: {
token
}
})
},
// 按时间搜索位置
// startTime=1290&endTime=1350
// t=1&roomId=7&buildingId=1&batch=9999&page=1&t2=2
SearchSeat: (buildingId, roomId, dateStr, startTime, endTime, token) => {
return request({
url: urls.library.SearchSeat.url(dateStr, startTime, endTime),
method: 'post',
headers: {
token
},
data: `t=1&roomId=${roomId}&buildingId=${buildingId}&batch=9999&page=1&t2=2`
})
},
// 预约位置
// t=1&startTime=1290&endTime=1350&seat=5728&date=2018-07-23&t2=2
Book: (t, t2, startTime, endTime, seat, date, token) => {
return request({
url: '/rest/v2/freeBook',
url: urls.library.Book.url(),
method: 'post',
headers: {
token
Expand All @@ -67,7 +81,7 @@ export default {
// 取消预约
Cancel: (id, token) => {
return request({
url: '/rest/v2/cancel/' + id,
url: urls.library.Cancel.url(id),
method: 'get',
headers: {
token
Expand All @@ -77,7 +91,7 @@ export default {
// 得到用户信息
User: (token) => {
return request({
url: '/rest/v2/user',
url: urls.library.User.url(),
method: 'get',
headers: {
token
Expand All @@ -87,7 +101,7 @@ export default {
// 得到预约历史
History: (page, count, token) => {
return request({
url: '/rest/v2/history/' + page + '/' + count,
url: urls.library.History.url(page, count),
method: 'get',
headers: {
token
Expand Down
File renamed without changes.
37 changes: 37 additions & 0 deletions src/renderer/api/mock/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Mock from 'mockjs'
import gitcontentsApi from './gitcontents.api'
import libraryApi from './library.api'
import urls from '../urls'

// 用户验证
Mock.mock(urls.gitcontents.validateUser.regular, 'get', gitcontentsApi.validateUser)

// 登录
Mock.mock(urls.library.Login.regular, 'get', libraryApi.Login)

// 得到可以使用的房间信息
Mock.mock(urls.library.FreeFilters.regular, 'get', libraryApi.FreeFilters)

// 得到房间详细信息
Mock.mock(urls.library.RoomStats.regular, 'get', libraryApi.RoomStats)

// 验证 token 是否可用
Mock.mock(urls.library.ValidateToken.regular, 'get', libraryApi.ValidateToken)

// 得到位置详细信息
Mock.mock(urls.library.LayoutByDate.regular, 'get', libraryApi.LayoutByDate)

// 按时间搜索位置
Mock.mock(urls.library.SearchSeat.regular, 'post', libraryApi.SearchSeat)

// 预约位置
Mock.mock(urls.library.Book.regular, 'post', libraryApi.Book)

// 取消预约
Mock.mock(urls.library.Cancel.regular, 'get', libraryApi.Cancel)

// 得到用户信息
Mock.mock(urls.library.User.regular, 'get', libraryApi.User)

// 得到预约历史
Mock.mock(urls.library.History.regular, 'get', libraryApi.History)
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ export default {
console.log('Mock: ' + config.url)
return {'status': 'success', 'data': {'reservations': [{'id': 3455821, 'date': '2018-7-27', 'begin': '21:57', 'end': '19:00', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆2层西区西自然科学区042号', 'stat': 'CANCEL'}, {'id': 3455625, 'date': '2018-7-27', 'begin': '18:30', 'end': '19:00', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆2层西区西自然科学区042号', 'stat': 'CANCEL'}, {'id': 3455632, 'date': '2018-7-27', 'begin': '18:30', 'end': '19:00', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆2层西区西自然科学区042号', 'stat': 'CANCEL'}, {'id': 3455591, 'date': '2018-7-27', 'begin': '18:00', 'end': '19:00', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆2层西区西自然科学区042号', 'stat': 'CANCEL'}, {'id': 3442608, 'date': '2018-7-23', 'begin': '21:30', 'end': '22:30', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆2层东区东自然科学区009号', 'stat': 'CANCEL'}, {'id': 3442606, 'date': '2018-7-23', 'begin': '21:14', 'end': '22:00', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆2层西区西自然科学区066号', 'stat': 'CANCEL'}, {'id': 3438064, 'date': '2018-7-22', 'begin': '14:30', 'end': '18:00', 'awayBegin': '17:33', 'awayEnd': null, 'loc': '信息馆3层东区东社会科学区018号', 'stat': 'COMPLETE'}, {'id': 3435621, 'date': '2018-7-21', 'begin': '20:00', 'end': '22:30', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆3层东区东社会科学区018号', 'stat': 'STOP'}, {'id': 3435017, 'date': '2018-7-21', 'begin': '14:04', 'end': '22:00', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆3层东区东社会科学区018号', 'stat': 'STOP'}, {'id': 3431464, 'date': '2018-7-20', 'begin': '15:00', 'end': '18:30', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆2层东区东自然科学区054号', 'stat': 'CANCEL'}, {'id': 3347961, 'date': '2018-7-1', 'begin': '09:00', 'end': '12:30', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆1层西区3C创客空间104号', 'stat': 'MISS'}, {'id': 3346080, 'date': '2018-6-30', 'begin': '16:03', 'end': '22:30', 'awayBegin': '22:03', 'awayEnd': null, 'loc': '信息馆2层西区西自然科学区021号', 'stat': 'COMPLETE'}, {'id': 3345151, 'date': '2018-6-30', 'begin': '14:30', 'end': '22:30', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆3层自主学习区172号', 'stat': 'STOP'}, {'id': 3341979, 'date': '2018-6-30', 'begin': '09:00', 'end': '22:30', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆1层西区3C创客空间103号', 'stat': 'STOP'}, {'id': 3341259, 'date': '2018-6-30', 'begin': '08:30', 'end': '22:30', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆1层西区3C创客空间103号', 'stat': 'CANCEL'}, {'id': 3338764, 'date': '2018-6-30', 'begin': '08:00', 'end': '22:30', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆1层西区3C创客空间100号', 'stat': 'CANCEL'}, {'id': 3339195, 'date': '2018-6-30', 'begin': '08:00', 'end': '22:30', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆1层西区3C创客空间103号', 'stat': 'CANCEL'}, {'id': 3334145, 'date': '2018-6-29', 'begin': '12:00', 'end': '14:00', 'awayBegin': '13:59', 'awayEnd': null, 'loc': '信息馆1层西区3C创客空间017号', 'stat': 'COMPLETE'}, {'id': 3329567, 'date': '2018-6-29', 'begin': '08:00', 'end': '12:30', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆3层自主学习区094号', 'stat': 'CANCEL'}, {'id': 3331464, 'date': '2018-6-29', 'begin': '08:00', 'end': '12:30', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆1层西区3C创客空间017号', 'stat': 'STOP'}, {'id': 3326046, 'date': '2018-6-28', 'begin': '18:00', 'end': '22:30', 'awayBegin': '22:19', 'awayEnd': null, 'loc': '信息馆3层自主学习区021号', 'stat': 'COMPLETE'}, {'id': 3308589, 'date': '2018-6-27', 'begin': '08:30', 'end': '12:30', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆3层自主学习区092号', 'stat': 'CANCEL'}, {'id': 3305612, 'date': '2018-6-27', 'begin': '08:00', 'end': '12:30', 'awayBegin': null, 'awayEnd': null, 'loc': '信息馆3层自主学习区092号', 'stat': 'CANCEL'}]}, 'message': '', 'code': '0'}
},
SearchSeat: config => {
console.log('Mock: ' + config.url)
return {'data': {'seats': {'7019': {'id': 5861, 'name': '028', 'type': 'seat', 'status': 'FREE', 'window': false, 'power': true, 'computer': false, 'local': false}, '18021': {'id': 6094, 'name': '063', 'type': 'seat', 'status': 'FREE', 'window': true, 'power': true, 'computer': false, 'local': false}, '22008': {'id': 6165, 'name': '078', 'type': 'seat', 'status': 'FREE', 'window': true, 'power': true, 'computer': false, 'local': false}}, 'page': 1, 'hasMore': false}, 'message': null, 'status': true}
},
LayoutByDate: config => {
console.log('Mock: ' + config.url)
return {'status': 'success',
return {
'status': 'success',
'data': {'id': 7,
'name': '东自然科学区',
'cols': 23,
Expand Down
85 changes: 85 additions & 0 deletions src/renderer/api/urls/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
const urls = {
gitcontents: {
// 用户验证
validateUser: {
url () {
return '/user-validation/validation.json'
},
regular: /\/user-validation\/validation.json/
}
},
library: {
// 登录
Login: {
url () {
return '/rest/auth'
},
regular: /\/rest\/auth/
},
// 得到可以使用的房间信息
FreeFilters: {
url () {
return '/rest/v2/free/filters'
},
regular: /\/rest\/v2\/free\/filters/
},
// 得到房间详细信息
RoomStats: {
url (libraryId) {
return `/rest/v2/room/stats2/${libraryId}`
},
regular: /\/rest\/v2\/room\/stats2\//
},
ValidateToken: {
// 验证 token 是否可用
url () {
return '/rest/v2/violations'
},
regular: /\/rest\/v2\/violations/
},
// 得到位置详细信息
LayoutByDate: {
url (roomId, dateStr) {
return `/rest/v2/room/layoutByDate/${roomId}/${dateStr}`
},
regular: /\/rest\/v2\/room\/layoutByDate\//
},
// 按时间搜索位置
SearchSeat: {
url (dateStr, startTime, endTime) {
return `/rest/v2/searchSeats/${dateStr}/${startTime}/${endTime}`
},
regular: /\/rest\/v2\/searchSeats\//
},
// 预约位置
Book: {
url () {
return '/rest/v2/freeBook'
},
regular: /\/rest\/v2\/freeBook/
},
// 取消预约
Cancel: {
url (id) {
return `/rest/v2/cancel/${id}`
},
regular: /\/rest\/v2\/cancel\//
},
// 得到用户信息
User: {
url () {
return '/rest/v2/user'
},
regular: /\/rest\/v2\/user/
},
// 得到预约历史
History: {
url (page, count) {
return `/rest/v2/history/${page}/${count}`
},
regular: /\/rest\/v2\/history\//
}
}
}

export default urls
2 changes: 1 addition & 1 deletion src/renderer/components/Body/Timer/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
label-width="40px"
class="flex-row">
<span class="form-item title">
<svg @mousedown="transparent=0.001" @mouseup="transparent=1" @mouseout="transparent=1" class="hide-icon" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="328.911px" height="328.911px" viewBox="0 0 328.911 328.911" style="enable-background:new 0 0 328.911 328.911;" xml:space="preserve"><g><path d="M310.206,18.71C297.735,6.242,282.657,0.007,264.958,0.007H63.954c-17.703,0-32.79,6.235-45.253,18.704C6.235,31.177,0,46.261,0,63.96v200.991c0,17.515,6.232,32.552,18.701,45.11c12.467,12.566,27.553,18.843,45.253,18.843h201.004c17.699,0,32.777-6.276,45.248-18.843c12.47-12.559,18.705-27.596,18.705-45.11V63.96C328.911,46.261,322.672,31.177,310.206,18.71z M292.362,264.96c0,7.614-2.673,14.089-8.001,19.414c-5.324,5.332-11.799,7.994-19.41,7.994H63.954c-7.614,0-14.082-2.662-19.414-7.994c-5.33-5.325-7.992-11.8-7.992-19.414V63.965c0-7.613,2.662-14.086,7.992-19.414c5.327-5.327,11.8-7.994,19.414-7.994h201.004c7.61,0,14.086,2.663,19.41,7.994c5.325,5.328,7.994,11.801,7.994,19.414V264.96z"/><path d="M246.683,146.189H82.229c-2.664,0-4.858,0.855-6.567,2.568c-1.711,1.713-2.568,3.903-2.568,6.567v18.271c0,2.666,0.854,4.855,2.568,6.563c1.713,1.708,3.903,2.57,6.567,2.57h164.454c2.662,0,4.853-0.862,6.563-2.57c1.712-1.708,2.563-3.897,2.563-6.563v-18.271c0-2.664-0.852-4.857-2.563-6.567C251.536,147.048,249.345,146.189,246.683,146.189z"/></g></svg>
<svg @mousedown="transparent=0.001" @mouseup="transparent=1" @mouseout="transparent=1" class="hide-icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1971" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M273.066667 273.066667h136.533333v68.266666H273.066667zM273.066667 477.866667h136.533333v68.266666H273.066667z" p-id="1972"></path><path d="M68.266667 68.266667v887.466666h887.466666V68.266667H68.266667z m819.2 819.2H136.533333V136.533333h750.933334v750.933334z" p-id="1973"></path><path d="M273.066667 682.666667h136.533333v68.266666H273.066667z" p-id="1974"></path></svg>
定时器
</span>
<el-form-item label="日期" class="form-item">
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/Body/User/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<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>
<span class="info"><span class="info-key">学号</span><span class="info-value">{{ userInfo.username }}</span></span>
<span class="info"><span class="info-key">状态</span><span class="info-value">{{ userInfo.status }}</span></span>
<span class="info"><span class="info-key">是否签到</span><span class="info-value">{{ userInfo.checkedIn === null?'无数据':(userInfo.checkedIn?'':'') }}</span></span>
<span class="info"><span class="info-key">最近入馆</span><span class="info-value">{{ userInfo.lastIn }}</span></span>
<span class="info"><span class="info-key">最近出馆</span><span class="info-value">{{ userInfo.lastOut }}</span></span>
<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>
Expand Down
Loading

0 comments on commit 3fdac58

Please sign in to comment.