mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-20 16:20:27 +08:00
阶段性提交
This commit is contained in:
9
web/public/js/components/api-node/api-node-selector.js
Normal file
9
web/public/js/components/api-node/api-node-selector.js
Normal file
@@ -0,0 +1,9 @@
|
||||
Vue.component("api-node-selector", {
|
||||
props: [],
|
||||
data: function () {
|
||||
return {}
|
||||
},
|
||||
template: `<div>
|
||||
暂未实现
|
||||
</div>`
|
||||
})
|
||||
23
web/public/js/components/common/inner-menu-item.js
Normal file
23
web/public/js/components/common/inner-menu-item.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 菜单项
|
||||
*/
|
||||
Vue.component("inner-menu-item", {
|
||||
props: ["href", "active", "code"],
|
||||
data: function () {
|
||||
var active = this.active;
|
||||
if (typeof(active) =="undefined") {
|
||||
var itemCode = "";
|
||||
if (typeof (window.TEA.ACTION.data.firstMenuItem) != "undefined") {
|
||||
itemCode = window.TEA.ACTION.data.firstMenuItem;
|
||||
}
|
||||
active = (itemCode == this.code);
|
||||
}
|
||||
return {
|
||||
vHref: (this.href == null) ? "" : this.href,
|
||||
vActive: active
|
||||
};
|
||||
},
|
||||
template: '\
|
||||
<a :href="vHref" class="item right" style="color:#4183c4" :class="{active:vActive}">[<slot></slot>]</a> \
|
||||
'
|
||||
});
|
||||
11
web/public/js/components/common/inner-menu.js
Normal file
11
web/public/js/components/common/inner-menu.js
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 二级菜单
|
||||
*/
|
||||
Vue.component("inner-menu", {
|
||||
template: `
|
||||
<div class="second-menu" style="width:80%;position: absolute;top:-8px;right:1em">
|
||||
<div class="ui menu text blue small">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>`
|
||||
});
|
||||
16
web/public/js/components/common/page-box.js
Normal file
16
web/public/js/components/common/page-box.js
Normal file
@@ -0,0 +1,16 @@
|
||||
Vue.component("page-box", {
|
||||
data: function () {
|
||||
return {
|
||||
page: ""
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
let that = this;
|
||||
setTimeout(function () {
|
||||
that.page = Tea.Vue.page;
|
||||
})
|
||||
},
|
||||
template: `<div>
|
||||
<div class="page" v-html="page"></div>
|
||||
</div>`
|
||||
})
|
||||
63
web/public/js/components/grant/grant-selector.js
Normal file
63
web/public/js/components/grant/grant-selector.js
Normal file
@@ -0,0 +1,63 @@
|
||||
Vue.component("grant-selector", {
|
||||
props: ["vGrant"],
|
||||
data: function () {
|
||||
return {
|
||||
grantId: (this.vGrant == null) ? 0 : this.vGrant.id,
|
||||
grant: this.vGrant
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 选择授权
|
||||
select: function () {
|
||||
let that = this;
|
||||
teaweb.popup("/nodes/grants/selectPopup", {
|
||||
callback: (resp) => {
|
||||
that.grantId = resp.data.grant.id;
|
||||
if (that.grantId > 0) {
|
||||
that.grant = resp.data.grant;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 创建授权
|
||||
create: function () {
|
||||
teaweb.popup("/nodes/grants/createPopup", {
|
||||
height: "31em",
|
||||
callback: (resp) => {
|
||||
this.grantId = resp.data.grant.id;
|
||||
if (this.grantId > 0) {
|
||||
this.grant = resp.data.grant;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 修改授权
|
||||
update: function () {
|
||||
if (this.grant == null) {
|
||||
window.location.reload();
|
||||
return;
|
||||
}
|
||||
teaweb.popup("/nodes/grants/updatePopup?grantId=" + this.grant.id, {
|
||||
height: "31em",
|
||||
callback: (resp) => {
|
||||
this.grant = resp.data.grant;
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除已选择授权
|
||||
remove: function () {
|
||||
this.grant = null;
|
||||
this.grantId = 0;
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<input type="hidden" name="grantId" :value="grantId"/>
|
||||
<div class="ui label small" v-if="grant != null">{{grant.name}}<span class="small">({{grant.methodName}})</span> <a href="" title="修改" @click.prevent="update()"><i class="icon pencil small"></i></a> <a href="" title="删除" @click.prevent="remove()"><i class="icon remove"></i></a> </div>
|
||||
<div v-if="grant == null">
|
||||
<a href="" @click.prevent="select()">[选择已有认证]</a> <a href="" @click.prevent="create()">[添加新认证]</a>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
51
web/public/js/components/node/node-ip-addresses-box.js
Normal file
51
web/public/js/components/node/node-ip-addresses-box.js
Normal file
@@ -0,0 +1,51 @@
|
||||
Vue.component("node-ip-addresses-box", {
|
||||
props: ["vIpAddresses"],
|
||||
data: function () {
|
||||
return {
|
||||
ipAddresses: (this.vIpAddresses == null) ? [] : this.vIpAddresses
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 添加IP地址
|
||||
addIPAddress: function () {
|
||||
let that = this;
|
||||
teaweb.popup("/nodes/ipAddresses/createPopup", {
|
||||
callback: function (resp) {
|
||||
that.ipAddresses.push(resp.data.ipAddress);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 修改地址
|
||||
updateIPAddress: function (index, address) {
|
||||
let that = this;
|
||||
teaweb.popup("/nodes/ipAddresses/updatePopup?addressId=" + address.id, {
|
||||
callback: function (resp) {
|
||||
Vue.set(that.ipAddresses, index, resp.data.ipAddress);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 删除IP地址
|
||||
removeIPAddress: function (index) {
|
||||
this.ipAddresses.$remove(index);
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<input type="hidden" name="ipAddresses" :value="JSON.stringify(ipAddresses)"/>
|
||||
<div v-if="ipAddresses.length > 0">
|
||||
<div>
|
||||
<div v-for="(address, index) in ipAddresses" class="ui label small">
|
||||
{{address.ip}}<span class="small" v-if="address.name.length > 0">({{address.name}})</span>
|
||||
<a href="" title="修改" @click.prevent="updateIPAddress(index, address)"><i class="icon pencil small"></i></a>
|
||||
<a href="" title="删除" @click.prevent="removeIPAddress(index)"><i class="icon remove"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
</div>
|
||||
<div>
|
||||
<button class="ui button small" type="button" @click.prevent="addIPAddress()">+</button>
|
||||
</div>
|
||||
<p class="comment">添加已经绑定的IP地址,仅做记录用。</p>
|
||||
</div>`
|
||||
})
|
||||
Reference in New Issue
Block a user