c24dbde7 by lttnew

修复bug

1 parent 6f6c7894
...@@ -1423,7 +1423,7 @@ export function groupInfoMod(ids) { ...@@ -1423,7 +1423,7 @@ export function groupInfoMod(ids) {
1423 1423
1424 export function extractInfoFromChinaIdCard(data) { 1424 export function extractInfoFromChinaIdCard(data) {
1425 return request({ 1425 return request({
1426 url: '/person/info/extractInfo', 1426 url: `/person/info/extractInfo?perType=1&idcCode=${data.idcCode}&idcType=${data.idcType}`,
1427 method: 'post', 1427 method: 'post',
1428 params: data 1428 params: data
1429 }) 1429 })
......
...@@ -59,12 +59,16 @@ ...@@ -59,12 +59,16 @@
59 59
60 <view class="flex-item"> 60 <view class="flex-item">
61 </view> 61 </view>
62 <view class="center-item"> 62 <view class="btn-group">
63 <button class="btn btn-register" @click="goRegister">注册</button>
64 <button class="btn btn-login" @click="login">登录</button>
65 </view>
66 <!-- <view class="center-item">
63 <button class="btn-red" @click="login">登录</button> 67 <button class="btn-red" @click="login">登录</button>
64 </view> 68 </view>
65 <view class="center-item"> 69 <view class="center-item">
66 <button class="btn-red btn-register" @click="goRegister">没有账号,去注册</button> 70 <button class="btn-red btn-register" @click="goRegister">没有账号,去注册</button>
67 </view> 71 </view> -->
68 </view> 72 </view>
69 <view class="wNumber"> 73 <view class="wNumber">
70 技术服务热线: 74 技术服务热线:
...@@ -122,7 +126,7 @@ import { ...@@ -122,7 +126,7 @@ import {
122 import config from '@/config.js' 126 import config from '@/config.js'
123 import { 127 import {
124 getCodeImg, 128 getCodeImg,
125 getSmsCode, 129 getSmsCodeImg,
126 pcLogin, 130 pcLogin,
127 loginByPhone 131 loginByPhone
128 } from '@/common/login.js' 132 } from '@/common/login.js'
...@@ -309,7 +313,7 @@ function getCaptchaSms() { ...@@ -309,7 +313,7 @@ function getCaptchaSms() {
309 return 313 return
310 } 314 }
311 315
312 getSmsCode({ 316 getSmsCodeImg({
313 uuid: form2.value.uuid, 317 uuid: form2.value.uuid,
314 telNo: form2.value.telNo, 318 telNo: form2.value.telNo,
315 code: form2.value.captcha 319 code: form2.value.captcha
...@@ -662,4 +666,34 @@ function call(num) { ...@@ -662,4 +666,34 @@ function call(num) {
662 background: #AD181F; 666 background: #AD181F;
663 color: #fff; 667 color: #fff;
664 } 668 }
669 .btn-group {
670 display: flex;
671 justify-content: space-between;
672 gap: 20rpx;
673 margin-top: 50rpx;
674
675 .btn {
676 flex: 1;
677 height: 88rpx;
678 line-height: 88rpx;
679 font-size: 32rpx;
680 font-weight: 500;
681 border-radius: 50rpx;
682 border: none;
683
684 &::after {
685 border: none;
686 }
687 }
688
689 .btn-register {
690 background: #D4B87A;
691 color: #fff;
692 }
693
694 .btn-login {
695 background: #AD181F;
696 color: #fff;
697 }
698 }
665 </style> 699 </style>
......
...@@ -52,9 +52,8 @@ ...@@ -52,9 +52,8 @@
52 52
53 <script setup> 53 <script setup>
54 import {ref} from 'vue' 54 import {ref} from 'vue'
55 import {onLoad, onReachBottom} from '@dcloudio/uni-app' 55 import {onLoad,onShow, onReachBottom} from '@dcloudio/uni-app'
56 import {getMyRecentExam} from '@/common/api' 56 import {getMyRecentExam} from '@/common/api'
57 import {onShow} from "@/unpackage/dist/dev/mp-weixin/common/vendor";
58 57
59 const app = getApp() 58 const app = getApp()
60 const list = ref([]) 59 const list = ref([])
......
...@@ -68,6 +68,10 @@ ...@@ -68,6 +68,10 @@
68 <text class="label">订单编号:</text> 68 <text class="label">订单编号:</text>
69 <text class="value">{{ item.tradeNo || '——' }}</text> 69 <text class="value">{{ item.tradeNo || '——' }}</text>
70 </view> 70 </view>
71 <view class="info-row" v-if="item.orderName">
72 <text class="label">缴费名称:</text>
73 <text class="value">{{ item.orderName || '' }}</text>
74 </view>
71 <!-- <view class="info-row"> 75 <!-- <view class="info-row">
72 <text class="label">缴费编号:</text> 76 <text class="label">缴费编号:</text>
73 77
......
...@@ -157,7 +157,9 @@ ...@@ -157,7 +157,9 @@
157 idcType: '0', 157 idcType: '0',
158 perType: '1', // (1:个人会员;2:教练;3:考官;4:裁判;5:临时会员;) 158 perType: '1', // (1:个人会员;2:教练;3:考官;4:裁判;5:临时会员;)
159 perCode:'', 159 perCode:'',
160 validityDate:'' 160 validityDate:'',
161 // multiDeptFlag: 1,
162 // isBlack: '1'
161 }) 163 })
162 const items = ref(['身份证添加', '证件照录入']) 164 const items = ref(['身份证添加', '证件照录入'])
163 const idcTypeList = ref([{ 165 const idcTypeList = ref([{
...@@ -476,7 +478,7 @@ ...@@ -476,7 +478,7 @@
476 getExtractInfo({ 478 getExtractInfo({
477 idcCode: baseFormData.value.idcCode, 479 idcCode: baseFormData.value.idcCode,
478 idcType: baseFormData.value.idcType, 480 idcType: baseFormData.value.idcType,
479 perType: baseFormData.value.perType 481 perType: baseFormData.value.perType || 1
480 }) 482 })
481 } 483 }
482 } 484 }
......
1 <template> 1 <template>
2 <view class="preview-container"> 2 <view class="preview-container">
3 <view class="loading-tip" v-if="loading">加载中...</view> 3 <!-- 加载提示 -->
4 <view class="error-tip" v-else-if="showError">{{ errorMsg }}</view> 4 <view class="loading-tip" v-if="loading">
5 <view class="loading-icon"></view>
6 <text>加载中...</text>
7 </view>
8
9 <!-- 错误提示 -->
10 <view class="error-tip" v-else-if="showError">
11 <text class="error-icon">⚠️</text>
12 <text class="error-text">{{ errorMsg }}</text>
13 <view class="retry-btn" @click="retryLoad">重试</view>
14 </view>
5 15
6 <web-view v-if="pdfUrl" :src="pdfUrl"></web-view> 16 <!-- 方式1:使用 web-view(备选) -->
17 <web-view
18 v-if="pdfUrl && !showError && useWebView"
19 :src="pdfUrl"
20 @message="onWebViewMessage"
21 ></web-view>
7 </view> 22 </view>
8 </template> 23 </template>
9 24
10 <script setup> 25 <script setup>
11 import { ref } from "vue"; 26 import { ref, onUnmounted } from "vue";
12 import { onLoad } from "@dcloudio/uni-app"; 27 import { onLoad } from "@dcloudio/uni-app";
13 import config from "@/config.js"; 28 import config from "@/config.js";
14 29
15 const pdfUrl = ref(""); 30 const pdfUrl = ref("");
16 const loading = ref(true); 31 const loading = ref(true);
17 const showError = ref(false); 32 const showError = ref(false);
18 const errorMsg = ref(""); 33 const errorMsg = ref("");
34 const useWebView = ref(false); // 是否使用 web-view 降级方案
35 let timeoutTimer = null;
19 36
20 onLoad((option) => { 37 onLoad((option) => {
21 if (option.url) { 38 if (option.url) {
22 pdfUrl.value = config.baseUrl_api + decodeURIComponent(option.url); 39 // 解码并拼接完整URL
23 loading.value = false; 40 let relativeUrl = decodeURIComponent(option.url);
41 let fullUrl = config.baseUrl_api + relativeUrl;
42
43 console.log("完整PDF地址:", fullUrl);
44
45 // 优先使用 openDocument 方式(兼容性最好)
46 openPdfWithDocument(fullUrl);
24 } else { 47 } else {
48 loading.value = false;
25 showError.value = true; 49 showError.value = true;
26 errorMsg.value = "参数错误"; 50 errorMsg.value = "参数错误";
27 } 51 }
52 });
53
54 // 优先方案:使用 uni.openDocument(推荐,兼容性最好)
55 const openPdfWithDocument = (url) => {
56 // 设置超时
57 timeoutTimer = setTimeout(() => {
58 if (loading.value) {
59 loading.value = false;
60 showError.value = true;
61 errorMsg.value = "加载超时,请检查网络";
62 }
63 }, 15000);
64
65 // 先下载文件
66 uni.downloadFile({
67 url: url,
68 success: (res) => {
69 clearTimeout(timeoutTimer);
70
71 if (res.statusCode === 200) {
72 const filePath = res.tempFilePath;
73 // 打开文档
74 uni.openDocument({
75 filePath: filePath,
76 success: () => {
77 // 打开成功,关闭当前页面
78 loading.value = false;
79 setTimeout(() => {
80 uni.navigateBack();
81 }, 500);
82 },
83 fail: (err) => {
84 console.error("openDocument失败:", err);
85 // 降级到 web-view 方式
86 fallbackToWebView(url);
87 }
88 });
89 } else {
90 fallbackToWebView(url);
91 }
92 },
93 fail: (err) => {
94 console.error("下载失败:", err);
95 clearTimeout(timeoutTimer);
96 // 降级到 web-view 方式
97 fallbackToWebView(url);
98 }
28 }); 99 });
100 };
101
102 // 降级方案:使用 web-view
103 const fallbackToWebView = (url) => {
104 console.log("降级使用 web-view 方式");
105 useWebView.value = true;
106
107 // 处理URL,确保是HTTPS
108 let webViewUrl = url;
109 if (webViewUrl.startsWith('http://')) {
110 webViewUrl = webViewUrl.replace('http://', 'https://');
111 }
112
113 // 添加时间戳避免缓存问题
114 webViewUrl = webViewUrl + (webViewUrl.includes('?') ? '&' : '?') + 't=' + Date.now();
115
116 pdfUrl.value = webViewUrl;
117
118 // 给 web-view 一些加载时间
119 setTimeout(() => {
120 if (loading.value) {
121 loading.value = false;
122 // 不立即显示错误,让 web-view 继续尝试
123 setTimeout(() => {
124 if (loading.value === false && !showError.value) {
125 // 如果还在加载状态,可能是真的有问题
126 // 但这里不做额外处理
127 }
128 }, 3000);
129 }
130 }, 2000);
131 };
132
133 // web-view 消息接收(可选)
134 const onWebViewMessage = (e) => {
135 console.log("web-view message:", e.detail);
136 };
137
138 // 重试加载
139 const retryLoad = () => {
140 showError.value = false;
141 loading.value = true;
142 useWebView.value = false;
143 errorMsg.value = "";
144
145 // 重新获取URL
146 const pages = getCurrentPages();
147 const currentPage = pages[pages.length - 1];
148 const url = currentPage.$page.options.url;
149
150 if (url) {
151 let fullUrl = BASE_URL + decodeURIComponent(url);
152 openPdfWithDocument(fullUrl);
153 }
154 };
155
156 // 页面卸载时清除定时器
157 onUnmounted(() => {
158 if (timeoutTimer) clearTimeout(timeoutTimer);
159 });
29 </script> 160 </script>
30 161
31 <style lang="scss" scoped> 162 <style lang="scss" scoped>
32 .preview-container { 163 .preview-container {
33 width: 100vw; 164 width: 100vw;
34 height: 100vh; 165 height: 100vh;
35 background: #f5f5f5; 166 background: #f5f5f5;
36 position: relative; 167 position: relative;
37 } 168 }
38 169
39 .loading-tip { 170 .loading-tip {
40 position: absolute; 171 position: absolute;
41 top: 50%; 172 top: 50%;
42 left: 50%; 173 left: 50%;
43 transform: translate(-50%, -50%); 174 transform: translate(-50%, -50%);
175 display: flex;
176 flex-direction: column;
177 align-items: center;
178 gap: 20rpx;
179
180 .loading-icon {
181 width: 60rpx;
182 height: 60rpx;
183 border: 4rpx solid #e0e0e0;
184 border-top-color: #AD181F;
185 border-radius: 50%;
186 animation: rotate 1s linear infinite;
187 }
188
189 text {
44 font-size: 28rpx; 190 font-size: 28rpx;
45 color: #666; 191 color: #666;
46 } 192 }
193 }
194
195 @keyframes rotate {
196 from {
197 transform: rotate(0deg);
198 }
199 to {
200 transform: rotate(360deg);
201 }
202 }
47 203
48 .error-tip { 204 .error-tip {
49 position: absolute; 205 position: absolute;
50 top: 50%; 206 top: 50%;
51 left: 50%; 207 left: 50%;
52 transform: translate(-50%, -50%); 208 transform: translate(-50%, -50%);
209 display: flex;
210 flex-direction: column;
211 align-items: center;
212 gap: 20rpx;
213
214 .error-icon {
215 font-size: 80rpx;
216 }
217
218 .error-text {
53 font-size: 28rpx; 219 font-size: 28rpx;
54 color: #C40F18; 220 color: #C40F18;
55 } 221 }
56 222
57 web-view { 223 .retry-btn {
224 margin-top: 30rpx;
225 padding: 16rpx 40rpx;
226 background: #AD181F;
227 color: #fff;
228 border-radius: 40rpx;
229 font-size: 28rpx;
230 }
231 }
232
233 web-view {
58 width: 100%; 234 width: 100%;
59 height: 100%; 235 height: 100%;
60 } 236 }
61 </style> 237 </style>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
14 </view> --> 14 </view> -->
15 <view class="card-body"> 15 <view class="card-body">
16 <view class="card-row"> 16 <view class="card-row">
17 <text class="row-label">级位</text> 17 <text class="row-label"> {{ pageType==0?'级位':'段位' }}</text>
18 <text class="row-value">{{ szToHz(item.level)}}</text> 18 <text class="row-value">{{ szToHz(item.level)}}{{ pageType==0?'级':'段' }}</text>
19 </view> 19 </view>
20 <view class="card-row"> 20 <view class="card-row">
21 <text class="row-label">级位号</text> 21 <text class="row-label">{{ pageType==0?'级位号':'段位号' }}</text>
22 <text class="row-value">{{ item.certCode || '-' }}</text> 22 <text class="row-value">{{ item.certCode || '-' }}</text>
23 </view> 23 </view>
24 <view class="card-row"> 24 <view class="card-row">
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
21 </view> 21 </view>
22 <view class="info-item"> 22 <view class="info-item">
23 <view class="info-label">性别</view> 23 <view class="info-label">性别</view>
24 <view class="info-value">{{ getGender(form?.sex) }}</view> 24 <view class="info-value">{{ form.sex == 0 ? '男' : '女' }}</view>
25 </view> 25 </view>
26 <view class="info-item"> 26 <view class="info-item">
27 <view class="info-label">会员编号</view> 27 <view class="info-label">会员编号</view>
...@@ -102,17 +102,7 @@ ...@@ -102,17 +102,7 @@
102 }; 102 };
103 103
104 // 获取性别 104 // 获取性别
105 const getGender = (gender) => { 105
106 switch (gender) {
107 case '0':
108 case '1':
109 return '男';
110 case '2':
111 return '女';
112 default:
113 return '--';
114 }
115 };
116 106
117 // 获取个人会员信息 107 // 获取个人会员信息
118 const getMemberInfo = async () => { 108 const getMemberInfo = async () => {
......
...@@ -424,7 +424,7 @@ ...@@ -424,7 +424,7 @@
424 getExtractInfo({ 424 getExtractInfo({
425 idcCode: baseFormData.value.idcCode, 425 idcCode: baseFormData.value.idcCode,
426 idcType: baseFormData.value.idcType, 426 idcType: baseFormData.value.idcType,
427 perType: baseFormData.value.perType 427 perType: baseFormData.value.perType ||1
428 }) 428 })
429 } 429 }
430 } 430 }
......
...@@ -48,6 +48,10 @@ ...@@ -48,6 +48,10 @@
48 <text class="label">订单编号</text> 48 <text class="label">订单编号</text>
49 <text class="value order-no">{{ item.tradeNo || '——' }}</text> 49 <text class="value order-no">{{ item.tradeNo || '——' }}</text>
50 </view> 50 </view>
51 <view class="info-row" v-if="item.orderName">
52 <text class="label">缴费名称</text>
53 <text class="value order-no">{{ item.orderName || '——' }}</text>
54 </view>
51 55
52 <!-- 缴费编号 --> 56 <!-- 缴费编号 -->
53 <view class="info-row payment-code-row" v-if="item.payTime"> 57 <view class="info-row payment-code-row" v-if="item.payTime">
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!