个人会员
Showing
5 changed files
with
22 additions
and
68 deletions
| ... | @@ -62,7 +62,10 @@ function handleTokenExpire() { | ... | @@ -62,7 +62,10 @@ function handleTokenExpire() { |
| 62 | function showError(msg) { | 62 | function showError(msg) { |
| 63 | console.log('showError called:', msg) | 63 | console.log('showError called:', msg) |
| 64 | // 先隐藏可能存在的 loading,确保 Toast 能显示 | 64 | // 先隐藏可能存在的 loading,确保 Toast 能显示 |
| 65 | if (loadingCount > 0) { | ||
| 66 | loadingCount = 0 | ||
| 65 | uni.hideLoading() | 67 | uni.hideLoading() |
| 68 | } | ||
| 66 | uni.showToast({ | 69 | uni.showToast({ |
| 67 | title: msg || '请求失败', | 70 | title: msg || '请求失败', |
| 68 | icon: 'none', | 71 | icon: 'none', | ... | ... |
| ... | @@ -4,7 +4,7 @@ | ... | @@ -4,7 +4,7 @@ |
| 4 | <custom-modal ref="customModalRef" :title="modalConfig.title" :content="modalConfig.content" :showCancel="modalConfig.showCancel" :cancelText="modalConfig.cancelText" :confirmText="modalConfig.confirmText" @confirm="onModalConfirm" /> | 4 | <custom-modal ref="customModalRef" :title="modalConfig.title" :content="modalConfig.content" :showCancel="modalConfig.showCancel" :cancelText="modalConfig.cancelText" :confirmText="modalConfig.confirmText" @confirm="onModalConfirm" /> |
| 5 | 5 | ||
| 6 | <!-- 考官选择类型 --> | 6 | <!-- 考官选择类型 --> |
| 7 | <view class="radio-section"> | 7 | <!-- <view class="radio-section"> |
| 8 | <radio-group class="radio-group" @change="onSelfSelectChange"> | 8 | <radio-group class="radio-group" @change="onSelfSelectChange"> |
| 9 | <label class="radio-item"> | 9 | <label class="radio-item"> |
| 10 | <radio :checked="form.selfSelect == '1'" class="custom-radio" value="1"/> | 10 | <radio :checked="form.selfSelect == '1'" class="custom-radio" value="1"/> |
| ... | @@ -15,7 +15,7 @@ | ... | @@ -15,7 +15,7 @@ |
| 15 | <text class="radio-text">省跆协指派考官</text> | 15 | <text class="radio-text">省跆协指派考官</text> |
| 16 | </label> | 16 | </label> |
| 17 | </radio-group> | 17 | </radio-group> |
| 18 | </view> | 18 | </view> --> |
| 19 | 19 | ||
| 20 | <!-- 温馨提示 --> | 20 | <!-- 温馨提示 --> |
| 21 | <view v-if="form.selfSelect == '1'" class="tip-box"> | 21 | <view v-if="form.selfSelect == '1'" class="tip-box"> | ... | ... |
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | <view class="exam-point-list"> | 2 | <view class="exam-point-list"> |
| 3 | <!-- 顶部申请按钮 --> | 3 | <!-- 顶部申请按钮 --> |
| 4 | <view class="apply-btn-box"> | 4 | <view class="apply-btn-box"> |
| 5 | <button class="apply-btn" :disabled="memberInfo.isPoints==0||memberInfo.auditStatus==2" @click="goApply">申请考点</button> | 5 | <button class="apply-btn" :disabled="memberInfo.isPoints==0&&memberInfo.auditStatus==2" @click="goApply">申请考点</button> |
| 6 | </view> | 6 | </view> |
| 7 | 7 | ||
| 8 | <!-- 列表 --> | 8 | <!-- 列表 --> | ... | ... |
| ... | @@ -3,9 +3,7 @@ | ... | @@ -3,9 +3,7 @@ |
| 3 | <view class="loading-tip" v-if="loading">加载中...</view> | 3 | <view class="loading-tip" v-if="loading">加载中...</view> |
| 4 | <view class="error-tip" v-else-if="showError">{{ errorMsg }}</view> | 4 | <view class="error-tip" v-else-if="showError">{{ errorMsg }}</view> |
| 5 | 5 | ||
| 6 | <view class="download-btn" @click="openDocument"> | 6 | <web-view v-if="pdfUrl" :src="pdfUrl"></web-view> |
| 7 | <text>查看会员证</text> | ||
| 8 | </view> | ||
| 9 | </view> | 7 | </view> |
| 10 | </template> | 8 | </template> |
| 11 | 9 | ||
| ... | @@ -18,65 +16,22 @@ | ... | @@ -18,65 +16,22 @@ |
| 18 | const loading = ref(true); | 16 | const loading = ref(true); |
| 19 | const showError = ref(false); | 17 | const showError = ref(false); |
| 20 | const errorMsg = ref(""); | 18 | const errorMsg = ref(""); |
| 21 | const tempFilePath = ref(""); | ||
| 22 | 19 | ||
| 23 | onLoad(async (option) => { | 20 | onLoad((option) => { |
| 24 | if (option.url) { | 21 | if (option.url) { |
| 25 | pdfUrl.value = config.baseUrl_api + decodeURIComponent(option.url); | 22 | pdfUrl.value = config.baseUrl_api + decodeURIComponent(option.url); |
| 26 | await downloadPdf(); | ||
| 27 | } | ||
| 28 | }); | ||
| 29 | |||
| 30 | const downloadPdf = () => { | ||
| 31 | return new Promise((resolve) => { | ||
| 32 | uni.showLoading({ title: "加载中..." }); | ||
| 33 | uni.downloadFile({ | ||
| 34 | url: pdfUrl.value, | ||
| 35 | success: (res) => { | ||
| 36 | uni.hideLoading(); | ||
| 37 | if (res.statusCode === 200) { | ||
| 38 | tempFilePath.value = res.tempFilePath; | ||
| 39 | loading.value = false; | 23 | loading.value = false; |
| 40 | // 自动打开文档 | ||
| 41 | openDocument(); | ||
| 42 | } else { | 24 | } else { |
| 43 | showError.value = true; | 25 | showError.value = true; |
| 44 | errorMsg.value = "下载失败"; | 26 | errorMsg.value = "参数错误"; |
| 45 | } | 27 | } |
| 46 | resolve(); | ||
| 47 | }, | ||
| 48 | fail: () => { | ||
| 49 | uni.hideLoading(); | ||
| 50 | showError.value = true; | ||
| 51 | errorMsg.value = "下载失败"; | ||
| 52 | resolve(); | ||
| 53 | } | ||
| 54 | }); | ||
| 55 | }); | 28 | }); |
| 56 | }; | ||
| 57 | |||
| 58 | const openDocument = () => { | ||
| 59 | if (!tempFilePath.value) { | ||
| 60 | uni.showToast({ title: "文件未准备好", icon: "none" }); | ||
| 61 | return; | ||
| 62 | } | ||
| 63 | uni.openDocument({ | ||
| 64 | filePath: tempFilePath.value, | ||
| 65 | fileType: "pdf", | ||
| 66 | showMenu: true, | ||
| 67 | success: () => { | ||
| 68 | console.log("打开文档成功"); | ||
| 69 | }, | ||
| 70 | fail: () => { | ||
| 71 | uni.showToast({ title: "打开失败,请在右上角菜单中下载", icon: "none" }); | ||
| 72 | } | ||
| 73 | }); | ||
| 74 | }; | ||
| 75 | </script> | 29 | </script> |
| 76 | 30 | ||
| 77 | <style lang="scss" scoped> | 31 | <style lang="scss" scoped> |
| 78 | .preview-container { | 32 | .preview-container { |
| 79 | min-height: 100vh; | 33 | width: 100vw; |
| 34 | height: 100vh; | ||
| 80 | background: #f5f5f5; | 35 | background: #f5f5f5; |
| 81 | position: relative; | 36 | position: relative; |
| 82 | } | 37 | } |
| ... | @@ -99,16 +54,8 @@ | ... | @@ -99,16 +54,8 @@ |
| 99 | color: #C40F18; | 54 | color: #C40F18; |
| 100 | } | 55 | } |
| 101 | 56 | ||
| 102 | .download-btn { | 57 | web-view { |
| 103 | position: fixed; | 58 | width: 100%; |
| 104 | bottom: 50rpx; | 59 | height: 100%; |
| 105 | left: 50%; | ||
| 106 | transform: translateX(-50%); | ||
| 107 | background: #C40F18; | ||
| 108 | color: #fff; | ||
| 109 | padding: 24rpx 60rpx; | ||
| 110 | border-radius: 40rpx; | ||
| 111 | font-size: 28rpx; | ||
| 112 | z-index: 100; | ||
| 113 | } | 60 | } |
| 114 | </style> | 61 | </style> | ... | ... |
| ... | @@ -22,7 +22,7 @@ | ... | @@ -22,7 +22,7 @@ |
| 22 | mode="aspectFill"> | 22 | mode="aspectFill"> |
| 23 | </image> | 23 | </image> |
| 24 | </view> | 24 | </view> |
| 25 | <view class="member-id">{{ userInfo.userName }}</view> | 25 | <view class="member-id">{{ userInfo?.userName }}</view> |
| 26 | </view> | 26 | </view> |
| 27 | <view class="user-bottom"> | 27 | <view class="user-bottom"> |
| 28 | <view class="user-name">{{ perInfo?.perName }}</view> | 28 | <view class="user-name">{{ perInfo?.perName }}</view> |
| ... | @@ -106,13 +106,13 @@ | ... | @@ -106,13 +106,13 @@ |
| 106 | </view> | 106 | </view> |
| 107 | <uni-icons type="arrowright" size="20" color="#999"></uni-icons> | 107 | <uni-icons type="arrowright" size="20" color="#999"></uni-icons> |
| 108 | </view> --> | 108 | </view> --> |
| 109 | <view class="query-item" @click="goToWebView(4)"> | 109 | <!-- <view class="query-item" @click="goToWebView(4)"> |
| 110 | <view class="query-item-left"> | 110 | <view class="query-item-left"> |
| 111 | <image :src="config.baseUrl_api + '/fs/static/user_icon02@2x.png'" class="query-item-icon"></image> | 111 | <image :src="config.baseUrl_api + '/fs/static/user_icon02@2x.png'" class="query-item-icon"></image> |
| 112 | <text class="query-item-text">新版级位证书查询</text> | 112 | <text class="query-item-text">新版级位证书查询</text> |
| 113 | </view> | 113 | </view> |
| 114 | <uni-icons type="arrowright" size="20" color="#999"></uni-icons> | 114 | <uni-icons type="arrowright" size="20" color="#999"></uni-icons> |
| 115 | </view> | 115 | </view> --> |
| 116 | <!-- <view class="query-item" @click="goToWebView(5)"> | 116 | <!-- <view class="query-item" @click="goToWebView(5)"> |
| 117 | <view class="query-item-left"> | 117 | <view class="query-item-left"> |
| 118 | <image :src="config.baseUrl_api + '/fs/static/user_icon02@2x.png'" class="query-item-icon"></image> | 118 | <image :src="config.baseUrl_api + '/fs/static/user_icon02@2x.png'" class="query-item-icon"></image> |
| ... | @@ -266,7 +266,12 @@ const showConfirm = ref(false) | ... | @@ -266,7 +266,12 @@ const showConfirm = ref(false) |
| 266 | watch(() => perInfo.value?.perCode, (val) => { | 266 | watch(() => perInfo.value?.perCode, (val) => { |
| 267 | if (val === undefined || val === null || val === '') { | 267 | if (val === undefined || val === null || val === '') { |
| 268 | nextTick(() => { | 268 | nextTick(() => { |
| 269 | // 延迟检查,确保数据已完全同步 | ||
| 270 | setTimeout(() => { | ||
| 271 | if (!isBound.value) { | ||
| 269 | openBindPopup() | 272 | openBindPopup() |
| 273 | } | ||
| 274 | }, 500) | ||
| 270 | }) | 275 | }) |
| 271 | } | 276 | } |
| 272 | }, { | 277 | }, { |
| ... | @@ -479,7 +484,6 @@ const showConfirm = ref(false) | ... | @@ -479,7 +484,6 @@ const showConfirm = ref(false) |
| 479 | .page-container { | 484 | .page-container { |
| 480 | min-height: 100vh; | 485 | min-height: 100vh; |
| 481 | background: #f5f5f5; | 486 | background: #f5f5f5; |
| 482 | padding-bottom: 40rpx; | ||
| 483 | } | 487 | } |
| 484 | 488 | ||
| 485 | /* 导航栏 */ | 489 | /* 导航栏 */ | ... | ... |
-
Please register or sign in to post a comment