@@ -417,17 +417,17 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
417417 </tbody>
418418 </table>
419419 <div class="margin"></div>
420- </div>` } ) , Vue . component ( "ns-route-ranges-box" , { props :[ "v-ranges" ] , data :function ( ) { let e = this . vRanges ; return { ranges :e = null == e ?[ ] :e , isAdding :! 1 , ipRangeFrom :"" , ipRangeTo :"" } } , methods :{ add :function ( ) { this . isAdding = ! 0 ; let e = this ; setTimeout ( function ( ) { e . $refs . ipRangeFrom . focus ( ) } , 100 ) } , remove :function ( e ) { this . ranges . $remove ( e ) } , cancelIPRange :function ( ) { this . isAdding = ! 1 , this . ipRangeFrom = "" , this . ipRangeTo = "" } , confirmIPRange :function ( ) { let e = this ; this . ipRangeFrom = this . ipRangeFrom . trim ( ) , this . validateIP ( this . ipRangeFrom ) ?( this . ipRangeTo = this . ipRangeTo . trim ( ) , this . validateIP ( this . ipRangeTo ) ?( this . ranges . push ( { type :"ipRange" , params :{ ipFrom :this . ipRangeFrom , ipTo :this . ipRangeTo } } ) , this . cancelIPRange ( ) ) :teaweb . warn ( "结束IP填写错误" , function ( ) { e . $refs . ipRangeTo . focus ( ) } ) ) :teaweb . warn ( "开始IP填写错误" , function ( ) { e . $refs . ipRangeFrom . focus ( ) } ) } , validateIP :function ( e ) { if ( ! e . match ( / ^ ( \d { 1 , 3 } ) \. ( \d { 1 , 3 } ) \. ( \d { 1 , 3 } ) \. ( \d { 1 , 3 } ) $ / ) ) return ! 1 ; let t = e . split ( "." ) , i = ! 0 ; return t . forEach ( function ( e ) { 255 < parseInt ( e ) && ( i = ! 1 ) } ) , i } } , template :`<div>
420+ </div>` } ) , Vue . component ( "ns-route-ranges-box" , { props :[ "v-ranges" ] , data :function ( ) { let e = this . vRanges ; return { ranges :e = null == e ?[ ] :e , isAdding :! 1 , isAddingBatch :! 1 , ipRangeFrom :"" , ipRangeTo :"" , batchIPRange :"" } } , methods :{ add :function ( ) { this . isAdding = ! 0 ; let e = this ; setTimeout ( function ( ) { e . $refs . ipRangeFrom . focus ( ) } , 100 ) } , remove :function ( e ) { this . ranges . $remove ( e ) } , cancelIPRange :function ( ) { this . isAdding = ! 1 , this . ipRangeFrom = "" , this . ipRangeTo = "" } , confirmIPRange :function ( ) { let e = this ; this . ipRangeFrom = this . ipRangeFrom . trim ( ) , this . validateIP ( this . ipRangeFrom ) ?( this . ipRangeTo = this . ipRangeTo . trim ( ) , this . validateIP ( this . ipRangeTo ) ?( this . ranges . push ( { type :"ipRange" , params :{ ipFrom :this . ipRangeFrom , ipTo :this . ipRangeTo } } ) , this . cancelIPRange ( ) ) :teaweb . warn ( "结束IP填写错误" , function ( ) { e . $refs . ipRangeTo . focus ( ) } ) ) :teaweb . warn ( "开始IP填写错误" , function ( ) { e . $refs . ipRangeFrom . focus ( ) } ) } , addBatch :function ( ) { this . isAddingBatch = ! 0 ; let e = this ; setTimeout ( function ( ) { e . $refs . batchIPRange . focus ( ) } , 100 ) } , cancelBatchIPRange :function ( ) { this . isAddingBatch = ! 1 , this . batchIPRange = "" } , confirmBatchIPRange :function ( ) { let a = this , e = this . batchIPRange ; if ( 0 == e . length ) teaweb . warn ( "请填写要加入的IP范围" , function ( ) { a . $refs . batchIPRange . focus ( ) } ) ; else { let n = [ ] , o = "" ; e . split ( "\n" ) . forEach ( function ( t ) { if ( 0 != ( t = t . trim ( ) ) . length ) { let e = ( t = t . replace ( "," , "," ) ) . split ( "," ) ; var i , s ; 2 != e . length ?o = t :( i = e [ 0 ] . trim ( ) , s = e [ 1 ] . trim ( ) , a . validateIP ( i ) && a . validateIP ( s ) ?n . push ( { type :"ipRange" , params :{ ipFrom :i , ipTo :s } } ) :o = t ) } } ) , 0 < o . length ?teaweb . warn ( "'" + o + "'格式错误" , function ( ) { a . $refs . batchIPRange . focus ( ) } ) :( n . forEach ( function ( e ) { a . ranges . push ( e ) } ) , this . cancelBatchIPRange ( ) ) } } , validateIP :function ( e ) { if ( ! e . match ( / ^ ( \d { 1 , 3 } ) \. ( \d { 1 , 3 } ) \. ( \d { 1 , 3 } ) \. ( \d { 1 , 3 } ) $ / ) ) return ! 1 ; let t = e . split ( "." ) , i = ! 0 ; return t . forEach ( function ( e ) { 255 < parseInt ( e ) && ( i = ! 1 ) } ) , i } } , template :`<div>
421421 <input type="hidden" name="rangesJSON" :value="JSON.stringify(ranges)"/>
422422 <div v-if="ranges.length > 0">
423- <div class="ui label tiny basic" v-for="(range, index) in ranges">
423+ <div class="ui label tiny basic" v-for="(range, index) in ranges" style="margin-bottom: 0.3em" >
424424 <span v-if="range.type == 'ipRange'">IP范围:</span>
425425 {{range.params.ipFrom}} - {{range.params.ipTo}} <a href="" title="删除" @click.prevent="remove(index)"><i class="icon remove small"></i></a>
426426 </div>
427427 <div class="ui divider"></div>
428428 </div>
429429
430- <!-- IP 范围 -->
430+ <!-- 添加单个 -->
431431 <div style="margin-bottom: 1em" v-show="isAdding">
432432 <div class="ui fields inline">
433433 <div class="ui field">
@@ -443,8 +443,23 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
443443 </div>
444444 </div>
445445 </div>
446+
447+ <!-- 添加多个 -->
448+ <div style="margin-bottom: 1em" v-show="isAddingBatch">
449+ <div class="ui field">
450+ <textarea rows="5" ref="batchIPRange" v-model="batchIPRange"></textarea>
451+ <p class="comment">每行一条,格式为<code-label>开始IP,结束IP</code-label>,比如<code-label>192.168.1.100,192.168.1.200</code-label>。</p>
452+ </div>
453+ <div class="ui field">
454+ <button class="ui button tiny" type="button" @click.prevent="confirmBatchIPRange">确定</button>
455+ <a href="" @click.prevent="cancelBatchIPRange" title="取消"><i class="icon remove small"></i></a>
456+ </div>
457+ </div>
446458
447- <button class="ui button tiny" type="button" @click.prevent="add">+</button>
459+ <div v-if="!isAdding && !isAddingBatch">
460+ <button class="ui button tiny" type="button" @click.prevent="add">单个添加</button>
461+ <button class="ui button tiny" type="button" @click.prevent="addBatch">批量添加</button>
462+ </div>
448463</div>` } ) , Vue . component ( "ns-route-selector" , { props :[ "v-route-code" ] , mounted :function ( ) { let t = this ; Tea . action ( "/ns/routes/options" ) . post ( ) . success ( function ( e ) { t . routes = e . data . routes } ) } , data :function ( ) { let e = this . vRouteCode ; return { routeCode :e = null == e ?"" :e , routes :[ ] } } , template :`<div>
449464 <div v-if="routes.length > 0">
450465 <select class="ui dropdown" name="routeCode" v-model="routeCode">
@@ -551,7 +566,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
551566 <div v-if="!isAdding">
552567 <button class="ui button small" type="button" @click.prevent="add">+</button>
553568 </div>
554- </div>` } ) , Vue . component ( "plan-price-config-box" , { props :[ "v-price-type" , "v-monthly-price" , "v-seasonally-price" , "v-yearly-price" , "v-traffic-price" , "v-bandwidth-price" , "v-disable-period" ] , data :function ( ) { let e = this . vPriceType , t = ( null == e && ( e = "bandwidth" ) , 0 ) , i = this . vMonthlyPrice , s = ( null == i || i <= 0 ?i = "" :( i = i . toString ( ) , t = parseFloat ( i ) , isNaN ( t ) && ( t = 0 ) ) , 0 ) , n = this . vSeasonallyPrice , o = ( null == n || n <= 0 ?n = "" :( n = n . toString ( ) , s = parseFloat ( n ) , isNaN ( s ) && ( s = 0 ) ) , 0 ) , a = this . vYearlyPrice , l = ( null == a || a <= 0 ?a = "" :( a = a . toString ( ) , o = parseFloat ( a ) , isNaN ( o ) && ( o = 0 ) ) , this . vTrafficPrice ) , r = 0 , c = ( null != l ?r = l . base :l = { base :0 } , "" ) , d = ( 0 < r && ( c = r . toString ( ) ) , this . vBandwidthPrice ) ; return null == d ?d = { percentile :95 , ranges :[ ] } :null == d . ranges && ( d . ranges = [ ] ) , { priceType :e , monthlyPrice :i , seasonallyPrice :n , yearlyPrice :a , monthlyPriceNumber :t , seasonallyPriceNumber :s , yearlyPriceNumber :o , trafficPriceBase :c , trafficPrice :l , bandwidthPrice :d , bandwidthPercentile :d . percentile } } , methods :{ changeBandwidthPriceRanges :function ( e ) { this . bandwidthPrice . ranges = e } } , watch :{ monthlyPrice :function ( e ) { let t = parseFloat ( e ) ; isNaN ( t ) && ( t = 0 ) , this . monthlyPriceNumber = t } , seasonallyPrice :function ( e ) { let t = parseFloat ( e ) ; isNaN ( t ) && ( t = 0 ) , this . seasonallyPriceNumber = t } , yearlyPrice :function ( e ) { let t = parseFloat ( e ) ; isNaN ( t ) && ( t = 0 ) , this . yearlyPriceNumber = t } , trafficPriceBase :function ( e ) { let t = parseFloat ( e ) ; isNaN ( t ) && ( t = 0 ) , this . trafficPrice . base = t } , bandwidthPercentile :function ( e ) { let t = parseInt ( e ) ; isNaN ( t ) || t <= 0 ?t = 95 :100 < t && ( t = 100 ) , this . bandwidthPrice . percentile = t } } , template :`<div>
569+ </div>` } ) , Vue . component ( "plan-price-config-box" , { props :[ "v-price-type" , "v-monthly-price" , "v-seasonally-price" , "v-yearly-price" , "v-traffic-price" , "v-bandwidth-price" , "v-disable-period" ] , data :function ( ) { let e = this . vPriceType , t = ( null == e && ( e = "bandwidth" ) , 0 ) , i = this . vMonthlyPrice , s = ( null == i || i <= 0 ?i = "" :( i = i . toString ( ) , t = parseFloat ( i ) , isNaN ( t ) && ( t = 0 ) ) , 0 ) , n = this . vSeasonallyPrice , o = ( null == n || n <= 0 ?n = "" :( n = n . toString ( ) , s = parseFloat ( n ) , isNaN ( s ) && ( s = 0 ) ) , 0 ) , a = this . vYearlyPrice , l = ( null == a || a <= 0 ?a = "" :( a = a . toString ( ) , o = parseFloat ( a ) , isNaN ( o ) && ( o = 0 ) ) , this . vTrafficPrice ) , c = 0 , r = ( null != l ?c = l . base :l = { base :0 } , "" ) , d = ( 0 < c && ( r = c . toString ( ) ) , this . vBandwidthPrice ) ; return null == d ?d = { percentile :95 , ranges :[ ] } :null == d . ranges && ( d . ranges = [ ] ) , { priceType :e , monthlyPrice :i , seasonallyPrice :n , yearlyPrice :a , monthlyPriceNumber :t , seasonallyPriceNumber :s , yearlyPriceNumber :o , trafficPriceBase :r , trafficPrice :l , bandwidthPrice :d , bandwidthPercentile :d . percentile } } , methods :{ changeBandwidthPriceRanges :function ( e ) { this . bandwidthPrice . ranges = e } } , watch :{ monthlyPrice :function ( e ) { let t = parseFloat ( e ) ; isNaN ( t ) && ( t = 0 ) , this . monthlyPriceNumber = t } , seasonallyPrice :function ( e ) { let t = parseFloat ( e ) ; isNaN ( t ) && ( t = 0 ) , this . seasonallyPriceNumber = t } , yearlyPrice :function ( e ) { let t = parseFloat ( e ) ; isNaN ( t ) && ( t = 0 ) , this . yearlyPriceNumber = t } , trafficPriceBase :function ( e ) { let t = parseFloat ( e ) ; isNaN ( t ) && ( t = 0 ) , this . trafficPrice . base = t } , bandwidthPercentile :function ( e ) { let t = parseInt ( e ) ; isNaN ( t ) || t <= 0 ?t = 95 :100 < t && ( t = 100 ) , this . bandwidthPrice . percentile = t } } , template :`<div>
555570 <input type="hidden" name="priceType" :value="priceType"/>
556571 <input type="hidden" name="monthlyPrice" :value="monthlyPriceNumber"/>
557572 <input type="hidden" name="seasonallyPrice" :value="seasonallyPriceNumber"/>
@@ -3742,7 +3757,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
37423757 <td>网页提示内容</td>
37433758 <td>
37443759 <textarea v-model="config.noticePageBody"></textarea>
3745- <p class="comment"><a href="" @click.prevent="showBodyTemplate">[使用模板]</a>。当达到流量限制时网页显示的HTML内容,不填写则显示默认的提示内容。</p>
3760+ <p class="comment"><a href="" @click.prevent="showBodyTemplate">[使用模板]</a>。当达到流量限制时网页显示的HTML内容,不填写则显示默认的提示内容,适用于网站类服务 。</p>
37463761 </td>
37473762 </tr>
37483763 </tbody>
0 commit comments