Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
factory_front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinjianhui
factory_front
Commits
66018a90
Commit
66018a90
authored
Aug 15, 2025
by
qinjianhui
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
Dev See merge request
!71
parents
515eebb7
0061d25b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
105 additions
and
134 deletions
+105
-134
components.d.ts
+0
-2
src/components/CommonCard.vue
+39
-30
src/views/order/podUs/index.vue
+66
-102
No files found.
components.d.ts
View file @
66018a90
...
...
@@ -21,7 +21,6 @@ declare module 'vue' {
ElConfigProvider
:
typeof
import
(
'element-plus/es'
)[
'ElConfigProvider'
]
ElDatePicker
:
typeof
import
(
'element-plus/es'
)[
'ElDatePicker'
]
ElDialog
:
typeof
import
(
'element-plus/es'
)[
'ElDialog'
]
ElDivider
:
typeof
import
(
'element-plus/es'
)[
'ElDivider'
]
ElDrawer
:
typeof
import
(
'element-plus/es'
)[
'ElDrawer'
]
ElDropdown
:
typeof
import
(
'element-plus/es'
)[
'ElDropdown'
]
ElDropdownItem
:
typeof
import
(
'element-plus/es'
)[
'ElDropdownItem'
]
...
...
@@ -33,7 +32,6 @@ declare module 'vue' {
ElImage
:
typeof
import
(
'element-plus/es'
)[
'ElImage'
]
ElInput
:
typeof
import
(
'element-plus/es'
)[
'ElInput'
]
ElInputNumber
:
typeof
import
(
'element-plus/es'
)[
'ElInputNumber'
]
ElLink
:
typeof
import
(
'element-plus/es'
)[
'ElLink'
]
ElMenu
:
typeof
import
(
'element-plus/es'
)[
'ElMenu'
]
ElMenuItem
:
typeof
import
(
'element-plus/es'
)[
'ElMenuItem'
]
ElOption
:
typeof
import
(
'element-plus/es'
)[
'ElOption'
]
...
...
src/components/CommonCard.vue
View file @
66018a90
...
...
@@ -76,36 +76,40 @@ import type { TypesettingListData } from '../types/api/typesetting'
// 定义通用字段接口,用于处理动态属性
interface
CommonFields
{
[
key
:
string
]:
unknown
;
variantImage
?:
string
;
mainImage
?:
string
;
sku
?:
string
;
productName
?:
string
;
[
key
:
string
]:
unknown
variantImage
?:
string
mainImage
?:
string
sku
?:
string
productName
?:
string
}
// 定义图片列表项接口
interface
ImageListItem
{
[
key
:
string
]:
unknown
;
imagePath
?:
string
;
[
key
:
string
]:
unknown
imagePath
?:
string
}
// 创建一个工具类型,用于使用字符串索引访问对象属性
type
IndexableObject
=
Record
<
string
,
unknown
>
;
type
IndexableObject
=
Record
<
string
,
unknown
>
// 扩展现有类型以确保它们有通用字段
type
CardItem
=
PodProductList
|
CardOrderData
|
TypesettingListData
|
CommonFields
;
type
CardItem
=
|
PodProductList
|
CardOrderData
|
TypesettingListData
|
CommonFields
// 定义 props 类型
interface
Props
{
cardItem
:
CardItem
;
active
?:
boolean
;
showSelectIcon
?:
boolean
;
showSku
?:
boolean
;
showProductInfo
?:
boolean
;
showImageList
?:
boolean
;
imageField
?:
string
;
imageListField
?:
string
;
imagePathField
?:
string
;
cardItem
:
CardItem
active
?:
boolean
showSelectIcon
?:
boolean
showSku
?:
boolean
showProductInfo
?:
boolean
showImageList
?:
boolean
imageField
?:
string
imageListField
?:
string
imagePathField
?:
string
}
// 定义默认值
...
...
@@ -122,45 +126,45 @@ const props = withDefaults(defineProps<Props>(), {
// 获取主图片源
const
mainImageSrc
=
computed
<
string
>
(()
=>
{
const
item
=
props
.
cardItem
as
IndexableObject
;
const
item
=
props
.
cardItem
as
IndexableObject
// 使用索引访问避免联合类型的属性访问问题
if
(
props
.
imageField
===
'variantImage'
&&
typeof
item
[
props
.
imageField
]
===
'string'
)
{
return
item
[
props
.
imageField
]
as
string
;
return
item
[
props
.
imageField
]
as
string
}
if
(
props
.
imageField
===
'mainImage'
&&
typeof
item
[
props
.
imageField
]
===
'string'
)
{
return
item
[
props
.
imageField
]
as
string
;
return
item
[
props
.
imageField
]
as
string
}
// 默认返回空字符串
return
''
;
return
''
})
// 获取图片列表
const
imageList
=
computed
<
ImageListItem
[]
>
(()
=>
{
const
item
=
props
.
cardItem
as
IndexableObject
;
const
list
=
item
[
props
.
imageListField
]
;
return
Array
.
isArray
(
list
)
?
list
as
ImageListItem
[]
:
[];
const
item
=
props
.
cardItem
as
IndexableObject
const
list
=
item
[
props
.
imageListField
]
return
Array
.
isArray
(
list
)
?
(
list
as
ImageListItem
[])
:
[]
})
// 判断是否有图片列表
const
hasImageList
=
computed
<
boolean
>
(()
=>
{
return
imageList
.
value
.
length
>
0
;
return
imageList
.
value
.
length
>
0
})
// 获取图片列表项的图片路径
function
getItemImagePath
(
item
:
IndexableObject
):
string
{
return
(
item
[
props
.
imagePathField
]
as
string
)
||
''
;
return
(
item
[
props
.
imagePathField
]
as
string
)
||
''
}
const
copy
=
(
text
:
string
)
=>
{
navigator
.
clipboard
.
writeText
(
text
)
;
ElMessage
.
success
(
'复制成功'
)
;
navigator
.
clipboard
.
writeText
(
text
)
ElMessage
.
success
(
'复制成功'
)
}
</
script
>
...
...
@@ -174,11 +178,16 @@ const copy = (text: string) => {
.commodity-card-image
{
position
:
relative
;
border
:
1px
solid
#eee
;
border-top-left-radius
:
10px
;
border-top-right-radius
:
10px
;
.img_top_left
{
position
:
absolute
;
top
:
5px
;
left
:
5px
;
display
:
flex
;
align-items
:
center
;
gap
:
4px
;
}
.img_top_right
{
...
...
src/views/order/podUs/index.vue
View file @
66018a90
This diff is collapsed.
Click to expand it.
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