mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	对访问日志中的Cookie进行排序显示
This commit is contained in:
		@@ -72,13 +72,13 @@
 | 
				
			|||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div v-if="tab == 'response'">
 | 
					<div v-if="tab == 'response'">
 | 
				
			||||||
    <table class="ui table selectable small">
 | 
					    <table class="ui table definition selectable small">
 | 
				
			||||||
        <tr>
 | 
					        <tr>
 | 
				
			||||||
            <td class="title">Status</td>
 | 
					            <td class="title">Status</td>
 | 
				
			||||||
            <td>{{accessLog.status}} {{accessLog.statusMessage}}</td>
 | 
					            <td>{{accessLog.status}} {{accessLog.statusMessage}}</td>
 | 
				
			||||||
        </tr>
 | 
					        </tr>
 | 
				
			||||||
    </table>
 | 
					    </table>
 | 
				
			||||||
	<table class="ui table selectable small">
 | 
						<table class="ui table definition selectable small" v-if="responseHeaders.length > 0">
 | 
				
			||||||
        <tbody v-for="header in responseHeaders">
 | 
					        <tbody v-for="header in responseHeaders">
 | 
				
			||||||
            <tr v-for="value in header.values">
 | 
					            <tr v-for="value in header.values">
 | 
				
			||||||
                <td class="title">
 | 
					                <td class="title">
 | 
				
			||||||
@@ -92,7 +92,7 @@
 | 
				
			|||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div v-if="tab == 'request'">
 | 
					<div v-if="tab == 'request'">
 | 
				
			||||||
	<table class="ui table selectable small">
 | 
						<table class="ui table definition selectable small">
 | 
				
			||||||
        <tbody v-for="header in requestHeaders">
 | 
					        <tbody v-for="header in requestHeaders">
 | 
				
			||||||
            <tr v-for="value in header.values">
 | 
					            <tr v-for="value in header.values">
 | 
				
			||||||
                <td class="title">
 | 
					                <td class="title">
 | 
				
			||||||
@@ -113,22 +113,25 @@
 | 
				
			|||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div v-if="tab == 'cookie'">
 | 
					<div v-if="tab == 'cookie'">
 | 
				
			||||||
	<p class="comment" v-if="accessLog.cookie == null">暂时没有Cookie数据。</p>
 | 
						<p class="comment" v-if="cookies.length == 0">暂时没有Cookie数据。</p>
 | 
				
			||||||
	<div v-else>
 | 
						<div v-else>
 | 
				
			||||||
		<table class="ui table selectable small">
 | 
							<table class="ui table definition selectable small">
 | 
				
			||||||
			<tr v-for="(v, k) in accessLog.cookie">
 | 
								<tr v-for="cookie in cookies">
 | 
				
			||||||
				<td class="title">{{k}}</td>
 | 
									<td class="title">{{cookie.name}}</td>
 | 
				
			||||||
				<td>{{v}}</td>
 | 
									<td>{{cookie.value}}</td>
 | 
				
			||||||
			</tr>
 | 
								</tr>
 | 
				
			||||||
		</table>
 | 
							</table>
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div v-if="tab == 'client'">
 | 
					<div v-if="tab == 'client'">
 | 
				
			||||||
	<table class="ui table selectable small">
 | 
						<table class="ui table definition selectable small">
 | 
				
			||||||
		<tr>
 | 
							<tr>
 | 
				
			||||||
			<td class="title">综合信息<em>(UserAgent)</em></td>
 | 
								<td class="title">综合信息<em>(UserAgent)</em></td>
 | 
				
			||||||
			<td>{{accessLog.userAgent}}</td>
 | 
								<td>
 | 
				
			||||||
 | 
					                <span v-if="accessLog.userAgent != null && accessLog.userAgent.length > 0">{{accessLog.userAgent}}</span>
 | 
				
			||||||
 | 
					                <span class="disabled" v-else>[没有设置]</span>
 | 
				
			||||||
 | 
					            </td>
 | 
				
			||||||
		</tr>
 | 
							</tr>
 | 
				
			||||||
		<tr>
 | 
							<tr>
 | 
				
			||||||
			<td>IP</td>
 | 
								<td>IP</td>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,6 +5,7 @@ Tea.context(function () {
 | 
				
			|||||||
		this.tab = tab
 | 
							this.tab = tab
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// 请求Header
 | 
				
			||||||
	this.requestHeaders = []
 | 
						this.requestHeaders = []
 | 
				
			||||||
	if (this.accessLog.header != null) {
 | 
						if (this.accessLog.header != null) {
 | 
				
			||||||
		for (let k in this.accessLog.header) {
 | 
							for (let k in this.accessLog.header) {
 | 
				
			||||||
@@ -23,6 +24,7 @@ Tea.context(function () {
 | 
				
			|||||||
		return (v1.name < v2.name) ? -1 : 1
 | 
							return (v1.name < v2.name) ? -1 : 1
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// 响应Header
 | 
				
			||||||
	this.responseHeaders = []
 | 
						this.responseHeaders = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this.accessLog.sentHeader != null) {
 | 
						if (this.accessLog.sentHeader != null) {
 | 
				
			||||||
@@ -41,4 +43,31 @@ Tea.context(function () {
 | 
				
			|||||||
	this.responseHeaders.sort(function (v1, v2) {
 | 
						this.responseHeaders.sort(function (v1, v2) {
 | 
				
			||||||
		return (v1.name < v2.name) ? -1 : 1
 | 
							return (v1.name < v2.name) ? -1 : 1
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Cookie
 | 
				
			||||||
 | 
						this.cookies = []
 | 
				
			||||||
 | 
						if (this.accessLog.cookie != null) {
 | 
				
			||||||
 | 
							for (let k in this.accessLog.cookie) {
 | 
				
			||||||
 | 
								let v = this.accessLog.cookie[k]
 | 
				
			||||||
 | 
								if (typeof (v) != "string") {
 | 
				
			||||||
 | 
									continue
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								this.cookies.push({
 | 
				
			||||||
 | 
									name: k,
 | 
				
			||||||
 | 
									value: v
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						this.cookies.sort(function (v1, v2) {
 | 
				
			||||||
 | 
							if (v1.name.startsWith("_")) {
 | 
				
			||||||
 | 
								if (v2.name.startsWith("_")) {
 | 
				
			||||||
 | 
									return (v1.name < v2.name) ? -1 : 1
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return -1
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (v2.name.startsWith("_")) {
 | 
				
			||||||
 | 
								return 1
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return (v1.name.toUpperCase() < v2.name.toUpperCase()) ? -1 : 1
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
		Reference in New Issue
	
	Block a user