chengjunhui hace 1 semana
padre
commit
e43239b315
Se han modificado 2 ficheros con 35 adiciones y 29 borrados
  1. 19 13
      pages/tournament/details.vue
  2. 16 16
      utils/request/responseInterceptors.js

+ 19 - 13
pages/tournament/details.vue

@@ -17,27 +17,18 @@
         </view>
         <view class="list-item ql-editor-box">
           <InfoHead title="赛事介绍" />
-          <!-- <rich-text
-          :nodes="processedContent(matchInfo?.introduction)"
-        ></rich-text> -->
           <uv-parse
             :content="processedContent(matchInfo.introduction)"
           ></uv-parse>
         </view>
         <view class="list-item ql-editor-box">
           <InfoHead title="报名要求" />
-          <!-- <rich-text
-          :nodes="processedContent(matchInfo?.registrationRequirement)"
-        ></rich-text> -->
           <uv-parse
             :content="processedContent(matchInfo.registrationRequirement)"
           ></uv-parse>
         </view>
         <view v-if="matchInfo?.awardContent" class="list-item ql-editor-box">
           <InfoHead title="奖励内容" />
-          <!-- <rich-text
-          :nodes="processedContent(matchInfo?.awardContent)"
-        ></rich-text> -->
           <uv-parse
             :content="processedContent(matchInfo.awardContent)"
           ></uv-parse>
@@ -95,7 +86,12 @@
 
 <script setup>
 import { ref } from "vue";
-import { onLoad, onUnload, onReachBottom, onShareAppMessage } from "@dcloudio/uni-app";
+import {
+  onLoad,
+  onUnload,
+  onReachBottom,
+  onShareAppMessage,
+} from "@dcloudio/uni-app";
 import { navigateTo, downloadFile, processedContent } from "@/utils/utils.js";
 import { useListQuery } from "@/mixins/useListQuery.js";
 import { matchDetailInfo, projectListByMatchId } from "@/api/tournament.js";
@@ -130,8 +126,17 @@ onLoad(async (options) => {
     pagesLoading.value = true;
     return;
   }
-  matchInfo.value = await getMatchInfo(options.id);
-  getDataList(true);
+  try {
+    let res = await getMatchInfo(options.id);
+    if (!res || res.hidden) {
+      pagesLoading.value = true;
+      return;
+    }
+    matchInfo.value = res;
+    getDataList(true);
+  } catch (error) {
+    console.log(error);
+  }
 });
 
 var { dataList, loading, noMore, getDataList, loadMore, queryForm } =
@@ -157,7 +162,8 @@ onShareAppMessage(() => {
 
 // 上拉加载更多
 onReachBottom(() => {
-  console.log("onReachBottom");
+  // console.log("onReachBottom");
+  if (!matchInfo.value.id) return;
   if (!loading.value && !noMore.value) {
     loadMore();
   }

+ 16 - 16
utils/request/responseInterceptors.js

@@ -25,22 +25,22 @@ export const responseInterceptors = (vm) => {
                 })
               }, 300);
             }
-						const codeList = [100001, 100003, 100004, 100005, 100007]
-						if(codeList.includes(data.code)){
-							// 获取当前页面实例
-							const pages = getCurrentPages();
-							// 获取当前页面的实例
-							const currentPage = pages[pages.length - 1];
-							// 获取页面路径
-							const pagePath = currentPage.route;
-							// console.log('当前页面路径为:' + pagePath);
-							if(pagePath != 'pages/login/index'){
-								uni.setStorageSync('token', '')
-								uni.reLaunch({
-									url: "/pages/login/index"
-								})
-							}
-						}
+						// const codeList = [100001, 100003, 100004, 100005, 100007]
+						// if(codeList.includes(data.code)){
+						// 	// 获取当前页面实例
+						// 	const pages = getCurrentPages();
+						// 	// 获取当前页面的实例
+						// 	const currentPage = pages[pages.length - 1];
+						// 	// 获取页面路径
+						// 	const pagePath = currentPage.route;
+						// 	// console.log('当前页面路径为:' + pagePath);
+						// 	if(pagePath != 'pages/login/index'){
+						// 		uni.setStorageSync('token', '')
+						// 		uni.reLaunch({
+						// 			url: "/pages/login/index"
+						// 		})
+						// 	}
+						// }
             // 如果需要catch返回,则进行reject
 						return Promise.reject(response.data)
             // if (custom?.catch) {