Year 2 Project: Frontend Development

Juntong20XX 于 2025-02-20 发布

Link to Chinese Version.

The project adopts a frontend-backend separation design. The frontend uses Vue framework with Node.js as the development environment.

Project Structure

.
├─public
├─src
│ ├─assets
│ └─components
├─index.html
├─jsconfig.json
├─package.json
└─vite.config.js

Each feature is implemented as an independent page, with each page being a Vue Component file.

Functionally divided into two parts: Control Interface and Login Interface.

Control Interface

Purpose: Real-time display of connected module names, sensor parameters, and user operations.

Frontend Design

API Design

Example using axios:

await axios.put(`${this.backendUrl}/items`, { key: item.key, value: item.value })

Testing Issues & Solutions

  1. Real-time refresh requirement

    Solution: Implement timer function after login for backend polling

    Optimization: Avoid refresh during user focus or value modification

  2. Value inconsistency between display and actual parameters

    Solution: Add warning text for unsaved changes

Interface Preview

Login Interface

Security Features

Frontend Design

Standard login form with fields for:

API Design

Send authentication request to user-specified backend containing username and TOTP. Backend returns verification result and token.

Testing Issues & Solutions

Frozen interface due to invalid backend

Solution: Implement timeout mechanism for connection attempts with user notification

Login Page

Deployment

Build project using Node.js build command, deploy generated dist directory via Nginx or Cloudflare.

Pages