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 Dec 19, 2019
2 parents f7c97bf + cba756f commit 8cc72bc
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 19 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
### 最新版本下载

- Windows
- 链接: [whu-library-seat-setup-1.9.0.exe](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.0/whu-library-seat-setup-1.9.0.exe)
- 备用地址: [whu-library-seat-setup-1.9.0.exe](https://assets.cs-tao.cc/whu-library-seat/releases/v1.9.0/whu-library-seat-setup-1.9.0.exe)
- 链接: [whu-library-seat-setup-1.9.1.exe](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.1/whu-library-seat-setup-1.9.1.exe)
- 备用地址: [whu-library-seat-setup-1.9.1.exe](https://assets.cs-tao.cc/whu-library-seat/releases/v1.9.1/whu-library-seat-setup-1.9.1.exe)

- Mac OS
- 链接: [whu-library-seat-1.9.0.dmg](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.0/whu-library-seat-1.9.0.dmg)
- 备用地址: [whu-library-seat-1.9.0.dmg](https://assets.cs-tao.cc/whu-library-seat/releases/v1.9.0/whu-library-seat-1.9.0.dmg)
- 链接: [whu-library-seat-1.9.1.dmg](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.1/whu-library-seat-1.9.1.dmg)
- 备用地址: [whu-library-seat-1.9.1.dmg](https://assets.cs-tao.cc/whu-library-seat/releases/v1.9.1/whu-library-seat-1.9.1.dmg)

- Linux
- 链接: [whu-library-seat-1.9.0-x86_64.AppImage](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.0/whu-library-seat-1.9.0-x86_64.AppImage)
- 备用地址: [whu-library-seat-1.9.0-x86_64.AppImage](https://assets.cs-tao.cc/whu-library-seat/releases/v1.9.0/whu-library-seat-1.9.0-x86_64.AppImage)
- 链接: [whu-library-seat-1.9.1-x86_64.AppImage](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.1/whu-library-seat-1.9.1-x86_64.AppImage)
- 备用地址: [whu-library-seat-1.9.1-x86_64.AppImage](https://assets.cs-tao.cc/whu-library-seat/releases/v1.9.1/whu-library-seat-1.9.1-x86_64.AppImage)

### 安装软件

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "whu-library-seat",
"version": "1.9.0",
"version": "1.9.1",
"author": "CS-Tao <whucstao@qq.com>",
"description": "武汉大学图书馆抢座软件",
"license": null,
Expand Down Expand Up @@ -74,6 +74,7 @@
"vue-markdown": "^2.2.4",
"vue-router": "^2.5.3",
"vuepress-theme-vue": "^1.0.3",
"vuetrend": "^0.3.4",
"vuex": "^2.3.1"
},
"devDependencies": {
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 @@ -20,7 +20,7 @@ export default {
Book: config => {
console.log('Mock: ' + config.url)
var num = Math.random()
if (num > 0.5) {
if (num > 0.02) {
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
106 changes: 97 additions & 9 deletions src/renderer/components/Body/Monitor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,18 @@
:max="360">
</el-input-number>
</el-form-item>
<div class="form-item" style="text-align: center;">
<div class="spark-line">
<v-trend
:data="spark.data"
:gradient="spark.color"
:height="40"
:max="20"
:min="-20"
:padding="4"
auto-draw>
</v-trend>
</div>
<div class="form-item" style="text-align: center;margin-top:0;">
<el-button
:disabled="isWorking"
type="primary"
Expand All @@ -71,6 +82,11 @@
</template>

<script>
import VTrend from 'vuetrend'
import { monitorStatuses } from './mixin'
const sparkLength = 300
export default {
name: 'monitor-form',
props: {
Expand Down Expand Up @@ -115,13 +131,33 @@ export default {
require: true
}
},
components: {
'v-trend': VTrend
},
data () {
return {
interval: 1500,
last: 60,
intervalTooLowWarned: false
intervalTooLowWarned: false,
spark: {
enable: true,
data: new Array(sparkLength).fill(0),
nextValue: 0,
color: ['#8fc8fc', '#62d9a3', '#4c5e70']
}
}
},
watch: {
workingStatus () {
this.spark.nextValue = this.getSparkValueOfStatus(this.workingStatus)
}
},
mounted () {
this.loopSparkLine()
},
beforeDestroy () {
this.stopSparkLine()
},
methods: {
okBtnClicked () {
this.$emit('btnClick', {
Expand All @@ -137,6 +173,23 @@ export default {
btn: 'cancel'
})
},
loopSparkLine () {
var loop = () => {
if (!this.spark.enable) {
return
}
this.spark.data.unshift(...this.getSparkPattern(this.spark.nextValue))
this.spark.data = this.spark.data.slice(0, sparkLength)
if (this.spark.nextValue !== 0) {
this.spark.nextValue = 0
}
window.requestAnimationFrame(loop)
}
window.requestAnimationFrame(loop)
},
stopSparkLine () {
this.spark.enable = false
},
warnIntervalTooLow () {
if (!this.intervalTooLowWarned) {
if (this.interval < 1500) {
Expand All @@ -149,6 +202,37 @@ export default {
}
this.intervalTooLowWarned = true
}
},
getSparkValueOfStatus (status) {
switch (status) {
case monitorStatuses.unstart:
return 0
case monitorStatuses.starting:
return 20
case monitorStatuses.checking:
return Math.random() > 0.5 ? 40 : -40
case monitorStatuses.checkFailed:
return -20
case monitorStatuses.checkSuccessfulYes:
return 32
case monitorStatuses.checkSuccessfulNo:
return -32
case monitorStatuses.grabingSeat:
return 28
case monitorStatuses.grabFailed:
return -40
case monitorStatuses.grabSuccessful:
return 40
case monitorStatuses.fatalError:
return -40
default:
return -40
}
},
getSparkPattern (amplitude) {
return [
amplitude
]
}
}
}
Expand All @@ -157,7 +241,7 @@ export default {
<style lang="scss" scoped>
@import '@/styles/index.scss';
$warp-width: 280px;
$warp-height: 300px;
$warp-height: 320px;
$warp-padding: 0px;
.dialog {
z-index: 15;
Expand All @@ -181,7 +265,7 @@ $warp-padding: 0px;
font-size: $text-size-large + 4;
}
.date-info {
margin: 6px 17px 10px 17px;
margin: 10px 17px 10px 17px;
display: flex;
justify-content: flex-start;
cursor: default !important;
Expand All @@ -199,7 +283,7 @@ $warp-padding: 0px;
}
}
.room-info {
margin-bottom: 6px;
margin-bottom: 12px;
cursor: default !important;
.room {
.tag {
Expand All @@ -209,11 +293,15 @@ $warp-padding: 0px;
}
}
}
.spark-line {
height: 40px;
margin-top: 4px;
}
.form-item {
margin: 10px 17px;
margin: 4px 18px;
border: none!important;
.save-button {
margin: 10px 8px;
margin: 4px 8px;
width: 80px;
color: $text-color;
background: $primary-button-background-blur!important;
Expand All @@ -226,7 +314,7 @@ $warp-padding: 0px;
}
}
.cancel-button {
margin: 10px 8px;
margin: 4px 8px;
width: 80px;
color: $text-color;
background: $cancel-button-background-blur!important;
Expand All @@ -239,7 +327,7 @@ $warp-padding: 0px;
}
}
.button-disabled {
margin: 10px 8px;
margin: 4px 8px;
width: 80px;
color: $text-color;
background: $disabled-button-background-blur!important;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/Body/Monitor/mixin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import libraryRestApi from '@/api/library.api'
import usageApi from '@/api/usage.api'

const monitorStatuses = {
export const monitorStatuses = {
unstart: 'unstart', // 未开始
starting: 'starting', // 正在启动
checking: 'checking', // 检测中
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/Body/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</el-select>
</el-form-item>
<el-form-item label="位置" :inline="true" style="flex-col">
<el-select v-model="form.seatNum" :placeholder="seatsForSelectIsAvailable!==null?(`共 ${seatsForSelectIsAvailable.length} 座可约`):'数据加载中...'"
<el-select v-model="form.seatNum" :placeholder="seatsForSelectIsAvailable!==null?(`共 ${seatsForSelectIsAvailable.length} 座可约`):seatsForSelect.length + ' 个座位'"
:no-data-text="seatSelectNoDataMessage"
class="num">
<el-option-group :key="'seat-group-1'" label="可选功能">
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10031,6 +10031,11 @@ vuepress-theme-vue@^1.0.3:
resolved "https://registry.yarnpkg.com/vuepress-theme-vue/-/vuepress-theme-vue-1.1.0.tgz#8b109e3db8cad7b18459f4d77076808110c2bcaa"
integrity sha512-oYbfWkeaQ6aUU8sl8fMzLnBnvsd23V0wkiqI0bR3Tq3mlI8EJu26PFOyyF7KvJu0qNo/lcL7CDSmX7ymUVpnvw==

vuetrend@^0.3.4:
version "0.3.4"
resolved "https://registry.npm.taobao.org/vuetrend/download/vuetrend-0.3.4.tgz#35e1dafb0f7cf4d66f69e289ee7028b9e12783d9"
integrity sha1-NeHa+w989NZvaeKJ7nAoueEng9k=

vuex@^2.3.1:
version "2.5.0"
resolved "https://registry.yarnpkg.com/vuex/-/vuex-2.5.0.tgz#20f0265ade6c9a5ac6724a405d3ffdb4726c9741"
Expand Down

0 comments on commit 8cc72bc

Please sign in to comment.