51313627 by lttnew

个人会员

1 parent 23436998
......@@ -62,7 +62,10 @@ function handleTokenExpire() {
function showError(msg) {
console.log('showError called:', msg)
// 先隐藏可能存在的 loading,确保 Toast 能显示
if (loadingCount > 0) {
loadingCount = 0
uni.hideLoading()
}
uni.showToast({
title: msg || '请求失败',
icon: 'none',
......
......@@ -4,7 +4,7 @@
<custom-modal ref="customModalRef" :title="modalConfig.title" :content="modalConfig.content" :showCancel="modalConfig.showCancel" :cancelText="modalConfig.cancelText" :confirmText="modalConfig.confirmText" @confirm="onModalConfirm" />
<!-- 考官选择类型 -->
<view class="radio-section">
<!-- <view class="radio-section">
<radio-group class="radio-group" @change="onSelfSelectChange">
<label class="radio-item">
<radio :checked="form.selfSelect == '1'" class="custom-radio" value="1"/>
......@@ -15,7 +15,7 @@
<text class="radio-text">省跆协指派考官</text>
</label>
</radio-group>
</view>
</view> -->
<!-- 温馨提示 -->
<view v-if="form.selfSelect == '1'" class="tip-box">
......
......@@ -2,7 +2,7 @@
<view class="exam-point-list">
<!-- 顶部申请按钮 -->
<view class="apply-btn-box">
<button class="apply-btn" :disabled="memberInfo.isPoints==0||memberInfo.auditStatus==2" @click="goApply">申请考点</button>
<button class="apply-btn" :disabled="memberInfo.isPoints==0&&memberInfo.auditStatus==2" @click="goApply">申请考点</button>
</view>
<!-- 列表 -->
......
......@@ -3,9 +3,7 @@
<view class="loading-tip" v-if="loading">加载中...</view>
<view class="error-tip" v-else-if="showError">{{ errorMsg }}</view>
<view class="download-btn" @click="openDocument">
<text>查看会员证</text>
</view>
<web-view v-if="pdfUrl" :src="pdfUrl"></web-view>
</view>
</template>
......@@ -18,65 +16,22 @@
const loading = ref(true);
const showError = ref(false);
const errorMsg = ref("");
const tempFilePath = ref("");
onLoad(async (option) => {
onLoad((option) => {
if (option.url) {
pdfUrl.value = config.baseUrl_api + decodeURIComponent(option.url);
await downloadPdf();
}
});
const downloadPdf = () => {
return new Promise((resolve) => {
uni.showLoading({ title: "加载中..." });
uni.downloadFile({
url: pdfUrl.value,
success: (res) => {
uni.hideLoading();
if (res.statusCode === 200) {
tempFilePath.value = res.tempFilePath;
loading.value = false;
// 自动打开文档
openDocument();
} else {
showError.value = true;
errorMsg.value = "下载失败";
errorMsg.value = "参数错误";
}
resolve();
},
fail: () => {
uni.hideLoading();
showError.value = true;
errorMsg.value = "下载失败";
resolve();
}
});
});
};
const openDocument = () => {
if (!tempFilePath.value) {
uni.showToast({ title: "文件未准备好", icon: "none" });
return;
}
uni.openDocument({
filePath: tempFilePath.value,
fileType: "pdf",
showMenu: true,
success: () => {
console.log("打开文档成功");
},
fail: () => {
uni.showToast({ title: "打开失败,请在右上角菜单中下载", icon: "none" });
}
});
};
</script>
<style lang="scss" scoped>
.preview-container {
min-height: 100vh;
width: 100vw;
height: 100vh;
background: #f5f5f5;
position: relative;
}
......@@ -99,16 +54,8 @@
color: #C40F18;
}
.download-btn {
position: fixed;
bottom: 50rpx;
left: 50%;
transform: translateX(-50%);
background: #C40F18;
color: #fff;
padding: 24rpx 60rpx;
border-radius: 40rpx;
font-size: 28rpx;
z-index: 100;
web-view {
width: 100%;
height: 100%;
}
</style>
......
......@@ -22,7 +22,7 @@
mode="aspectFill">
</image>
</view>
<view class="member-id">{{ userInfo.userName }}</view>
<view class="member-id">{{ userInfo?.userName }}</view>
</view>
<view class="user-bottom">
<view class="user-name">{{ perInfo?.perName }}</view>
......@@ -106,13 +106,13 @@
</view>
<uni-icons type="arrowright" size="20" color="#999"></uni-icons>
</view> -->
<view class="query-item" @click="goToWebView(4)">
<!-- <view class="query-item" @click="goToWebView(4)">
<view class="query-item-left">
<image :src="config.baseUrl_api + '/fs/static/user_icon02@2x.png'" class="query-item-icon"></image>
<text class="query-item-text">新版级位证书查询</text>
</view>
<uni-icons type="arrowright" size="20" color="#999"></uni-icons>
</view>
</view> -->
<!-- <view class="query-item" @click="goToWebView(5)">
<view class="query-item-left">
<image :src="config.baseUrl_api + '/fs/static/user_icon02@2x.png'" class="query-item-icon"></image>
......@@ -266,7 +266,12 @@ const showConfirm = ref(false)
watch(() => perInfo.value?.perCode, (val) => {
if (val === undefined || val === null || val === '') {
nextTick(() => {
// 延迟检查,确保数据已完全同步
setTimeout(() => {
if (!isBound.value) {
openBindPopup()
}
}, 500)
})
}
}, {
......@@ -479,7 +484,6 @@ const showConfirm = ref(false)
.page-container {
min-height: 100vh;
background: #f5f5f5;
padding-bottom: 40rpx;
}
/* 导航栏 */
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!