<template>
|
<view class="pages-my-log-detail">
|
<view class="title"> {{'接口 '+ info.date}}
|
</view>
|
<view class="content">{{info.method + " " + info.url}}
|
</view>
|
<template v-if="info.method == 'POST'">
|
<view class="title">参数
|
</view>
|
<textarea class="param" disabled :value="paramText"></textarea>
|
</template>
|
<template v-if="info.statusCode!=200">
|
<view class="title">错误码
|
</view>
|
<view class="content error">{{info.statusCode}}
|
</view>
|
<view class="title">错误信息
|
</view>
|
<view class="content error">{{info.msg}}
|
</view>
|
</template>
|
<template v-else>
|
<view class="title">结果
|
</view>
|
<textarea class="result" disabled :value="result"></textarea>
|
<!-- <view class="result">{{result}}
|
</view> -->
|
</template>
|
</view>
|
</template>
|
<script>
|
import {
|
session,
|
} from "@/comm/utils.js"
|
export default {
|
name: "PagesMyLogDetail",
|
data() {
|
return {
|
info: {}
|
|
}
|
},
|
onLoad(option) {
|
this.info = JSON.parse(option.info) || {}
|
if(this.info.data_key)
|
{
|
const maxData = session.getValue("request_log_max_data") || {}
|
this.info.data = maxData[this.info.data_key]
|
}
|
uni.setNavigationBarTitle({
|
title: this.info.method || "接口日志详情"
|
})
|
|
|
},
|
computed: {
|
paramText() {
|
const res = this.info.param
|
return typeof res == 'string' ? res : JSON.stringify(res)
|
},
|
result() {
|
const res = this.info.data
|
return typeof res == 'string' ? res : JSON.stringify(res)
|
}
|
},
|
methods: {
|
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
.pages-my-log-detail {
|
display: flex;
|
width: 750rpx;
|
height: 100vh;
|
flex-direction: column;
|
background-color: #F5F5F5;
|
|
.title {
|
margin: 5rpx;
|
font-size: 32rpx;
|
font-weight: 700;
|
}
|
|
.content {
|
padding: 20rpx 10rpx;
|
border-radius: 10rpx;
|
background-color: #fff;
|
width: 710rpx;
|
margin: 10rpx;
|
word-wrap: break-word;
|
/* 允许长单词或 URL 地址换行到下一行 */
|
word-break: break-all;
|
/* 强制文本在超出容器宽度时换行 */
|
white-space: normal;
|
/* 允许文本换行 */
|
}
|
|
.result {
|
flex: 1;
|
overflow: auto;
|
padding: 20rpx 10rpx;
|
border-radius: 10rpx;
|
background-color: #fff;
|
width: 710rpx;
|
margin: 10rpx;
|
}
|
|
.param {
|
max-height: 50vh;
|
overflow: auto;
|
padding: 20rpx 10rpx;
|
border-radius: 10rpx;
|
background-color: #fff;
|
width: 710rpx;
|
margin: 10rpx;
|
}
|
|
.error {
|
color: red;
|
|
}
|
|
}
|
</style>
|