Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持学习中心平台预约 #124

Open
wants to merge 47 commits into
base: master
Choose a base branch
from

Conversation

Seeridia
Copy link

@Seeridia Seeridia commented Mar 1, 2025

  • 登录
  • 座位预约
    • 日期与时间的选择
    • 座位预约
    • 座位的预约情况展示
  • 预约历史
    • 预约记录的展示
    • 预约的签到、签退、取消

一些或许有用的东西

@Seeridia
Copy link
Author

Seeridia commented Mar 1, 2025

这是前台签到的二维码生成程序,可用来验证

# 签到二维码

import qrcode
from datetime import datetime, timedelta
from IPython.display import display, clear_output

def generate_qr_code():
    current_time = datetime.now()
    next_minute_time = current_time + timedelta(minutes=1)
    
    current_time_str = current_time.strftime("%Y-%m-%d %H:%M:%S")
    next_minute_time_str = next_minute_time.strftime("%Y-%m-%d %H:%M:%S")
    
    qr_content = f"seatSignInCode@{current_time_str}@{next_minute_time_str}"
    
    qr = qrcode.QRCode(
        version=1,
        error_correction=qrcode.constants.ERROR_CORRECT_L,
        box_size=10,
        border=4,
    )
    qr.add_data(qr_content)
    qr.make(fit=True)
    
    img = qr.make_image(fill='black', back_color='white')
    
    return img, qr_content



img, qr_content = generate_qr_code()
    
clear_output(wait=True)
    
display(img)
print(f"QR Code Content: {qr_content}")

@ozline ozline changed the title 增加 学习中心预约平台 支持学习中心平台预约 Mar 2, 2025
@renbaoshuo renbaoshuo requested a review from Copilot March 4, 2025 10:53
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This pull request adds full support for the learning center platform appointment workflow, including login integration, seat reservation with availability queries, appointment history display, and check‐in/sign‐out functionality. Key changes include:

  • A new Appointment model and related status logic for appointment states.
  • A suite of UI components and pages for handling authentication, token management, QR scanning, seat listing, and appointment history.
  • API service updates for fetching appointments, signing in/out, and seat status queries.

Reviewed Changes

File Description
utils/learning-center/history-appointment-status.ts Defines the Appointment model and methods for checking appointment status.
components/learning-center/history-appointment-card.tsx Implements the UI card for appointment history with actions for cancel, sign-in/out.
app/toolbox/learning-center/token.tsx Provides token acquisition from SSO and token persistence via AsyncStorage.
utils/learning-center/api_service.ts Implements API calls for appointment-related requests and seat queries.
app/(guest)/unified-auth-login.tsx Integrates SSO and YMT login flows with combined asynchronous login logic.
lib/constants.ts Introduces constants for SSO, token storage, and learning center.
lib/sso-login.ts Provides SSO login and token extraction logic with multiple redirections.
app/toolbox/learning-center/qr-scanner.tsx Implements QR code scanning for appointment sign-in.
app/toolbox/learning-center/index.tsx Main entry page for learning center services based on token availability.
app/toolbox/learning-center/history.tsx Displays appointment history with infinite scroll and pull-to-refresh.
app/toolbox/learning-center/available-seats.tsx Provides a seat selection UI with seat status summary and filtering tabs.
app/(tabs)/toolbox.tsx Adds the new Study Center tool icon and routing to the learning center pages.

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

@renbaoshuo
Copy link
Member

我简单 review 了一下登录逻辑,感觉 ymt-login 和 sso-login 不需要封装成 class。

之前的 user-login 是因为教务系统登录需要进行多个步骤来完成,中间需要保存状态,所以才进行的封装。

这个可以合并以后慢慢修改。

@renbaoshuo renbaoshuo requested a review from Copilot March 9, 2025 05:32

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This pull request implements the study center reservation system including appointment history management, seating reservations with time selection, QR scanning for sign‐in, and SSO/统一身份认证 integration. Key changes include:

  • Introduction of utility classes and API service methods in the learning center module (e.g. Appointment, ApiService) to support booking, signing in/out, and retrieving appointments.
  • New UI components and pages for appointment history, seat selection, QR code scanning, and webview-based token login.
  • Integration of SSO and一码通 login flows with updated constants and navigation in the app's toolbox.

Reviewed Changes

File Description
utils/learning-center/history-appointment-status.ts Adds the Appointment class with status getters to compute appointment states.
components/learning-center/history-appointment-card.tsx Implements the appointment card UI with action buttons based on appointment state.
app/toolbox/learning-center/qr-scanner.tsx Introduces the QR scanner page with QR code validation for sign-in.
app/toolbox/learning-center/index.tsx Provides the main entry point for the study center feature.
app/toolbox/learning-center/test-api.tsx Implements a test page for API verification of appointment and seat status requests.
lib/sso-login.ts Implements SSO login functionality using extracted keys from HTML responses.
app/toolbox/learning-center/history.tsx Creates the appointment history page with pull-to-refresh and paginated loading.
app/toolbox/learning-center/seats.tsx Implements a seat selection page with date/time choices and visual time slot selection.
app/toolbox/learning-center/webview-login.tsx Adds the WebView-based login page for obtaining the study center token.
app/toolbox/learning-center/available-seats.tsx Creates the available seats page with seat map display and seat grouping by area.
app/(guest)/unified-auth-login.tsx Updates unified authentication login to incorporate simultaneous SSO and一码通 login.
utils/learning-center/api_service.ts Provides API methods for booking, signing in/out, canceling appointments, and seat status queries.
lib/constants.ts Updates constants related to SSO, study center, and一码通 keys.
app/(tabs)/toolbox.tsx Adds the study center entry icon to the toolbox tabs.
components/tab-flatlist.tsx Enhances TabFlatList by adding a configurable FlatList options prop.
lib/user-login.ts, lib/ymt-login.ts Minor adjustments and code cleanup in user authentication modules.

Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

lib/sso-login.ts:84

  • The variable and regex key 'croypto' may be a misspelling of 'crypto'. If the external API permits, consider renaming to 'crypto' to improve clarity.
const matchCroypto = html.match(/"login-croypto">(.*?)</);

components/tab-flatlist.tsx:91

  • Consider adding error handling or logging in the onScrollToIndexFailed callback to assist with debugging any scrolling issues.
onScrollToIndexFailed={() => {}}

// 判断时间是否已过
const isTimePast = useCallback((date: Date, timeStr: string): boolean => {
const isToday = formatDate(date, 'yyyy-MM-dd') === formatDate(new Date(), 'yyyy-MM-dd');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里要改。等我新 PR。


const handleCommit = useCallback(() => {
// 格式化日期
const formattedDate = formatDate(selectedDate, 'yyyy-MM-dd');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants