This commit is contained in:
unknown
2026-02-04 20:27:13 +08:00
commit 3b042d1dad
9410 changed files with 1488147 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
<first-menu>
<menu-item href="/ns/routes" code="index">自定义线路</menu-item>
<menu-item href="" @click.prevent="createRoute()">[创建线路]</menu-item>
<span class="ui item disabled">|</span>
<menu-item href="/ns/routes/internal" code="internal">内置线路</menu-item>
</first-menu>

View File

@@ -0,0 +1,34 @@
{$layout "layout_popup"}
<h3>创建线路</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="clusterId" :value="clusterId"/>
<input type="hidden" name="domainId" :value="domainId"/>
<input type="hidden" name="userId" :value="userId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">线路名称 *</td>
<td>
<input type="text" name="name" maxlength="100" ref="focus"/>
</td>
</tr>
<tr>
<td rowspan="2">范围类型</td>
<td>
<select class="ui dropdown auto-width" v-model="rangeTypeCode" @change="changeRangeType">
<option v-for="rangeType in rangeTypes" :value="rangeType.code">{{rangeType.name}}</option>
</select>
</td>
</tr>
<tr>
<td>
<ns-route-ranges-box ref="routeRangesBox"></ns-route-ranges-box>
</td>
</tr>
</table>
<submit-btn v-if="quotaCanCreate"></submit-btn>
<p class="ui message error" v-if="!quotaCanCreate">已添加线路个数已超出最大限额({{quotaMaxCustomRoutes}}个线路),请升级套餐后重试。</p>
</form>

View File

@@ -0,0 +1,23 @@
Tea.context(function () {
this.rangeTypeCode = "ipRange"
this.rangeType = null
this.ranges = []
this.$delay(function () {
this.changeRangeType()
})
this.changeRangeType = function () {
let that = this
this.rangeType = this.rangeTypes.$find(function (k, v) {
return v.code == that.rangeTypeCode
})
if (this.$refs != null) {
let rangesBox = this.$refs.routeRangesBox
if (rangesBox != null) {
rangesBox.updateRangeType(this.rangeTypeCode)
}
}
}
})

View File

@@ -0,0 +1,38 @@
{$layout}
{$template "menu"}
<div class="margin"></div>
<div v-if="routes.length == 0">
<p class="comment">暂时还没有线路。</p>
</div>
<div v-show="routes.length > 0">
<table class="ui table selectable celled" id="sortable-table">
<thead>
<tr>
<th style="width: 3em"></th>
<th>线路名称</th>
<th>代号</th>
<th class="two wide">状态</th>
<th class="two op">操作</th>
</tr>
</thead>
<tbody v-for="route in routes" :v-id="route.id">
<tr>
<td style="text-align: center;"><i class="icon bars handle grey"></i> </td>
<td><a href="" @click.prevent="updateRoute(route.id)">{{route.name}} <i class="icon expand small"></i> </a></td>
<td>id:{{route.id}}</td>
<td>
<label-on :v-is-on="route.isOn"></label-on>
</td>
<td>
<a href="" @click.prevent="updateRoute(route.id)">修改</a> &nbsp;
<a href="" @click.prevent="deleteRoute(route.id)">删除</a>
</td>
</tr>
</tbody>
</table>
<p class="comment" v-if="routes.length > 0">可以拖动左侧的<i class="icon bars"></i>排序。</p>
</div>

View File

@@ -0,0 +1,51 @@
Tea.context(function () {
this.$delay(function () {
let that = this
sortTable(function (ids) {
that.$post(".sort")
.params({
routeIds: ids
})
.success(function () {
teaweb.successToast("排序保存成功")
})
})
})
this.createRoute = function () {
teaweb.popup("/ns/routes/createPopup", {
width: "50em",
height: "30em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.updateRoute = function (routeId) {
teaweb.popup("/ns/routes/updatePopup?routeId=" + routeId, {
width: "50em",
height: "30em",
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
this.deleteRoute = function (routeId) {
let that = this
teaweb.confirm("确定要删除此线路吗?", function () {
that.$post(".delete")
.params({
routeId: routeId
})
.success(function () {
teaweb.reload()
})
})
}
})

View File

@@ -0,0 +1,91 @@
{$layout}
{$template "menu"}
<second-menu>
<menu-item :class="{active: selectedType == 'isp'}" @click.prevent="selectRouteType('isp')">运营商</menu-item>
<menu-item :class="{active: selectedType == 'chinaProvince'}" @click.prevent="selectRouteType('chinaProvince')">中国省市</menu-item>
<menu-item :class="{active: selectedType == 'worldRegion'}" @click.prevent="selectRouteType('worldRegion')">全球国家地区</menu-item>
<menu-item :class="{active: selectedType == 'agent'}" @click.prevent="selectRouteType('agent')">搜索引擎</menu-item>
<span class="item disabled" v-if="publicCategories.length > 0">|</span>
<menu-item :class="{active: selectedType == 'category:' + category.id}" v-for="category in publicCategories" @click.prevent="selectRouteType('category:' + category.id)">{{category.name}}</menu-item>
</second-menu>
<!-- 运营商 -->
<div v-if="selectedType == 'isp'">
<table class="ui table selectable celled" style="width: 30em">
<thead>
<tr>
<th>运营商</th>
<th>代号</th>
</tr>
</thead>
<tr v-for="route in ispRoutes">
<td style="width: 50%">{{route.name}}</td>
<td>{{route.code}}</td>
</tr>
</table>
</div>
<!-- 中国省市 -->
<div v-if="selectedType == 'chinaProvince'">
<table class="ui table selectable celled" style="width: 30em">
<thead>
<tr>
<th>省市</th>
<th>代号</th>
</tr>
</thead>
<tr v-for="route in chinaProvinceRoutes">
<td style="width: 50%">{{route.name}}</td>
<td>{{route.code}}</td>
</tr>
</table>
</div>
<!-- 全球国家地区 -->
<div v-if="selectedType == 'worldRegion'">
<table class="ui table selectable celled" style="width: 30em">
<thead>
<tr>
<th>国家/地区</th>
<th>代号</th>
</tr>
</thead>
<tr v-for="route in worldRegionRoutes">
<td style="width: 50%">{{route.name}}</td>
<td>{{route.code}}</td>
</tr>
</table>
</div>
<!-- 搜索引擎 -->
<div v-if="selectedType == 'agent'">
<table class="ui table selectable celled" style="width: 30em">
<thead>
<tr>
<th>搜索引擎</th>
<th>代号</th>
</tr>
</thead>
<tr v-for="route in agentRoutes">
<td style="width: 50%">{{route.name}}</td>
<td>{{route.code}}</td>
</tr>
</table>
</div>
<!-- 官方分类 -->
<div v-if="selectedType.startsWith('category:')">
<table class="ui table selectable celled" style="width: 30em">
<thead>
<tr>
<th>线路名</th>
<th>代号</th>
</tr>
</thead>
<tr v-for="route in publicRoutes" v-if="selectedType == 'category:' + route.categoryId">
<td style="width: 50%">{{route.name}}</td>
<td>{{route.code}}</td>
</tr>
</table>
</div>

View File

@@ -0,0 +1,19 @@
Tea.context(function () {
this.createRoute = function () {
teaweb.popup("/ns/routes/createPopup", {
width: "50em",
height: "30em",
callback: function () {
teaweb.success("保存成功", function () {
window.location = "/ns/routes"
})
}
})
}
this.selectedType = "isp"
this.selectRouteType = function (routeType) {
this.selectedType = routeType
}
})

View File

@@ -0,0 +1,41 @@
{$layout "layout_popup"}
<h3>修改线路</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<csrf-token></csrf-token>
<input type="hidden" name="routeId" :value="route.id"/>
<table class="ui table definition selectable">
<tr>
<td class="title">线路名称 *</td>
<td>
<input type="text" name="name" maxlength="100" ref="focus" v-model="route.name"/>
</td>
</tr>
<tr>
<td rowspan="2">范围类型</td>
<td>
<select class="ui dropdown auto-width" v-model="rangeTypeCode" @change="changeRangeType">
<option v-for="rangeType in rangeTypes" :value="rangeType.code">{{rangeType.name}}</option>
</select>
</td>
</tr>
<tr>
<td>
<ns-route-ranges-box ref="routeRangesBox" :v-ranges="route.ranges"></ns-route-ranges-box>
</td>
</tr>
<tr>
<td colspan="2"><more-options-indicator></more-options-indicator></td>
</tr>
<tbody v-show="moreOptionsVisible">
<tr>
<td>启用当前线路</td>
<td>
<checkbox name="isOn" value="1" v-model="route.isOn"></checkbox>
</td>
</tr>
</tbody>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,23 @@
Tea.context(function () {
this.rangeTypeCode = "ipRange"
this.rangeType = null
this.ranges = []
this.$delay(function () {
this.changeRangeType()
})
this.changeRangeType = function () {
let that = this
this.rangeType = this.rangeTypes.$find(function (k, v) {
return v.code == that.rangeTypeCode
})
if (this.$refs != null) {
let rangesBox = this.$refs.routeRangesBox
if (rangesBox != null) {
rangesBox.updateRangeType(this.rangeTypeCode)
}
}
}
})