|
@@ -78,18 +78,18 @@ export function mockGetLanguageListEmpty() {
|
|
|
* @url /dr/api/v1/pub/trans/{locale}/{locale}.js
|
|
|
* @access 公开接口
|
|
|
*
|
|
|
- * @param {string} locale - 语言代码(zh/en)
|
|
|
+ * @param {string} locale - 语言代码(zh_CN/en_US)
|
|
|
*
|
|
|
* @returns {Object} 翻译键值对
|
|
|
*
|
|
|
* @example
|
|
|
- * mockI18nSuccess('zh');
|
|
|
+ * mockI18nSuccess('en_US');
|
|
|
* cy.wait('@getI18nZHSuccess');
|
|
|
*
|
|
|
* @see docs/DR.md - 章节3
|
|
|
*/
|
|
|
-export function mockI18nSuccess(locale: 'zh' | 'en') {
|
|
|
- const mockData = locale === 'zh' ? {
|
|
|
+export function mockI18nSuccess(locale: 'zh_CN' | 'en_US') {
|
|
|
+ const mockData = locale === 'zh_CN' ? {
|
|
|
greeting: '你好,世界!',
|
|
|
name: '张三',
|
|
|
patient: '患者管理',
|
|
@@ -115,7 +115,23 @@ export function mockI18nSuccess(locale: 'zh' | 'en') {
|
|
|
'register.patientName': '患者姓名',
|
|
|
'register.gender': '性别',
|
|
|
'register.gender.male': '男',
|
|
|
- 'register.gender.female': '女'
|
|
|
+ 'register.gender.female': '女',
|
|
|
+ // Login page
|
|
|
+ 'login.username': '用户名',
|
|
|
+ 'login.username.placeholder': '请输入用户名',
|
|
|
+ 'login.username.required': '请输入用户名',
|
|
|
+ 'login.password': '密码',
|
|
|
+ 'login.password.placeholder': '请输入密码',
|
|
|
+ 'login.password.required': '请输入密码',
|
|
|
+ 'login.submit': '登录',
|
|
|
+ 'login.emergency': '急诊',
|
|
|
+ 'login.success': '登录成功',
|
|
|
+ 'login.failed': '登录失败',
|
|
|
+ 'login.failedDetail': ',详情:',
|
|
|
+ 'login.networkError': ',网络错误:',
|
|
|
+ 'login.unknownError': '未知错误',
|
|
|
+ 'login.emergency.success': '急诊模式启动成功',
|
|
|
+ 'login.emergency.failed': '急诊操作失败:'
|
|
|
} : {
|
|
|
greeting: 'Hello, world!',
|
|
|
name: 'John Doe',
|
|
@@ -142,10 +158,26 @@ export function mockI18nSuccess(locale: 'zh' | 'en') {
|
|
|
'register.patientName': 'Patient Name',
|
|
|
'register.gender': 'Gender',
|
|
|
'register.gender.male': 'Male',
|
|
|
- 'register.gender.female': 'Female'
|
|
|
+ 'register.gender.female': 'Female',
|
|
|
+ // Login page
|
|
|
+ 'login.username': 'Username',
|
|
|
+ 'login.username.placeholder': 'Enter username',
|
|
|
+ 'login.username.required': 'Please enter username',
|
|
|
+ 'login.password': 'Password',
|
|
|
+ 'login.password.placeholder': 'Enter password',
|
|
|
+ 'login.password.required': 'Please enter password',
|
|
|
+ 'login.submit': 'Login',
|
|
|
+ 'login.emergency': 'Emergency',
|
|
|
+ 'login.success': 'Login successful',
|
|
|
+ 'login.failed': 'Login failed',
|
|
|
+ 'login.failedDetail': ', details: ',
|
|
|
+ 'login.networkError': ', network error: ',
|
|
|
+ 'login.unknownError': 'Unknown error',
|
|
|
+ 'login.emergency.success': 'Emergency mode activated successfully',
|
|
|
+ 'login.emergency.failed': 'Emergency operation failed: '
|
|
|
};
|
|
|
|
|
|
- cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale}.js`, (req) => {
|
|
|
+ cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale.split('_')[0]}.js`, (req) => {
|
|
|
req.reply({
|
|
|
statusCode: 200,
|
|
|
body: mockData
|
|
@@ -154,8 +186,8 @@ export function mockI18nSuccess(locale: 'zh' | 'en') {
|
|
|
}
|
|
|
|
|
|
// 封装获取多语言资源失败的 mock (404错误)
|
|
|
-export function mockI18nError(locale: 'zh' | 'en') {
|
|
|
- cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale}.js`, (req) => {
|
|
|
+export function mockI18nError(locale: 'zh_CN' | 'en_US') {
|
|
|
+ cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale.split('_')[0]}.js`, (req) => {
|
|
|
req.reply({
|
|
|
statusCode: 404,
|
|
|
body: {
|
|
@@ -167,8 +199,8 @@ export function mockI18nError(locale: 'zh' | 'en') {
|
|
|
}
|
|
|
|
|
|
// 封装获取多语言资源服务器错误的 mock (500错误)
|
|
|
-export function mockI18nServerError(locale: 'zh' | 'en') {
|
|
|
- cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale}.js`, (req) => {
|
|
|
+export function mockI18nServerError(locale: 'zh_CN' | 'en_US') {
|
|
|
+ cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale.split('_')[0]}.js`, (req) => {
|
|
|
req.reply({
|
|
|
statusCode: 500,
|
|
|
body: {
|
|
@@ -180,8 +212,8 @@ export function mockI18nServerError(locale: 'zh' | 'en') {
|
|
|
}
|
|
|
|
|
|
// 封装获取多语言资源超时的 mock
|
|
|
-export function mockI18nTimeout(locale: 'zh' | 'en') {
|
|
|
- cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale}.js`, (req) => {
|
|
|
+export function mockI18nTimeout(locale: 'zh_CN' | 'en_US') {
|
|
|
+ cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale.split('_')[0]}.js`, (req) => {
|
|
|
req.reply({
|
|
|
delay: 30000, // 30秒延迟,模拟超时
|
|
|
statusCode: 200,
|
|
@@ -191,8 +223,8 @@ export function mockI18nTimeout(locale: 'zh' | 'en') {
|
|
|
}
|
|
|
|
|
|
// 封装获取多语言资源格式错误的 mock
|
|
|
-export function mockI18nInvalidFormat(locale: 'zh' | 'en') {
|
|
|
- cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale}.js`, (req) => {
|
|
|
+export function mockI18nInvalidFormat(locale: 'zh_CN' | 'en_US') {
|
|
|
+ cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale.split('_')[0]}.js`, (req) => {
|
|
|
req.reply({
|
|
|
statusCode: 200,
|
|
|
body: "invalid json format" // 返回非JSON格式数据
|
|
@@ -201,8 +233,8 @@ export function mockI18nInvalidFormat(locale: 'zh' | 'en') {
|
|
|
}
|
|
|
|
|
|
// 封装获取多语言资源空数据的 mock
|
|
|
-export function mockI18nEmptyData(locale: 'zh' | 'en') {
|
|
|
- cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale}.js`, (req) => {
|
|
|
+export function mockI18nEmptyData(locale: 'zh_CN' | 'en_US') {
|
|
|
+ cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale.split('_')[0]}.js`, (req) => {
|
|
|
req.reply({
|
|
|
statusCode: 200,
|
|
|
body: {} // 返回空对象
|
|
@@ -211,8 +243,8 @@ export function mockI18nEmptyData(locale: 'zh' | 'en') {
|
|
|
}
|
|
|
|
|
|
// 封装获取多语言资源网络错误的 mock
|
|
|
-export function mockI18nNetworkError(locale: 'zh' | 'en') {
|
|
|
- cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale}.js`, (req) => {
|
|
|
+export function mockI18nNetworkError(locale: 'zh_CN' | 'en_US') {
|
|
|
+ cy.intercept('GET', `/dr/api/v1/pub/trans/${locale}/${locale.split('_')[0]}.js`, (req) => {
|
|
|
req.reply({
|
|
|
forceNetworkError: true
|
|
|
});
|
|
@@ -220,69 +252,72 @@ export function mockI18nNetworkError(locale: 'zh' | 'en') {
|
|
|
}
|
|
|
|
|
|
// 封装软件信息API的 mock,避免影响页面加载
|
|
|
-export function mockSoftwareInfo() {
|
|
|
+export function mockSoftwareInfo(locale: 'zh_CN' | 'en_US' = 'zh_CN') {
|
|
|
cy.intercept('GET', '/dr/api/v1/pub/software_info', (req) => {
|
|
|
req.reply({
|
|
|
statusCode: 200,
|
|
|
body: {
|
|
|
code: "0x000000",
|
|
|
data: {
|
|
|
- FPD: "Simulator",
|
|
|
- GEN: "Simulator",
|
|
|
- guest: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTY3MjAxMTUsImlkIjoyLCJuYW1lIjoiZ3Vlc3QifQ.cDkkxM2mkiCQf7T87WsCMewITk13c7jSDoniT7gDHXQ",
|
|
|
+ FPD: "Physics",
|
|
|
+ GEN: "Physics",
|
|
|
+ current_locale: locale,
|
|
|
+ default_locale: "zh_CN",
|
|
|
+ guest: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NjA0OTc2NDksImlkIjoyLCJuYW1lIjoiZ3Vlc3QifQ.hUV5_GOzlWKDeFioJCsHMG2IXa0oJPfNNlPsr69ypqc",
|
|
|
language: ["en", "zh"],
|
|
|
- product: "DROS",
|
|
|
+ product: "VETDROS",
|
|
|
server: {
|
|
|
auth: {
|
|
|
- build: "2025-08-25 17:45:18",
|
|
|
+ build: "2025-10-08 11:06:08",
|
|
|
desc: "Authentication Server repo",
|
|
|
- submodule: ["3a167dd4[rpc_idl]"],
|
|
|
- version: "0.3.0-13-g8b85622"
|
|
|
+ submodule: ["0baa8db0[rpc_idl]"],
|
|
|
+ version: "0.4.0-21-g4a37cc7"
|
|
|
},
|
|
|
dcmtk: {
|
|
|
- build: "2025-08-25 13:43:16",
|
|
|
+ build: "2025-09-29 16:35:39",
|
|
|
desc: "Dcmtk Server repo",
|
|
|
- submodule: ["0fc2b1e4[rpc_idl]"],
|
|
|
- version: "0.3.0-12-gff618d4"
|
|
|
+ submodule: ["c2039235[rpc_idl]"],
|
|
|
+ version: "0.4.0-2-g36bc18f"
|
|
|
},
|
|
|
imgProc: {
|
|
|
- build: "2025-08-25 13:46:23",
|
|
|
+ build: "2025-09-29 16:36:36",
|
|
|
desc: "Img Proc Server repo",
|
|
|
submodule: [
|
|
|
- "5e507af7[auto_wwwl]",
|
|
|
- "3a75bb1f[collimator_circle]",
|
|
|
- "e7b69785[collimator_rect]",
|
|
|
- "6b7fbbd1[enhance]",
|
|
|
+ "d00bfca5[auto_wwwl]",
|
|
|
+ "89fd9218[collimator_circle]",
|
|
|
+ "c9582bbe[collimator_rect]",
|
|
|
+ "98c510bd[enhance]",
|
|
|
+ "6f9bf7de[enhance_v3]",
|
|
|
"5905e001[rpc_idl]"
|
|
|
],
|
|
|
- version: "0.3.0-7-gbb2ee0b"
|
|
|
+ version: "0.4.0-7-gca1c8a4"
|
|
|
},
|
|
|
protocol: {
|
|
|
- build: "2025-08-25 17:45:23",
|
|
|
+ build: "2025-10-08 11:06:13",
|
|
|
desc: "Protocol Server repo",
|
|
|
- submodule: ["3a167dd4[rpc_idl]"],
|
|
|
- version: "0.3.0-7-g1954756"
|
|
|
+ submodule: ["0baa8db0[rpc_idl]"],
|
|
|
+ version: "0.4.0-8-g47990eb"
|
|
|
},
|
|
|
resource: {
|
|
|
- build: "2025-08-25 17:45:27",
|
|
|
+ build: "2025-10-08 11:06:17",
|
|
|
desc: "Resource Server repo",
|
|
|
- submodule: ["0fc2b1e4[rpc_idl]"],
|
|
|
- version: "0.3.0-12-g60e37c1"
|
|
|
+ submodule: ["9725e654[rpc_idl]"],
|
|
|
+ version: "0.4.0-9-g10766e8"
|
|
|
},
|
|
|
study: {
|
|
|
- build: "2025-08-25 17:45:25",
|
|
|
+ build: "2025-10-08 11:06:15",
|
|
|
desc: "Study Server repo",
|
|
|
- submodule: ["3a167dd4[rpc_idl]"],
|
|
|
- version: "0.3.0-11-g784ba1b"
|
|
|
+ submodule: ["8595ea2d[rpc_idl]"],
|
|
|
+ version: "0.5.0-1-g7620712"
|
|
|
},
|
|
|
task: {
|
|
|
- build: "2025-08-25 17:45:29",
|
|
|
+ build: "2025-10-08 11:06:19",
|
|
|
desc: "Task Server repo",
|
|
|
- submodule: ["0fc2b1e4[rpc_idl]"],
|
|
|
- version: "0.3.0-20-ge9ec04a"
|
|
|
+ submodule: ["8595ea2d[rpc_idl]"],
|
|
|
+ version: "0.4.0-11-g494849d"
|
|
|
}
|
|
|
},
|
|
|
- sn: "2edbc382-044adc78-95bed11b-51c9328a"
|
|
|
+ sn: "19d5d2eb-8b720370-7d617b19-670dd1ae"
|
|
|
},
|
|
|
description: "Success",
|
|
|
solution: ""
|
|
@@ -306,7 +341,7 @@ export function mockLogger() {
|
|
|
}
|
|
|
|
|
|
// 封装所有必要的API mock,避免影响页面加载
|
|
|
-export function mockAllRequiredAPIs() {
|
|
|
- mockSoftwareInfo();
|
|
|
+export function mockAllRequiredAPIs(locale: 'zh_CN' | 'en_US' = 'zh_CN') {
|
|
|
+ mockSoftwareInfo(locale);
|
|
|
mockLogger();
|
|
|
}
|