spec.md 4.1 KB

app-shell Specification

Purpose

This specification defines the native WeChat Mini Program app shell for 普瑞互联网医院智慧医院小程序 V2.0, including base project structure, routing, custom tabBar, global UI tokens, unified request wrapping, login/hospital initialization skeletons, and legacy resource reuse helpers.

Requirements

Requirement: Native Mini Program Structure

The source directory SHALL contain a native WeChat Mini Program structure with app.js, app.json, app.wxss, project.config.json, sitemap.json, pages, components, custom-tab-bar, utils, and assets entry points.

Scenario: Import basic project

  • WHEN a developer imports 04-新项目源码_source/pri-smart-hospital-miniprogram in WeChat DevTools
  • THEN the project has the required native mini program entry files
  • AND no empty subPackages item is registered in app.json.

Requirement: Base Routing And Placeholder Pages

The app shell SHALL register the five first-level tab pages, the hospital switch placeholder page, and the common error page.

Scenario: Open tab placeholders

  • WHEN a user opens 首页、就诊指引、缴费、消息、我的
  • THEN each page renders a visible placeholder state
  • AND unfinished business entries are presented as unavailable or module pending
  • AND no concrete registration, payment, patient editing, order detail, report, or message detail workflow is executed.

Requirement: Custom TabBar Skeleton

The app shell SHALL provide a custom tabBar component with selected state, unselected state, badge placeholders, and configurable guidance tab visibility.

Scenario: Guidance tab visibility

  • WHEN tabBarSettings.guideHospConfig is Y
  • THEN the guidance tab can be shown
  • WHEN tabBarSettings.guideHospConfig is not Y
  • THEN the guidance tab can be hidden by configuration.

Requirement: Global UI Tokens And Base States

The app shell SHALL provide project-level UI tokens and common classes for page background, hero area, cards, buttons, text, loading, empty, error, disabled, and image fallback states.

Scenario: Placeholder page styling

  • WHEN a placeholder page renders
  • THEN it uses the light blue background, white cards, blue/cyan brand accents, readable text hierarchy, and minimum 44px touch targets from the UI standard.

Requirement: Unified Request Wrapper

The app shell SHALL provide a request wrapper for the legacy unified gateway that supports business code, data/params, namespace, session: [userData], HISFlag, and UPPFlag.

Scenario: Build default request body

  • WHEN request({ code: "01050001", data: {} }) is called
  • THEN the generated body includes code, HISFlag: "N", UPPFlag: "N", session: [userData], and params.

Scenario: Build namespace request body

  • WHEN namespace is Y
  • THEN HISFlag is Y
  • WHEN namespace is UPP
  • THEN UPPFlag is Y.

Requirement: Login And Hospital Initialization Skeleton

The app shell SHALL provide skeletons for WeChat automatic login and hospital configuration initialization without blocking base page browsing on failure.

Scenario: Login initialization

  • WHEN app launch runs
  • THEN the app initializes cached userData
  • AND provides a wx.login -> 01050001 login path
  • AND records login failure state without white screen.

Scenario: Hospital initialization

  • WHEN hospital initialization runs
  • THEN the app provides a 02010009 initialization path
  • AND can write hospital data into userData, allHospitalData, and global state
  • AND renders a hospital switch placeholder when full hospital selection is not implemented.

Requirement: Resource Reuse Configuration

The app shell SHALL provide configuration and helper functions for legacy image host, upload URL, download URL, image URL joining, and image failure fallback.

Scenario: Server image reuse

  • WHEN a business module receives a server image path
  • THEN it can use the resource helper to join the configured server host
  • AND the app shell does not migrate server images into local static assets.