@@ -922,25 +922,52 @@ <h2>{{curbak.name}}</h2>
922922 < v-avatar > < img :src ="box.syscfgs.boxjs.icons[iconThemeIdx] " /> </ v-avatar >
923923 </ v-btn >
924924 </ template >
925- < v-btn dark v-if ="!box.usercfgs.isHideHelp " fab small color ="grey " @click ="">
925+ < v-btn dark v-if ="!box.usercfgs.isHideHelp " fab small color ="grey " @click ="ui.versionsheet.show = true ">
926926 < v-icon > mdi-help</ v-icon >
927927 </ v-btn >
928928 < v-btn dark fab small color ="pink " @click ="box.usercfgs.isLeftBoxIcon = !box.usercfgs.isLeftBoxIcon ">
929929 < v-icon >
930930 {{box.usercfgs.isLeftBoxIcon ? 'mdi-format-horizontal-align-right' : 'mdi-format-horizontal-align-left'}}
931931 </ v-icon >
932932 </ v-btn >
933- < v-btn dark fab small color ="indigo " @click ="">
933+ <!-- < v-btn dark fab small color="indigo" @click="">
934934 <v-icon>mdi-database-import</v-icon>
935935 </v-btn>
936936 <v-btn dark fab small color="success" @click="">
937937 <v-icon>mdi-export-variant</v-icon>
938- </ v-btn >
938+ </v-btn> -->
939939 < v-btn dark v-if ="!box.usercfgs.isHideRefresh " fab small color ="orange " @dblclick ="window.location.reload() ">
940940 < v-icon > mdi-refresh</ v-icon >
941941 </ v-btn >
942942 </ v-speed-dial >
943943 </ v-fab-transition >
944+ < v-bottom-sheet v-model ="ui.versionsheet.show " scrollable >
945+ < v-card v-if ="box.versions ">
946+ < v-subheader >
947+ < v-btn icon small @click ="ui.versionsheet.show = false ">
948+ < v-icon > mdi-help-circle</ v-icon >
949+ </ v-btn >
950+ < v-spacer > </ v-spacer >
951+ < v-btn text small v-if ="hasNewVersion "> 新版本</ v-btn >
952+ < v-spacer > </ v-spacer >
953+ < v-btn icon small @click ="ui.versionsheet.show = false ">
954+ < v-icon > mdi-close</ v-icon >
955+ </ v-btn >
956+ </ v-subheader >
957+ < v-divider > </ v-divider >
958+ < v-card-text style ="height: 80%; ">
959+ < div class ="mt-6 " v-for ="(ver, verIdx) in box.versions ">
960+ < h2 :class ="version === ver.version ? 'primary--text' : undefined "> v{{ver.version}}</ h2 >
961+ < div class ="pl-4 pt-2 " v-for ="(note, noteIdx) in ver.notes ">
962+ < strong > {{note.name}}</ strong >
963+ < ul >
964+ < li v-for ="(desc, descIdx) in note.descs "> {{desc}}</ li >
965+ </ ul >
966+ </ div >
967+ </ div >
968+ </ v-card-text >
969+ </ v-card >
970+ </ v-bottom-sheet >
944971 < v-overlay v-model ="ui.overlay.show " :opacity ="0.8 ">
945972 < v-progress-circular indeterminate :value ="ui.overlay.val " :size ="64 " color ="primary "> </ v-progress-circular >
946973 </ v-overlay >
@@ -974,6 +1001,8 @@ <h2>{{curbak.name}}</h2>
9741001 overlay : { show : false , val : 60 } ,
9751002 snackbar : { show : false , color : 'primary' , msg : '' } ,
9761003 searchBar : { menuProps : { closeOnContentClick : true } } ,
1004+ versionsheet : { show : false } ,
1005+ updatesheet : { show : false } ,
9771006 naviDrawer : { show : false } ,
9781007 baksSkeleton : { show : true } ,
9791008 editProfileDialog : { show : false } ,
@@ -993,6 +1022,15 @@ <h2>{{curbak.name}}</h2>
9931022 version ( ) {
9941023 return this . box . syscfgs . version
9951024 } ,
1025+ // 判断是否有新版本
1026+ hasNewVersion ( ) {
1027+ const curver = this . box . syscfgs . version
1028+ const vers = this . box . versions
1029+ if ( curver && vers && vers . length > 0 ) {
1030+ const lastestVer = vers [ 0 ] . version
1031+ return this . compareVersion ( lastestVer , curver ) > 0
1032+ }
1033+ } ,
9961034 // 判断是否需要跨域请求
9971035 isCors ( ) {
9981036 return this . ui . isCors
@@ -1261,6 +1299,7 @@ <h2>{{curbak.name}}</h2>
12611299 }
12621300 // 获取贡献者列表
12631301 this . getContributors ( )
1302+ this . getVersions ( )
12641303 this . loadTheme ( )
12651304 } ,
12661305 methods : {
@@ -1681,6 +1720,24 @@ <h2>{{curbak.name}}</h2>
16811720 this . ui . contributors . push ( { id, login, repo, icon } )
16821721 } )
16831722 } )
1723+ } ,
1724+ // 获取版本清单
1725+ getVersions ( ) {
1726+ axios . get ( '/query/versions' ) . then ( ( resp ) => {
1727+ if ( resp . data && resp . data . releases ) {
1728+ Object . assign ( this . box , { versions : resp . data . releases } )
1729+ if ( this . hasNewVersion ) {
1730+ this . ui . versionsheet . show = true
1731+ }
1732+ }
1733+ } )
1734+ } ,
1735+ // 对比版本号
1736+ compareVersion ( v1 , v2 ) {
1737+ var _v1 = v1 . split ( '.' ) ,
1738+ _v2 = v2 . split ( '.' ) ,
1739+ _r = _v1 [ 0 ] - _v2 [ 0 ]
1740+ return _r == 0 && v1 != v2 ? this . compareVersion ( _v1 . splice ( 1 ) . join ( '.' ) , _v2 . splice ( 1 ) . join ( '.' ) ) : _r
16841741 }
16851742 }
16861743 } )
0 commit comments