个人中心页面接口数据获取

This commit is contained in:
WindowBird 2025-08-27 11:09:36 +08:00
parent 5c935f23b1
commit a5f7f64459
2 changed files with 57 additions and 47 deletions

View File

@ -1,5 +1,5 @@
// 个人中心相关API
import { get, request } from '@/utils/request'
import { get, request } from "@/utils/request";
/**
* 获取预约列表
@ -10,10 +10,10 @@ import { get, request } from '@/utils/request'
* @returns {Promise} 返回预约列表数据
*/
export function getAppointmentList(params) {
return get('/app/subscribe/list', params, {
timeout: 10000,
return get("/app/subscribe/list", params, {
timeout: 6000,
showLoading: false,
})
});
}
/**
@ -23,12 +23,12 @@ export function getAppointmentList(params) {
*/
export function cancelAppointment(subscribeId) {
return request({
url: '/app/subscribe/cancelSub',
method: 'PUT',
url: "/app/subscribe/cancelSub",
method: "PUT",
params: {
subscribeId: subscribeId
}
})
subscribeId: subscribeId,
},
});
}
/**
@ -37,12 +37,16 @@ export function cancelAppointment(subscribeId) {
* @returns {Promise} 返回核销结果
*/
export function verifyAppointmentCode(subscribeId) {
return get('/app/subscribe/verifiedCode', {
subscribeId: subscribeId
}, {
timeout: 10000,
showLoading: true,
})
return get(
"/app/subscribe/verifiedCode",
{
subscribeId: subscribeId,
},
{
timeout: 6000,
showLoading: true,
},
);
}
/**
@ -50,10 +54,14 @@ export function verifyAppointmentCode(subscribeId) {
* @returns {Promise} 返回用户信息
*/
export function getUserInfo() {
return get('/app/user/info', {}, {
timeout: 10000,
showLoading: false,
})
return get(
"/app/user/getUser",
{},
{
timeout: 6000,
showLoading: false,
},
);
}
/**
@ -63,10 +71,10 @@ export function getUserInfo() {
*/
export function updateUserInfo(data) {
return request({
url: '/app/user/info',
method: 'PUT',
url: "/app/user/info",
method: "PUT",
data,
})
});
}
/**
@ -77,10 +85,10 @@ export function updateUserInfo(data) {
* @returns {Promise} 返回收藏列表数据
*/
export function getMyCollection(params) {
return get('/app/collection/list', params, {
timeout: 10000,
return get("/app/collection/list", params, {
timeout: 6000,
showLoading: false,
})
});
}
/**
@ -91,10 +99,10 @@ export function getMyCollection(params) {
* @returns {Promise} 返回捐赠历史数据
*/
export function getDonationHistory(params) {
return get('/app/donation/history', params, {
timeout: 10000,
return get("/app/donation/history", params, {
timeout: 6000,
showLoading: false,
})
});
}
/**
@ -105,10 +113,10 @@ export function getDonationHistory(params) {
* @returns {Promise} 返回祈福记录数据
*/
export function getPrayerRecords(params) {
return get('/app/prayer/records', params, {
timeout: 10000,
return get("/app/prayer/records", params, {
timeout: 6000,
showLoading: false,
})
});
}
/**
@ -119,8 +127,8 @@ export function getPrayerRecords(params) {
* @returns {Promise} 返回寺庙活动数据
*/
export function getTempleActivities(params) {
return get('/app/temple/activities', params, {
timeout: 10000,
return get("/app/temple/activities", params, {
timeout: 6000,
showLoading: false,
})
});
}

View File

@ -5,16 +5,12 @@
<custom-navbar ref="customNavbar" title="个人中心" />
<view class="user-info">
<view class="avatar-container">
<image
class="avatar"
mode="aspectFill"
src="https://api.ccttiot.com/image-1755237410755.png"
/>
<image :src="userInfo.avatar" class="avatar" mode="aspectFill" />
</view>
<view class="user-details">
<text class="phone-number">{{ userInfo.phone }}</text>
<view class="verification-status">
<text class="status-text">{{ userInfo.verificationStatus }}</text>
<text class="status-text">{{ realNameStatus }}</text>
</view>
</view>
</view>
@ -57,8 +53,9 @@ export default {
loading: false,
//
userInfo: {
phone: "138****8912",
verificationStatus: "未实名",
phone: "666****6666",
verificationStatus: "false",
avatar: "",
},
//
menuItems: [
@ -97,15 +94,15 @@ export default {
methods: {
//
async loadUserInfo() {
this.loading = true;
try {
const response = await getUserInfo();
if (response.code === 200) {
//
this.userInfo = {
phone: response.data.phone || "138****8912",
verificationStatus: response.data.verificationStatus || "未实名",
phone: response.data.phonenumber || "666****6666",
isRealName: response.data.isReal || "false",
avatar: response.data.avatar,
};
} else {
console.warn("获取用户信息失败:", response.msg);
@ -138,6 +135,11 @@ export default {
}
},
},
computed: {
realNameStatus() {
return this.isRealName ? "实名" : "未实名";
},
},
};
</script>