Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 959b6809
authored
Mar 10, 2026
by
Jaxon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
chron: 目录结构修正
1 parent
e5d01cbf
Pipeline
#66
for
959b6809
failed
in 0 seconds
Changes
41
Pipelines
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
452 additions
and
443 deletions
apps/web/venus-usedcar/venus-usedcar-h5/.env → apps/web/venus-usedcar-quality/.env
apps/web/venus-usedcar/venus-usedcar-h5/.env.development → apps/web/venus-usedcar-quality/.env.development
apps/web/venus-usedcar/venus-usedcar-h5/.env.production → apps/web/venus-usedcar-quality/.env.production
apps/web/venus-usedcar/venus-usedcar-h5/README.md → apps/web/venus-usedcar-quality/README.md
apps/web/venus-usedcar/venus-usedcar-h5/env.d.ts → apps/web/venus-usedcar-quality/env.d.ts
apps/web/venus-usedcar/venus-usedcar-h5/index.html → apps/web/venus-usedcar-quality/index.html
apps/web/venus-usedcar/venus-usedcar-h5/package.json → apps/web/venus-usedcar-quality/package.json
apps/web/venus-usedcar/venus-usedcar-h5/src/App.vue → apps/web/venus-usedcar-quality/src/App.vue
apps/web/venus-usedcar-quality/src/api/index.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/api/modules/car.ts → apps/web/venus-usedcar-quality/src/api/modules/car.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/api/modules/user.ts → apps/web/venus-usedcar-quality/src/api/modules/user.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/assets/styles/index.scss → apps/web/venus-usedcar-quality/src/assets/styles/index.scss
apps/web/venus-usedcar/venus-usedcar-h5/src/assets/styles/reset.scss → apps/web/venus-usedcar-quality/src/assets/styles/reset.scss
apps/web/venus-usedcar/venus-usedcar-h5/src/assets/styles/variables.scss → apps/web/venus-usedcar-quality/src/assets/styles/variables.scss
apps/web/venus-usedcar/venus-usedcar-h5/src/auto-imports.d.ts → apps/web/venus-usedcar-quality/src/auto-imports.d.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/components.d.ts → apps/web/venus-usedcar-quality/src/components.d.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/composables/useRequest.ts → apps/web/venus-usedcar-quality/src/composables/useRequest.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/config/center.ts → apps/web/venus-usedcar-quality/src/config/center.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/config/constants.ts → apps/web/venus-usedcar-quality/src/config/constants.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/config/index.ts → apps/web/venus-usedcar-quality/src/config/index.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/layouts/index.vue → apps/web/venus-usedcar-quality/src/layouts/index.vue
apps/web/venus-usedcar/venus-usedcar-h5/src/main.ts → apps/web/venus-usedcar-quality/src/main.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/router/index.ts → apps/web/venus-usedcar-quality/src/router/index.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/router/routes.ts → apps/web/venus-usedcar-quality/src/router/routes.ts
apps/web/venus-usedcar-quality/src/stores/index.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/stores/modules/app.ts → apps/web/venus-usedcar-quality/src/stores/modules/app.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/stores/modules/user.ts → apps/web/venus-usedcar-quality/src/stores/modules/user.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/types/api.ts → apps/web/venus-usedcar-quality/src/types/api.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/types/global.d.ts → apps/web/venus-usedcar-quality/src/types/global.d.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/utils/index.ts → apps/web/venus-usedcar-quality/src/utils/index.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/utils/request.ts → apps/web/venus-usedcar-quality/src/utils/request.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/views/404/index.vue → apps/web/venus-usedcar-quality/src/views/404/index.vue
apps/web/venus-usedcar/venus-usedcar-h5/src/views/car-detail/index.vue → apps/web/venus-usedcar-quality/src/views/car-detail/index.vue
apps/web/venus-usedcar/venus-usedcar-h5/src/views/car-list/index.vue → apps/web/venus-usedcar-quality/src/views/car-list/index.vue
apps/web/venus-usedcar/venus-usedcar-h5/src/views/home/index.vue → apps/web/venus-usedcar-quality/src/views/home/index.vue
apps/web/venus-usedcar/venus-usedcar-h5/src/views/mine/index.vue → apps/web/venus-usedcar-quality/src/views/mine/index.vue
apps/web/venus-usedcar/venus-usedcar-h5/tsconfig.json → apps/web/venus-usedcar-quality/tsconfig.json
apps/web/venus-usedcar/venus-usedcar-h5/tsconfig.node.json → apps/web/venus-usedcar-quality/tsconfig.node.json
apps/web/venus-usedcar/venus-usedcar-h5/vite.config.ts → apps/web/venus-usedcar-quality/vite.config.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/api/index.ts
apps/web/venus-usedcar/venus-usedcar-h5/src/stores/index.ts
apps/web/venus-usedcar
/venus-usedcar-h5
/.env
→
apps/web/venus-usedcar
-quality
/.env
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/.env.development
→
apps/web/venus-usedcar
-quality
/.env.development
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/.env.production
→
apps/web/venus-usedcar
-quality
/.env.production
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/README.md
→
apps/web/venus-usedcar
-quality
/README.md
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/env.d.ts
→
apps/web/venus-usedcar
-quality
/env.d.ts
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/index.html
→
apps/web/venus-usedcar
-quality
/index.html
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/package.json
→
apps/web/venus-usedcar
-quality
/package.json
View file @
959b680
{
{
"name"
:
"@venus/venus-usedcar-h5"
,
"name"
:
"venus-usedcar-h5"
,
"version"
:
"1.0.0"
,
"version"
:
"1.0.0"
,
"description"
:
"二手车H5移动端应用"
,
"description"
:
"二手车H5移动端应用"
,
"private"
:
true
,
"private"
:
true
,
"type"
:
"module"
,
"type"
:
"module"
,
"scripts"
:
{
"scripts"
:
{
"dev"
:
"vite --host --port 8082"
,
"dev"
:
"vite --host --port 8082"
,
"build"
:
"vue-tsc && vite build"
,
"build"
:
"vue-tsc && vite build"
,
"preview"
:
"vite preview --port 8082"
,
"preview"
:
"vite preview --port 8082"
,
"type-check"
:
"vue-tsc --noEmit"
"type-check"
:
"vue-tsc --noEmit"
},
},
"dependencies"
:
{
"dependencies"
:
{
"@vueuse/core"
:
"catalog:"
,
"@vueuse/core"
:
"catalog:"
,
"dayjs"
:
"catalog:"
,
"dayjs"
:
"catalog:"
,
"glsk-toolkit"
:
"catalog:"
,
"glsk-toolkit"
:
"catalog:"
,
"pinia"
:
"catalog:"
,
"pinia"
:
"catalog:"
,
"pinia-plugin-persistedstate"
:
"catalog:"
,
"pinia-plugin-persistedstate"
:
"catalog:"
,
"vant"
:
"^4.9.0"
,
"vant"
:
"^4.9.0"
,
"vue"
:
"catalog:"
,
"vue"
:
"catalog:"
,
"vue-router"
:
"catalog:"
"vue-router"
:
"catalog:"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"@types/node"
:
"catalog:"
,
"@types/node"
:
"catalog:"
,
"@vitejs/plugin-vue"
:
"catalog:"
,
"@vitejs/plugin-vue"
:
"catalog:"
,
"autoprefixer"
:
"catalog:"
,
"autoprefixer"
:
"catalog:"
,
"postcss"
:
"catalog:"
,
"postcss"
:
"catalog:"
,
"postcss-px-to-viewport-8-plugin"
:
"^1.2.5"
,
"postcss-px-to-viewport-8-plugin"
:
"^1.2.5"
,
"sass"
:
"catalog:"
,
"sass"
:
"catalog:"
,
"typescript"
:
"catalog:"
,
"typescript"
:
"catalog:"
,
"unplugin-auto-import"
:
"catalog:"
,
"unplugin-auto-import"
:
"catalog:"
,
"unplugin-vue-components"
:
"catalog:"
,
"unplugin-vue-components"
:
"catalog:"
,
"vite"
:
"catalog:"
,
"vite"
:
"catalog:"
,
"vue-tsc"
:
"catalog:"
"vue-tsc"
:
"catalog:"
}
}
}
}
apps/web/venus-usedcar
/venus-usedcar-h5
/src/App.vue
→
apps/web/venus-usedcar
-quality
/src/App.vue
View file @
959b680
File moved
apps/web/venus-usedcar-quality/src/api/index.ts
0 → 100644
View file @
959b680
export
*
from
"./modules/car.ts"
;
export
*
from
"./modules/user.ts"
;
apps/web/venus-usedcar
/venus-usedcar-h5
/src/api/modules/car.ts
→
apps/web/venus-usedcar
-quality
/src/api/modules/car.ts
View file @
959b680
import
type
{
PageData
}
from
"@/utils/request"
;
import
type
{
PageData
}
from
"@utils/request.ts"
;
import
{
get
,
post
}
from
"@/utils/request"
;
import
{
get
,
post
}
from
"@utils/request.ts"
;
export
interface
CarItem
{
export
interface
CarItem
{
id
:
number
;
id
:
number
;
...
@@ -27,35 +28,35 @@ export interface CarListParams {
...
@@ -27,35 +28,35 @@ export interface CarListParams {
maxPrice
?:
number
;
maxPrice
?:
number
;
city
?:
string
;
city
?:
string
;
keyword
?:
string
;
keyword
?:
string
;
sortBy
?:
"
price_asc"
|
"price_desc"
|
"mileage_asc"
|
"newest
"
;
sortBy
?:
"
mileage_asc"
|
"newest"
|
"price_asc"
|
"price_desc
"
;
}
}
export
interface
CarFilter
{
export
interface
CarFilter
{
brands
:
Array
<
{
label
:
string
;
value
:
string
}
>
;
brands
:
Array
<
{
label
:
string
;
value
:
string
}
>
;
cities
:
Array
<
{
label
:
string
;
value
:
string
}
>
;
cities
:
Array
<
{
label
:
string
;
value
:
string
}
>
;
priceRanges
:
Array
<
{
label
:
string
;
m
in
:
number
;
max
:
number
}
>
;
priceRanges
:
Array
<
{
label
:
string
;
m
ax
:
number
;
min
:
number
;
}
>
;
}
}
export
function
getCarList
(
params
?:
CarListParams
)
{
export
function
getCarList
(
params
?:
CarListParams
)
{
return
get
<
PageData
<
CarItem
>>
(
"/api/cars"
,
params
as
Record
<
string
,
unknown
>
);
return
get
<
PageData
<
CarItem
>>
(
"/api/cars"
,
params
as
Record
<
string
,
unknown
>
);
}
}
export
function
getCarDetail
(
id
:
number
|
string
)
{
export
function
getCarDetail
(
id
:
number
|
string
)
{
return
get
<
CarItem
>
(
`/api/cars/
${
id
}
`
);
return
get
<
CarItem
>
(
`/api/cars/
${
id
}
`
);
}
}
export
function
getCarFilters
()
{
export
function
getCarFilters
()
{
return
get
<
CarFilter
>
(
"/api/cars/filters"
);
return
get
<
CarFilter
>
(
"/api/cars/filters"
);
}
}
export
function
getRecommendedCars
(
limit
=
10
)
{
export
function
getRecommendedCars
(
limit
=
10
)
{
return
get
<
CarItem
[]
>
(
"/api/cars/recommended"
,
{
limit
});
return
get
<
CarItem
[]
>
(
"/api/cars/recommended"
,
{
limit
});
}
}
export
function
collectCar
(
carId
:
number
)
{
export
function
collectCar
(
carId
:
number
)
{
return
post
<
void
>
(
`/api/cars/
${
carId
}
/collect`
);
return
post
<
void
>
(
`/api/cars/
${
carId
}
/collect`
);
}
}
export
function
uncollectCar
(
carId
:
number
)
{
export
function
uncollectCar
(
carId
:
number
)
{
return
post
<
void
>
(
`/api/cars/
${
carId
}
/uncollect`
);
return
post
<
void
>
(
`/api/cars/
${
carId
}
/uncollect`
);
}
}
apps/web/venus-usedcar
/venus-usedcar-h5
/src/api/modules/user.ts
→
apps/web/venus-usedcar
-quality
/src/api/modules/user.ts
View file @
959b680
import
type
{
UserInfo
}
from
"@/stores/modules/user"
;
import
type
{
UserInfo
}
from
"@stores/modules/user.ts"
;
import
{
get
,
post
}
from
"@/utils/request"
;
import
{
get
,
post
}
from
"@utils/request.ts"
;
export
interface
LoginParams
{
export
interface
LoginParams
{
phone
:
string
;
phone
:
string
;
...
@@ -12,25 +13,25 @@ export interface LoginResult {
...
@@ -12,25 +13,25 @@ export interface LoginResult {
}
}
export
function
sendSmsCode
(
phone
:
string
)
{
export
function
sendSmsCode
(
phone
:
string
)
{
return
post
<
void
>
(
"/api/user/sms-code"
,
{
phone
});
return
post
<
void
>
(
"/api/user/sms-code"
,
{
phone
});
}
}
export
function
login
(
params
:
LoginParams
)
{
export
function
login
(
params
:
LoginParams
)
{
return
post
<
LoginResult
>
(
"/api/user/login"
,
params
);
return
post
<
LoginResult
>
(
"/api/user/login"
,
params
);
}
}
export
function
logout
()
{
export
function
logout
()
{
return
post
<
void
>
(
"/api/user/logout"
);
return
post
<
void
>
(
"/api/user/logout"
);
}
}
export
function
getUserInfo
()
{
export
function
getUserInfo
()
{
return
get
<
UserInfo
>
(
"/api/user/info"
);
return
get
<
UserInfo
>
(
"/api/user/info"
);
}
}
export
function
updateUserInfo
(
data
:
Partial
<
Pick
<
UserInfo
,
"
nickname"
|
"avatar
"
>>
)
{
export
function
updateUserInfo
(
data
:
Partial
<
Pick
<
UserInfo
,
"
avatar"
|
"nickname
"
>>
)
{
return
post
<
UserInfo
>
(
"/api/user/update"
,
data
);
return
post
<
UserInfo
>
(
"/api/user/update"
,
data
);
}
}
export
function
getCollectedCars
()
{
export
function
getCollectedCars
()
{
return
get
<
number
[]
>
(
"/api/user/collected-cars"
);
return
get
<
number
[]
>
(
"/api/user/collected-cars"
);
}
}
apps/web/venus-usedcar
/venus-usedcar-h5
/src/assets/styles/index.scss
→
apps/web/venus-usedcar
-quality
/src/assets/styles/index.scss
View file @
959b680
@use
"
./
variables"
as
*
;
@use
"variables"
as
*
;
// ===== Vant 主题定制(通过 CSS 变量覆盖)=====
// ===== Vant 主题定制(通过 CSS 变量覆盖)=====
:root
{
:root
{
...
...
apps/web/venus-usedcar
/venus-usedcar-h5
/src/assets/styles/reset.scss
→
apps/web/venus-usedcar
-quality
/src/assets/styles/reset.scss
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/src/assets/styles/variables.scss
→
apps/web/venus-usedcar
-quality
/src/assets/styles/variables.scss
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/src/auto-imports.d.ts
→
apps/web/venus-usedcar
-quality
/src/auto-imports.d.ts
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/src/components.d.ts
→
apps/web/venus-usedcar
-quality
/src/components.d.ts
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/src/composables/useRequest.ts
→
apps/web/venus-usedcar
-quality
/src/composables/useRequest.ts
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/src/config/center.ts
→
apps/web/venus-usedcar
-quality
/src/config/center.ts
View file @
959b680
...
@@ -4,128 +4,140 @@
...
@@ -4,128 +4,140 @@
*/
*/
import
{
Defaults
,
Request
}
from
"glsk-toolkit"
;
import
{
Defaults
,
Request
}
from
"glsk-toolkit"
;
import
{
showToast
}
from
"vant"
;
import
{
showToast
}
from
"vant"
;
import
{
CONFIG_CACHE_KEY
,
CONFIG_CENTER_URL
}
from
"./constants"
;
import
{
CONFIG_CACHE_KEY
,
CONFIG_CENTER_URL
}
from
"./constants.ts"
;
const
TOKEN_KEY
=
"venus_usedcar_token"
;
const
TOKEN_KEY
=
"venus_usedcar_token"
;
const
defaultBaseURL
=
import
.
meta
.
env
.
VITE_API_BASE_URL
??
""
;
const
defaultBaseURL
=
import
.
meta
.
env
.
VITE_API_BASE_URL
??
""
;
let
config
:
Record
<
string
,
unknown
>
=
{};
let
config
:
Record
<
string
,
unknown
>
=
{};
let
requestInstance
:
Request
|
null
=
null
;
let
requestInstance
:
null
|
Request
=
null
;
function
getCached
<
T
>
(
key
:
string
):
T
|
null
{
function
getCached
<
T
>
(
key
:
string
):
null
|
T
{
try
{
try
{
const
item
=
localStorage
.
getItem
(
key
);
const
item
=
localStorage
.
getItem
(
key
);
return
item
?
(
JSON
.
parse
(
item
)
as
T
)
:
null
;
return
item
?
(
JSON
.
parse
(
item
)
as
T
)
:
null
;
}
catch
{
}
catch
{
return
null
;
return
null
;
}
}
}
}
function
setCache
(
key
:
string
,
value
:
unknown
):
void
{
function
setCache
(
key
:
string
,
value
:
unknown
):
void
{
try
{
try
{
localStorage
.
setItem
(
key
,
JSON
.
stringify
(
value
));
localStorage
.
setItem
(
key
,
JSON
.
stringify
(
value
));
}
catch
{
}
catch
{
/* ignore */
/* ignore */
}
}
}
}
function
getToken
():
string
{
function
getToken
():
string
{
const
token
=
localStorage
.
getItem
(
TOKEN_KEY
);
const
token
=
localStorage
.
getItem
(
TOKEN_KEY
);
return
token
?
`Bearer
${
token
}
`
:
""
;
return
token
?
`Bearer
${
token
}
`
:
""
;
}
}
/**
/**
* 获取 Request 实例
* 获取 Request 实例
*/
*/
export
function
getRequestApi
():
Request
|
null
{
export
function
getRequestApi
():
null
|
Request
{
return
requestInstance
;
return
requestInstance
;
}
}
/**
/**
* 初始化 Request 实例(在 fetchConfig 中调用)
* 初始化 Request 实例(在 fetchConfig 中调用)
*/
*/
function
initRequestInstance
(
cfg
:
Record
<
string
,
unknown
>
):
void
{
function
initRequestInstance
(
cfg
:
Record
<
string
,
unknown
>
):
void
{
const
apiBaseUrl
=
(
cfg
.
apiBaseUrl
??
(
cfg
.
gsc
as
{
baseUrl
?:
string
;
baseURL
?:
string
})?.
baseUrl
??
(
cfg
.
gsc
as
{
baseUrl
?:
string
;
baseURL
?:
string
})?.
baseURL
)
as
string
|
undefined
;
const
apiBaseUrl
=
(
cfg
.
apiBaseUrl
??
(
cfg
.
gsc
as
{
baseUrl
?:
string
;
baseURL
?:
string
})?.
baseUrl
??
(
cfg
.
gsc
as
{
baseUrl
?:
string
;
baseURL
?:
string
})?.
baseURL
)
as
string
|
undefined
;
const
baseUrl
=
apiBaseUrl
||
defaultBaseURL
;
const
baseUrl
=
apiBaseUrl
||
defaultBaseURL
;
const
requestConfig
=
{
const
requestConfig
=
{
baseUrl
:
baseUrl
||
"/"
,
baseUrl
:
baseUrl
||
"/"
,
baseURL
:
baseUrl
||
"/"
,
baseURL
:
baseUrl
||
"/"
,
timeout
:
15
_000
,
timeout
:
15
_000
,
headers
:
{
headers
:
{
"Content-Type"
:
"application/json"
,
"Content-Type"
:
"application/json"
,
},
},
events
:
{
events
:
{
error
:
(
error
:
unknown
)
=>
{
error
:
(
error
:
unknown
)
=>
{
const
err
=
error
as
{
msg
?:
string
;
message
?:
string
;
response
?:
{
status
?:
number
}
};
const
err
=
error
as
{
message
?:
string
;
msg
?:
string
;
response
?:
{
status
?:
number
}
};
const
msg
=
err
?.
msg
??
err
?.
message
??
String
(
error
);
const
msg
=
err
?.
msg
??
err
?.
message
??
String
(
error
);
const
status
=
err
?.
response
?.
status
;
const
status
=
err
?.
response
?.
status
;
if
(
status
===
401
)
{
switch
(
status
)
{
showToast
(
"登录已过期,请重新登录"
);
case
401
:
{
localStorage
.
removeItem
(
TOKEN_KEY
);
showToast
(
"登录已过期,请重新登录"
);
window
.
location
.
href
=
"/login"
;
localStorage
.
removeItem
(
TOKEN_KEY
);
}
else
if
(
status
===
403
)
{
window
.
location
.
href
=
"/login"
;
showToast
(
"暂无权限"
);
}
else
if
(
status
===
500
)
{
break
;
showToast
(
"服务器异常,请稍后重试"
);
}
}
else
{
case
403
:
{
showToast
(
msg
||
"网络错误,请检查网络连接"
);
showToast
(
"暂无权限"
);
}
},
break
;
},
}
};
case
500
:
{
showToast
(
"服务器异常,请稍后重试"
);
const
globalDefaults
=
new
Defaults
(
requestConfig
);
requestInstance
=
new
Request
(
globalDefaults
);
break
;
}
requestInstance
.
interceptors
.
request
.
use
(
default
:
{
(
reqConfig
:
Record
<
string
,
unknown
>
)
=>
{
showToast
(
msg
||
"网络错误,请检查网络连接"
);
const
token
=
getToken
();
}
if
(
token
)
{
}
const
headers
=
(
reqConfig
.
headers
as
Record
<
string
,
string
>
)
??
{};
},
reqConfig
.
headers
=
{
...
headers
,
Authorization
:
token
};
},
}
};
return
reqConfig
;
},
const
globalDefaults
=
new
Defaults
(
requestConfig
);
(
err
:
unknown
)
=>
Promise
.
reject
(
err
)
requestInstance
=
new
Request
(
globalDefaults
);
);
requestInstance
.
interceptors
.
request
.
use
(
(
reqConfig
:
Record
<
string
,
unknown
>
)
=>
{
const
token
=
getToken
();
if
(
token
)
{
const
headers
=
(
reqConfig
.
headers
as
Record
<
string
,
string
>
)
??
{};
reqConfig
.
headers
=
{
...
headers
,
Authorization
:
token
};
}
return
reqConfig
;
},
(
err
:
unknown
)
=>
Promise
.
reject
(
err
)
);
}
}
/**
/**
* 获取远程配置(优先缓存)
* 获取远程配置(优先缓存)
*/
*/
export
async
function
fetchConfig
():
Promise
<
Record
<
string
,
unknown
>>
{
export
async
function
fetchConfig
():
Promise
<
Record
<
string
,
unknown
>>
{
const
cached
=
getCached
<
Record
<
string
,
unknown
>>
(
CONFIG_CACHE_KEY
);
const
cached
=
getCached
<
Record
<
string
,
unknown
>>
(
CONFIG_CACHE_KEY
);
if
(
cached
)
{
if
(
cached
)
{
config
=
cached
;
config
=
cached
;
initRequestInstance
(
config
);
initRequestInstance
(
config
);
return
config
;
return
config
;
}
}
try
{
try
{
const
res
=
await
fetch
(
CONFIG_CENTER_URL
);
const
res
=
await
fetch
(
CONFIG_CENTER_URL
);
const
data
=
(
await
res
.
json
())
as
Record
<
string
,
unknown
>
;
const
data
=
(
await
res
.
json
())
as
Record
<
string
,
unknown
>
;
if
(
data
)
{
if
(
data
)
{
config
=
(
data
?.
data
??
data
)
as
Record
<
string
,
unknown
>
;
config
=
(
data
?.
data
??
data
)
as
Record
<
string
,
unknown
>
;
setCache
(
CONFIG_CACHE_KEY
,
config
);
setCache
(
CONFIG_CACHE_KEY
,
config
);
initRequestInstance
(
config
);
initRequestInstance
(
config
);
}
else
{
}
else
{
initRequestInstance
({
apiBaseUrl
:
defaultBaseURL
});
initRequestInstance
({
apiBaseUrl
:
defaultBaseURL
});
}
}
}
catch
(
e
)
{
}
catch
(
error
)
{
console
.
warn
(
"[配置中心] 获取失败,使用默认配置:"
,
e
);
console
.
warn
(
"[配置中心] 获取失败,使用默认配置:"
,
error
);
initRequestInstance
({
apiBaseUrl
:
defaultBaseURL
});
initRequestInstance
({
apiBaseUrl
:
defaultBaseURL
});
}
}
return
config
;
return
config
;
}
}
/** 获取当前配置 */
/** 获取当前配置 */
export
function
getConfig
():
Record
<
string
,
unknown
>
{
export
function
getConfig
():
Record
<
string
,
unknown
>
{
return
config
;
return
config
;
}
}
/** 清空配置缓存 */
/** 清空配置缓存 */
export
function
clearConfigCache
():
void
{
export
function
clearConfigCache
():
void
{
localStorage
.
removeItem
(
CONFIG_CACHE_KEY
);
localStorage
.
removeItem
(
CONFIG_CACHE_KEY
);
config
=
{};
config
=
{};
requestInstance
=
null
;
requestInstance
=
null
;
}
}
apps/web/venus-usedcar
/venus-usedcar-h5
/src/config/constants.ts
→
apps/web/venus-usedcar
-quality
/src/config/constants.ts
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/src/config/index.ts
→
apps/web/venus-usedcar
-quality
/src/config/index.ts
View file @
959b680
export
{
CONFIG_CENTER_URL
,
CONFIG_CACHE_KEY
}
from
"./constants"
;
export
{
export
{
fetchConfig
,
clearConfigCache
,
getConfig
,
fetchConfig
,
getRequestApi
,
getConfig
,
clearConfigCache
,
getRequestApi
,
}
from
"./center"
;
}
from
"./center.ts"
;
export
{
CONFIG_CACHE_KEY
,
CONFIG_CENTER_URL
}
from
"./constants.ts"
;
apps/web/venus-usedcar
/venus-usedcar-h5
/src/layouts/index.vue
→
apps/web/venus-usedcar
-quality
/src/layouts/index.vue
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/src/main.ts
→
apps/web/venus-usedcar
-quality
/src/main.ts
View file @
959b680
import
{
createApp
}
from
"vue"
;
import
{
createApp
}
from
"vue"
;
import
{
createPinia
}
from
"pinia"
;
import
{
createPinia
}
from
"pinia"
;
import
piniaPluginPersistedstate
from
"pinia-plugin-persistedstate"
;
import
piniaPluginPersistedstate
from
"pinia-plugin-persistedstate"
;
import
App
from
"./App.vue"
;
import
App
from
"./App.vue"
;
import
{
fetchConfig
}
from
"./config/center.ts"
;
import
router
from
"./router"
;
import
router
from
"./router"
;
import
{
fetchConfig
}
from
"./config/center"
;
import
"
./
assets/styles/reset.scss"
;
import
"
@
assets/styles/reset.scss"
;
import
"
./
assets/styles/index.scss"
;
import
"
@
assets/styles/index.scss"
;
async
function
bootstrap
()
{
async
function
bootstrap
()
{
await
fetchConfig
();
await
fetchConfig
();
const
app
=
createApp
(
App
);
const
app
=
createApp
(
App
);
const
pinia
=
createPinia
();
const
pinia
=
createPinia
();
pinia
.
use
(
piniaPluginPersistedstate
);
pinia
.
use
(
piniaPluginPersistedstate
);
app
.
use
(
pinia
);
app
.
use
(
pinia
);
app
.
use
(
router
);
app
.
use
(
router
);
app
.
mount
(
"#app"
);
app
.
mount
(
"#app"
);
}
}
bootstrap
();
bootstrap
();
apps/web/venus-usedcar
/venus-usedcar-h5
/src/router/index.ts
→
apps/web/venus-usedcar
-quality
/src/router/index.ts
View file @
959b680
import
{
createRouter
,
createWebHistory
}
from
"vue-router"
;
import
{
createRouter
,
createWebHistory
}
from
"vue-router"
;
import
{
showLoadingToast
,
closeToast
}
from
"vant"
;
import
routes
from
"./routes"
;
import
{
closeToast
,
showLoadingToast
}
from
"vant"
;
import
routes
from
"./routes.ts"
;
const
router
=
createRouter
({
const
router
=
createRouter
({
history
:
createWebHistory
(
import
.
meta
.
env
.
BASE_URL
),
history
:
createWebHistory
(
import
.
meta
.
env
.
BASE_URL
),
routes
,
routes
,
scrollBehavior
(
_
,
_from
,
savedPosition
)
{
scrollBehavior
(
_
,
_from
,
savedPosition
)
{
if
(
savedPosition
)
{
if
(
savedPosition
)
{
return
savedPosition
;
return
savedPosition
;
}
}
return
{
top
:
0
};
return
{
top
:
0
};
},
},
});
});
router
.
beforeEach
((
to
,
_from
,
next
)
=>
{
router
.
beforeEach
((
to
,
_from
,
next
)
=>
{
showLoadingToast
({
showLoadingToast
({
message
:
"加载中..."
,
message
:
"加载中..."
,
forbidClick
:
true
,
forbidClick
:
true
,
duration
:
0
,
duration
:
0
,
loadingType
:
"spinner"
,
loadingType
:
"spinner"
,
});
});
if
(
to
.
meta
.
title
)
{
if
(
to
.
meta
.
title
)
{
document
.
title
=
`
${
to
.
meta
.
title
}
-
${
import
.
meta
.
env
.
VITE_APP_TITLE
}
`
;
document
.
title
=
`
${
to
.
meta
.
title
}
-
${
import
.
meta
.
env
.
VITE_APP_TITLE
}
`
;
}
}
next
();
next
();
});
});
router
.
afterEach
(()
=>
{
router
.
afterEach
(()
=>
{
closeToast
();
closeToast
();
});
});
export
default
router
;
export
default
router
;
apps/web/venus-usedcar
/venus-usedcar-h5
/src/router/routes.ts
→
apps/web/venus-usedcar
-quality
/src/router/routes.ts
View file @
959b680
import
type
{
RouteRecordRaw
}
from
"vue-router"
;
import
type
{
RouteRecordRaw
}
from
"vue-router"
;
const
routes
:
RouteRecordRaw
[]
=
[
const
routes
:
RouteRecordRaw
[]
=
[
{
{
path
:
"/"
,
path
:
"/"
,
component
:
()
=>
import
(
"@/layouts/index.vue"
),
component
:
()
=>
import
(
"@/layouts/index.vue"
),
children
:
[
children
:
[
{
{
path
:
""
,
path
:
""
,
redirect
:
"/home"
,
redirect
:
"/home"
,
},
},
{
{
path
:
"home"
,
path
:
"home"
,
name
:
"Home"
,
name
:
"Home"
,
component
:
()
=>
import
(
"@/
views/home/index.vue"
),
component
:
()
=>
import
(
"@
views/home/index.vue"
),
meta
:
{
meta
:
{
title
:
"首页"
,
title
:
"首页"
,
keepAlive
:
true
,
keepAlive
:
true
,
showTabBar
:
true
,
showTabBar
:
true
,
},
},
},
},
{
{
path
:
"car-list"
,
path
:
"car-list"
,
name
:
"CarList"
,
name
:
"CarList"
,
component
:
()
=>
import
(
"@/
views/car-list/index.vue"
),
component
:
()
=>
import
(
"@
views/car-list/index.vue"
),
meta
:
{
meta
:
{
title
:
"找车"
,
title
:
"找车"
,
keepAlive
:
true
,
keepAlive
:
true
,
showTabBar
:
true
,
showTabBar
:
true
,
},
},
},
},
{
{
path
:
"mine"
,
path
:
"mine"
,
name
:
"Mine"
,
name
:
"Mine"
,
component
:
()
=>
import
(
"@/
views/mine/index.vue"
),
component
:
()
=>
import
(
"@
views/mine/index.vue"
),
meta
:
{
meta
:
{
title
:
"我的"
,
title
:
"我的"
,
keepAlive
:
false
,
keepAlive
:
false
,
showTabBar
:
true
,
showTabBar
:
true
,
},
},
},
},
],
],
},
},
{
{
path
:
"/car-detail/:id"
,
path
:
"/car-detail/:id"
,
name
:
"CarDetail"
,
name
:
"CarDetail"
,
component
:
()
=>
import
(
"@/
views/car-detail/index.vue"
),
component
:
()
=>
import
(
"@
views/car-detail/index.vue"
),
meta
:
{
meta
:
{
title
:
"车辆详情"
,
title
:
"车辆详情"
,
showTabBar
:
false
,
showTabBar
:
false
,
},
},
},
},
{
{
path
:
"/:pathMatch(.*)*"
,
path
:
"/:pathMatch(.*)*"
,
name
:
"NotFound"
,
name
:
"NotFound"
,
component
:
()
=>
import
(
"@/
views/404/index.vue"
),
component
:
()
=>
import
(
"@
views/404/index.vue"
),
meta
:
{
meta
:
{
title
:
"页面不存在"
,
title
:
"页面不存在"
,
},
},
},
},
];
];
export
default
routes
;
export
default
routes
;
apps/web/venus-usedcar-quality/src/stores/index.ts
0 → 100644
View file @
959b680
export
{
useAppStore
}
from
"./modules/app.ts"
;
export
{
useUserStore
}
from
"./modules/user.ts"
;
export
type
{
UserInfo
}
from
"./modules/user.ts"
;
apps/web/venus-usedcar
/venus-usedcar-h5
/src/stores/modules/app.ts
→
apps/web/venus-usedcar
-quality
/src/stores/modules/app.ts
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/src/stores/modules/user.ts
→
apps/web/venus-usedcar
-quality
/src/stores/modules/user.ts
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/src/types/api.ts
→
apps/web/venus-usedcar
-quality
/src/types/api.ts
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/src/types/global.d.ts
→
apps/web/venus-usedcar
-quality
/src/types/global.d.ts
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/src/utils/index.ts
→
apps/web/venus-usedcar
-quality
/src/utils/index.ts
View file @
959b680
File moved
apps/web/venus-usedcar
/venus-usedcar-h5
/src/utils/request.ts
→
apps/web/venus-usedcar
-quality
/src/utils/request.ts
View file @
959b680
import
{
getRequestApi
}
from
"@/config/center.ts"
;
/**
/**
* 请求封装 - 基于 glsk-toolkit Request
* 请求封装 - 基于 glsk-toolkit Request
* 参考 gscrequest.ts 模式,Authorization 通过 center 拦截器统一处理
* 参考 gscrequest.ts 模式,Authorization 通过 center 拦截器统一处理
*/
*/
import
{
showToast
}
from
"vant"
;
import
{
showToast
}
from
"vant"
;
import
{
getRequestApi
}
from
"@/config/center"
;
export
interface
ApiResponse
<
T
=
unknown
>
{
export
interface
ApiResponse
<
T
=
unknown
>
{
code
:
number
;
code
:
number
;
...
@@ -26,46 +26,46 @@ export interface RequestConfig {
...
@@ -26,46 +26,46 @@ export interface RequestConfig {
}
}
function
getInstance
()
{
function
getInstance
()
{
const
api
=
getRequestApi
();
const
api
=
getRequestApi
();
if
(
!
api
)
{
if
(
!
api
)
{
throw
new
Error
(
throw
new
Error
(
"[Request] API 实例未初始化,请确保 fetchConfig 已在 main.ts 中执行"
"[Request] API 实例未初始化,请确保 fetchConfig 已在 main.ts 中执行"
);
);
}
}
return
api
;
return
api
;
}
}
/** 统一处理响应,提取 data 或按业务码处理 */
/** 统一处理响应,提取 data 或按业务码处理 */
async
function
handleResponse
<
T
>
(
promise
:
Promise
<
unknown
>
):
Promise
<
T
>
{
async
function
handleResponse
<
T
>
(
promise
:
Promise
<
unknown
>
):
Promise
<
T
>
{
const
res
=
await
promise
;
const
res
=
await
promise
;
const
data
=
res
as
ApiResponse
<
T
>
;
const
data
=
res
as
ApiResponse
<
T
>
;
if
(
data
?.
code
===
200
||
data
?.
code
===
0
)
{
if
(
data
?.
code
===
200
||
data
?.
code
===
0
)
{
return
(
data
.
data
??
res
)
as
T
;
return
(
data
.
data
??
res
)
as
T
;
}
}
if
(
data
?.
code
===
undefined
)
{
if
(
data
?.
code
===
undefined
)
{
return
res
as
T
;
return
res
as
T
;
}
}
showToast
(
data
?.
message
||
"请求失败"
);
showToast
(
data
?.
message
||
"请求失败"
);
return
Promise
.
reject
(
new
Error
(
data
?.
message
||
"请求失败"
)
);
throw
new
Error
(
data
?.
message
||
"请求失败"
);
}
}
function
get
<
T
=
unknown
>
(
function
get
<
T
=
unknown
>
(
url
:
string
,
url
:
string
,
params
?:
Record
<
string
,
unknown
>
,
params
?:
Record
<
string
,
unknown
>
,
config
?:
RequestConfig
config
?:
RequestConfig
)
{
)
{
const
instance
=
getInstance
();
const
instance
=
getInstance
();
const
mergedConfig
=
{
...
config
,
params
};
const
mergedConfig
=
{
...
config
,
params
};
return
handleResponse
<
T
>
(
instance
.
get
(
url
,
mergedConfig
));
return
handleResponse
<
T
>
(
instance
.
get
(
url
,
mergedConfig
));
}
}
function
post
<
T
=
unknown
>
(
function
post
<
T
=
unknown
>
(
url
:
string
,
url
:
string
,
data
?:
unknown
,
data
?:
unknown
,
config
?:
RequestConfig
config
?:
RequestConfig
)
{
)
{
const
instance
=
getInstance
();
const
instance
=
getInstance
();
return
handleResponse
<
T
>
(
instance
.
post
(
url
,
data
,
config
));
return
handleResponse
<
T
>
(
instance
.
post
(
url
,
data
,
config
));
}
}
export
{
get
,
post
};
export
{
get
,
post
};
apps/web/venus-usedcar
/venus-usedcar-h5
/src/views/404/index.vue
→
apps/web/venus-usedcar
-quality
/src/views/404/index.vue
View file @
959b680
...
@@ -4,32 +4,34 @@ import { useRouter } from "vue-router";
...
@@ -4,32 +4,34 @@ import { useRouter } from "vue-router";
const
router
=
useRouter
();
const
router
=
useRouter
();
function
goHome
()
{
function
goHome
()
{
router
.
replace
({
name
:
"Home"
});
router
.
replace
({
name
:
"Home"
});
}
}
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"not-found-page"
>
<div
class=
"not-found-page"
>
<van-empty
description=
"页面不存在"
image=
"error"
>
<van-empty
description=
"页面不存在"
image=
"error"
>
<template
#
description
>
<template
#
description
>
<p
class=
"empty-title"
>
页面不存在
</p>
<p
class=
"empty-title"
>
<p
class=
"empty-desc"
>
您访问的页面已移动或不存在
</p>
页面不存在
</
template
>
</p>
<van-button
<p
class=
"empty-desc"
>
round
您访问的页面已移动或不存在
type=
"primary"
</p>
color=
"#ee0a24"
</
template
>
class=
"back-btn"
<van-button
class=
"back-btn"
@
click=
"goHome"
color=
"#ee0a24"
>
round
返回首页
type=
"primary"
</van-button>
@
click=
"goHome"
>
</van-empty>
返回首页
</div>
</van-button>
</van-empty>
</div>
</template>
</template>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
@use
"@
/
assets/styles/variables"
as
*
;
@use
"@assets/styles/variables"
as
*
;
.not-found-page
{
.not-found-page
{
display
:
flex
;
display
:
flex
;
...
...
apps/web/venus-usedcar
/venus-usedcar-h5
/src/views/car-detail/index.vue
→
apps/web/venus-usedcar
-quality
/src/views/car-detail/index.vue
View file @
959b680
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
type
{
CarItem
}
from
"@
/api/modules/car
"
;
import
type
{
CarItem
}
from
"@
api/modules/car.ts
"
;
import
{
onMounted
,
ref
}
from
"vue"
;
import
{
onMounted
,
ref
}
from
"vue"
;
import
{
useRoute
,
useRouter
}
from
"vue-router"
;
import
{
useRoute
,
useRouter
}
from
"vue-router"
;
import
{
collectCar
,
getCarDetail
,
uncollectCar
}
from
"@/api/modules/car"
;
import
{
formatDate
,
formatMileage
}
from
"@/utils"
;
import
{
formatDate
,
formatMileage
}
from
"@/utils"
;
import
{
collectCar
,
getCarDetail
,
uncollectCar
}
from
"@api/modules/car.ts"
;
import
{
showConfirmDialog
,
showToast
}
from
"vant"
;
import
{
showConfirmDialog
,
showToast
}
from
"vant"
;
const
route
=
useRoute
();
const
route
=
useRoute
();
...
@@ -226,7 +226,7 @@ onMounted(() => {
...
@@ -226,7 +226,7 @@ onMounted(() => {
</template>
</template>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
@use
"@
/
assets/styles/variables"
as
*
;
@use
"@assets/styles/variables"
as
*
;
.car-detail-page
{
.car-detail-page
{
min-height
:
100vh
;
min-height
:
100vh
;
...
...
apps/web/venus-usedcar
/venus-usedcar-h5
/src/views/car-list/index.vue
→
apps/web/venus-usedcar
-quality
/src/views/car-list/index.vue
View file @
959b680
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ref
,
onMounted
}
from
"vue"
;
import
type
{
CarItem
,
CarListParams
}
from
"@api/modules/car.ts"
;
import
{
useRouter
,
useRoute
}
from
"vue-router"
;
import
type
{
CarItem
,
CarListParams
}
from
"@/api/modules/car"
;
import
{
onMounted
,
ref
}
from
"vue"
;
import
{
getCarList
}
from
"@/api/modules/car"
;
import
{
useRoute
,
useRouter
}
from
"vue-router"
;
import
{
formatMileage
,
formatPrice
}
from
"@/utils"
;
import
{
formatMileage
,
formatPrice
}
from
"@/utils"
;
import
{
getCarList
}
from
"@api/modules/car.ts"
;
const
router
=
useRouter
();
const
router
=
useRouter
();
const
route
=
useRoute
();
const
route
=
useRoute
();
...
@@ -14,180 +16,168 @@ const finished = ref(false);
...
@@ -14,180 +16,168 @@ const finished = ref(false);
const
refreshing
=
ref
(
false
);
const
refreshing
=
ref
(
false
);
const
params
=
ref
<
CarListParams
>
({
const
params
=
ref
<
CarListParams
>
({
page
:
1
,
page
:
1
,
pageSize
:
10
,
pageSize
:
10
,
keyword
:
(
route
.
query
.
keyword
as
string
)
||
""
,
keyword
:
(
route
.
query
.
keyword
as
string
)
||
""
,
sortBy
:
"newest"
,
sortBy
:
"newest"
,
});
});
const
searchValue
=
ref
(
params
.
value
.
keyword
??
""
);
const
searchValue
=
ref
(
params
.
value
.
keyword
??
""
);
const
sortOptions
=
[
const
sortOptions
=
[
{
label
:
"最新"
,
value
:
"newest"
},
{
label
:
"最新"
,
value
:
"newest"
},
{
label
:
"价格升序"
,
value
:
"price_asc"
},
{
label
:
"价格升序"
,
value
:
"price_asc"
},
{
label
:
"价格降序"
,
value
:
"price_desc"
},
{
label
:
"价格降序"
,
value
:
"price_desc"
},
{
label
:
"里程升序"
,
value
:
"mileage_asc"
},
{
label
:
"里程升序"
,
value
:
"mileage_asc"
},
];
];
async
function
loadData
(
reset
=
false
)
{
async
function
loadData
(
reset
=
false
)
{
if
(
reset
)
{
if
(
reset
)
{
params
.
value
.
page
=
1
;
params
.
value
.
page
=
1
;
finished
.
value
=
false
;
finished
.
value
=
false
;
}
}
loading
.
value
=
true
;
loading
.
value
=
true
;
try
{
try
{
const
res
=
await
getCarList
(
params
.
value
);
const
res
=
await
getCarList
(
params
.
value
);
const
newList
=
res
.
list
;
const
newList
=
res
.
list
;
if
(
reset
)
{
if
(
reset
)
{
carList
.
value
=
newList
;
carList
.
value
=
newList
;
}
else
{
}
else
{
carList
.
value
.
push
(...
newList
);
carList
.
value
.
push
(...
newList
);
}
}
if
(
carList
.
value
.
length
>=
res
.
total
||
newList
.
length
<
(
params
.
value
.
pageSize
??
10
))
{
if
(
carList
.
value
.
length
>=
res
.
total
||
newList
.
length
<
(
params
.
value
.
pageSize
??
10
))
{
finished
.
value
=
true
;
finished
.
value
=
true
;
}
else
{
}
else
{
params
.
value
.
page
=
(
params
.
value
.
page
??
1
)
+
1
;
params
.
value
.
page
=
(
params
.
value
.
page
??
1
)
+
1
;
}
}
}
catch
{
}
catch
{
// 展示 mock 数据
// 展示 mock 数据
if
(
reset
)
{
if
(
reset
)
{
carList
.
value
=
Array
.
from
({
length
:
8
},
(
_
,
i
)
=>
({
carList
.
value
=
Array
.
from
({
length
:
8
},
(
_
,
i
)
=>
({
id
:
i
+
1
,
id
:
i
+
1
,
title
:
`2021款
${[
"宝马3系"
,
"奥迪A4L"
,
"奔驰C级"
,
"大众帕萨特"
][
i
%
4
]}
330i 豪华型`
,
title
:
`2021款
${[
"宝马3系"
,
"奥迪A4L"
,
"奔驰C级"
,
"大众帕萨特"
][
i
%
4
]}
330i 豪华型`
,
brand
:
[
"宝马"
,
"奥迪"
,
"奔驰"
,
"大众"
][
i
%
4
],
brand
:
[
"宝马"
,
"奥迪"
,
"奔驰"
,
"大众"
][
i
%
4
],
model
:
[
"3系"
,
"A4L"
,
"C级"
,
"帕萨特"
][
i
%
4
],
model
:
[
"3系"
,
"A4L"
,
"C级"
,
"帕萨特"
][
i
%
4
],
year
:
2019
+
(
i
%
4
),
year
:
2019
+
(
i
%
4
),
mileage
:
20
000
+
i
*
8000
,
mileage
:
20
_
000
+
i
*
8000
,
price
:
180000
+
i
*
30
000
,
price
:
180
_000
+
i
*
30
_
000
,
city
:
[
"上海"
,
"北京"
,
"广州"
,
"深圳"
][
i
%
4
],
city
:
[
"上海"
,
"北京"
,
"广州"
,
"深圳"
][
i
%
4
],
coverImage
:
`https://fastly.jsdelivr.net/npm/@vant/assets/apple-
${(
i
%
3
)
+
1
}
.jpeg`
,
coverImage
:
`https://fastly.jsdelivr.net/npm/@vant/assets/apple-
${(
i
%
3
)
+
1
}
.jpeg`
,
images
:
[],
images
:
[],
transmission
:
"自动"
,
transmission
:
"自动"
,
displacement
:
"2.0T"
,
displacement
:
"2.0T"
,
color
:
[
"白色"
,
"黑色"
,
"银色"
,
"蓝色"
][
i
%
4
],
color
:
[
"白色"
,
"黑色"
,
"银色"
,
"蓝色"
][
i
%
4
],
createdAt
:
new
Date
().
toISOString
(),
createdAt
:
new
Date
().
toISOString
(),
tags
:
i
%
2
===
0
?
[
"精品车源"
]
:
[
"全程质保"
,
"一口价"
],
tags
:
i
%
2
===
0
?
[
"精品车源"
]
:
[
"全程质保"
,
"一口价"
],
}));
}));
finished
.
value
=
true
;
finished
.
value
=
true
;
}
}
}
finally
{
}
finally
{
loading
.
value
=
false
;
loading
.
value
=
false
;
refreshing
.
value
=
false
;
refreshing
.
value
=
false
;
}
}
}
}
function
onLoad
()
{
function
onLoad
()
{
loadData
();
loadData
();
}
}
function
onRefresh
()
{
function
onRefresh
()
{
loadData
(
true
);
loadData
(
true
);
}
}
function
onSearch
()
{
function
onSearch
()
{
params
.
value
.
keyword
=
searchValue
.
value
;
params
.
value
.
keyword
=
searchValue
.
value
;
loadData
(
true
);
loadData
(
true
);
}
}
function
onSortChange
(
val
:
string
)
{
function
onSortChange
(
val
:
string
)
{
params
.
value
.
sortBy
=
val
as
CarListParams
[
"sortBy"
];
params
.
value
.
sortBy
=
val
as
CarListParams
[
"sortBy"
];
loadData
(
true
);
loadData
(
true
);
}
}
function
onCarClick
(
id
:
number
)
{
function
onCarClick
(
id
:
number
)
{
router
.
push
({
name
:
"CarDetail"
,
params
:
{
id
}
});
router
.
push
({
name
:
"CarDetail"
,
params
:
{
id
}
});
}
}
onMounted
(()
=>
{
onMounted
(()
=>
{
loadData
(
true
);
loadData
(
true
);
});
});
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"car-list-page"
>
<div
class=
"car-list-page"
>
<!-- 搜索栏 -->
<!-- 搜索栏 -->
<van-sticky>
<van-sticky>
<van-search
<van-search
v-model=
"searchValue"
v-model=
"searchValue"
placeholder=
"搜索品牌、车型..."
placeholder=
"搜索品牌、车型..."
shape=
"round"
shape=
"round"
@
search=
"onSearch"
/>
@
search=
"onSearch"
</van-sticky>
/>
</van-sticky>
<!-- 排序筛选 -->
<div
class=
"sort-bar"
>
<!-- 排序筛选 -->
<van-tabs
:model-value=
"params.sortBy"
<div
class=
"sort-bar"
>
shrink
<van-tabs
@
change=
"onSortChange"
>
:model-value=
"params.sortBy"
<van-tab
v-for=
"opt in sortOptions"
shrink
:key=
"opt.value"
@
change=
"onSortChange"
:name=
"opt.value"
>
:title=
"opt.label"
/>
<van-tab
</van-tabs>
v-for=
"opt in sortOptions"
:key=
"opt.value"
:title=
"opt.label"
:name=
"opt.value"
/>
</van-tabs>
</div>
<!-- 列表 -->
<van-pull-refresh
v-model=
"refreshing"
@
refresh=
"onRefresh"
>
<van-list
v-model:loading=
"loading"
:finished=
"finished"
finished-text=
"没有更多了"
@
load=
"onLoad"
>
<div
v-for=
"car in carList"
:key=
"car.id"
class=
"car-list-item card"
@
click=
"onCarClick(car.id)"
>
<van-image
:src=
"car.coverImage"
width=
"120"
height=
"90"
fit=
"cover"
lazy-load
radius=
"4"
/>
<div
class=
"car-list-info"
>
<p
class=
"car-title ellipsis-2"
>
{{
car
.
title
}}
</p>
<div
class=
"car-tags"
>
<van-tag
v-for=
"tag in car.tags.slice(0, 2)"
:key=
"tag"
type=
"primary"
plain
size=
"medium"
>
{{
tag
}}
</van-tag>
</div>
<p
class=
"car-specs ellipsis"
>
{{
car
.
year
}}
年 ·
{{
formatMileage
(
car
.
mileage
)
}}
·
{{
car
.
city
}}
</p>
<div
class=
"car-bottom flex-between"
>
<div
class=
"car-price price-tag"
>
<span
class=
"amount"
>
{{
formatPrice
(
car
.
price
)
}}
</span>
<span
class=
"unit"
>
元
</span>
</div>
<van-icon
name=
"arrow"
color=
"#c8c9cc"
/>
</div>
</div>
</div>
</div>
</van-list>
</van-pull-refresh>
<!-- 列表 -->
</div>
<van-pull-refresh
v-model=
"refreshing"
@
refresh=
"onRefresh"
>
<van-list
v-model:loading=
"loading"
:finished=
"finished"
finished-text=
"没有更多了"
@
load=
"onLoad"
>
<div
v-for=
"car in carList"
:key=
"car.id"
class=
"car-list-item card"
@
click=
"onCarClick(car.id)"
>
<van-image
fit=
"cover"
height=
"90"
lazy-load
radius=
"4"
:src=
"car.coverImage"
width=
"120"
/>
<div
class=
"car-list-info"
>
<p
class=
"car-title ellipsis-2"
>
{{
car
.
title
}}
</p>
<div
class=
"car-tags"
>
<van-tag
v-for=
"tag in car.tags.slice(0, 2)"
:key=
"tag"
plain
size=
"medium"
type=
"primary"
>
{{
tag
}}
</van-tag>
</div>
<p
class=
"car-specs ellipsis"
>
{{
car
.
year
}}
年 ·
{{
formatMileage
(
car
.
mileage
)
}}
·
{{
car
.
city
}}
</p>
<div
class=
"car-bottom flex-between"
>
<div
class=
"car-price price-tag"
>
<span
class=
"amount"
>
{{
formatPrice
(
car
.
price
)
}}
</span>
<span
class=
"unit"
>
元
</span>
</div>
<van-icon
color=
"#c8c9cc"
name=
"arrow"
/>
</div>
</div>
</div>
</van-list>
</van-pull-refresh>
</div>
</
template
>
</
template
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
@use
"@
/
assets/styles/variables"
as
*
;
@use
"@assets/styles/variables"
as
*
;
.car-list-page
{
.car-list-page
{
background-color
:
var
(
--color-bg-page
);
background-color
:
var
(
--color-bg-page
);
...
...
apps/web/venus-usedcar
/venus-usedcar-h5
/src/views/home/index.vue
→
apps/web/venus-usedcar
-quality
/src/views/home/index.vue
View file @
959b680
This diff is collapsed.
Click to expand it.
apps/web/venus-usedcar
/venus-usedcar-h5
/src/views/mine/index.vue
→
apps/web/venus-usedcar
-quality
/src/views/mine/index.vue
View file @
959b680
...
@@ -185,7 +185,7 @@ const __APP_VERSION__ = "1.0.0";
...
@@ -185,7 +185,7 @@ const __APP_VERSION__ = "1.0.0";
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
@use
"@
/
assets/styles/variables"
as
*
;
@use
"@assets/styles/variables"
as
*
;
.mine-page
{
.mine-page
{
min-height
:
100vh
;
min-height
:
100vh
;
...
...
apps/web/venus-usedcar
/venus-usedcar-h5
/tsconfig.json
→
apps/web/venus-usedcar
-quality
/tsconfig.json
View file @
959b680
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
"jsxImportSource"
:
"vue"
,
"jsxImportSource"
:
"vue"
,
"lib"
:
[
"ES2020"
,
"DOM"
,
"DOM.Iterable"
],
"lib"
:
[
"ES2020"
,
"DOM"
,
"DOM.Iterable"
],
"useDefineForClassFields"
:
true
,
"useDefineForClassFields"
:
true
,
"baseUrl"
:
"."
,
"baseUrl"
:
".
/
"
,
"module"
:
"ESNext"
,
"module"
:
"ESNext"
,
"moduleResolution"
:
"bundler"
,
"moduleResolution"
:
"bundler"
,
"paths"
:
{
"paths"
:
{
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
"skipLibCheck"
:
true
,
"skipLibCheck"
:
true
,
"types"
:
[
"vite/client"
]
"types"
:
[
"vite/client"
]
},
},
"references"
:
[{
"path"
:
"./tsconfig.node.json"
}],
"references"
:
[{
"path"
:
"./tsconfig.node.json"
}],
"include"
:
[
"include"
:
[
"env.d.ts"
,
"env.d.ts"
,
"src/**/*.ts"
,
"src/**/*.ts"
,
...
...
apps/web/venus-usedcar
/venus-usedcar-h5
/tsconfig.node.json
→
apps/web/venus-usedcar
-quality
/tsconfig.node.json
View file @
959b680
...
@@ -7,5 +7,7 @@
...
@@ -7,5 +7,7 @@
"skipLibCheck"
:
true
,
"skipLibCheck"
:
true
,
"strict"
:
true
"strict"
:
true
},
},
"include"
:
[
"vite.config.ts"
]
"include"
:
[
"vite.config.ts"
]
}
}
apps/web/venus-usedcar
/venus-usedcar-h5
/vite.config.ts
→
apps/web/venus-usedcar
-quality
/vite.config.ts
View file @
959b680
File moved
apps/web/venus-usedcar/venus-usedcar-h5/src/api/index.ts
deleted
100644 → 0
View file @
e5d01cb
export
*
from
"./modules/car"
;
export
*
from
"./modules/user"
;
apps/web/venus-usedcar/venus-usedcar-h5/src/stores/index.ts
deleted
100644 → 0
View file @
e5d01cb
export
{
useAppStore
}
from
"./modules/app"
;
export
{
useUserStore
}
from
"./modules/user"
;
export
type
{
UserInfo
}
from
"./modules/user"
;
Write
Preview
Markdown
is supported
Attach a file
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 post a comment