优化代码

This commit is contained in:
pengxiaolong
2025-08-15 13:05:19 +08:00
parent 784a19bdda
commit 15335e8921
17 changed files with 1501 additions and 133 deletions

View File

@@ -125,6 +125,11 @@ import {
onUpdated, // 组件更新后执行
onUnmounted, // 组件销毁前执行
} from "vue";
import {getPkRecord} from "@/api/account";
import { ElMessage } from "element-plus";
import {getPromiseStorage } from "@/utils/storage.js";
const user = ref(null); // 用户信息
const refname = ref("");
const segmentedvalue = ref(1);
const options = [
@@ -141,9 +146,44 @@ const options = [
SelectedIcon: require("@/assets/InvitationSelected.png"),
},
];
const list = ref([{}, {}, {}, {}, {}, {}, {}]);
const list = ref([]);
const page = ref(0);
const IPKPostedData = ref([]);
const InvitationData = ref([]);
//获取PK记录列表
function PkRecord() {
getPkRecord({
type: segmentedvalue.value,
userId: user.value.id,
page: page.value,
size: 10,
}).then((res) => {
console.log(res);
if (segmentedvalue.value === 1) {
IPKPostedData.value.push(...res);
list.value = IPKPostedData.value;
}else{
InvitationData.value.push(...res);
list.value = InvitationData.value;
}
})
}
// 加载更多
function load() {}
// 组件挂载完成后执行
onMounted(() => {
getPromiseStorage("user")
.then((res) => {
user.value = res;
PkRecord();
})
.catch((err) => {
console.log(err);
});
});
onUpdated(() => {
// 组件更新后执行
});