1c937c08 by lttnew

人员信息

1 parent 3b993e08
......@@ -437,15 +437,18 @@ const goToAuth = () => {
});
};
const goToScore = () => {
if (!isBound.value) {
uni.showToast({title: '请先绑定学员', icon: 'none'})
return
}
uni.navigateTo({
url: '/personal/memberInfo'
});
};
const goToScore = () => {
if (!isBound.value) {
uni.showToast({title: '请先绑定学员', icon: 'none'})
return
}
const perId = userInfo.value.perId ?? ''
const name = perInfo.value?.perName ? encodeURIComponent(perInfo.value.perName) : ''
const idcCode = perInfo.value?.perIdcCode ? encodeURIComponent(perInfo.value.perIdcCode) : ''
uni.navigateTo({
url: `/personal/memberInfo?perId=${perId}&name=${name}&idcCode=${idcCode}`
});
};
const goToWebView = (type) => {
// const url = "https://member.taekwondo.org.cn/#/authAccurate?type=" + type
......
......@@ -69,6 +69,7 @@
<script setup>
import { ref, onMounted } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { useUserStore } from '../store/modules/user';
import { getAssoPers, getInfo } from '@/common/api.js';
......@@ -76,6 +77,21 @@
const form = ref({});
const loading = ref(false);
const perId = ref('');
const homeFallbackInfo = ref({
name: '',
idcCode: ''
});
onLoad((option) => {
if (option.perId) {
perId.value = option.perId;
}
homeFallbackInfo.value = {
name: option.name ? decodeURIComponent(option.name) : '',
idcCode: option.idcCode ? decodeURIComponent(option.idcCode) : ''
};
applyHomeFallbackInfo();
});
// 返回上一页
const goBack = () => {
......@@ -109,7 +125,8 @@
loading.value = true;
try {
const res = await getInfo(perId.value);
form.value = res.data;
form.value = res.data || {};
applyHomeFallbackInfo();
// 处理数据
form.value.topAssName = form.value?.ancestorNameList?.[0] || '--';
form.value.areaAssName = form.value?.ancestorNameList?.[1] || '--';
......@@ -121,6 +138,7 @@
form.value.address = form.value.address || '--';
} catch (error) {
console.error('获取个人会员信息失败:', error);
applyHomeFallbackInfo();
uni.showToast({
title: '获取个人会员信息失败',
icon: 'none'
......@@ -130,10 +148,22 @@
}
};
const applyHomeFallbackInfo = () => {
if (!form.value) form.value = {};
if (!form.value.name && homeFallbackInfo.value.name) {
form.value.name = homeFallbackInfo.value.name;
}
if (!form.value.idcCode && homeFallbackInfo.value.idcCode) {
form.value.idcCode = homeFallbackInfo.value.idcCode;
}
};
onMounted(async () => {
// 获取perId
const userInfo = userStore.user;
if (userInfo && userInfo.perId) {
if (perId.value) {
getMemberInfo();
} else if (userInfo && userInfo.perId) {
perId.value = userInfo.perId;
getMemberInfo();
} else {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!