Browse Source

feat(reportProblems): 增加接口与页面完整访问地址查看

在问题答复页新增完整访问地址弹窗,集中展示HTTPS域名、列表/详情接口地址以及当前页与详情页访问地址,便于快速定位当前环境真实请求地址。

Made-with: Cursor
haifeng.zhang 12 hours ago
parent
commit
833b0026d1
1 changed files with 45 additions and 0 deletions
  1. 45 0
      src/subPages/pages/reportProblems/index.vue

+ 45 - 0
src/subPages/pages/reportProblems/index.vue

@@ -230,6 +230,7 @@ let listInitPromise: Promise<void> | null = null
 
 /** 列表接口调试:最近一次请求参数与完整响应 */
 const showListRawJsonPopup = ref(false)
+const showApiFullUrlPopup = ref(false)
 const listLastReqParams = ref<PageQuestionReportDataReq | null>(null)
 const listLastApiResponse = ref<ApiResponse<PageResp<QuestionListRes>> | null>(null)
 
@@ -243,6 +244,20 @@ const listApiRawJson = computed(() => {
   return JSON.stringify(listLastApiResponse.value, null, 2)
 })
 
+const httpsOrigin = computed(() => {
+  if (typeof window === 'undefined') return ''
+  const host = window.location.host || ''
+  return host ? `https://${host}` : ''
+})
+
+const listApiFullUrl = computed(() => `${httpsOrigin.value}/api/questionReport/pageQuestionReportData`)
+const detailApiFullUrl = computed(() => `${httpsOrigin.value}/api/questionReport/detailsQuestionReportData/{id}`)
+const currentPageUrl = computed(() => {
+  if (typeof window === 'undefined') return ''
+  return window.location.href || ''
+})
+const detailPageUrl = computed(() => `${httpsOrigin.value}/subPages/pages/reportProblems/detail?id={id}`)
+
 const resetQuestionList = () => {
   list.value = []
   pageInfo.value.pageNumber = 1
@@ -400,6 +415,7 @@ watch(active, async (value) => {
       <view class="tab-container">
         <view class="mb-[8px]">
           <van-button size="small" plain type="primary" @click="showListRawJsonPopup = true">查看接口原始JSON</van-button>
+          <van-button class="ml-[8px]" size="small" plain type="primary" @click="showApiFullUrlPopup = true">查看完整访问地址</van-button>
         </view>
         <van-list
           v-model:loading="loading"
@@ -444,6 +460,35 @@ watch(active, async (value) => {
             </scroll-view>
           </view>
         </van-popup>
+        <van-popup
+          v-model:show="showApiFullUrlPopup"
+          round
+          position="bottom"
+          :style="{ height: '55%' }"
+        >
+          <view class="json-popup">
+            <view class="json-title">当前HTTPS域名</view>
+            <scroll-view scroll-y class="json-scroll json-scroll--small">
+              <text class="json-text">{{ httpsOrigin || '当前环境未获取到浏览器域名' }}</text>
+            </scroll-view>
+            <view class="json-title">问题答复列表接口</view>
+            <scroll-view scroll-y class="json-scroll json-scroll--small">
+              <text class="json-text">{{ listApiFullUrl }}</text>
+            </scroll-view>
+            <view class="json-title">详情接口</view>
+            <scroll-view scroll-y class="json-scroll">
+              <text class="json-text">{{ detailApiFullUrl }}</text>
+            </scroll-view>
+            <view class="json-title">当前页面访问地址</view>
+            <scroll-view scroll-y class="json-scroll json-scroll--small">
+              <text class="json-text">{{ currentPageUrl || '当前环境未获取到页面地址' }}</text>
+            </scroll-view>
+            <view class="json-title">详情页访问地址</view>
+            <scroll-view scroll-y class="json-scroll">
+              <text class="json-text">{{ detailPageUrl }}</text>
+            </scroll-view>
+          </view>
+        </van-popup>
       </view>
     </van-tab>
   </van-tabs>