n
This commit is contained in:
@@ -47,6 +47,13 @@ class Activity(models.Model):
|
|||||||
return self.banner.url
|
return self.banner.url
|
||||||
return self.banner_url
|
return self.banner_url
|
||||||
|
|
||||||
|
@property
|
||||||
|
def current_signups(self):
|
||||||
|
"""
|
||||||
|
当前有效报名人数
|
||||||
|
"""
|
||||||
|
return self.signups.exclude(status='cancelled').count()
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,13 @@ from .utils import get_current_wechat_user
|
|||||||
class ActivitySerializer(serializers.ModelSerializer):
|
class ActivitySerializer(serializers.ModelSerializer):
|
||||||
display_banner_url = serializers.ReadOnlyField()
|
display_banner_url = serializers.ReadOnlyField()
|
||||||
signup_form_config = serializers.SerializerMethodField()
|
signup_form_config = serializers.SerializerMethodField()
|
||||||
current_signups = serializers.SerializerMethodField()
|
current_signups = serializers.ReadOnlyField()
|
||||||
has_signed_up = serializers.SerializerMethodField()
|
has_signed_up = serializers.SerializerMethodField()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Activity
|
model = Activity
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def get_current_signups(self, obj):
|
|
||||||
# 统计非取消状态的报名人数
|
|
||||||
return obj.signups.exclude(status='cancelled').count()
|
|
||||||
|
|
||||||
def get_has_signed_up(self, obj):
|
def get_has_signed_up(self, obj):
|
||||||
request = self.context.get('request')
|
request = self.context.get('request')
|
||||||
if not request:
|
if not request:
|
||||||
|
|||||||
@@ -21,6 +21,13 @@ class ActivityViewSet(viewsets.ReadOnlyModelViewSet):
|
|||||||
queryset = Activity.objects.filter(is_active=True).order_by('-created_at')
|
queryset = Activity.objects.filter(is_active=True).order_by('-created_at')
|
||||||
serializer_class = ActivitySerializer
|
serializer_class = ActivitySerializer
|
||||||
|
|
||||||
|
def retrieve(self, request, *args, **kwargs):
|
||||||
|
instance = self.get_object()
|
||||||
|
serializer = self.get_serializer(instance)
|
||||||
|
# Debug print to verify data
|
||||||
|
print(f"DEBUG: Activity {instance.title} current_signups: {instance.current_signups}")
|
||||||
|
return Response(serializer.data)
|
||||||
|
|
||||||
@extend_schema(summary="报名活动")
|
@extend_schema(summary="报名活动")
|
||||||
@action(detail=True, methods=['post'])
|
@action(detail=True, methods=['post'])
|
||||||
def signup(self, request, pk=None):
|
def signup(self, request, pk=None):
|
||||||
|
|||||||
Binary file not shown.
@@ -65,6 +65,7 @@ def get_wechat_pay_client():
|
|||||||
possible_key_paths = [
|
possible_key_paths = [
|
||||||
os.path.join(settings.BASE_DIR, 'certs', 'apiclient_key.pem'),
|
os.path.join(settings.BASE_DIR, 'certs', 'apiclient_key.pem'),
|
||||||
os.path.join(settings.BASE_DIR, 'static', 'cert', 'apiclient_key.pem'),
|
os.path.join(settings.BASE_DIR, 'static', 'cert', 'apiclient_key.pem'),
|
||||||
|
os.path.join(settings.BASE_DIR, 'staticfiles', 'cert', 'apiclient_key.pem'),
|
||||||
os.path.join(settings.BASE_DIR, 'backend', 'certs', 'apiclient_key.pem'),
|
os.path.join(settings.BASE_DIR, 'backend', 'certs', 'apiclient_key.pem'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
|||||||
{"files": [{"filename": "inflection-0.1.1.tar.gz", "hashes": {"sha256": "70a0014cb3b36f6c8230756ae5c1bdc6aecd1f5beff240d8207f31ba9c13948c"}, "requires-python": null, "size": 7586, "upload-time": "2012-02-24T20:09:17.268105Z", "url": "../../packages/04/68/55d46b34f7d50f96c3bb26582c7334bdeae422c9ac0058ed48d79f7c5ade/inflection-0.1.1.tar.gz", "yanked": false}, {"filename": "inflection-0.1.2.tar.gz", "hashes": {"sha256": "e310c98c69ffac3866cc38b0d869a4b94aa61a59f890102e341d4c8c96d4d228"}, "requires-python": null, "size": 8543, "upload-time": "2012-03-13T21:45:11.124181Z", "url": "../../packages/fb/d8/fb45d4ba177fef3bd87f103edc2b28fcdf24f43952928d47cef73ec6d3f4/inflection-0.1.2.tar.gz", "yanked": false}, {"filename": "inflection-0.2.0.tar.gz", "hashes": {"sha256": "dab6ca89b6a91aecc8ba28ad9376b85a362c413733d108a3ffaae2e0b768e57e"}, "requires-python": null, "size": 8153, "upload-time": "2013-06-15T14:55:27.831074Z", "url": "../../packages/17/17/e063022e2b77cb9f4a83ed4089e5b0debdddbc6b685c679f387b657c73c1/inflection-0.2.0.tar.gz", "yanked": false}, {"filename": "inflection-0.2.1.tar.gz", "hashes": {"sha256": "96e6233bb5b9dcf0a34081bd31b1ca7ea2aea9c7110615acc14fdcaa3e71071f"}, "requires-python": null, "size": 8219, "upload-time": "2014-09-03T14:37:27.192869Z", "url": "../../packages/d4/d5/5ae57400b6c5374fe279c76e220588a554688138945601f5dde4733e22be/inflection-0.2.1.tar.gz", "yanked": false}, {"filename": "inflection-0.3.0.tar.gz", "hashes": {"sha256": "c6ab173181fd3bbee53187b7535f395ed802ef69d9f3bb5f8c2a5cdfb3e92d08"}, "requires-python": null, "size": 8565, "upload-time": "2015-03-01T17:36:33.912921Z", "url": "../../packages/5a/42/489536aac4f16828e19823406e83b943860d30767c71f390511a45ce095d/inflection-0.3.0.tar.gz", "yanked": false}, {"filename": "inflection-0.3.1.tar.gz", "hashes": {"sha256": "18ea7fb7a7d152853386523def08736aa8c32636b047ade55f7578c4edeb16ca"}, "requires-python": null, "size": 8715, "upload-time": "2015-05-03T08:08:12.824777Z", "url": "../../packages/d5/35/a6eb45b4e2356fe688b21570864d4aa0d0a880ce387defe9c589112077f8/inflection-0.3.1.tar.gz", "yanked": false}, {"filename": "inflection-0.4.0-py2.py3-none-any.whl", "hashes": {"sha256": "9a15d3598f01220e93f2207c432cfede50daff53137ce660fb8be838ef1ca6cc"}, "requires-python": ">=3.5", "size": 5789, "upload-time": "2020-04-06T19:35:36.732518Z", "url": "../../packages/52/c1/36be286d85dbd76527fb613527222a795d7c071da195fa916e7bf3cb03cb/inflection-0.4.0-py2.py3-none-any.whl", "yanked": false}, {"filename": "inflection-0.4.0.tar.gz", "hashes": {"sha256": "32a5c3341d9583ec319548b9015b7fbdf8c429cbcb575d326c33ae3a0e90d52c"}, "requires-python": ">=3.5", "size": 14536, "upload-time": "2020-04-06T19:35:37.724962Z", "url": "../../packages/e8/dc/3986343faf9631d8bc61d8a6a1331b5f4f08723dbce3b39f524c367a1621/inflection-0.4.0.tar.gz", "yanked": false}, {"filename": "inflection-0.5.0-py2.py3-none-any.whl", "hashes": {"sha256": "88b101b2668a1d81d6d72d4c2018e53bc6c7fc544c987849da1c7f77545c3bc9"}, "requires-python": ">=3.5", "size": 5840, "upload-time": "2020-06-06T08:04:42.855673Z", "url": "../../packages/d2/cd/f04c661d1b5ba6b7d77008e8fedd28a27a683eeeffcd93c6b2dbe54ea983/inflection-0.5.0-py2.py3-none-any.whl", "yanked": false}, {"filename": "inflection-0.5.0.tar.gz", "hashes": {"sha256": "f576e85132d34f5bf7df5183c2c6f94cfb32e528f53065345cf71329ba0b8924"}, "requires-python": ">=3.5", "size": 14830, "upload-time": "2020-06-06T08:04:44.356715Z", "url": "../../packages/87/41/07fa466e0525635243f0cb94f81b9e99508edc23af7d9bf6c2009e11eadc/inflection-0.5.0.tar.gz", "yanked": false}, {"filename": "inflection-0.5.1-py2.py3-none-any.whl", "hashes": {"sha256": "f38b2b640938a4f35ade69ac3d053042959b62a0f1076a5bbaa1b9526605a8a2"}, "requires-python": ">=3.5", "size": 9454, "upload-time": "2020-08-22T08:16:27.816929Z", "url": "../../packages/59/91/aa6bde563e0085a02a435aa99b49ef75b0a4b062635e606dab23ce18d720/inflection-0.5.1-py2.py3-none-any.whl", "yanked": false}, {"filename": "inflection-0.5.1.tar.gz", "hashes": {"sha256": "1a29730d366e996aaacffb2f1f1cb9593dc38e2ddd30c91250c6dde09ea9b417"}, "requires-python": ">=3.5", "size": 15091, "upload-time": "2020-08-22T08:16:29.139062Z", "url": "../../packages/e1/7e/691d061b7329bc8d54edbf0ec22fbfb2afe61facb681f9aaa9bff7a27d04/inflection-0.5.1.tar.gz", "yanked": false}], "meta": {"api-version": "1.1", "_last-serial": "8016752"}, "name": "inflection", "versions": ["0.1.1", "0.1.2", "0.2.0", "0.2.1", "0.3.0", "0.3.1", "0.4.0", "0.5.0", "0.5.1"]}
|
|
||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
@@ -64,7 +64,7 @@ const LoginModal = ({ visible, onClose, onLoginSuccess }) => {
|
|||||||
open={visible}
|
open={visible}
|
||||||
onCancel={onClose}
|
onCancel={onClose}
|
||||||
footer={null}
|
footer={null}
|
||||||
destroyOnClose={true}
|
destroyOnClose
|
||||||
centered
|
centered
|
||||||
>
|
>
|
||||||
<Form
|
<Form
|
||||||
|
|||||||
@@ -65,8 +65,9 @@ const Home = () => {
|
|||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '50vh' }}>
|
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', height: '50vh' }}>
|
||||||
<Spin size="large" tip="加载硬件配置中..." />
|
<Spin size="large" />
|
||||||
|
<div style={{ marginTop: 20, color: '#00b96b' }}>加载硬件配置中...</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -127,7 +128,7 @@ const Home = () => {
|
|||||||
>
|
>
|
||||||
<Card
|
<Card
|
||||||
className="tech-card glass-panel"
|
className="tech-card glass-panel"
|
||||||
bordered={false}
|
variant="borderless"
|
||||||
cover={
|
cover={
|
||||||
<div style={{
|
<div style={{
|
||||||
height: 200,
|
height: 200,
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ export const getStarUsers = () => request({ url: '/users/stars/' })
|
|||||||
export const getAnnouncements = () => request({ url: '/community/announcements/' })
|
export const getAnnouncements = () => request({ url: '/community/announcements/' })
|
||||||
|
|
||||||
// Activities
|
// Activities
|
||||||
export const getActivities = () => request({ url: '/community/activities/' })
|
export const getActivities = () => request({ url: '/community/activities/', data: { _t: Date.now() } })
|
||||||
export const getActivityDetail = (id: number) => request({ url: `/community/activities/${id}/` })
|
export const getActivityDetail = (id: number) => request({ url: `/community/activities/${id}/`, data: { _t: Date.now() } })
|
||||||
export const signupActivity = (id: number, data?: any) => request({ url: `/community/activities/${id}/signup/`, method: 'POST', data })
|
export const signupActivity = (id: number, data?: any) => request({ url: `/community/activities/${id}/signup/`, method: 'POST', data })
|
||||||
export const getMySignups = () => request({ url: '/community/activities/my_signups/' })
|
export const getMySignups = () => request({ url: '/community/activities/my_signups/' })
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ const ActivityDetail = () => {
|
|||||||
try {
|
try {
|
||||||
const res = await getActivityDetail(Number(id))
|
const res = await getActivityDetail(Number(id))
|
||||||
const data = res.data || res
|
const data = res.data || res
|
||||||
|
console.log('Activity Detail Data:', data) // Debug Log
|
||||||
|
console.log('Current Signups:', data.current_signups) // Debug Log
|
||||||
setActivity(data)
|
setActivity(data)
|
||||||
|
|
||||||
// Calculate signup progress
|
// Calculate signup progress
|
||||||
|
|||||||
Reference in New Issue
Block a user