From 4b499e312d27cb36b7037a3f7adfc212db0b1b50 Mon Sep 17 00:00:00 2001 From: taoky Date: Mon, 6 Nov 2023 20:31:22 +0800 Subject: [PATCH] AccountView: add account_identity method --- frontend/templates/user.html | 16 ++++++++++++++++ frontend/views.py | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/frontend/templates/user.html b/frontend/templates/user.html index 49caa19..c61143e 100644 --- a/frontend/templates/user.html +++ b/frontend/templates/user.html @@ -37,6 +37,14 @@

查询用户信息

专业:{{ obj.major }}
校区:{{ obj.campus }}
了解比赛的渠道: {{ obj.aff }}
+
+
+
Account identity 信息:
+
+
{{ identity }}
+
+
没有记录
+

AccountLog 信息:
@@ -57,6 +65,7 @@

查询用户信息

pk: '', obj: undefined, accountlog: {}, + identities: {}, }, methods: { load() { @@ -74,6 +83,13 @@

查询用户信息

.catch(({response: {data: {error}}}) => { console.log("accountlog:", error && error.message); }); + axios.post('/account/', {method: 'account_identity', user: Number(this.pk)}) + .then(({data: {value}}) => { + this.$set(this.identities, Number(this.pk), value); + }) + .catch(({response: {data: {error}}}) => { + console.log("account_identity:", error && error.message); + }); }, }, }); diff --git a/frontend/views.py b/frontend/views.py index 197387b..75f6960 100644 --- a/frontend/views.py +++ b/frontend/views.py @@ -288,6 +288,10 @@ def post(self, request): elif method == "accountlog": logs = list(AccountLog.objects.filter(account__in=accounts).values('content_type', 'contents')) return JsonResponse({'value': logs}) + elif method == "account_identity": + return JsonResponse({'value': [i.identity for i in accounts]}) + else: + return JsonResponse({'error': 'Method not found'}, status=400) # noinspection PyMethodMayBeStatic