Skip to content

Commit

Permalink
AccountView: add account_identity method
Browse files Browse the repository at this point in the history
  • Loading branch information
taoky committed Nov 6, 2023
1 parent d3d24ae commit 4b499e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions frontend/templates/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ <h1>查询用户信息</h1>
<div>专业:{{ obj.major }}</div>
<div>校区:{{ obj.campus }}</div>
<div>了解比赛的渠道: {{ obj.aff }}</div>
<div v-if="identities[obj.pk]">
<hr>
<div>Account identity 信息:</div>
<div v-if="identities[obj.pk].length > 0">
<div v-for="identity in identities[obj.pk]">{{ identity }}</div>
</div>
<div v-else>没有记录</div>
</div>
<div v-if="accountlog[obj.pk]">
<hr>
<div>AccountLog 信息:</div>
Expand All @@ -57,6 +65,7 @@ <h1>查询用户信息</h1>
pk: '',
obj: undefined,
accountlog: {},
identities: {},
},
methods: {
load() {
Expand All @@ -74,6 +83,13 @@ <h1>查询用户信息</h1>
.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);
});
},
},
});
Expand Down
4 changes: 4 additions & 0 deletions frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4b499e3

Please sign in to comment.