人员信息
Showing
2 changed files
with
44 additions
and
11 deletions
| ... | @@ -437,15 +437,18 @@ const goToAuth = () => { | ... | @@ -437,15 +437,18 @@ const goToAuth = () => { |
| 437 | }); | 437 | }); |
| 438 | }; | 438 | }; |
| 439 | 439 | ||
| 440 | const goToScore = () => { | 440 | const goToScore = () => { |
| 441 | if (!isBound.value) { | 441 | if (!isBound.value) { |
| 442 | uni.showToast({title: '请先绑定学员', icon: 'none'}) | 442 | uni.showToast({title: '请先绑定学员', icon: 'none'}) |
| 443 | return | 443 | return |
| 444 | } | 444 | } |
| 445 | uni.navigateTo({ | 445 | const perId = userInfo.value.perId ?? '' |
| 446 | url: '/personal/memberInfo' | 446 | const name = perInfo.value?.perName ? encodeURIComponent(perInfo.value.perName) : '' |
| 447 | }); | 447 | const idcCode = perInfo.value?.perIdcCode ? encodeURIComponent(perInfo.value.perIdcCode) : '' |
| 448 | }; | 448 | uni.navigateTo({ |
| 449 | url: `/personal/memberInfo?perId=${perId}&name=${name}&idcCode=${idcCode}` | ||
| 450 | }); | ||
| 451 | }; | ||
| 449 | 452 | ||
| 450 | const goToWebView = (type) => { | 453 | const goToWebView = (type) => { |
| 451 | // const url = "https://member.taekwondo.org.cn/#/authAccurate?type=" + type | 454 | // const url = "https://member.taekwondo.org.cn/#/authAccurate?type=" + type | ... | ... |
| ... | @@ -69,6 +69,7 @@ | ... | @@ -69,6 +69,7 @@ |
| 69 | 69 | ||
| 70 | <script setup> | 70 | <script setup> |
| 71 | import { ref, onMounted } from 'vue'; | 71 | import { ref, onMounted } from 'vue'; |
| 72 | import { onLoad } from '@dcloudio/uni-app'; | ||
| 72 | import { useUserStore } from '../store/modules/user'; | 73 | import { useUserStore } from '../store/modules/user'; |
| 73 | import { getAssoPers, getInfo } from '@/common/api.js'; | 74 | import { getAssoPers, getInfo } from '@/common/api.js'; |
| 74 | 75 | ||
| ... | @@ -76,6 +77,21 @@ | ... | @@ -76,6 +77,21 @@ |
| 76 | const form = ref({}); | 77 | const form = ref({}); |
| 77 | const loading = ref(false); | 78 | const loading = ref(false); |
| 78 | const perId = ref(''); | 79 | const perId = ref(''); |
| 80 | const homeFallbackInfo = ref({ | ||
| 81 | name: '', | ||
| 82 | idcCode: '' | ||
| 83 | }); | ||
| 84 | |||
| 85 | onLoad((option) => { | ||
| 86 | if (option.perId) { | ||
| 87 | perId.value = option.perId; | ||
| 88 | } | ||
| 89 | homeFallbackInfo.value = { | ||
| 90 | name: option.name ? decodeURIComponent(option.name) : '', | ||
| 91 | idcCode: option.idcCode ? decodeURIComponent(option.idcCode) : '' | ||
| 92 | }; | ||
| 93 | applyHomeFallbackInfo(); | ||
| 94 | }); | ||
| 79 | 95 | ||
| 80 | // 返回上一页 | 96 | // 返回上一页 |
| 81 | const goBack = () => { | 97 | const goBack = () => { |
| ... | @@ -109,7 +125,8 @@ | ... | @@ -109,7 +125,8 @@ |
| 109 | loading.value = true; | 125 | loading.value = true; |
| 110 | try { | 126 | try { |
| 111 | const res = await getInfo(perId.value); | 127 | const res = await getInfo(perId.value); |
| 112 | form.value = res.data; | 128 | form.value = res.data || {}; |
| 129 | applyHomeFallbackInfo(); | ||
| 113 | // 处理数据 | 130 | // 处理数据 |
| 114 | form.value.topAssName = form.value?.ancestorNameList?.[0] || '--'; | 131 | form.value.topAssName = form.value?.ancestorNameList?.[0] || '--'; |
| 115 | form.value.areaAssName = form.value?.ancestorNameList?.[1] || '--'; | 132 | form.value.areaAssName = form.value?.ancestorNameList?.[1] || '--'; |
| ... | @@ -121,6 +138,7 @@ | ... | @@ -121,6 +138,7 @@ |
| 121 | form.value.address = form.value.address || '--'; | 138 | form.value.address = form.value.address || '--'; |
| 122 | } catch (error) { | 139 | } catch (error) { |
| 123 | console.error('获取个人会员信息失败:', error); | 140 | console.error('获取个人会员信息失败:', error); |
| 141 | applyHomeFallbackInfo(); | ||
| 124 | uni.showToast({ | 142 | uni.showToast({ |
| 125 | title: '获取个人会员信息失败', | 143 | title: '获取个人会员信息失败', |
| 126 | icon: 'none' | 144 | icon: 'none' |
| ... | @@ -130,10 +148,22 @@ | ... | @@ -130,10 +148,22 @@ |
| 130 | } | 148 | } |
| 131 | }; | 149 | }; |
| 132 | 150 | ||
| 151 | const applyHomeFallbackInfo = () => { | ||
| 152 | if (!form.value) form.value = {}; | ||
| 153 | if (!form.value.name && homeFallbackInfo.value.name) { | ||
| 154 | form.value.name = homeFallbackInfo.value.name; | ||
| 155 | } | ||
| 156 | if (!form.value.idcCode && homeFallbackInfo.value.idcCode) { | ||
| 157 | form.value.idcCode = homeFallbackInfo.value.idcCode; | ||
| 158 | } | ||
| 159 | }; | ||
| 160 | |||
| 133 | onMounted(async () => { | 161 | onMounted(async () => { |
| 134 | // 获取perId | 162 | // 获取perId |
| 135 | const userInfo = userStore.user; | 163 | const userInfo = userStore.user; |
| 136 | if (userInfo && userInfo.perId) { | 164 | if (perId.value) { |
| 165 | getMemberInfo(); | ||
| 166 | } else if (userInfo && userInfo.perId) { | ||
| 137 | perId.value = userInfo.perId; | 167 | perId.value = userInfo.perId; |
| 138 | getMemberInfo(); | 168 | getMemberInfo(); |
| 139 | } else { | 169 | } else { | ... | ... |
-
Please register or sign in to post a comment