Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
river-refunds
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Qian Xu
river-refunds
Commits
424962a8
Commit
424962a8
authored
Jul 08, 2026
by
Lily Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updateupdate
parent
6dac75af
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
109 additions
and
15 deletions
+109
-15
.env.development
.env.development
+2
-0
.env.example
.env.example
+2
-0
.env.production
.env.production
+2
-0
.env.staging
.env.staging
+2
-0
README.md
README.md
+17
-0
package.json
package.json
+4
-4
App.jsx
src/App.jsx
+11
-3
api.js
src/api.js
+66
-8
vite.out.log
vite.out.log
+3
-0
No files found.
.env.development
View file @
424962a8
...
...
@@ -4,4 +4,6 @@ VITE_STREAMS_TYPE=ticket
VITE_STREAMS_TICKET=cydz5uLSWULm1gu5ACUWEXor1mrrBzr0
VITE_MIDDLE_QUERY_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_CREATE_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_TERMS_PATH=/record/query
VITE_MIDDLE_TERMS_PAGE_SIZE=20
VITE_USE_MOCK=false
.env.example
View file @
424962a8
...
...
@@ -5,4 +5,6 @@ VITE_STREAMS_TYPE=ticket
VITE_STREAMS_TICKET=ODJuvaIno8PUnnHhCCZSuFpJVD7ZJCJh
VITE_MIDDLE_QUERY_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_CREATE_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_TERMS_PATH=/record/query
VITE_MIDDLE_TERMS_PAGE_SIZE=20
VITE_USE_MOCK=false
.env.production
View file @
424962a8
...
...
@@ -5,4 +5,6 @@ VITE_STREAMS_TYPE=ticket
VITE_STREAMS_TICKET=ODJuvaIno8PUnnHhCCZSuFpJVD7ZJCJh
VITE_MIDDLE_QUERY_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_CREATE_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_TERMS_PATH=/record/query
VITE_MIDDLE_TERMS_PAGE_SIZE=20
VITE_USE_MOCK=false
.env.staging
View file @
424962a8
...
...
@@ -5,4 +5,6 @@ VITE_STREAMS_TYPE=ticket
VITE_STREAMS_TICKET=cydz5uLSWULm1gu5ACUWEXor1mrrBzr0
VITE_MIDDLE_QUERY_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_CREATE_DEVIATION_PATH=/client/salesforce/call/DeviationAgreementService
VITE_MIDDLE_TERMS_PATH=/record/query
VITE_MIDDLE_TERMS_PAGE_SIZE=20
VITE_USE_MOCK=false
README.md
View file @
424962a8
...
...
@@ -32,6 +32,23 @@ npm run dev:production
-
`GET /client/salesforce/call/DeviationAgreementService?PassengerID=xxx`
-
`POST /client/salesforce/call/DeviationAgreementService`
补偿条款接口:
-
`POST /record/query`
请求体:
```
json
{
"subject"
:
"deviation"
,
"page"
:
0
,
"page_size"
:
20
,
"filter"
:
{},
"full"
:
false
,
"select"
:
null
}
```
本地开发时 Vite 会把
`/api2`
代理到测试中台;生产环境默认使用
`https://streams.vikingcruises.cn/api/`
。
## 打包部署
...
...
package.json
View file @
424962a8
{
"scripts"
:
{
"dev"
:
"vite --host 0.0.0.0 --port 5173
--strictPort
"
,
"dev:development"
:
"vite --mode development --host 0.0.0.0 --port 5173
--strictPort
"
,
"dev:staging"
:
"vite --mode staging --host 0.0.0.0 --port 5173
--strictPort
"
,
"dev:production"
:
"vite --mode production --host 0.0.0.0 --port 5173
--strictPort
"
,
"dev"
:
"vite --host 0.0.0.0 --port 5173"
,
"dev:development"
:
"vite --mode development --host 0.0.0.0 --port 5173"
,
"dev:staging"
:
"vite --mode staging --host 0.0.0.0 --port 5173"
,
"dev:production"
:
"vite --mode production --host 0.0.0.0 --port 5173"
,
"build"
:
"vite build"
,
"build:staging"
:
"vite build --mode staging"
,
"build:production"
:
"vite build --mode production"
,
...
...
src/App.jsx
View file @
424962a8
...
...
@@ -2,6 +2,7 @@ import { useEffect, useMemo, useState } from 'react';
import
{
createDeviationService
,
fetchDeviationPageData
,
fetchDeviationTerms
,
sendSmsCode
,
useMock
,
verifySmsCode
,
...
...
@@ -126,9 +127,16 @@ export default function App() {
}
const
passengerId
=
getPassengerId
();
const
{
order
:
nextOrder
,
terms
:
nextTerms
}
=
passengerId
?
await
fetchDeviationPageData
(
passengerId
)
:
{
order
:
null
,
terms
:
[]
};
if
(
!
passengerId
)
{
setOrder
(
null
);
setTerms
([]);
return
;
}
const
[{
order
:
nextOrder
},
nextTerms
]
=
await
Promise
.
all
([
fetchDeviationPageData
(
passengerId
),
fetchDeviationTerms
(),
]);
if
(
!
active
)
{
return
;
...
...
src/api.js
View file @
424962a8
...
...
@@ -2,6 +2,7 @@ import { get as middleGet, post as middlePost } from './streamsRequest.js';
const
messageBaseUrl
=
import
.
meta
.
env
.
VITE_MESSAGE_BASE_URL
||
'https://api.cmviking.com/message'
;
const
middleDeviationPath
=
'/client/salesforce/call/DeviationAgreementService'
;
const
middleTermsPath
=
import
.
meta
.
env
.
VITE_MIDDLE_TERMS_PATH
||
'/record/query'
;
const
middleQueryDeviationPath
=
import
.
meta
.
env
.
VITE_MIDDLE_QUERY_DEVIATION_PATH
||
middleDeviationPath
;
const
middleCreateDeviationPath
=
...
...
@@ -26,25 +27,82 @@ async function parseJson(response) {
function
normalizeDeviationPayload
(
payload
)
{
const
data
=
payload
?.
data
||
payload
||
{};
const
order
=
data
.
itinerary
||
data
.
order
||
data
;
const
terms
=
data
.
terms
||
data
.
deviation_terms
||
data
.
deviationTerms
||
payload
?.
terms
||
payload
?.
deviation_terms
||
[];
return
{
order
,
terms
:
Array
.
isArray
(
terms
)
?
terms
:
[],
terms
:
normalizeDeviationTerms
(
payload
),
};
}
function
parseRecordData
(
record
)
{
const
rawData
=
record
?.
data
||
record
?.
fields
||
record
?.
value
||
{};
if
(
typeof
rawData
===
'string'
)
{
try
{
return
JSON
.
parse
(
rawData
);
}
catch
(
error
)
{
return
{};
}
}
return
rawData
&&
typeof
rawData
===
'object'
?
rawData
:
{};
}
function
normalizeTermRecord
(
record
)
{
const
data
=
parseRecordData
(
record
);
return
{
code
:
record
?.
code
||
data
.
code
||
record
?.
slug
||
data
.
slug
||
''
,
desc
:
record
?.
desc
||
data
.
desc
||
record
?.
description
||
data
.
description
||
''
,
content
:
record
?.
content
||
data
.
content
||
record
?.
post_content
||
data
.
post_content
||
record
?.
html
||
data
.
html
||
''
,
};
}
function
normalizeDeviationTerms
(
payload
)
{
const
data
=
payload
?.
data
||
payload
||
{};
const
records
=
data
.
records
||
data
.
list
||
data
.
items
||
data
.
rows
||
data
.
data
||
payload
?.
records
||
payload
?.
terms
||
payload
?.
deviation_terms
||
[];
if
(
!
Array
.
isArray
(
records
))
{
return
[];
}
return
records
.
map
(
normalizeTermRecord
).
filter
((
item
)
=>
item
.
code
);
}
export
async
function
fetchDeviationPageData
(
passengerId
)
{
const
payload
=
await
middleGet
(
middleQueryDeviationPath
,
{
PassengerID
:
passengerId
});
return
normalizeDeviationPayload
(
payload
);
}
export
async
function
fetchDeviationTerms
()
{
const
payload
=
await
middlePost
(
middleTermsPath
,
{
subject
:
'deviation'
,
page
:
0
,
page_size
:
Number
(
import
.
meta
.
env
.
VITE_MIDDLE_TERMS_PAGE_SIZE
||
20
),
filter
:
{},
full
:
false
,
select
:
null
,
});
return
normalizeDeviationTerms
(
payload
);
}
export
async
function
sendSmsCode
(
mobile
)
{
const
response
=
await
fetch
(
`
${
messageBaseUrl
}
/send-sms-code`
,
{
method
:
'POST'
,
...
...
vite.out.log
View file @
424962a8
...
...
@@ -32,3 +32,6 @@
[2m11:42:55[22m [36m[1m[vite][22m[39m [90m[2m(client)[22m[39m [32mpage reload [39m[2mindex.html[22m
[2m11:42:59[22m [36m[1m[vite][22m[39m [32m.env.development changed, restarting server...[39m
[2m11:42:59[22m [36m[1m[vite][22m[39m server restarted.
[2m12:09:27[22m [36m[1m[vite][22m[39m [32m.env.development changed, restarting server...[39m
[2m12:09:27[22m [36m[1m[vite][22m[39m [90m[2m(client)[22m[39m Re-optimizing dependencies because vite config has changed
[2m12:09:27[22m [36m[1m[vite][22m[39m server restarted.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment