Commit 5aef76d0 authored by 王炽's avatar 王炽

邀请记录页

parent 67644f4a
...@@ -56,3 +56,6 @@ export const assistInviteJSON = (invitationCode, wxUnionId) => api.post('/c/acti ...@@ -56,3 +56,6 @@ export const assistInviteJSON = (invitationCode, wxUnionId) => api.post('/c/acti
invitationCode, invitationCode,
wxUnionId wxUnionId
}); });
//获取邀请记录列表接口
export const getInvitationListJSON = () => api.get('/c/activity/origin_invite/invitationList');
{
"ok": true,
"success": true,
"msg": "获取成功",
"code": "000000",
"data": [
{
"id": 1001,
"activityId": 1,
"inviterUserId": 123456,
"inviteeUserId": 234567,
"inviteePhone": "136****2718",
"inviteeName": "张**",
"inviteeIcon": "https://example.com/icon1.png",
"createTime": "2025-09-11 23:23:23"
},
{
"id": 1002,
"activityId": 1,
"inviterUserId": 123456,
"inviteeUserId": 234568,
"inviteePhone": "138****4567",
"inviteeName": "李**",
"inviteeIcon": "https://example.com/icon2.png",
"createTime": "2025-09-10 15:30:45"
},
{
"id": 1003,
"activityId": 1,
"inviterUserId": 123456,
"inviteeUserId": 234569,
"inviteePhone": "139****7890",
"inviteeName": "王**",
"inviteeIcon": "https://example.com/icon3.png",
"createTime": "2025-09-09 09:15:20"
},
{
"id": 1004,
"activityId": 1,
"inviterUserId": 123456,
"inviteeUserId": 234570,
"inviteePhone": "135****1234",
"inviteeName": "赵**",
"inviteeIcon": "https://example.com/icon4.png",
"createTime": "2025-09-08 18:45:30"
},
{
"id": 1005,
"activityId": 1,
"inviterUserId": 123456,
"inviteeUserId": 234571,
"inviteePhone": "137****5678",
"inviteeName": "钱**",
"inviteeIcon": "https://example.com/icon5.png",
"createTime": "2025-09-07 12:20:15"
},
{
"id": 1006,
"activityId": 1,
"inviterUserId": 123456,
"inviteeUserId": 234572,
"inviteePhone": "150****9012",
"inviteeName": "孙**",
"inviteeIcon": "https://example.com/icon6.png",
"createTime": "2025-09-06 10:30:25"
},
{
"id": 1007,
"activityId": 1,
"inviterUserId": 123456,
"inviteeUserId": 234573,
"inviteePhone": "151****3456",
"inviteeName": "周**",
"inviteeIcon": "https://example.com/icon7.png",
"createTime": "2025-09-05 16:15:40"
},
{
"id": 1008,
"activityId": 1,
"inviterUserId": 123456,
"inviteeUserId": 234574,
"inviteePhone": "152****7890",
"inviteeName": "吴**",
"inviteeIcon": "https://example.com/icon8.png",
"createTime": "2025-09-04 14:50:55"
}
]
}
...@@ -16,7 +16,10 @@ ...@@ -16,7 +16,10 @@
z-index: 10; z-index: 10;
.note_text { .note_text {
text-align: center;
left: 50%; left: 50%;
width: 100%;
transform: translateX(-50%); transform: translateX(-50%);
position: absolute; position: absolute;
font-size: 24rpx; font-size: 24rpx;
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
<view class="records_list"> <view class="records_list">
<view class="record_item" v-for="(record, index) in records" :key="index"> <view class="record_item" v-for="(record, index) in records" :key="index">
<view class="record_left"> <view class="record_left">
<text class="phone_number">{{ record.phoneNumber }}</text> <text class="phone_number">{{ maskPhone(record.inviteePhone) }}</text>
<text class="invite_time">{{ record.inviteTime }}</text> <text class="invite_time">{{ formatTimestamp(record.createTime) }}</text>
</view> </view>
<view class="record_right"> <view class="record_right">
<text class="status_text">邀请成功</text> <!-- <text class="status_text">邀请成功</text> -->
</view> </view>
</view> </view>
</view> </view>
...@@ -21,43 +21,63 @@ ...@@ -21,43 +21,63 @@
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'; import { ref, onMounted } from 'vue';
import { useIntegralStore } from '@/stores/integral';
import { showLoading, hideLoading } from '@/utils';
// 邀请记录数据 const integralStore = useIntegralStore();
const records = ref([ const records = ref([]);
{
phoneNumber: '136****2718', // 手机号脱敏处理:中间四位显示为 ****
inviteTime: '2025.09.11 23:23:23' const maskPhone = (phone) => {
}, if (!phone) return '';
{ const phoneStr = String(phone);
phoneNumber: '138****4567', // 如果是11位手机号,将中间4位替换为****
inviteTime: '2025.09.10 15:30:45' if (phoneStr.length === 11) {
}, return phoneStr.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
{ }
phoneNumber: '139****7890', // 如果已经是脱敏格式(包含*),直接返回
inviteTime: '2025.09.09 09:15:20' if (phoneStr.includes('*')) {
}, return phoneStr;
{ }
phoneNumber: '135****1234', // 其他情况返回原值
inviteTime: '2025.09.08 18:45:30' return phoneStr;
}, };
{
phoneNumber: '137****5678', // 将时间戳转为 "2025.09.11 23:23:23" 格式
inviteTime: '2025.09.07 12:20:15' const formatTimestamp = (timestamp) => {
}, if (!timestamp) return '';
{
phoneNumber: '139****7890', const date = new Date(timestamp);
inviteTime: '2025.09.09 09:15:20'
}, // 检查日期是否有效
{ if (isNaN(date.getTime())) return '';
phoneNumber: '135****1234',
inviteTime: '2025.09.08 18:45:30' // 获取年月日时分秒
}, const year = date.getFullYear();
{ const month = String(date.getMonth() + 1).padStart(2, '0');
phoneNumber: '137****5678', const day = String(date.getDate()).padStart(2, '0');
inviteTime: '2025.09.07 12:20:15' const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
// 返回格式:2025.09.11 23:23:23
return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`;
};
onMounted(async () => {
showLoading('加载中...');
try {
await integralStore.getInvitationList();
if (integralStore.invitationList?.success && integralStore.invitationList?.data) {
records.value = integralStore.invitationList.data;
}
} catch (error) {
console.error('获取邀请记录失败:', error);
} finally {
hideLoading();
} }
]); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { getSigninAndTaskInfoJSON, checkInJSON, getSeckillList, getPointsBenefitCouponJSON, queryTodoResultJSON, getOriginInviteHomeJSON, assistInviteJSON } from "../api/integral"; import { getSigninAndTaskInfoJSON, checkInJSON, getSeckillList, getPointsBenefitCouponJSON, queryTodoResultJSON, getOriginInviteHomeJSON, assistInviteJSON, getInvitationListJSON } from "../api/integral";
import signinAndTaskInfoMock from '../mock/getSigninAndTaskInMock.json'; import signinAndTaskInfoMock from '../mock/getSigninAndTaskInMock.json';
import checkInMock from '../mock/checkIndata.json'; import checkInMock from '../mock/checkIndata.json';
import pointsBenefitCouponMock from '../mock/pointsBenefitCoupon.json'; import pointsBenefitCouponMock from '../mock/pointsBenefitCoupon.json';
import queryTodoResultMock from '../mock/queryTodoResult.json'; import queryTodoResultMock from '../mock/queryTodoResult.json';
import originInviteHomeMock from '../mock/originInviteHome.json'; import originInviteHomeMock from '../mock/originInviteHome.json';
import assistInviteMock from '../mock/assistInvite.json'; import assistInviteMock from '../mock/assistInvite.json';
import invitationListMock from '../mock/invitationList.json';
export const useIntegralStore = defineStore("integral", { export const useIntegralStore = defineStore("integral", {
state: () => { state: () => {
return { return {
...@@ -16,6 +17,7 @@ export const useIntegralStore = defineStore("integral", { ...@@ -16,6 +17,7 @@ export const useIntegralStore = defineStore("integral", {
_queryTodoResult: null, // 新增:存储查询任务结果数据 _queryTodoResult: null, // 新增:存储查询任务结果数据
_originInviteHome: null, // 新增:存储邀请活动首页数据 _originInviteHome: null, // 新增:存储邀请活动首页数据
_assistInviteData: null, // 新增:存储邀请助力数据 _assistInviteData: null, // 新增:存储邀请助力数据
_invitationList: null, // 新增:存储邀请记录列表数据
}; };
}, },
actions: { actions: {
...@@ -111,6 +113,16 @@ export const useIntegralStore = defineStore("integral", { ...@@ -111,6 +113,16 @@ export const useIntegralStore = defineStore("integral", {
return res; return res;
} }
}, },
async getInvitationList(isdebug = false) {
if(isdebug) {
this._invitationList = invitationListMock;
return invitationListMock;
}else{
const res = await getInvitationListJSON();
this._invitationList = res;
return res;
}
},
}, },
getters: { getters: {
signinAndTaskInfo : (state) => {return state._signinAndTaskInfo; }, signinAndTaskInfo : (state) => {return state._signinAndTaskInfo; },
...@@ -120,5 +132,6 @@ export const useIntegralStore = defineStore("integral", { ...@@ -120,5 +132,6 @@ export const useIntegralStore = defineStore("integral", {
queryTodoResult : (state) => {return state._queryTodoResult; }, queryTodoResult : (state) => {return state._queryTodoResult; },
originInviteHome : (state) => {return state._originInviteHome; }, originInviteHome : (state) => {return state._originInviteHome; },
assistInviteData : (state) => {return state._assistInviteData; }, assistInviteData : (state) => {return state._assistInviteData; },
invitationList : (state) => {return state._invitationList; },
}, },
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment