From 2af5f043b60c1f7ac38ecccc8f5bf44743134325 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 12 十二月 2025 18:08:00 +0800
Subject: [PATCH] test
---
pages/my/log-detail.vue | 65 ++++++++++++++++++++++++--------
1 files changed, 48 insertions(+), 17 deletions(-)
diff --git a/pages/my/log-detail.vue b/pages/my/log-detail.vue
index 3b5d184..4a43ab1 100644
--- a/pages/my/log-detail.vue
+++ b/pages/my/log-detail.vue
@@ -1,26 +1,26 @@
<template>
<view class="pages-my-log-detail">
- <view class="title"> {{'鎺ュ彛 '+ info.date}}
+ <view class="title"> {{ info.date+" " +info.method }}
</view>
- <view class="content">{{info.method + " " + info.url}}
+ <view class="content">{{ info.url}}
</view>
<template v-if="info.method == 'POST'">
- <view class="title">鍙傛暟
+ <view class="title">{{translate('parameter')}}
</view>
<textarea class="param" disabled :value="paramText"></textarea>
</template>
- <template v-if="info.statusCode!=200">
- <view class="title">閿欒鐮�+ <template v-if="isError">
+ <view class="title">{{translate('error_code')}}
</view>
<view class="content error">{{info.statusCode}}
</view>
- <view class="title">閿欒淇℃伅
+ <view class="title">{{translate('error_msg')}}
</view>
<textarea class="content error" disabled :value="result"></textarea>
-
+
</template>
<template v-else>
- <view class="title">缁撴灉
+ <view class="title">{{translate('result')}}
</view>
<textarea class="result" disabled :value="result"></textarea>
<!-- <view class="result">{{result}}
@@ -32,6 +32,9 @@
import {
session,
} from "@/comm/utils.js"
+ import {
+ Base64
+ } from '@/comm/Base64.js';
export default {
name: "PagesMyLogDetail",
data() {
@@ -41,18 +44,25 @@
}
},
onLoad(option) {
- this.info = JSON.parse(option.info) || {}
- console.log( this.info)
- if(this.info.data_key)
- {
+ this.info = getApp().globalData.pageBigData || {}
+ getApp().globalData.pageBigData = {}
+ if (this.info.data_key) {
const maxData = session.getValue("request_log_max_data") || {}
this.info.data = maxData[this.info.data_key]
}
+ const list = (this.info.url || "").split("/")
+ let title = ""
+ for (let i in list) {
+ if (list[i] == "api") {
+ title = "api"
+ } else
+ title += "/" + list[i]
+ }
uni.setNavigationBarTitle({
- title: this.info.method || "鎺ュ彛鏃ュ織璇︽儏"
+ title: title || "鎺ュ彛鏃ュ織璇︽儏"
})
-
-
+
+
},
computed: {
paramText() {
@@ -62,10 +72,31 @@
result() {
const res = this.info.data
return typeof res == 'string' ? res : JSON.stringify(res)
+ },
+ isError() {
+ if (this.info.statusCode == 200) {
+ const res = typeof this.info.data == 'string' ? this.parseJson(this.info.data) : this.info.data
+ if (res?.code)
+ return true
+ return false
+ }
+ return true
}
},
methods: {
-
+ parseJson(str) {
+ try {
+ const obj = JSON.parse(str)
+ return obj
+ } catch (ex) {
+ console.log(ex)
+ return str
+ }
+ },
+ translate(t) {
+ if (typeof this.$t == "function") return this.$t(`page.${t}`)
+ else return t;
+ },
}
}
</script>
@@ -79,7 +110,7 @@
background-color: #F5F5F5;
.title {
- margin: 5rpx;
+ margin: 10rpx;
font-size: 32rpx;
font-weight: 700;
}
--
Gitblit v1.9.1