File:index.htmllines 24-45,js/app.jslines 75-100
Đường dẫn:http://localhost/lean.vn/appassessment/(local) hoặchttps://lean.vn/appassessment/(production)
1. Màn hình Đăng nhập
Hiện ra khi chưa có 6s_user trong localStorage.
┌──────────────────────────────────┐
│ │
│ 📋 │
│ CiCC Assessment │
│ Hệ thống đánh giá đa năng │
│ │
│ Tài khoản / Email / SĐT │
│ ┌────────────────────────────┐ │
│ │ Username, email hoặc SĐT...│ │
│ └────────────────────────────┘ │
│ │
│ Mật khẩu │
│ ┌────────────────────────────┐ │
│ │ ••••••••• │ │
│ └────────────────────────────┘ │
│ │
│ ┌────────────────────────────┐ │
│ │ ĐĂNG NHẬP │ │
│ └────────────────────────────┘ │
│ │
│ 🔗 Mở App 6S Tagging │
└──────────────────────────────────┘
Trường nhập liệu
| Trường | ID | Loại | Bắt buộc | Mô tả |
|---|---|---|---|---|
| Tài khoản / Email / SĐT | login-username | Text | ✅ | Nhập username, email hoặc SĐT |
| Mật khẩu | login-password | Password | ✅ | Nhập mật khẩu (ẩn dấu ●) |
Nút & Link
| Element | Hành động |
|---|---|
| ĐĂNG NHẬP | Gọi doLogin() → POST /auth/login → lưu localStorage → checkAuth() |
| 🔗 Mở App 6S Tagging | Mở APP6S_URL trong tab mới (điều hướng sang app6suser) |
Xử lý khi Enter
Cả 2 ô input có onkeyup="if(event.key==='Enter') doLogin()" — nhấn Enter = submit.
Luồng xử lý (doLogin)
1. Lấy login + password từ input
2. Validate: không trống?
3. fetch POST /auth/login với { login, password }
4. Thành công:
- Lưu response.data vào localStorage('6s_user')
- checkAuth()
5. Thất bại: alert(j.message)
6. Lỗi mạng: alert('Lỗi kết nối!')
API Auth
Endpoint: POST /cicc-assessment/v1/auth/login
Dùng chung bảng wp_6s_users với app6suser — 1 tài khoản dùng được cả 2 app.
// Request
{ "login": "danhgia", "password": "123456" }
// Response success
{
"success": true,
"data": {
"user_6s_id": 1,
"wp_user_id": 2,
"username": "danhgia",
"display_name": "Nguyễn Văn A",
"role_code": "R07",
"location_id": [22, 8, 12, 18],
"tenant_id": 1,
"login_identifier": "danhgia"
}
}
2. Sau đăng nhập (checkAuth)
Check localStorage('6s_user')
→ Có? Ẩn auth-container, hiện .app
→ Không? Hiện auth-container, ẩn .app
→ Nếu có user:
- Hiển thị avatar (2 ký tự đầu tên) + tên + role
- Gọi loadUserLocations(userId) — tải locations từ cicc-6s/v1
- switchTab('home')
Biến toàn cục
| Biến | Mô tả |
|---|---|
API | Base URL của cicc-assessment/v1 API |
APP6S_URL | URL app6suser để điều hướng |
ROLE_MAP | Map role_code → tên hiển thị |
EVAL_TYPES | 3 loại đánh giá: self/cross/expert |
EVAL_THRESHOLDS | Ngưỡng: self=90, cross=85, expert=80 |
userLocations | Locations được phân quyền cho user |
Header sau login
[📋 Assessment CiCC Evaluation] [NV] [ON] [🔄] [🏷️] [🚪]
Nguyễn Văn A ▾
- Avatar: 2 ký tự đầu tên, gradient xanh dương-xanh lá
- 🏷️: Điều hướng sang app6suser
- 🚪: Logout → xóa localStorage → reload
3. Lưu ý
- Dùng chung tài khoản với app6suser (bảng
wp_6s_users) - User phải được Admin kích hoạt (
status='active') mới login được user_6s_id≠wp_user_id— dùnguser_6s_idcho API- App tự động detect localhost → dùng
http://localhost/lean.vn/làm base
Audio thuyết minh
audio/ass-01-dang-nhap.mp3Click play để nghe hướng dẫn bằng giọng đọc.
Screenshots
images/ass-login-screen.pngChú thích: Màn hình login CiCC Assessment với username/password và nút ĐĂNG NHẬP
images/ass-login-header.pngChú thích: Header sau đăng nhập: avatar, tên user, trạng thái ON, nút sync/logout
images/ass-login-link-6s.pngChú thích: Link "Mở App 6S Tagging" điều hướng sang app6suser
images/ass-login-error.pngChú thích: Alert thông báo khi đăng nhập thất bại