travis ci: add package

pull/69/head
Doflatango 2018-03-07 09:48:09 +08:00
parent d536e8fbd0
commit 79fb9da2ca
2 changed files with 22 additions and 12 deletions

View File

@ -12,6 +12,8 @@ install:
- go get github.com/gorilla/mux - go get github.com/gorilla/mux
- go get github.com/smartystreets/goconvey/convey - go get github.com/smartystreets/goconvey/convey
- go get github.com/spf13/cobra - go get github.com/spf13/cobra
- go get github.com/denisbrodbeck/machineid
before_script: before_script:
- go vet -x ./... - go vet -x ./...
script: script:

View File

@ -1,10 +1,10 @@
<template> <template>
<div style="text-align: center; margin-bottom: 1em;"> <div style="text-align: center; margin-bottom: 1em;">
<div class="ui icon buttons"> <div class="ui icon buttons">
<router-link :to="pageURL(_startPage-1)" class="ui button" :class="{disabled: _startPage<=1}"><i class="angle left icon"></i></router-link> <router-link :to="pageURL(startPage-1)" class="ui button" :class="{disabled: startPage<=1}"><i class="angle left icon"></i></router-link>
<router-link :to="pageURL(_startPage + n - 1)" v-for="n in _pageBtnNum" class="ui button" :class="{blue: _startPage+n-1 == _current}">{{_startPage + n-1}}</router-link> <router-link :to="pageURL(startPage + n - 1)" v-for="n in pageBtnNum" class="ui button" :class="{blue: startPage+n-1 == _current}">{{startPage + n-1}}</router-link>
<a class="ui button disabled">{{_current}}/{{total}}</a> <a class="ui button disabled">{{_current}}/{{total}}</a>
<router-link :to="pageURL(_startPage+length)" class="ui button" :class="{disabled: _startPage+length>total}"><i class="angle right icon"></i></router-link> <router-link :to="pageURL(startPage+length)" class="ui button" :class="{disabled: startPage+length>total}"><i class="angle right icon"></i></router-link>
</div> </div>
<div class="ui action input"> <div class="ui action input">
<input type="text" ref="gopage" style="width: 70px;"> <input type="text" ref="gopage" style="width: 70px;">
@ -25,17 +25,17 @@ export default {
data: function(){ data: function(){
return { return {
_pagevar: '', _pagevar: '',
_current: 1, _current: 1//,
_startPage: 1, //_startPage: 1,
_pageBtnNUm: 5 //_pageBtnNum: 5
} }
}, },
created: function(){ created: function(){
this._pagevar = this.pageVar || 'page'; this._pagevar = this.pageVar || 'page';
this._current = this.$route.query[this._pagevar] || 1; this._current = this.$route.query[this._pagevar] || 1;
this._startPage = Math.floor((this._current-1)/this.length) * this.length + 1; // this._startPage = Math.floor((this._current-1)/this.length) * this.length + 1;
this._pageBtnNum = this.total - this._startPage - this.length <= 0 ? this.total - this._startPage + 1 : this.length; // this._pageBtnNum = this.total - this._startPage - this.length <= 0 ? this.total - this._startPage + 1 : this.length;
}, },
methods: { methods: {
@ -53,8 +53,8 @@ export default {
watch: { watch: {
'$route': function(){ '$route': function(){
this._current = this.$route.query[this._pagevar] || 1; this._current = this.$route.query[this._pagevar] || 1;
this._startPage = Math.floor((this._current-1)/this.length) * this.length + 1; // this._startPage = Math.floor((this._current-1)/this.length) * this.length + 1;
this._pageBtnNum = this.total - this._startPage - this.length <= 0 ? this.total - this._startPage + 1 : this.length; // this._pageBtnNum = this.total - this._startPage - this.length <= 0 ? this.total - this._startPage + 1 : this.length;
} }
}, },
@ -67,7 +67,15 @@ export default {
} }
return this.$route.path+'?'+query.join('&') + '&'; return this.$route.path+'?'+query.join('&') + '&';
} },
startPage: function(){
return Math.floor((this._current-1)/this.length) * this.length + 1;
},
pageBtnNum: function(){
return this.total - this.startPage - this.length <= 0 ? this.total - this.startPage + 1 : this.length;
},
} }
} }
</script> </script>