c24dbde7 by lttnew

修复bug

1 parent 6f6c7894
......@@ -1423,7 +1423,7 @@ export function groupInfoMod(ids) {
export function extractInfoFromChinaIdCard(data) {
return request({
url: '/person/info/extractInfo',
url: `/person/info/extractInfo?perType=1&idcCode=${data.idcCode}&idcType=${data.idcType}`,
method: 'post',
params: data
})
......
......@@ -59,12 +59,16 @@
<view class="flex-item">
</view>
<view class="center-item">
<view class="btn-group">
<button class="btn btn-register" @click="goRegister">注册</button>
<button class="btn btn-login" @click="login">登录</button>
</view>
<!-- <view class="center-item">
<button class="btn-red" @click="login">登录</button>
</view>
<view class="center-item">
<button class="btn-red btn-register" @click="goRegister">没有账号,去注册</button>
</view>
</view> -->
</view>
<view class="wNumber">
技术服务热线:
......@@ -74,7 +78,7 @@
@click="call('15305299762')">15305299762
</text>
</view>
</view>
</view>
<!-- <image :src="config.baseUrl_api+'/fs/static/login/ren2.png'" class="ren2"/> -->
......@@ -122,7 +126,7 @@ import {
import config from '@/config.js'
import {
getCodeImg,
getSmsCode,
getSmsCodeImg,
pcLogin,
loginByPhone
} from '@/common/login.js'
......@@ -309,7 +313,7 @@ function getCaptchaSms() {
return
}
getSmsCode({
getSmsCodeImg({
uuid: form2.value.uuid,
telNo: form2.value.telNo,
code: form2.value.captcha
......@@ -662,4 +666,34 @@ function call(num) {
background: #AD181F;
color: #fff;
}
.btn-group {
display: flex;
justify-content: space-between;
gap: 20rpx;
margin-top: 50rpx;
.btn {
flex: 1;
height: 88rpx;
line-height: 88rpx;
font-size: 32rpx;
font-weight: 500;
border-radius: 50rpx;
border: none;
&::after {
border: none;
}
}
.btn-register {
background: #D4B87A;
color: #fff;
}
.btn-login {
background: #AD181F;
color: #fff;
}
}
</style>
......
......@@ -52,9 +52,8 @@
<script setup>
import {ref} from 'vue'
import {onLoad, onReachBottom} from '@dcloudio/uni-app'
import {onLoad,onShow, onReachBottom} from '@dcloudio/uni-app'
import {getMyRecentExam} from '@/common/api'
import {onShow} from "@/unpackage/dist/dev/mp-weixin/common/vendor";
const app = getApp()
const list = ref([])
......
......@@ -68,6 +68,10 @@
<text class="label">订单编号:</text>
<text class="value">{{ item.tradeNo || '——' }}</text>
</view>
<view class="info-row" v-if="item.orderName">
<text class="label">缴费名称:</text>
<text class="value">{{ item.orderName || '' }}</text>
</view>
<!-- <view class="info-row">
<text class="label">缴费编号:</text>
......
......@@ -157,7 +157,9 @@
idcType: '0',
perType: '1', // (1:个人会员;2:教练;3:考官;4:裁判;5:临时会员;)
perCode:'',
validityDate:''
validityDate:'',
// multiDeptFlag: 1,
// isBlack: '1'
})
const items = ref(['身份证添加', '证件照录入'])
const idcTypeList = ref([{
......@@ -476,7 +478,7 @@
getExtractInfo({
idcCode: baseFormData.value.idcCode,
idcType: baseFormData.value.idcType,
perType: baseFormData.value.perType
perType: baseFormData.value.perType || 1
})
}
}
......
<template>
<view class="preview-container">
<view class="loading-tip" v-if="loading">加载中...</view>
<view class="error-tip" v-else-if="showError">{{ errorMsg }}</view>
<view class="preview-container">
<!-- 加载提示 -->
<view class="loading-tip" v-if="loading">
<view class="loading-icon"></view>
<text>加载中...</text>
</view>
<!-- 错误提示 -->
<view class="error-tip" v-else-if="showError">
<text class="error-icon">⚠️</text>
<text class="error-text">{{ errorMsg }}</text>
<view class="retry-btn" @click="retryLoad">重试</view>
</view>
<web-view v-if="pdfUrl" :src="pdfUrl"></web-view>
</view>
<!-- 方式1:使用 web-view(备选) -->
<web-view
v-if="pdfUrl && !showError && useWebView"
:src="pdfUrl"
@message="onWebViewMessage"
></web-view>
</view>
</template>
<script setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { ref, onUnmounted } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import config from "@/config.js";
const pdfUrl = ref("");
const loading = ref(true);
const showError = ref(false);
const errorMsg = ref("");
onLoad((option) => {
if (option.url) {
pdfUrl.value = config.baseUrl_api + decodeURIComponent(option.url);
loading.value = false;
} else {
showError.value = true;
errorMsg.value = "参数错误";
}
});
const pdfUrl = ref("");
const loading = ref(true);
const showError = ref(false);
const errorMsg = ref("");
const useWebView = ref(false); // 是否使用 web-view 降级方案
let timeoutTimer = null;
onLoad((option) => {
if (option.url) {
// 解码并拼接完整URL
let relativeUrl = decodeURIComponent(option.url);
let fullUrl = config.baseUrl_api + relativeUrl;
console.log("完整PDF地址:", fullUrl);
// 优先使用 openDocument 方式(兼容性最好)
openPdfWithDocument(fullUrl);
} else {
loading.value = false;
showError.value = true;
errorMsg.value = "参数错误";
}
});
// 优先方案:使用 uni.openDocument(推荐,兼容性最好)
const openPdfWithDocument = (url) => {
// 设置超时
timeoutTimer = setTimeout(() => {
if (loading.value) {
loading.value = false;
showError.value = true;
errorMsg.value = "加载超时,请检查网络";
}
}, 15000);
// 先下载文件
uni.downloadFile({
url: url,
success: (res) => {
clearTimeout(timeoutTimer);
if (res.statusCode === 200) {
const filePath = res.tempFilePath;
// 打开文档
uni.openDocument({
filePath: filePath,
success: () => {
// 打开成功,关闭当前页面
loading.value = false;
setTimeout(() => {
uni.navigateBack();
}, 500);
},
fail: (err) => {
console.error("openDocument失败:", err);
// 降级到 web-view 方式
fallbackToWebView(url);
}
});
} else {
fallbackToWebView(url);
}
},
fail: (err) => {
console.error("下载失败:", err);
clearTimeout(timeoutTimer);
// 降级到 web-view 方式
fallbackToWebView(url);
}
});
};
// 降级方案:使用 web-view
const fallbackToWebView = (url) => {
console.log("降级使用 web-view 方式");
useWebView.value = true;
// 处理URL,确保是HTTPS
let webViewUrl = url;
if (webViewUrl.startsWith('http://')) {
webViewUrl = webViewUrl.replace('http://', 'https://');
}
// 添加时间戳避免缓存问题
webViewUrl = webViewUrl + (webViewUrl.includes('?') ? '&' : '?') + 't=' + Date.now();
pdfUrl.value = webViewUrl;
// 给 web-view 一些加载时间
setTimeout(() => {
if (loading.value) {
loading.value = false;
// 不立即显示错误,让 web-view 继续尝试
setTimeout(() => {
if (loading.value === false && !showError.value) {
// 如果还在加载状态,可能是真的有问题
// 但这里不做额外处理
}
}, 3000);
}
}, 2000);
};
// web-view 消息接收(可选)
const onWebViewMessage = (e) => {
console.log("web-view message:", e.detail);
};
// 重试加载
const retryLoad = () => {
showError.value = false;
loading.value = true;
useWebView.value = false;
errorMsg.value = "";
// 重新获取URL
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const url = currentPage.$page.options.url;
if (url) {
let fullUrl = BASE_URL + decodeURIComponent(url);
openPdfWithDocument(fullUrl);
}
};
// 页面卸载时清除定时器
onUnmounted(() => {
if (timeoutTimer) clearTimeout(timeoutTimer);
});
</script>
<style lang="scss" scoped>
.preview-container {
width: 100vw;
height: 100vh;
background: #f5f5f5;
position: relative;
}
.loading-tip {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 28rpx;
color: #666;
}
.error-tip {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 28rpx;
color: #C40F18;
}
web-view {
width: 100%;
height: 100%;
}
</style>
.preview-container {
width: 100vw;
height: 100vh;
background: #f5f5f5;
position: relative;
}
.loading-tip {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 20rpx;
.loading-icon {
width: 60rpx;
height: 60rpx;
border: 4rpx solid #e0e0e0;
border-top-color: #AD181F;
border-radius: 50%;
animation: rotate 1s linear infinite;
}
text {
font-size: 28rpx;
color: #666;
}
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.error-tip {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 20rpx;
.error-icon {
font-size: 80rpx;
}
.error-text {
font-size: 28rpx;
color: #C40F18;
}
.retry-btn {
margin-top: 30rpx;
padding: 16rpx 40rpx;
background: #AD181F;
color: #fff;
border-radius: 40rpx;
font-size: 28rpx;
}
}
web-view {
width: 100%;
height: 100%;
}
</style>
\ No newline at end of file
......
......@@ -14,11 +14,11 @@
</view> -->
<view class="card-body">
<view class="card-row">
<text class="row-label">级位</text>
<text class="row-value">{{ szToHz(item.level)}}</text>
<text class="row-label"> {{ pageType==0?'级位':'段位' }}</text>
<text class="row-value">{{ szToHz(item.level)}}{{ pageType==0?'级':'段' }}</text>
</view>
<view class="card-row">
<text class="row-label">级位号</text>
<text class="row-label">{{ pageType==0?'级位号':'段位号' }}</text>
<text class="row-value">{{ item.certCode || '-' }}</text>
</view>
<view class="card-row">
......
......@@ -21,7 +21,7 @@
</view>
<view class="info-item">
<view class="info-label">性别</view>
<view class="info-value">{{ getGender(form?.sex) }}</view>
<view class="info-value">{{ form.sex == 0 ? '男' : '女' }}</view>
</view>
<view class="info-item">
<view class="info-label">会员编号</view>
......@@ -102,17 +102,7 @@
};
// 获取性别
const getGender = (gender) => {
switch (gender) {
case '0':
case '1':
return '男';
case '2':
return '女';
default:
return '--';
}
};
// 获取个人会员信息
const getMemberInfo = async () => {
......
......@@ -424,7 +424,7 @@
getExtractInfo({
idcCode: baseFormData.value.idcCode,
idcType: baseFormData.value.idcType,
perType: baseFormData.value.perType
perType: baseFormData.value.perType ||1
})
}
}
......
......@@ -48,6 +48,10 @@
<text class="label">订单编号</text>
<text class="value order-no">{{ item.tradeNo || '——' }}</text>
</view>
<view class="info-row" v-if="item.orderName">
<text class="label">缴费名称</text>
<text class="value order-no">{{ item.orderName || '——' }}</text>
</view>
<!-- 缴费编号 -->
<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!